:root {
  color-scheme: light;

  /* ===== Paleta de marca Hacienda Colonial ===== */
  --mustard: #6e7138;        /* Mustard Green  (40%) — color dominante / barra lateral */
  --mustard-deep: #565937;   /* Mustard Green más oscuro para hovers */
  --teal: #0e6e73;           /* Tropical Rain Forest (40%) — color primario / acciones */
  --teal-deep: #0a585c;      /* Teal más oscuro para hovers */
  --bronze: #6b3100;         /* Philippine Bronze (10%) — acento */
  --conditioner: #faf8c9;    /* Conditioner — fondo crema */

  /* ===== Variables del sistema (mapeadas a la marca) ===== */
  --ink: #2b2e15;
  --ink-soft: #5c5f44;
  --forest: #0e6e73;         /* primario = Tropical Rain Forest */
  --forest-deep: #0a585c;
  --sage: #d6e6e3;
  --sage-soft: #eaf3f1;
  --terracotta: #6b3100;     /* acento = Philippine Bronze */
  --terracotta-soft: #efe0d2;
  --gold: #a98a2c;
  --cream: #f4f1e1;          /* fondo de página: crema suave y desaturada (el amarillo intenso solo como acento) */
  --paper: #fffefa;          /* tarjetas: casi blanco, para que contrasten con el fondo */
  --white: #ffffff;
  --line: #e6e3cf;
  --line-dark: rgba(255, 255, 255, 0.16);
  --danger: #a94442;
  --shadow: 0 16px 40px rgba(70, 73, 30, 0.10);
  --sidebar-width: 264px;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  /* Escala global: agranda toda la interfaz (texto, espaciado y elementos)
     de forma proporcional. Ajusta este valor para hacerla más o menos grande. */
  zoom: 1.18;
  background:
    radial-gradient(circle at 88% 6%, rgba(14, 110, 115, 0.07), transparent 24rem),
    radial-gradient(circle at 4% 98%, rgba(110, 113, 56, 0.07), transparent 22rem),
    var(--cream);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow: hidden;
  padding: 26px 18px 18px;
  color: rgba(255, 255, 255, 0.86);
  background:
    linear-gradient(rgba(110, 113, 56, 0.97), rgba(86, 89, 55, 0.99)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.05) 12px 13px);
  box-shadow: 12px 0 38px rgba(70, 73, 30, 0.12);
}

.sidebar::after {
  position: absolute;
  right: -70px;
  bottom: 70px;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255, 255, 255, 0.025), 0 0 0 56px rgba(255, 255, 255, 0.018);
  content: "";
  pointer-events: none;
}

.sidebar-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 6px 30px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 168px;
  max-width: 100%;
  height: auto;
}

.brand-mark-img {
  display: none;
  width: 42px;
  height: 42px;
}

.sidebar-toggle {
  display: grid;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.07);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: 160ms ease;
}

.sidebar-toggle:hover {
  color: white;
  background: rgba(255, 255, 255, 0.16);
}

.brand-mark {
  display: flex;
  width: 38px;
  height: 38px;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 9px 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50% 50% 42% 42%;
  background: rgba(255, 255, 255, 0.08);
}

.brand-mark span {
  width: 4px;
  border-radius: 8px 8px 2px 2px;
  background: var(--gold);
  transform-origin: bottom;
}

.brand-mark span:nth-child(1) { height: 13px; transform: rotate(-15deg); }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 13px; transform: rotate(15deg); }

.brand strong,
.brand small {
  display: block;
  line-height: 1;
}

.brand strong {
  font-family: "Fraunces", serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 5px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.workspace-switcher {
  position: relative;
  z-index: 3;
  margin: 0 0 25px;
}

.switcher-label {
  display: block;
  margin: 0 10px 8px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.workspace-button,
.workspace-menu button {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line-dark);
  border-radius: 12px;
  color: white;
  background: rgba(255, 255, 255, 0.075);
  text-align: left;
  cursor: pointer;
}

.workspace-button {
  padding: 11px;
}

.workspace-button:hover {
  background: rgba(255, 255, 255, 0.11);
}

.workspace-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: var(--forest-deep);
  background: var(--gold);
  font-family: "Fraunces", serif;
  font-weight: 700;
}

.workspace-icon.admin {
  color: white;
  background: var(--terracotta);
}

.workspace-button strong,
.workspace-button small,
.workspace-menu strong,
.workspace-menu small {
  display: block;
}

.workspace-button strong,
.workspace-menu strong {
  font-size: 13px;
}

.workspace-button small,
.workspace-menu small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
}

.chevron {
  color: rgba(255,255,255,.5);
}

.workspace-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--line-dark);
  border-radius: 14px;
  background: #244b40;
  box-shadow: 0 16px 36px rgba(0,0,0,.22);
}

.workspace-menu button {
  grid-template-columns: auto 1fr;
  margin: 2px 0;
  padding: 8px;
  border-color: transparent;
  background: transparent;
}

.workspace-menu button:hover {
  background: rgba(255,255,255,.08);
}

.main-nav {
  position: relative;
  z-index: 1;
  overflow-y: auto;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-heading {
  margin: 0 10px 7px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 3px 0;
  padding: 10px 11px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: 180ms ease;
}

.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 3px 0 var(--conditioner);
}

.nav-icon {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: var(--conditioner);
  font-size: 16px;
}

/* Íconos SVG del sistema: heredan color y se dimensionan por su contenedor. */
.ico { display: block; width: 100%; height: 100%; }
.nav-icon .ico { width: 18px; height: 18px; }
.toggle-icon svg, .mobile-menu svg { width: 18px; height: 18px; display: block; }
.global-search > span svg { width: 15px; height: 15px; display: block; }
.profile-button .more svg { width: 16px; height: 16px; display: block; }

.nav-badge {
  min-width: 21px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 20px;
  color: white;
  background: var(--terracotta);
  font-size: 9px;
  text-align: center;
}

.sidebar-footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line-dark);
}

.environment-badge,
.profile-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
}

.environment-badge {
  padding: 0 10px 15px;
  color: rgba(255,255,255,.82);
}

.environment-badge strong,
.environment-badge small,
.profile-button strong,
.profile-button small {
  display: block;
}

.environment-badge strong {
  color: rgba(255,255,255,.92);
  font-size: 10px;
}

.environment-badge small {
  margin-top: 2px;
  font-size: 9px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #75ce86;
  box-shadow: 0 0 0 4px rgba(117,206,134,.12);
}

.profile-button {
  padding: 8px;
  border: 0;
  border-radius: 11px;
  color: white;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.profile-button:hover {
  background: rgba(255,255,255,.06);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--forest-deep);
  background: var(--sage);
  font-size: 10px;
  font-weight: 800;
}

.profile-button strong { font-size: 11px; }
.profile-button small { margin-top: 3px; color: rgba(255,255,255,.62); font-size: 9px; }
.profile-button .more { margin-left: auto; color: rgba(255,255,255,.55); font-size: 10px; }

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 34px;
  border-bottom: 1px solid rgba(110, 113, 56, 0.12);
  background: rgba(244, 241, 225, 0.82);
  backdrop-filter: blur(16px);
}

.breadcrumb span,
.breadcrumb strong {
  display: block;
}

.breadcrumb span {
  margin-bottom: 4px;
  color: var(--terracotta);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.breadcrumb strong {
  font-family: "Fraunces", serif;
  font-size: 18px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.global-search {
  display: flex;
  width: min(320px, 30vw);
  height: 39px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #8a9993;
  background: rgba(255,255,255,.7);
}

.global-search:focus-within {
  border-color: #9bb7a9;
  box-shadow: 0 0 0 3px rgba(33,77,64,.07);
}

.global-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
}

.global-search kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #8a9993;
  background: var(--paper);
  font-size: 8px;
  white-space: nowrap;
}

.icon-button,
.mobile-menu {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.7);
  cursor: pointer;
}

.notification-button {
  position: relative;
}

.notification-button i {
  position: absolute;
  top: -4px;
  right: -3px;
  display: grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  border: 2px solid var(--cream);
  border-radius: 50%;
  color: white;
  background: var(--terracotta);
  font-size: 8px;
  font-style: normal;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 180ms ease;
}

.primary-button {
  border: 1px solid var(--forest);
  color: white;
  background: var(--forest);
  box-shadow: 0 8px 18px rgba(33,77,64,.16);
}

.primary-button:hover {
  background: var(--forest-deep);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--forest);
  background: white;
}

.ghost-button {
  border: 0;
  color: var(--forest);
  background: transparent;
}

.mobile-menu {
  display: none;
}

.page-container {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 34px;
}

.page-enter {
  animation: page-enter 460ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, .72fr);
  gap: 22px;
  margin-bottom: 22px;
}

.welcome-card {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  padding: 33px 36px;
  border-radius: 22px;
  color: white;
  background:
    linear-gradient(110deg, rgba(21,56,47,.97) 0%, rgba(33,77,64,.94) 62%, rgba(51,98,81,.88) 100%);
  box-shadow: var(--shadow);
}

.welcome-card::before {
  position: absolute;
  inset: 0 0 0 53%;
  background:
    linear-gradient(135deg, transparent 48%, rgba(255,255,255,.04) 48% 51%, transparent 51%),
    linear-gradient(45deg, transparent 48%, rgba(255,255,255,.035) 48% 51%, transparent 51%);
  background-size: 42px 42px;
  content: "";
}

.welcome-card::after {
  position: absolute;
  right: -80px;
  bottom: -122px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(217,170,82,.25);
  border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(217,170,82,.055), 0 0 0 70px rgba(217,170,82,.035);
  content: "";
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--terracotta);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.welcome-card .eyebrow {
  position: relative;
  z-index: 1;
  color: var(--gold);
}

.welcome-card h1 {
  position: relative;
  z-index: 1;
  max-width: 570px;
  margin: 16px 0 11px;
  font-family: "Fraunces", serif;
  font-size: clamp(29px, 3vw, 42px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -.035em;
}

.welcome-card p {
  position: relative;
  z-index: 1;
  max-width: 540px;
  margin: 0;
  color: rgba(255,255,255,.67);
  font-size: 12px;
  line-height: 1.65;
}

.welcome-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 9px;
  margin-top: 24px;
}

.welcome-actions .primary-button {
  color: var(--forest-deep);
  border-color: var(--gold);
  background: var(--gold);
}

.welcome-actions .secondary-button {
  color: white;
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
}

.focus-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 25px;
  border: 1px solid rgba(33,77,64,.09);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 10px 32px rgba(31,62,52,.065);
}

.focus-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.focus-card h2 {
  margin: 9px 0 0;
  font-family: "Fraunces", serif;
  font-size: 20px;
}

.focus-date {
  display: grid;
  width: 42px;
  height: 47px;
  place-items: center;
  border: 1px solid #ead6c8;
  border-radius: 11px;
  color: var(--terracotta);
  background: var(--terracotta-soft);
}

.focus-date strong,
.focus-date small {
  display: block;
  line-height: 1;
  text-align: center;
}

.focus-date strong { font-family: "Fraunces", serif; font-size: 18px; }
.focus-date small { margin-top: 3px; font-size: 7px; font-weight: 800; text-transform: uppercase; }

.focus-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.focus-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}

.focus-item:hover {
  border-color: var(--line);
  background: var(--sage-soft);
  transform: translateX(2px);
}

.focus-item > span:first-child {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  color: var(--forest);
  background: var(--sage-soft);
  font-size: 12px;
}

.focus-item:hover > span:first-child { background: var(--white); }

.focus-item.alert > span:first-child { color: var(--danger); background: #f7e4e1; }

.focus-item strong,
.focus-item small {
  display: block;
}

.focus-item strong { font-size: 10px; }
.focus-item small { margin-top: 3px; color: #87938e; font-size: 8px; }

.focus-count {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 20px;
  color: var(--forest);
  background: var(--sage-soft);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.focus-item.alert .focus-count { color: var(--danger); background: #f7e4e1; }

.focus-hint {
  margin: 14px 4px 0;
  color: #98a39d;
  font-size: 8.5px;
  font-style: italic;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 22px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 20px 21px;
  border: 1px solid rgba(33,77,64,.09);
  border-radius: var(--radius);
  background: rgba(255,253,248,.88);
  box-shadow: 0 8px 24px rgba(31,62,52,.055);
}

.metric-card::after {
  position: absolute;
  top: -27px;
  right: -27px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--metric-tint, var(--sage));
  content: "";
  opacity: .55;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 10px;
}

.metric-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: var(--metric-color, var(--forest));
  background: var(--metric-tint, var(--sage-soft));
  font-size: 13px;
}

.metric-value {
  margin: 13px 0 7px;
  font-family: "Fraunces", serif;
  font-size: 29px;
  line-height: 1;
}

.metric-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #87938e;
  font-size: 8px;
}

.trend {
  padding: 2px 5px;
  border-radius: 10px;
  color: #3e7b50;
  background: #e7f3e9;
  font-weight: 700;
}

.trend.warn {
  color: #a4573a;
  background: var(--terracotta-soft);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .62fr);
  gap: 22px;
}

.panel {
  border: 1px solid rgba(33,77,64,.09);
  border-radius: var(--radius);
  background: rgba(255,253,248,.91);
  box-shadow: 0 9px 28px rgba(31,62,52,.05);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 22px 17px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 18px;
  font-weight: 600;
}

.panel-header p {
  margin: 4px 0 0;
  color: #87938e;
  font-size: 9px;
}

.text-button {
  border: 0;
  color: var(--forest);
  background: transparent;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
}

.data-table th {
  color: #83918b;
  background: #faf9f3;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.data-table td {
  border-top: 1px solid #ecefe9;
  font-size: 10px;
}

.data-table tbody tr {
  cursor: pointer;
  transition: 150ms ease;
}

.data-table tbody tr:hover {
  background: var(--sage-soft);
}

.entity-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  color: var(--forest);
  background: var(--sage);
  font-size: 9px;
  font-weight: 800;
}

.entity-cell strong,
.entity-cell small {
  display: block;
}

.entity-cell strong { font-size: 10px; }
.entity-cell small { margin-top: 2px; color: #8a9691; font-size: 8px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 20px;
  color: #3e7252;
  background: #e6f1e7;
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status.pending {
  color: #9b643b;
  background: #f8eadc;
}

.status.neutral {
  color: #65756e;
  background: #edf0ed;
}

.status.danger {
  color: #a24949;
  background: #f5dfdf;
}

.lot-list {
  padding: 9px 18px 14px;
}

.lot-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 3px;
  border-bottom: 1px solid #e9ece7;
}

.lot-row:last-child {
  border-bottom: 0;
}

.lot-map {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #cadbcf;
  border-radius: 11px;
  color: var(--forest);
  background:
    linear-gradient(135deg, transparent 48%, rgba(33,77,64,.08) 49% 51%, transparent 52%),
    var(--sage-soft);
  font-family: "Fraunces", serif;
  font-size: 11px;
  font-weight: 700;
}

.lot-row strong,
.lot-row small {
  display: block;
}

.lot-row strong { font-size: 10px; }
.lot-row small { margin-top: 3px; color: #87938e; font-size: 8px; }
.lot-price { color: var(--forest); font-size: 9px; font-weight: 800; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 5px 0 25px;
}

.page-heading h1 {
  margin: 8px 0 5px;
  font-family: "Fraunces", serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -.025em;
}

.page-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.toolbar-group {
  display: flex;
  gap: 8px;
}

.filter-button {
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.filter-button.active {
  color: white;
  border-color: var(--forest);
  background: var(--forest);
}

.search-field {
  min-width: 230px;
  height: 35px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--paper);
  font-size: 9px;
}

.search-field:focus {
  border-color: #9bb7a9;
}

.lot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.lot-card {
  overflow: hidden;
  border: 1px solid rgba(33,77,64,.1);
  border-radius: 15px;
  background: var(--paper);
  cursor: pointer;
  transition: 180ms ease;
}

.lot-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.lot-visual {
  position: relative;
  display: grid;
  height: 110px;
  place-items: center;
  color: rgba(33,77,64,.28);
  background:
    linear-gradient(30deg, transparent 45%, rgba(33,77,64,.08) 45% 47%, transparent 47%),
    linear-gradient(-30deg, transparent 45%, rgba(33,77,64,.07) 45% 47%, transparent 47%),
    var(--sage-soft);
  background-size: 34px 34px;
  font-family: "Fraunces", serif;
  font-size: 29px;
}

.lot-visual .status {
  position: absolute;
  top: 10px;
  right: 10px;
}

.lot-card-body {
  padding: 15px;
}

.lot-card-body h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 16px;
}

.lot-meta {
  display: flex;
  justify-content: space-between;
  margin: 8px 0 14px;
  color: #82908a;
  font-size: 8px;
}

.lot-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid #e9ede8;
}

.lot-card-footer span {
  color: #89958f;
  font-size: 8px;
}

.lot-card-footer strong {
  display: block;
  margin-top: 3px;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: 14px;
}

.empty-page {
  display: grid;
  min-height: 520px;
  place-items: center;
  border: 1px dashed #cbd6ce;
  border-radius: 20px;
  text-align: center;
  background: rgba(255,253,248,.5);
}

.empty-page-icon {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 17px;
  place-items: center;
  border-radius: 24px;
  color: var(--forest);
  background: var(--sage);
  font-family: "Fraunces", serif;
  font-size: 29px;
}

.empty-page h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 25px;
}

.empty-page p {
  max-width: 430px;
  margin: 9px auto 19px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: 340px;
  padding: 13px 16px;
  border-radius: 11px;
  color: white;
  background: var(--forest-deep);
  box-shadow: 0 15px 35px rgba(18,47,39,.25);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 220ms ease;
}

.toast.visible {
  opacity: 1;
  transform: none;
}

.quick-dialog {
  width: min(610px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(22,49,40,.28);
}

.quick-dialog::backdrop {
  background: rgba(14,40,32,.55);
  backdrop-filter: blur(5px);
}

.quick-dialog form {
  position: relative;
  padding: 30px;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

.quick-dialog h2 {
  margin: 9px 0 5px;
  font-family: "Fraunces", serif;
  font-size: 28px;
}

.quick-dialog > form > p {
  margin: 0 0 23px;
  color: var(--ink-soft);
  font-size: 10px;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dialog-grid label span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
}

.dialog-grid input,
.dialog-grid select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: white;
  font-size: 10px;
}

.dialog-grid input:focus,
.dialog-grid select:focus {
  border-color: #8eae9d;
  box-shadow: 0 0 0 3px rgba(33,77,64,.06);
}

.dialog-note {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #e9d6c8;
  border-radius: 10px;
  color: #85573e;
  background: #fbf1ea;
}

.dialog-note > span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--terracotta);
  font-family: serif;
  font-size: 11px;
}

.dialog-note p {
  margin: 2px 0 0;
  font-size: 9px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* Administración · Clientes */
.admin-client-heading {
  margin-bottom: 20px;
}

.admin-clients-page {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.admin-client-heading > div {
  min-width: 0;
}

.admin-client-heading p {
  max-width: 720px;
}

.client-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* La página de Clientes tiene una tarjeta extra (pend. de escrituración) */
.admin-clients-page .client-summary-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.client-summary-card {
  position: relative;
  display: grid;
  min-height: 108px;
  overflow: hidden;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 4px 16px rgba(70, 73, 30, .05);
  text-align: left;
  cursor: pointer;
  transition: 180ms ease;
}

.client-summary-card::after {
  position: absolute;
  right: -28px;
  bottom: -32px;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: var(--conditioner);
  content: "";
  opacity: .9;
}

.client-summary-card:hover {
  border-color: rgba(110, 113, 56, .35);
  box-shadow: 0 12px 30px rgba(70, 73, 30, .1);
  transform: translateY(-2px);
}

.client-summary-card.active {
  color: white;
  background: var(--forest);
  border-color: transparent;
  box-shadow: 0 14px 32px rgba(14, 110, 115, .26);
}

.client-summary-card.active::after {
  background: rgba(250, 248, 201, .22);
}

.client-summary-card span,
.client-summary-card strong,
.client-summary-card small {
  position: relative;
  z-index: 1;
}

.client-summary-card span {
  font-size: 9px;
  font-weight: 700;
}

.client-summary-card strong {
  margin: 7px 0 5px;
  font-family: "Fraunces", serif;
  font-size: 28px;
  line-height: 1;
}

.client-summary-card small {
  color: var(--ink-soft);
  font-size: 8px;
}

.client-summary-card.active small {
  color: rgba(255,255,255,.58);
}

.client-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.client-search {
  display: flex;
  width: min(460px, 46%);
  height: 39px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #83918b;
  background: var(--paper);
}

.crear-usuario-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 4px 4px 8px;
}
.crear-usuario-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #6c776f;
  flex: 1 1 200px;
}
.crear-usuario-form input,
.crear-usuario-form select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}
.crear-usuario-form label:has(select) { flex: 0 1 160px; }
.crear-usuario-form .primary-button { flex: 0 0 auto; height: 38px; }
.equipo-empty {
  text-align: center;
  padding: 18px;
  color: #8a948d;
  font-size: 12px;
}
.estado-toggle {
  margin-left: 8px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.estado-toggle:hover { background: #f1efe6; }
.estado-toggle:disabled { opacity: .5; cursor: default; }

.client-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 10px;
}

.client-toolbar-actions {
  display: flex;
  gap: 8px;
}

.client-toolbar-actions select {
  min-width: 150px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 9px;
}

.admin-client-table-panel {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 8px 26px rgba(70, 73, 30, .06);
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-client-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.admin-client-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  color: #7b8983;
  background: #faf9f3;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
}

.admin-client-table td {
  padding: 11px 13px;
  border-bottom: 1px solid #e8ece7;
  color: #43534d;
  font-size: 9px;
  vertical-align: middle;
}

.admin-client-row {
  cursor: pointer;
  transition: 140ms ease;
}

.admin-client-row:hover {
  background: var(--sage-soft);
}

.admin-client-identity {
  display: flex;
  min-width: 230px;
  align-items: center;
  gap: 9px;
}

.admin-client-identity .entity-avatar.joint {
  color: #a55a37;
  background: var(--terracotta-soft);
}

.admin-client-identity strong,
.admin-client-identity small {
  display: block;
}

.admin-client-identity strong {
  max-width: 260px;
  overflow: hidden;
  color: var(--ink);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-client-identity small,
.admin-client-table td > small {
  margin-top: 3px;
  color: #89958f;
  font-size: 7px;
}

.client-group-row td {
  padding: 9px 12px;
  background: #f1f3ef;
}

.group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.group-toggle strong {
  display: grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 7px;
  color: #687770;
  background: #dfe4df;
  font-size: 8px;
}

.group-chevron {
  transition: 160ms ease;
}

.group-toggle.collapsed .group-chevron {
  transform: rotate(-90deg);
}

.client-lot {
  display: block;
  color: #6c6c30;
}

.signature-state {
  display: inline-block;
  max-width: 250px;
  line-height: 1.35;
}

.access-yes,
.access-no {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 12px;
  color: #3d7250;
  background: #e5f1e7;
  font-size: 8px;
  font-weight: 700;
}

.access-no {
  color: #7a8782;
  background: #edf0ed;
}

.document-progress {
  display: flex;
  align-items: center;
  gap: 3px;
}

.document-progress i {
  width: 11px;
  height: 4px;
  border-radius: 4px;
  background: #e2e6e2;
}

.document-progress i.ready {
  background: var(--forest);
}

.document-progress small {
  margin-left: 4px;
  color: #788680;
  font-size: 7px;
}

.row-open-button {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--forest);
  background: white;
  cursor: pointer;
}

.row-open-button:hover {
  color: white;
  border-color: var(--forest);
  background: var(--forest);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 17px;
  color: #7b8983;
  font-size: 8px;
}

.table-footer div {
  display: flex;
  gap: 4px;
}

.table-footer button {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  font-size: 8px;
}

.table-footer button.active {
  color: white;
  border-color: var(--forest);
  background: var(--forest);
}

/* Expediente del cliente */
.client-detail-page {
  max-width: 1260px;
  margin: 0 auto;
}

.back-link {
  margin: 0 0 15px;
  padding: 0;
  border: 0;
  color: var(--forest);
  background: transparent;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.client-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid rgba(33,77,64,.1);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgba(31,62,52,.06);
}

.client-profile-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 17px;
}

.client-profile-avatar {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 19px;
  color: var(--forest);
  background: var(--sage);
  font-family: "Fraunces", serif;
  font-size: 20px;
  font-weight: 600;
}

.profile-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #82908a;
  font-size: 8px;
  text-transform: uppercase;
}

.client-profile-main h1 {
  max-width: 650px;
  margin: 7px 0 5px;
  overflow: hidden;
  font-family: "Fraunces", serif;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.05;
  text-overflow: ellipsis;
}

.client-profile-main p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.client-profile-main p strong {
  color: #6f702e;
}

.client-profile-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.client-alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  padding: 13px 15px;
  border: 1px solid #ebd0bf;
  border-radius: 12px;
  color: #874d32;
  background: #fbede4;
}

.client-alert.success {
  color: #376648;
  border-color: #cadfce;
  background: #e9f3ea;
}

.client-alert > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--terracotta);
  font-weight: 800;
}

.client-alert.success > span {
  background: #4d895d;
}

.client-alert strong,
.client-alert small {
  display: block;
}

.client-alert strong {
  font-size: 10px;
}

.client-alert small {
  margin-top: 3px;
  opacity: .75;
  font-size: 8px;
}

.client-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid rgba(33,77,64,.1);
  border-radius: 12px;
  background: rgba(255,253,248,.82);
}

.client-tabs button {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  color: #718079;
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.client-tabs button:hover {
  color: var(--forest);
  background: var(--sage-soft);
}

.client-tabs button.active {
  color: white;
  background: var(--forest);
}

.client-tabs i {
  display: grid;
  min-width: 19px;
  height: 18px;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  font-size: 7px;
  font-style: normal;
}

.client-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .62fr);
  gap: 16px;
}

.client-detail-primary {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;            /* evita que contenido ancho (selects/tablas) ensanche la
                              columna y se encime sobre el panel derecho */
}

.client-detail-aside {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.detail-section {
  padding: 21px;
  border: 1px solid rgba(33,77,64,.1);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(31,62,52,.045);
}

.detail-section > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.detail-section h2 {
  margin: 6px 0 0;
  font-family: "Fraunces", serif;
  font-size: 19px;
  font-weight: 600;
}

.detail-section header p {
  margin: 5px 0 0;
  color: #82908a;
  font-size: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 25px;
}

.info-item {
  min-width: 0;
}

.info-item span,
.info-item strong {
  display: block;
}

.info-item span {
  margin-bottom: 5px;
  color: #84918c;
  font-size: 8px;
}

.info-item strong {
  overflow-wrap: anywhere;
  font-size: 10px;
  font-weight: 600;
}

.info-item-edit {
  display: flex;
  flex-direction: column;
}

.info-item-edit span {
  margin-bottom: 6px;
  color: #84918c;
  font-size: 8px;
}

.info-item-edit input,
.info-item-edit select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: white;
  font-size: 10px;
}

.info-item-edit input:focus,
.info-item-edit select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(33, 77, 64, 0.12);
}

.info-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.finance-feature {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid #dfe6df;
  border-radius: 12px;
  background: #dfe6df;
}

.finance-feature div {
  padding: 14px;
  background: var(--sage-soft);
}

.finance-feature span,
.finance-feature strong {
  display: block;
}

.finance-feature span {
  margin-bottom: 6px;
  color: #718079;
  font-size: 8px;
}

.finance-feature strong {
  font-family: "Fraunces", serif;
  font-size: 17px;
}

.completion-ring {
  display: grid;
  width: 126px;
  height: 126px;
  margin: 2px auto 18px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--forest) var(--progress), #e4e9e4 0);
}

.completion-ring::before {
  position: absolute;
  width: 94px;
  height: 94px;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.completion-ring span {
  position: relative;
  z-index: 1;
  text-align: center;
}

.completion-ring strong,
.completion-ring small {
  display: block;
}

.completion-ring strong {
  font-family: "Fraunces", serif;
  font-size: 24px;
}

.completion-ring small {
  color: #82908a;
  font-size: 8px;
}

.checklist {
  display: grid;
  gap: 9px;
  margin: 0 0 17px;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: 23px;
  color: #85918c;
  font-size: 9px;
}

.checklist li::before {
  position: absolute;
  top: -2px;
  left: 0;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid #ccd5ce;
  border-radius: 50%;
  content: "";
}

.checklist li.done {
  color: var(--ink);
}

.checklist li.done::before {
  color: white;
  border-color: var(--forest);
  background: var(--forest);
  content: "✓";
  font-size: 8px;
}

.full-width {
  width: 100%;
}

.quick-actions-section {
  padding-bottom: 13px;
}

.quick-doc-action {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.quick-doc-action:last-child {
  border-bottom: 0;
}

.quick-doc-action > span:first-child {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 9px;
  color: var(--forest);
  background: var(--sage-soft);
}

.quick-doc-action strong,
.quick-doc-action small {
  display: block;
}

.quick-doc-action strong {
  font-size: 9px;
}

.quick-doc-action small {
  margin-top: 3px;
  color: #85918c;
  font-size: 7px;
}

.quick-doc-action b {
  color: #82908a;
  font-size: 10px;
}

.tab-enter {
  animation: page-enter 300ms ease both;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.document-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
}

.document-card.missing {
  border-style: dashed;
  background: #faf8f1;
}

.document-type {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: var(--forest);
  background: var(--sage);
  font-size: 16px;
}

.document-card strong,
.document-card small {
  display: block;
}

.document-card strong {
  font-size: 10px;
}

.document-card small {
  max-width: 300px;
  overflow: hidden;
  margin-top: 4px;
  color: #7f8d87;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-meta {
  grid-column: 2;
  color: #7e8c86;
  font-size: 7px;
}

.document-actions {
  display: flex;
  grid-column: 2;
  gap: 12px;
}

.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.related-table-wrap {
  overflow-x: auto;
}

.related-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.related-table th,
.related-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  text-align: left;
}

.related-table th {
  color: #7c8984;
  background: #faf9f3;
  font-size: 8px;
  text-transform: uppercase;
}

.contract-preview {
  align-self: start;
  text-align: center;
}

.contract-preview .document-type {
  margin: 5px auto 14px;
}

.contract-preview h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 18px;
}

.contract-preview p {
  margin: 6px 0 18px;
  color: #82908a;
  font-size: 8px;
}

.activity-timeline {
  display: grid;
  gap: 0;
}

.activity-timeline article {
  position: relative;
  display: flex;
  gap: 13px;
  padding: 0 0 22px;
}

.activity-timeline article:not(:last-child)::before {
  position: absolute;
  top: 11px;
  bottom: 0;
  left: 5px;
  width: 1px;
  background: #dce3dd;
  content: "";
}

.activity-timeline i {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  margin-top: 3px;
  border: 3px solid var(--sage);
  border-radius: 50%;
  background: var(--forest);
}

.activity-timeline strong,
.activity-timeline small {
  display: block;
}

.activity-timeline strong {
  font-size: 10px;
}

.activity-timeline small {
  margin-top: 4px;
  color: #83908b;
  font-size: 8px;
}

/* Administración · Ingreso de pagos */
.payments-module,
.payment-detail-page,
.new-payment-page {
  width: 100%;
  min-width: 0;
  max-width: 1320px;
  margin: 0 auto;
}

.payments-heading {
  margin-bottom: 20px;
}

.payments-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.payments-summary-grid article {
  position: relative;
  overflow: hidden;
  padding: 17px 18px;
  border: 1px solid rgba(33,77,64,.1);
  border-radius: 14px;
  background: var(--paper);
}

.payments-summary-grid article > span,
.payments-summary-grid article > strong,
.payments-summary-grid article > small {
  position: relative;
  z-index: 1;
  display: block;
}

.payments-summary-grid article > span {
  color: var(--ink-soft);
  font-size: 8px;
}

.payments-summary-grid article > strong {
  margin: 8px 0 5px;
  font-family: "Fraunces", serif;
  font-size: 23px;
}

.payments-summary-grid article > small {
  color: #85918c;
  font-size: 7px;
}

.payments-summary-grid article > i {
  position: absolute;
  right: -13px;
  bottom: -17px;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  color: rgba(33,77,64,.28);
  background: var(--sage);
  font-size: 19px;
  font-style: normal;
}

.payments-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 11px;
}

.date-navigator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-navigator button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  cursor: pointer;
}

.date-navigator span small,
.date-navigator span strong {
  display: block;
}

.date-navigator span small {
  color: #87938e;
  font-size: 7px;
}

.date-navigator span strong {
  margin-top: 2px;
  font-family: "Fraunces", serif;
  font-size: 14px;
}

.payments-view-toggle {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.payments-view-toggle button {
  min-height: 29px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: #76847e;
  background: transparent;
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
}

.payments-view-toggle button.active {
  color: white;
  background: var(--forest);
}

.payment-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 165px auto;
  gap: 8px;
  margin-bottom: 12px;
}

.payment-filter-bar .client-search {
  width: 100%;
}

.payment-filter-bar select {
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 8px;
}

.payment-ledger-panel {
  overflow: hidden;
}

.payment-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}

.payment-day-header h2 {
  margin: 5px 0 0;
  font-family: "Fraunces", serif;
  font-size: 19px;
}

.payment-day-header > div:last-child {
  text-align: right;
}

.payment-day-header > div:last-child span,
.payment-day-header > div:last-child strong {
  display: block;
}

.payment-day-header > div:last-child span {
  color: #83908b;
  font-size: 7px;
}

.payment-day-header > div:last-child strong {
  margin-top: 4px;
  font-family: "Fraunces", serif;
  font-size: 19px;
}

.payment-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.payment-ledger-table {
  width: 100%;
  min-width: 1520px;
  border-collapse: collapse;
}

.payment-ledger-table th,
.payment-ledger-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e6ebe6;
  text-align: left;
}

.payment-ledger-table th {
  color: #7d8a84;
  background: #faf9f3;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.payment-ledger-table td {
  font-size: 8px;
  vertical-align: middle;
}

.payment-ledger-table td strong,
.payment-ledger-table td small {
  display: block;
}

.payment-ledger-table td strong {
  color: var(--ink);
  font-size: 8px;
}

.payment-ledger-table td small {
  margin-top: 3px;
  color: #85918b;
  font-size: 7px;
}

.payment-ledger-row {
  cursor: pointer;
  transition: 140ms ease;
}

.payment-ledger-row:hover {
  background: var(--sage-soft);
}

.payment-date-divider td {
  padding: 8px 12px;
  color: #6e7d76;
  background: #eef1ed;
}

.payment-date-divider td {
  display: table-cell;
}

.payment-date-divider td span,
.payment-date-divider td strong {
  display: inline;
}

.payment-date-divider td strong {
  float: right;
  font-family: "Fraunces", serif;
}

.payment-concept {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 8px;
  color: var(--forest);
  background: var(--sage-soft);
  font-size: 7px;
  font-weight: 800;
}

.payment-amount {
  font-family: "Fraunces", serif;
  font-size: 11px !important;
  white-space: nowrap;
}

.allocation-mini {
  display: flex;
  width: 105px;
  height: 5px;
  overflow: hidden;
  border-radius: 4px;
  background: #e4e8e4;
}

.allocation-mini i {
  display: block;
  width: var(--part);
}

.allocation-mini .mora,
.allocation-bar .mora { background: var(--terracotta); }
.allocation-mini .interest,
.allocation-bar .interest { background: var(--gold); }
.allocation-mini .capital,
.allocation-bar .capital { background: var(--forest); }

.payment-rules-note {
  display: grid;
  grid-template-columns: 150px 150px 1fr;
  align-items: center;
  gap: 15px;
  margin-top: 13px;
  padding: 14px 17px;
  border: 1px solid #dfd7bd;
  border-radius: 12px;
  color: #6d643f;
  background: #f6f0dd;
}

.payment-rules-note > div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 9px;
}

.payment-rules-note > div > span {
  grid-row: 1 / 3;
  font-family: "Fraunces", serif;
  font-size: 24px;
}

.payment-rules-note strong {
  font-size: 8px;
}

.payment-rules-note small,
.payment-rules-note p {
  margin: 0;
  font-size: 7px;
  line-height: 1.5;
}

.payment-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
  padding: 22px 24px;
  border: 1px solid rgba(33,77,64,.1);
  border-radius: 17px;
  background: var(--paper);
}

.payment-detail-header h1 {
  margin: 9px 0 5px;
  font-family: "Fraunces", serif;
  font-size: 34px;
  font-weight: 500;
}

.payment-detail-header p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
}

.payment-detail-header > div:last-child {
  display: flex;
  gap: 7px;
}

.payment-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, .55fr);
  gap: 15px;
}

.payment-detail-main,
.payment-detail-aside {
  display: grid;
  align-content: start;
  gap: 15px;
}

.reconciliation-code,
.step-chip {
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--forest);
  background: var(--sage-soft);
  font-family: monospace;
  font-size: 8px;
}

.allocation-hero {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 22px;
  align-items: center;
}

.allocation-hero > div:first-child {
  padding: 17px;
  border-radius: 12px;
  background: var(--forest);
  color: white;
}

.allocation-hero > div:first-child span,
.allocation-hero > div:first-child strong,
.allocation-hero > div:first-child small {
  display: block;
}

.allocation-hero > div:first-child span {
  color: rgba(255,255,255,.58);
  font-size: 8px;
}

.allocation-hero > div:first-child strong {
  margin: 7px 0 5px;
  font-family: "Fraunces", serif;
  font-size: 23px;
}

.allocation-hero > div:first-child small {
  color: rgba(255,255,255,.54);
  font-size: 7px;
}

.allocation-equation {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.allocation-equation span {
  min-width: 0;
  color: #75837c;
  font-size: 8px;
}

.allocation-equation span strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-family: "Fraunces", serif;
  font-size: 15px;
}

.allocation-equation i,
.calculator-lines i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
}

.mora-dot { background: var(--terracotta); }
.interest-dot { background: var(--gold); }
.capital-dot { background: var(--forest); }

.allocation-equation b {
  color: #b0bab4;
}

.allocation-bar {
  display: flex;
  height: 10px;
  overflow: hidden;
  margin: 18px 0;
  border-radius: 7px;
  background: #e4e8e4;
}

.calculation-explanation {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.calculation-explanation div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.calculation-explanation span,
.calculation-explanation strong {
  display: block;
}

.calculation-explanation span {
  color: #7e8b85;
  font-size: 7px;
}

.calculation-explanation strong {
  margin-top: 5px;
  font-size: 9px;
}

.audit-checklist {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.audit-checklist li {
  position: relative;
  padding-left: 25px;
  color: #82908a;
  font-size: 8px;
}

.audit-checklist li::before {
  position: absolute;
  top: -3px;
  left: 0;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid #cdd5cf;
  border-radius: 50%;
  content: "";
}

.audit-checklist li.done {
  color: var(--ink);
}

.audit-checklist li.done::before {
  color: white;
  border-color: var(--forest);
  background: var(--forest);
  content: "✓";
  font-size: 8px;
}

.audit-note span,
.payment-description span,
.payment-form-grid label span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 700;
}

.audit-state-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.audit-state-picker button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #718079;
  background: white;
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
}

.audit-state-picker button.active {
  color: #356548;
  border-color: #bfd6c4;
  background: #e8f2e9;
}

.audit-state-picker button.warning {
  color: #9a583b;
  border-color: #e9c8b8;
  background: #faeae1;
}

.audit-state-picker button.danger {
  color: #9c4444;
}

.audit-note textarea,
.payment-description textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: white;
  font-size: 9px;
}

.payment-proof {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefa;
  text-align: left;
  cursor: pointer;
}

.payment-proof > span {
  display: grid;
  width: 35px;
  height: 35px;
  grid-row: 1 / 3;
  place-items: center;
  border-radius: 9px;
  color: var(--forest);
  background: var(--sage);
}

.payment-proof strong {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-proof small {
  color: #809089;
  font-size: 7px;
}

.payment-noninstallment {
  padding: 20px;
  border-radius: 11px;
  color: var(--ink-soft);
  background: var(--sage-soft);
  font-size: 9px;
  line-height: 1.6;
}

.new-payment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr);
  gap: 15px;
}

.payment-entry-form {
  margin: 0;
}

.payment-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.payment-form-grid input,
.payment-form-grid select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: white;
  font-size: 9px;
}

.payment-form-grid input.system-filled-input {
  color: #536860;
  background:
    linear-gradient(90deg, rgba(33,77,64,.045), rgba(33,77,64,.015)),
    #f5f7f3;
  cursor: not-allowed;
}

/* Combobox con búsqueda para elegir cliente */
.client-combobox .combo {
  position: relative;
}

.combo-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 14px 30px rgba(20, 40, 33, .16);
}

.combo-results li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 9px;
  color: var(--ink);
  cursor: pointer;
}

.combo-results li small {
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
}

.combo-results li.active,
.combo-results li:hover {
  background: #eef3ee;
}

.combo-results li.empty {
  color: var(--ink-soft);
  cursor: default;
  justify-content: flex-start;
}

.payment-description {
  display: block;
  margin-top: 14px;
}

.required-mark {
  color: var(--terracotta);
  font-weight: 800;
}

.payment-support-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(230px, .65fr);
  gap: 14px;
  margin-top: 14px;
}

.payment-support-fields .payment-description {
  margin-top: 0;
}

.payment-proof-upload {
  display: flex;
  min-height: 105px;
  flex-direction: column;
  justify-content: center;
  padding: 13px;
  border: 1px dashed #bccbc1;
  border-radius: 10px;
  background: #fbfcf8;
}

/* El display:flex anula el atributo hidden; esta regla restaura el ocultado. */
.payment-proof-upload[hidden] {
  display: none;
}

.payment-proof-upload > span,
.payment-proof-upload > small {
  display: block;
}

.payment-proof-upload input {
  width: 100%;
  margin: 7px 0;
  font-size: 8px;
}

.payment-proof-upload small {
  color: #7e8b85;
  font-size: 7px;
}

.system-audit-caption {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #65756e;
  background: #f1f3ef;
  font-size: 7px;
}

.system-audit-caption strong {
  color: var(--ink);
}

.system-audit-caption i {
  margin-left: auto;
  font-style: normal;
}

.form-error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid #ecc7b7;
  border-radius: 9px;
  color: #8d4d31;
  background: #fbe9df;
}

.form-error-banner[hidden] {
  display: none;
}

.form-error-banner > span {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--terracotta);
  font-weight: 800;
}

.form-error-banner strong,
.form-error-banner small {
  display: block;
}

.form-error-banner strong {
  font-size: 8px;
}

.form-error-banner small {
  margin-top: 2px;
  font-size: 7px;
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea,
.field-invalid.payment-proof-upload {
  border-color: var(--terracotta) !important;
  box-shadow: 0 0 0 3px rgba(199,108,71,.08);
}

.system-calculation-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #d6e1d8;
  border-radius: 11px;
  background: var(--sage-soft);
}

.system-calculation-panel[hidden] {
  display: none;
}

.system-calculation-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.system-calculation-panel header > span {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
}

.system-calculation-panel header i {
  display: grid;
  width: 29px;
  height: 29px;
  grid-row: 1 / 3;
  place-items: center;
  border-radius: 8px;
  color: var(--forest);
  background: white;
  font-style: normal;
}

.system-calculation-panel header strong,
.system-calculation-panel header small {
  display: block;
}

.system-calculation-panel header strong {
  font-size: 9px;
}

.system-calculation-panel header small {
  color: #7b8983;
  font-size: 7px;
}

.system-calculation-panel header b {
  padding: 5px 8px;
  border-radius: 8px;
  color: #50705f;
  background: white;
  font-size: 7px;
}

.system-calculation-panel > div {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.system-calculation-panel > div > span {
  padding: 9px;
  border-radius: 8px;
  background: rgba(255,255,255,.68);
}

.system-calculation-panel > div small,
.system-calculation-panel > div strong {
  display: block;
}

.system-calculation-panel > div small {
  min-height: 20px;
  color: #7d8a84;
  font-size: 6px;
  line-height: 1.35;
}

.system-calculation-panel > div strong {
  margin-top: 5px;
  font-size: 8px;
}

.legacy-amount-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfaf5;
}

.legacy-amount-section > header {
  margin-bottom: 13px;
}

.legacy-amount-section h3 {
  margin: 5px 0 3px;
  font-family: "Fraunces", serif;
  font-size: 17px;
}

.legacy-amount-section header p {
  margin: 0;
  color: #7f8d87;
  font-size: 7px;
}

.legacy-amount-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
}

.legacy-amount-grid label > span,
.legacy-reference-grid label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 7px;
  font-weight: 700;
}

.legacy-amount-grid input,
.legacy-reference-grid input,
.legacy-reference-grid select {
  width: 100%;
  height: 39px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: white;
  font-size: 8px;
}

.legacy-amount-grid input[readonly] {
  color: #5f6f68;
  background: #f0f3ef;
}

.percent-input {
  position: relative;
}

.percent-input input {
  padding-right: 27px;
}

.percent-input b {
  position: absolute;
  top: 50%;
  right: 10px;
  color: #718079;
  font-size: 8px;
  transform: translateY(-50%);
}

.legacy-reference-grid {
  margin-top: 14px;
}

.payment-month-allocation {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #dfe4dd;
  border-radius: 10px;
  background: white;
}

.allocation-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 72px;
  padding: 14px;
  color: #75827c;
  text-align: center;
  font-size: 7px;
}

.allocation-empty span {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: var(--sage-soft);
  font-size: 13px;
}

.payment-month-allocation > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 13px;
  border-bottom: 1px solid #e4e8e2;
  background: #f7f8f4;
}

.payment-month-allocation h4 {
  margin: 3px 0 0;
  font-size: 10px;
}

.payment-month-allocation > header > strong {
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--forest);
  background: white;
  font-size: 7px;
}

.month-allocation-head,
.month-allocation-row {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, .85fr) .7fr;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
}

.month-allocation-head {
  color: #87928d;
  background: #fcfcfa;
  font-size: 6px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.month-allocation-row {
  border-top: 1px solid #edf0eb;
  font-size: 7px;
}

.month-allocation-row > span strong,
.month-allocation-row > span small {
  display: block;
}

.month-allocation-row > span small {
  margin-top: 2px;
  color: #87938d;
  font-size: 6px;
}

.month-allocation-row > strong {
  font-size: 7px;
}

/* Equivalente en US$ bajo cada importe en lempiras (cuenta en dólares). */
.usd-equiv {
  display: block;
  margin-top: 1px;
  font-size: 6px;
  font-weight: 700;
  color: #2f6f8f;
}

.allocation-rate-note {
  margin: 6px 0 2px;
  font-size: 6px;
  color: #2f6f8f;
}

/* Nota de equivalente en lempiras bajo "Monto total recibido". */
.received-equiv-note {
  display: block;
  margin-top: 4px;
  font-size: 6px;
  font-weight: 700;
  color: #2f6f8f;
}

#receivedCurrencyTag {
  font-style: normal;
  font-weight: 800;
  color: #2f6f8f;
}

.month-allocation-row i {
  justify-self: start;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 6px;
  font-style: normal;
  font-weight: 800;
}

.month-allocation-row i.complete {
  color: #397257;
  background: #e2f1e7;
}

.month-allocation-row i.partial {
  color: #976036;
  background: #f8e7d8;
}

.month-allocation-row i.capital-payment {
  color: #315f52;
  background: #dcece4;
}

.automatic-capital-row {
  background: #f3f8f4;
}

.allocation-capital-note {
  padding: 9px 13px;
  color: #315f52;
  background: #e4f0e8;
  font-size: 7px;
}

.allocation-warning {
  padding: 9px 13px;
  color: #8d4d31;
  background: #fbe9df;
  font-size: 7px;
}

.payment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 17px;
}

.payment-calculator-card {
  align-self: start;
  padding: 22px;
  border-radius: 16px;
  color: white;
  background:
    linear-gradient(rgba(21,56,47,.98), rgba(21,56,47,.98)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.05) 12px 13px);
  box-shadow: var(--shadow);
}

.payment-calculator-card h2 {
  margin: 8px 0 4px;
  font-family: "Fraunces", serif;
  font-size: 23px;
}

.payment-calculator-card > p {
  margin: 0 0 17px;
  color: rgba(255,255,255,.55);
  font-size: 8px;
  line-height: 1.5;
}

.calculator-total {
  padding: 15px;
  border-radius: 11px;
  background: rgba(255,255,255,.08);
}

.calculator-total span,
.calculator-total strong {
  display: block;
}

.calculator-total span {
  color: rgba(255,255,255,.55);
  font-size: 7px;
}

.calculator-total strong {
  margin-top: 6px;
  font-family: "Fraunces", serif;
  font-size: 25px;
}

.calculator-lines {
  display: grid;
  gap: 11px;
  margin: 18px 0;
}

.calculator-lines div,
.calculator-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-size: 8px;
}

.calculator-lines strong {
  font-family: "Fraunces", serif;
  font-size: 14px;
}

.calculator-balance {
  padding: 13px 0;
  border-top: 1px solid rgba(255,255,255,.13);
  border-bottom: 1px solid rgba(255,255,255,.13);
}

.calculator-balance strong {
  font-family: "Fraunces", serif;
  font-size: 16px;
}

.calculator-income {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 0 0 14px;
  padding: 13px;
  border-radius: 9px;
  color: var(--forest-deep);
  background: var(--gold);
}

.calculator-income span {
  font-size: 8px;
  font-weight: 700;
}

.calculator-income strong {
  font-family: "Fraunces", serif;
  font-size: 17px;
}

.calculator-formula {
  margin-top: 16px;
}

.calculator-formula strong,
.calculator-formula code,
.calculator-formula small {
  display: block;
}

.calculator-formula strong {
  color: var(--gold);
  font-size: 8px;
}

.calculator-formula code {
  margin: 7px 0;
  padding: 9px;
  border-radius: 8px;
  color: #dbe8df;
  background: rgba(0,0,0,.17);
  font-size: 8px;
}

.calculator-formula small {
  color: rgba(255,255,255,.5);
  font-size: 7px;
  line-height: 1.5;
}

.payment-calculator-card .dialog-note {
  color: #f0d4c6;
  border-color: rgba(255,255,255,.12);
  background: rgba(199,108,71,.13);
}

@media (max-width: 1120px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .lot-grid { grid-template-columns: repeat(3, 1fr); }
  .global-search { display: none; }
  .client-summary-strip { grid-template-columns: repeat(2, 1fr); }
  .client-profile-header { align-items: flex-start; flex-direction: column; }
  .payments-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .payment-detail-layout,
  .new-payment-layout { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
  .sidebar {
    transform: translateX(-100%);
    transition: 220ms ease;
  }
  body.menu-open .sidebar { transform: none; }
  .main-content { margin-left: 0; }
  .mobile-menu { display: grid; }
  .hero,
  .content-grid { grid-template-columns: 1fr; }
  .lot-grid { grid-template-columns: repeat(2, 1fr); }
  .client-detail-grid { grid-template-columns: 1fr; }
  .client-toolbar { align-items: stretch; flex-direction: column; }
  .client-search { width: 100%; }
  .client-toolbar-actions { flex-wrap: wrap; }
  .client-toolbar-actions { width: 100%; }
  .client-toolbar-actions select { flex: 1 1 100%; min-height: 39px; }
  .client-toolbar-actions .secondary-button { flex: 1 1 calc(50% - 4px); }
  .admin-table-wrap { width: 100%; max-width: 100%; }
  .payment-filter-bar { grid-template-columns: 1fr 1fr; }
  .payment-filter-bar .client-search { grid-column: 1 / -1; }
  .payment-rules-note { grid-template-columns: 1fr 1fr; }
  .payment-rules-note p { grid-column: 1 / -1; }
  .allocation-hero { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { height: 68px; padding: 0 16px; }
  .topbar .breadcrumb { display: none; }
  .topbar-actions { margin-left: auto; }
  .topbar-actions > .primary-button {
    display: none;
  }
  .page-container { padding: 20px 15px; }
  .primary-button { padding: 0 11px; }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { padding: 16px; }
  .metric-value { font-size: 24px; }
  .welcome-card { min-height: 260px; padding: 27px 24px; }
  .welcome-actions { align-items: stretch; flex-direction: column; }
  .lot-grid { grid-template-columns: 1fr; }
  .lot-card-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .lot-card-footer .text-button { flex: 0 0 auto; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-group { overflow-x: auto; }
  .search-field { width: 100%; }
  .data-table th:nth-child(3),
  .data-table td:nth-child(3) { display: none; }
  .dialog-grid { grid-template-columns: 1fr; }
  .client-summary-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .admin-client-heading,
  .admin-client-heading > div,
  .admin-client-heading p {
    width: 100%;
    max-width: calc(100vw - 30px);
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .client-summary-card { min-height: 98px; padding: 14px; }
  .client-toolbar-actions select { width: 100%; }
  .client-profile-main { align-items: flex-start; }
  .client-profile-avatar { width: 50px; height: 50px; border-radius: 15px; font-size: 16px; }
  .client-profile-actions { width: 100%; overflow-x: auto; }
  .client-profile-actions button { flex: 0 0 auto; }
  .client-alert { grid-template-columns: auto 1fr; }
  .client-alert .text-button { grid-column: 2; justify-self: start; padding: 0; }
  .info-grid { grid-template-columns: 1fr; }
  .finance-feature { grid-template-columns: 1fr; }
  .document-grid { grid-template-columns: 1fr; }
  .payment-summary-grid { grid-template-columns: 1fr; }
  .payments-heading,
  .payments-control-bar,
  .payment-detail-header { align-items: flex-start; flex-direction: column; }
  .payment-day-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .payment-day-header > div:last-child { text-align: left; }
  .payments-view-toggle { width: 100%; overflow-x: auto; }
  .payments-view-toggle button { flex: 1 0 auto; }
  .payment-filter-bar { grid-template-columns: 1fr; }
  .payment-filter-bar .client-search { grid-column: auto; }
  .payment-filter-bar select { min-height: 39px; }
  .payment-rules-note { grid-template-columns: 1fr; }
  .payment-rules-note p { grid-column: auto; }
  .payment-detail-header > div:last-child { width: 100%; overflow-x: auto; }
  .allocation-equation { grid-template-columns: 1fr; }
  .allocation-equation b { display: none; }
  .calculation-explanation { grid-template-columns: 1fr; }
  .payment-form-grid { grid-template-columns: 1fr; }
  .payment-support-fields { grid-template-columns: 1fr; }
  .system-audit-caption { align-items: flex-start; flex-direction: column; }
  .system-audit-caption i { margin-left: 0; }
  .system-calculation-panel header { align-items: flex-start; flex-direction: column; }
  .system-calculation-panel > div { grid-template-columns: 1fr 1fr; }
  .legacy-amount-grid { grid-template-columns: 1fr 1fr; }
  .month-allocation-head { display: none; }
  .month-allocation-row { grid-template-columns: 1fr 1fr; }
  .month-allocation-row i { justify-self: end; }
}

/* Visor de documentos */
.doc-dialog .doc-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin: 6px 0 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, rgba(33,77,64,.03) 10px 11px),
    var(--sage-soft);
}
.doc-viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--forest);
}
.doc-viewer-placeholder span { font-size: 44px; line-height: 1; }
.doc-viewer-placeholder strong { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.doc-dialog-meta {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.doc-dialog-meta div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: baseline;
}
.doc-dialog-meta span { color: #84918c; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.doc-dialog-meta strong { font-size: 11px; font-weight: 600; overflow-wrap: anywhere; }

/* Documento incrustado en el visor (Drive conectado) */
.doc-frame {
  width: 100%;
  height: 60vh;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}
img.doc-frame { object-fit: contain; }
.doc-dialog .doc-viewer:has(.doc-frame) {
  min-height: 0;
  border: none;
  background: none;
  padding: 0;
}

/* ===== Inventario de lotes (admin) ===== */
.lot-alerts-banner {
  margin: 0 0 18px;
  padding: 14px 18px;
  border: 1px solid #e7c4b3;
  border-left: 4px solid var(--terracotta);
  border-radius: 12px;
  background: var(--terracotta-soft);
}
.lot-alerts-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.lot-alerts-icon {
  display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--terracotta); color: #fff;
  font-weight: 800; font-size: 12px;
}
.lot-alerts-head strong { font-size: 12px; color: #8a3f1f; }
.lot-alerts-banner ul { margin: 0; padding-left: 30px; }
.lot-alerts-banner li { font-size: 11px; color: #7a4a35; margin: 3px 0; }
.lot-alerts-banner li b { color: #6b2f15; }

.admin-lot-table td small { display: block; color: #8a9189; font-size: 8px; margin-top: 2px; }
.entity-avatar.lot-avatar { background: var(--sage); color: var(--forest); font-weight: 700; }

.audit-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 9px; font-weight: 700; letter-spacing: .03em;
  background: #ece9dd; color: #7a7a64;
}
.audit-badge.ok { background: #e0efe0; color: #2f6b3a; }

.lot-state.free { background: #e0efe0; color: #2f6b3a; }
.lot-state.sold { background: #e9e6dc; color: #6a6a52; }
.lot-state.neutral { background: #e8eaee; color: #5a6270; }

.lot-row-alert { background: #fbf0ea !important; }
.lot-alert-icon { color: var(--terracotta); font-size: 14px; cursor: help; }

/* ===== Editor de lote ===== */
.admin-lot-row { cursor: pointer; }
.lot-edit-grid { margin-top: 6px; }
.lot-edit-grid input:disabled {
  background: #f1f0e8;
  color: #9a9a86;
  cursor: not-allowed;
}
.lot-audit-note {
  margin: 10px 0 4px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f0efe7;
  color: #6a6a52;
  font-size: 10px;
  line-height: 1.5;
}
.lot-edit-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 16px 0 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sage-soft);
}
.lot-edit-preview > div { display: flex; flex-direction: column; gap: 2px; }
.lot-edit-preview span { color: #84918c; font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.lot-edit-preview strong { font-size: 13px; font-weight: 700; color: var(--ink); }
.lot-edit-preview .destacado { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
.lot-edit-preview .destacado strong { color: var(--forest); font-size: 16px; }
.lot-dialog-actions { display: flex; align-items: center; gap: 10px; }
.flex-spacer { flex: 1; }
#lotAuditBtn { color: var(--forest); }

/* Padding para diálogos sin <form> interno (editor de lote y visor de documentos) */
.quick-dialog.lot-dialog,
.quick-dialog.doc-dialog {
  padding: 30px 32px 26px;
}
.quick-dialog.lot-dialog .eyebrow,
.quick-dialog.doc-dialog .eyebrow {
  display: block;
  margin-bottom: 2px;
}
.quick-dialog.lot-dialog .dialog-actions,
.quick-dialog.lot-dialog .lot-edit-preview {
  margin-top: 18px;
}

/* ===== Comisiones ===== */
.comi-payee-tabs { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.comi-payee-tabs button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 12px 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--white); cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink);
}
.comi-payee-tabs button i { font-style: normal; font-size: 10px; font-weight: 600; color: var(--ink-soft); }
.comi-payee-tabs button.active { background: var(--forest); color: #fff; border-color: var(--forest); }
.comi-payee-tabs button.active i { color: rgba(255,255,255,.8); }

.comi-group { margin-bottom: 18px; }
.comi-group-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.comi-group-head h2 { margin: 2px 0 0; font-size: 16px; }
.comi-group-actions { display: flex; align-items: center; gap: 16px; }
.comi-table td:first-child, .comi-table th:first-child { width: 40px; text-align: center; }
.comi-table td small { display: block; color: #8a9189; font-size: 8px; }
.comi-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; color: var(--ink-soft); }
.comi-check input { width: 16px; height: 16px; accent-color: var(--forest); cursor: pointer; }
.comi-liquidar:disabled { opacity: .45; cursor: not-allowed; }

/* Comisiones — toggle de vista e historial */
.comi-view-toggle { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--sage-soft); border-radius: 12px; }
.comi-view-toggle button { border: none; background: transparent; padding: 8px 16px; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.comi-view-toggle button.active { background: var(--white); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.comi-trx { font-family: monospace; color: var(--forest); }
.comi-liq-table .secondary-button { padding: 5px 12px; font-size: 10px; }

/* ===== Equipo y accesos ===== */
.perfil-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--sage); color: var(--forest); font-size: 9px; font-weight: 700; letter-spacing: .02em;
}
.equipo-page .client-summary-strip { margin-bottom: 18px; }
.equipo-page .client-summary-card { cursor: default; }
.equipo-page .comi-group-head { gap: 16px; }

/* ===== Cobranza ===== */
.cobro-meta { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 16px; margin-bottom: 18px; }
.cobro-meta-num { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.cobro-meta-num span { display: block; color: var(--ink-soft); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.cobro-meta-num strong { display: block; font-family: "Fraunces", serif; font-size: 26px; margin: 6px 0 2px; color: var(--forest); }
.cobro-meta-num small { color: var(--ink-soft); font-size: 10px; }
.cobro-meta-progress { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--sage-soft); }
.cobro-bar { height: 14px; border-radius: 8px; background: #e3e6dd; overflow: hidden; }
.cobro-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--forest)); }
.cobro-meta-progress span { font-size: 11px; font-weight: 700; color: var(--ink); }

.cobro-clases { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cobro-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); cursor: pointer; font-size: 11px; font-weight: 600; color: var(--ink); }
.cobro-chip i { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.06); }
.cobro-chip.active { box-shadow: 0 0 0 2px var(--forest) inset; }

.cobro-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 9px; font-weight: 700; }
.score-chips { font-family: monospace; font-weight: 700; color: var(--forest); }
.cobro-table td small { display: block; color: #8a9189; font-size: 8px; }

/* colores por clasificación */
.c-vip { background: #f3e6c8; color: #8a6516; }
.c-nuevo { background: #e0efe0; color: #2f6b3a; }
.c-valioso { background: #dbe7f3; color: #2f567a; }
.c-critico { background: #f6dcd5; color: #a23b22; }
.c-fiel { background: #d9eceb; color: #2c6b66; }
.c-pocofrec { background: #f5e7cf; color: #8a5a1e; }
.c-cumplidor { background: #e7efdc; color: #4d6b2a; }
.c-intermitente { background: #eceadf; color: #6a6650; }
.cobro-chip.c-critico.active, .cobro-chip.c-vip.active { box-shadow: 0 0 0 2px currentColor inset; }

/* Desglose de cobro (modal) */
.quick-dialog.cobro-dialog { padding: 30px 32px 24px; width: min(720px, calc(100vw - 32px)); }
.cobro-desglose-meta { display: flex; gap: 24px; margin: 6px 0 16px; font-size: 12px; }
.cobro-desglose-meta b { color: var(--forest); }
.cobro-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 16px 0 8px; }
.cobro-desglose-tabla { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.cobro-desglose-tabla table { width: 100%; border-collapse: collapse; }
.cobro-desglose-tabla th { position: sticky; top: 0; background: var(--forest); color: #f4f1e4; padding: 8px 10px; font-size: 10px; text-align: left; }
.cobro-desglose-tabla td { padding: 7px 10px; border-bottom: 1px solid #eee; font-size: 11px; }
.cobro-desglose-tabla tr:last-child td { border-bottom: none; }
.tag-parcial { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--terracotta-soft); color: #a23b22; font-size: 9px; font-weight: 700; }
.vacio-cell { color: #8a8a78; font-style: italic; text-align: center; padding: 14px; }

/* Resumen total de deuda en el desglose de cobro */
.cobro-total-deuda { display: flex; gap: 14px; align-items: stretch; margin-top: 16px; }
.cobro-total-deuda > div { flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.cobro-total-deuda span { display: block; color: var(--ink-soft); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.cobro-total-deuda strong { display: block; font-size: 15px; font-weight: 700; margin-top: 3px; }
.cobro-total-deuda .cobro-total-grande { flex: 1.3; background: var(--forest); border-color: var(--forest); }
.cobro-total-deuda .cobro-total-grande span { color: rgba(255,255,255,.7); }
.cobro-total-deuda .cobro-total-grande strong { color: #fff; font-size: 19px; }

/* ===== Expedientes (clientes iniciados) ===== */
.expedientes-page .client-summary-strip { margin-bottom: 18px; }
.expedientes-page .client-summary-card { cursor: default; }
.expediente-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.expediente-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.expediente-card.completo { border-color: #a9d3ad; background: #f4faf3; }
.exp-head { display: flex; align-items: center; gap: 10px; }
.exp-head strong { display: block; font-size: 12px; }
.exp-head small { display: block; color: var(--ink-soft); font-size: 9px; }
.exp-progress { margin-left: auto; font-weight: 800; font-size: 13px; color: var(--terracotta); }
.exp-progress.ok { color: #2f6b3a; }
.exp-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0; font-size: 9px; color: var(--ink-soft); }
.exp-dias { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.exp-dias.dias-verde { background: #e5f3e7; color: #2f6b3a; }
.exp-dias.dias-amarillo { background: #fbf1d8; color: #8d6d29; }
.exp-dias.dias-rojo { background: #f8e2dc; color: #b0402c; }
.exp-checklist { list-style: none; margin: 0 0 10px; padding: 0; }
.exp-checklist li { display: flex; align-items: center; gap: 8px; font-size: 11px; padding: 3px 0; }
.exp-checklist li i { font-style: normal; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; font-size: 9px; }
.exp-checklist li.ok { color: var(--ink); }
.exp-checklist li.ok i { background: #e0efe0; color: #2f6b3a; }
.exp-checklist li.pend { color: #9a9a86; }
.exp-checklist li.pend i { background: #efece2; color: #b0ab97; }
.exp-firma { font-size: 9px; color: var(--ink-soft); margin-bottom: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.exp-firma span { font-weight: 700; }
.exp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.exp-listo { font-size: 10px; font-weight: 700; color: #2f6b3a; }
.exp-falta { font-size: 10px; font-weight: 700; color: var(--terracotta); }

/* ===== Rescisión de contrato · devolución al cliente ===== */
.rescision-section { border: 1px solid #e2c9bf; background: #fbf3ef; }
.rescision-section h2 { color: var(--danger); }
.rescision-section .eyebrow { color: #b06a4f; }
.rescision-formula {
  margin: 4px 0 16px; font-size: 12.5px; line-height: 1.55; color: #6a5a52;
  background: #fff; border: 1px solid #ecd9d0; border-radius: 10px; padding: 11px 14px;
}
.rescision-formula b { color: var(--danger); }
.rescision-inputs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; margin-bottom: 14px;
}
.rescision-inputs .info-item span { font-size: 10px; }
.rescision-inputs .info-item-edit input {
  font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; width: 100%;
}
.rescision-preview {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px;
  padding: 14px 16px; border: 1px solid #ecd9d0; border-radius: 12px; background: #fff;
}
.rescision-preview > div { display: flex; flex-direction: column; gap: 2px; }
.rescision-preview span { color: #9a8278; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.rescision-preview strong { font-size: 15px; font-weight: 700; color: var(--ink); }
.rescision-preview .destacado { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid #ecd9d0; }
.rescision-preview .destacado strong { color: var(--danger); font-size: 19px; }
.rescision-actions { margin-top: 16px; display: flex; justify-content: flex-end; }

.firma-section .firma-editor { display: flex; flex-direction: column; gap: 10px; }
.firma-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.firma-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 220px;
  min-width: 0;             /* permite que el select encoja y no empuje el botón fuera de vista */
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  color: #84918c;
}
.firma-editor select,
.firma-editor textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 400;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
}
.firma-editor textarea { resize: vertical; min-height: 32px; }
.firma-row .primary-button { flex: 0 0 auto; box-sizing: border-box; min-height: 0; height: 39px; padding: 0 18px; }
.firma-row .primary-button:disabled { opacity: .5; cursor: default; }

.phone-value { display: inline-flex; align-items: center; gap: 8px; }
.wa-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #25d366;
  flex: 0 0 auto;
  transition: transform 150ms ease, filter 150ms ease;
}
.wa-link:hover { transform: scale(1.08); filter: brightness(1.05); }
.wa-link svg { width: 11px; height: 11px; fill: #fff; }

.titulares-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.titular-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfbf7;
}
.titular-tag { font-size: 8px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--teal); }
.titular-card strong { font-size: 14px; color: var(--ink); }
.titular-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.titular-mail { font-size: 12px; color: #6c776f; word-break: break-word; }
@media (max-width: 640px) { .titulares-grid { grid-template-columns: 1fr; } }
.cotitular-y { font-weight: 400; font-size: .6em; color: #9aa49d; vertical-align: middle; }
.titulares-grid.rep-residencia { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); margin-bottom: 0; }

/* ===== Estado "Pago Completo" ===== */
.status.success { color: #1d6b43; background: #d6f0df; }

/* ===== Finiquito de pago completo · cliente al 100% ===== */
.pago-completo-section { border: 1px solid #c6e3cf; background: #f1f9f3; }
.pago-completo-section h2 { color: var(--forest); }
.pago-completo-section .eyebrow { color: #2f7a52; }
.pago-completo-msg {
  margin: 4px 0 16px; font-size: 12.5px; line-height: 1.55; color: #41594b;
  background: #fff; border: 1px solid #d2e8d8; border-radius: 10px; padding: 11px 14px;
}
.pago-completo-msg b { color: var(--forest); }
.pago-completo-section .rescision-preview { border-color: #d2e8d8; }
.pago-completo-section .rescision-preview span { color: #6f8c79; }

/* ===== Menú lateral compacto (colapsable) ===== */
.sidebar { transition: padding 200ms ease; }
.main-content { transition: margin-left 220ms ease; }

body.sidebar-collapsed { --sidebar-width: 82px; }
body.sidebar-collapsed .sidebar { padding: 22px 12px 16px; }

/* Encabezado: emblema centrado y el toggle debajo */
body.sidebar-collapsed .sidebar-head {
  flex-direction: column;
  gap: 14px;
  margin: 0 0 22px;
}
body.sidebar-collapsed .brand { gap: 0; }
body.sidebar-collapsed .brand-logo { display: none; }
body.sidebar-collapsed .brand-mark-img { display: block; }
body.sidebar-collapsed .sidebar-toggle .toggle-icon { transform: rotate(180deg); }

/* Ocultar todas las etiquetas de texto */
body.sidebar-collapsed .switcher-label,
body.sidebar-collapsed .nav-heading,
body.sidebar-collapsed .nav-link > span:not(.nav-icon),
body.sidebar-collapsed .workspace-button strong,
body.sidebar-collapsed .workspace-button small,
body.sidebar-collapsed .workspace-button .chevron,
body.sidebar-collapsed .environment-badge > span:not(.status-dot),
body.sidebar-collapsed .profile-button > span:not(.avatar) {
  display: none;
}

/* Separadores entre grupos cuando no hay encabezado */
body.sidebar-collapsed .nav-group + .nav-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-dark);
}

/* Navegación: solo iconos centrados */
body.sidebar-collapsed .nav-link {
  justify-content: center;
  gap: 0;
  padding: 11px 0;
}
body.sidebar-collapsed .nav-icon { width: 26px; font-size: 18px; }
body.sidebar-collapsed .nav-link.active { box-shadow: none; background: rgba(255,255,255,.16); }

/* Workspace y perfil: solo el icono/avatar centrado */
body.sidebar-collapsed .workspace-switcher { margin-bottom: 18px; }
body.sidebar-collapsed .workspace-button {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 9px;
}
body.sidebar-collapsed .environment-badge { justify-content: center; padding: 0 0 14px; }
body.sidebar-collapsed .profile-button { justify-content: center; padding: 11px 8px; }

/* ===== Panel administrativo: métricas clicables y tabla de gestión ===== */
.metric-card.metric-clickable {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: 170ms ease;
}
.metric-card.metric-clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(70, 73, 30, .12);
}

.gestion-table tbody tr { cursor: pointer; transition: 130ms ease; }
.gestion-table tbody tr:hover { background: var(--sage-soft); }

.gestion-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
  color: var(--forest);
  background: var(--sage-soft);
}
.gestion-badge.danger { color: var(--danger); background: #f7e4e1; }
.gestion-badge.pending { color: #9b643b; background: #f8eadc; }

.gestion-empty {
  padding: 26px 18px;
  color: var(--forest);
  font-size: 11px;
  text-align: center;
}
.gestion-more {
  padding: 12px 16px;
  color: var(--ink-soft);
  font-size: 9px;
  border-top: 1px solid var(--line);
}

/* ===================== GESTIONES DE COBRO (trazabilidad) ===================== */
/* Colores del resultado de cada gestión */
.gestion-badge.ok { color: var(--forest); background: var(--sage-soft); }
.gestion-badge.warn { color: #9b643b; background: #f8eadc; }
.gestion-badge.bad { color: var(--danger); background: #f7e4e1; }
.gestion-badge.neutral { color: var(--ink-soft); background: rgba(0,0,0,.06); }

/* Chip "Seguimiento hoy" en Cobranza */
.cobro-chip.c-seguimiento.active { box-shadow: 0 0 0 2px #9b643b inset; }

/* Celda "Gestión de cobro" en la tabla de Cobranza */
.cobro-gestion-cell { white-space: nowrap; }
.cobro-ultima { display: inline-flex; flex-direction: column; gap: 1px; vertical-align: middle; }
.cobro-ultima small { font-size: 9.5px; color: var(--ink-soft); }
.cobro-prox { font-size: 9.5px; color: var(--ink-soft); }
.cobro-prox.vencido { color: var(--danger); font-weight: 700; }
.cobro-sin-gestion { font-size: 10px; color: var(--ink-soft); }
.cobro-registrar { margin-left: 10px; font-size: 10px; font-weight: 700; color: var(--forest); white-space: nowrap; }

/* Línea de tiempo de gestiones (pestaña Actividad del cliente) */
.gestiones-timeline { margin-top: 6px; }
.activity-loading { padding: 22px 16px; text-align: center; color: var(--ink-soft); font-size: 11px; }
.gestion-canal { font-style: normal; font-weight: 600; color: var(--ink-soft); }
.gestion-nota-text { display: block; margin-top: 2px; color: var(--ink); font-size: 11px; white-space: pre-wrap; }
.gestion-meta { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 9.5px; }
.gestion-dot.ok { background: var(--forest); }
.gestion-dot.warn { background: #c98a3c; }
.gestion-dot.bad { background: var(--danger); }
.gestion-dot.neutral { background: var(--line); }

/* Modal de registrar gestión */
.gestion-dialog .dialog-grid { grid-template-columns: 1fr 1fr; }
.gestion-nota-field { display: block; margin-top: 12px; }
.gestion-nota-field span { display: block; font-size: 11px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.gestion-nota-field textarea { width: 100%; min-height: 80px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; box-sizing: border-box; }

/* ===================== MAPA DE LOTES ===================== */
.mapa-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.mapa-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Colores de estado (custom property reutilizable) */
.estado-libre { --est: #2faa46; }
.estado-vendido { --est: #1d1d1d; }
.estado-bloqueado { --est: #d6a32e; }
.estado-revision { --est: #b13bd1; }
.estado-libre-activo { --est: #c0392b; }
.estado-reservado-sin { --est: #2d7ff0; }
.estado-reservado { --est: #0e6e73; }
.estado-otro { --est: #8a8a78; }

.mapa-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--est, #888); flex-shrink: 0; }

/* Chips de conteo por estado */
.mapa-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.mapa-stat {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 30px;
  background: var(--white); color: var(--ink); font-size: 11px; font-weight: 600; cursor: pointer;
  transition: 150ms ease;
}
.mapa-stat:hover { border-color: var(--est); }
.mapa-stat.active { border-color: var(--est); box-shadow: inset 0 0 0 1px var(--est); }
.mapa-stat b { font-size: 12px; font-weight: 800; }

/* Layout mapa + panel lateral */
.mapa-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .mapa-layout { grid-template-columns: 1fr; } }

.mapa-wrap {
  position: relative; width: 100%; min-height: 420px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: #f3efe1; box-shadow: var(--shadow);
  touch-action: none;
}
.mapa-wrap[data-edit="0"] { cursor: grab; }
.mapa-wrap[data-edit="0"]:active { cursor: grabbing; }
.mapa-wrap[data-edit="1"] { cursor: crosshair; }
.mapa-stage { position: relative; width: 100%; transform-origin: 0 0; --inv: 1; }
.mapa-img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; pointer-events: none; }

/* Controles de zoom */
.mapa-zoom-controls {
  position: absolute; top: 12px; left: 12px; z-index: 8;
  display: flex; align-items: center; gap: 4px;
  padding: 4px; border-radius: 10px; background: rgba(255,255,255,.92);
  box-shadow: 0 3px 12px rgba(0,0,0,.18); backdrop-filter: blur(4px);
}
.mapa-zoom-controls button {
  width: 28px; height: 28px; border: 0; border-radius: 7px; background: var(--sage-soft);
  color: var(--ink); font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer;
}
.mapa-zoom-controls button:hover { background: var(--sage); }
.mapa-zoom-level { padding: 0 8px; font-size: 11px; font-weight: 700; color: var(--ink-soft); }

.mapa-img-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 30px; color: var(--ink-soft);
}
.mapa-fallback-icon { font-size: 34px; color: var(--mustard); }
.mapa-img-fallback strong { font-size: 15px; color: var(--ink); }
.mapa-img-fallback p { max-width: 320px; font-size: 12px; line-height: 1.5; }
.mapa-img-fallback code { background: #ece5d2; padding: 1px 6px; border-radius: 5px; font-size: 11px; }

/* Pines */
.mapa-pins { position: absolute; inset: 0; pointer-events: none; }
.mapa-pin {
  position: absolute; transform: translate(-50%, -50%) scale(var(--inv, 1));
  display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border: 2px solid #fff; border-radius: 20px;
  background: var(--est, #888); color: #fff;
  font-size: 9px; font-weight: 800; line-height: 1;
  box-shadow: 0 2px 7px rgba(0,0,0,.35); cursor: pointer; pointer-events: auto;
  transition: box-shadow 120ms ease;
}
.mapa-pin:hover { transform: translate(-50%, -50%) scale(calc(1.4 * var(--inv, 1))); z-index: 5; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
.mapa-pin.sel { outline: 3px solid rgba(14,110,115,.4); z-index: 6; }
.mapa-pin.dim { opacity: .22; }
.mapa-pin.tiene-alerta::after {
  content: "!"; position: absolute; top: -7px; right: -7px;
  width: 13px; height: 13px; display: grid; place-items: center;
  background: #c0392b; color: #fff; border: 1.5px solid #fff; border-radius: 50%; font-size: 8px;
}
.mapa-pin.editable { cursor: grab; }
.mapa-pin.editable:active { cursor: grabbing; }

/* Panel lateral */
.mapa-aside-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
  padding: 16px 16px 18px; box-shadow: var(--shadow);
}
.mapa-aside-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.mapa-aside-card h3 { margin: 0; font-family: "Fraunces", serif; font-size: 16px; }
.mapa-progress { font-size: 10px; font-weight: 700; color: var(--teal); background: var(--sage-soft); padding: 3px 9px; border-radius: 20px; }
.mapa-aside-help, .mapa-aside-ok { font-size: 11px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 12px; }
.mapa-aside-ok { color: var(--forest); font-weight: 600; }
.mapa-hint-sel { font-size: 11px; line-height: 1.5; background: var(--sage-soft); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin-bottom: 12px; }
.mapa-aside-empty { text-align: center; color: var(--ink-soft); }
.mapa-aside-empty strong { display: block; margin: 6px 0 4px; color: var(--ink); font-size: 14px; }
.mapa-aside-empty p { font-size: 11px; line-height: 1.5; margin: 0; }

.mapa-chip-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 360px; overflow-y: auto; }
.mapa-chip-lot {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
  font-size: 10px; font-weight: 700; color: var(--ink); cursor: pointer; transition: 120ms ease;
}
.mapa-chip-lot:hover { border-color: var(--est); }
.mapa-chip-lot.sel { border-color: var(--est); box-shadow: inset 0 0 0 1px var(--est); background: var(--white); }

/* Tarjeta de información del lote */
.mapa-info-head { display: flex; align-items: center; gap: 10px; }
.mapa-info-code { font-family: "Fraunces", serif; font-size: 26px; font-weight: 700; color: var(--ink); }
.mapa-info-badge { padding: 4px 10px; border-radius: 20px; background: var(--est); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .03em; }
.mapa-info-proj { margin: 2px 0 12px; font-size: 11px; color: var(--ink-soft); }
.mapa-info-alert { background: #f7e4e1; color: #8f2f2a; border-radius: 9px; padding: 9px 11px; font-size: 10.5px; line-height: 1.5; margin-bottom: 12px; }
.mapa-info-grid { display: grid; gap: 9px; }
.mapa-info-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.mapa-info-row:last-child { border-bottom: 0; }
.mapa-info-row span { color: var(--ink-soft); }
.mapa-info-row strong { color: var(--ink); text-align: right; }
.mapa-info-actions { margin-top: 14px; }
.mapa-info-actions .secondary-button { width: 100%; }

/* Leyenda */
.mapa-legend { display: flex; flex-wrap: wrap; gap: 14px 20px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.mapa-leg-item { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink); }

/* Buscador del panel de ubicación de lotes */
.mapa-search {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper);
  color: #83918b;
}
.mapa-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.mapa-hint-sel .text-button { margin-left: 4px; }

/* ---------- Pantalla de inicio de sesión (login con Google) ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(15, 76, 71, .25), transparent 60%),
    var(--conditioner, #0f2e2b);
}
.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  padding: 40px 32px 32px;
  border-radius: 20px;
  background: var(--paper, #fbfaf4);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
}
.login-logo { width: 64px; height: auto; margin-bottom: 16px; }
.login-card h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 24px;
  color: var(--ink, #20302c);
}
.login-card > p { margin: 4px 0 24px; color: #6b7a73; font-size: 13px; }
.login-google { display: flex; justify-content: center; min-height: 44px; }
.login-hint { display: block; margin-top: 18px; color: #6b7a73; font-size: 12px; }
.login-error { display: block; margin-top: 10px; color: #b3261e; font-size: 12px; min-height: 14px; }

/* Selector de acceso a la app en "Equipo y accesos" */
.app-role-select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}
.app-role-select:disabled { opacity: .55; cursor: not-allowed; }

/* Diálogo de edición de pago */
.dialog-grid .dialog-full { grid-column: 1 / -1; }
.dialog-grid textarea { width: 100%; min-height: 64px; resize: vertical; padding: 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); }
.dialog-grid select { width: 100%; }
.lock-note { opacity: .6; font-size: 12px; }

/* Diálogo de reasignación de pagos (simulación) */
.reaplicacion-dialog { max-width: 760px; width: 92vw; }
.reaplicacion-body { max-height: 52vh; overflow: auto; margin: 8px 0; }
.reaplicacion-body table { font-size: 11px; }
.reaplicacion-body .row-cambio { background: #fcf7e8; }
.reaplicacion-body .row-cambio td { font-weight: 600; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Acciones del diálogo de reasignación */
.reaplicacion-dialog .flex-spacer { flex: 1; }
.reaplicacion-dialog .danger-text { color: #b3261e; border-color: #e7c3bf; }

/* El display del botón anula el atributo hidden; forzamos el ocultado. */
#reaplicacionDeshacer[hidden] { display: none; }

/* Botones de eliminar (acción destructiva) */
.danger-text { color: #b3261e; }
button.danger-text { border-color: #e7c3bf; }

/* Barra de filtro por rango de fechas en Ingreso de pagos */
.payment-range-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.payment-range-bar .range-label { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.payment-range-bar label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #5f6f68; }
.payment-range-bar input[type="date"] { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; }
.payment-range-bar .range-info { color: #2f6f8f; font-weight: 700; font-size: 12px; }

/* Nota de prima pendiente en el formulario de ingreso (concepto Prima) */
.prima-hint { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: #eef4f0; border: 1px solid #cfe0d6; color: #20302c; font-size: 12px; }
.prima-hint strong { color: #1d5e4f; }

/* Elección del destino del excedente al registrar una cuota */
.excedente-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1px solid #e3decd;
  border-radius: 10px;
  background: #f7f4ea;
}
.excedente-choice .excedente-title {
  flex: 1 1 100%;
  font-size: 12.5px;
  font-weight: 600;
  color: #4a4a36;
}
.excedente-choice .excedente-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* Comisiones: cliente no habilitado para pago (no Activo o sin contrato privado) */
.comi-row-bloqueada { opacity: 0.62; }
.comi-row-bloqueada .comi-bloqueado { font-size: 14px; opacity: 0.7; }
.comi-motivo { color: #b94434; font-weight: 600; }

/* CRM de cobros (pipeline de gestión) */
.cobros-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-top: 14px; }
.cobros-col { flex: 0 0 256px; background: #f4f1e8; border: 1px solid #e3decd; border-radius: 12px; display: flex; flex-direction: column; }
.cobros-col > header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #e3decd; }
.cobros-col > header h3 { margin: 0; font-size: 13px; }
.cobros-count { background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.cobros-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.cobros-empty { color: #9a937f; font-size: 12px; text-align: center; margin: 6px 0; }
.cobros-card { background: #fff; border: 1px solid #e6e1d2; border-radius: 10px; padding: 10px; font-size: 12.5px; }
.cobros-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.cobros-card-top strong { font-size: 13px; }
.cobros-cuota { margin-top: 4px; color: #4a4a36; }
.cobros-contador { margin-top: 4px; color: #8d6d29; font-weight: 600; }
.cobros-promesa { display: block; margin-top: 4px; color: #2c6940; }
.cobros-promesa.promesa-vencida { color: #b94434; font-weight: 700; }
.cobros-etapa-select { width: 100%; margin-top: 8px; }
.cobros-card-actions { display: flex; gap: 10px; margin-top: 8px; }
.cobros-card-pagado { border-color: #4a9150; background: #eef6ee; }
.cobros-card-por_rescindir { border-color: #bf6038; background: #fbeee6; }
.cobros-card-rescindido { border-color: #b94434; background: #f6e7e5; opacity: 0.85; }
.clase-chip { font-size: 10px; padding: 1px 6px; border-radius: 999px; white-space: nowrap; background: #eee9d8; color: #6d5a1f; align-self: flex-start; }

/* CRM de cobros — drag & drop, detalle y modal de promesa */
.cobros-card[draggable="true"] { cursor: grab; }
.cobros-card.dragging { opacity: 0.5; }
.cobros-card-open { cursor: pointer; }
.cobros-card-open:hover strong { text-decoration: underline; }
.cobros-col-over { outline: 2px dashed #6d7042; outline-offset: -4px; background: #eef1e5; }
.cobros-pago { display: block; margin-top: 4px; color: #2c6940; font-weight: 600; }
.gestiones-resumen { margin-bottom: 10px; padding: 8px 12px; background: #f4f1e8; border: 1px solid #e3decd; border-radius: 8px; font-size: 13px; font-weight: 600; color: #4a4a36; }
.app-dialog { border: none; border-radius: 14px; padding: 0; max-width: 420px; width: 92%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.app-dialog::backdrop { background: rgba(20,20,15,.45); }
.app-dialog .dialog-card { padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.app-dialog h2 { margin: 0; font-size: 18px; }
.app-dialog .dialog-sub { margin: 0; color: #8d7f5f; font-weight: 600; }
.app-dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #4a4a36; }
.app-dialog input { padding: 8px 10px; border: 1px solid #d8d2bf; border-radius: 8px; font-size: 14px; }
.app-dialog .dialog-error { color: #b94434; font-size: 13px; margin: 0; }
.app-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* =====================================================================
   ELEVACIÓN 2026 — capa de refinamiento visual (clase mundial)
   Sistema: sombras entintadas de la marca, anillos de foco accesibles,
   micro-interacciones, textura de papel y componentes pulidos.
   Se apoya en la cascada: refina lo anterior sin reescribirlo.
   ===================================================================== */

:root {
  --shadow-sm: 0 1px 2px rgba(70, 73, 30, 0.06), 0 2px 6px rgba(70, 73, 30, 0.05);
  --shadow-md: 0 2px 4px rgba(70, 73, 30, 0.05), 0 10px 24px rgba(70, 73, 30, 0.09);
  --shadow-lg: 0 4px 10px rgba(70, 73, 30, 0.07), 0 24px 56px rgba(70, 73, 30, 0.14);
  --ring: 0 0 0 3px rgba(14, 110, 115, 0.22);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* Textura de papel sutil sobre toda la interfaz (los <dialog> quedan en la
   capa superior nativa, no se ven afectados). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

::selection { background: rgba(169, 138, 44, 0.28); }

/* ---------- Foco visible consistente (teclado) ---------- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 8px;
}
.sidebar a:focus-visible,
.sidebar button:focus-visible {
  outline-color: var(--conditioner);
}

/* ---------- Botones: presión, foco y consistencia ---------- */
.primary-button,
.secondary-button,
.ghost-button {
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out),
              background 160ms ease, border-color 160ms ease;
}
.primary-button { box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.primary-button:hover { box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.primary-button:active,
.secondary-button:active { transform: translateY(0) scale(.985); box-shadow: var(--shadow-sm); }
.secondary-button:hover { border-color: #c9c4a8; background: #fdfcf6; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ghost-button:hover { background: rgba(14, 110, 115, 0.07); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------- Tarjetas de métricas ---------- */
.metric-card {
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
  box-shadow: var(--shadow-sm);
}
.metric-card.metric-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-icon svg { width: 16px; height: 16px; display: block; }
.focus-ico svg { width: 17px; height: 17px; display: block; }
.metric-value, .data-table td, .payment-metrics strong, .focus-count {
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---------- Tablas ---------- */
.data-table th {
  color: #7c8a80;
  letter-spacing: .1em;
  border-bottom: 1px solid #e7e4d2;
}
.data-table tbody tr { transition: background 130ms ease; }
.data-table tbody tr:hover { background: #f3f6ef; }
.data-table tbody tr:focus-within { background: #eef3ea; }

/* ---------- Paneles y tarjetas base ---------- */
.panel, .focus-card { box-shadow: var(--shadow-sm); }

/* ---------- Héroe del panel: más operación, menos póster ---------- */
.welcome-card { min-height: 0; }
.welcome-card h1 { font-size: clamp(20px, 2.1vw, 26px); line-height: 1.18; }
.welcome-card p { max-width: 52ch; }
.hero { margin-bottom: 18px; }

/* ---------- Barra superior más esbelta ---------- */
.topbar { height: 64px; }

/* ---------- Diálogos: entrada suave y fondo desenfocado ---------- */
dialog.quick-dialog, dialog.app-dialog {
  border: 1px solid rgba(110, 113, 56, 0.14);
  box-shadow: var(--shadow-lg);
}
dialog.quick-dialog[open], dialog.app-dialog[open] {
  animation: dialog-in 240ms var(--ease-out);
}
dialog.quick-dialog::backdrop, dialog.app-dialog::backdrop {
  background: rgba(30, 32, 14, 0.42);
  backdrop-filter: blur(5px);
  animation: backdrop-in 240ms ease;
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(.977); }
  to { opacity: 1; transform: none; }
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toast: voz propia de la marca ---------- */
.toast {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  color: var(--conditioner);
  background: #26290f;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  letter-spacing: .01em;
}

/* ---------- Kanban de cobros ---------- */
.cobros-card {
  box-shadow: var(--shadow-sm);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.cobros-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cobros-col { background: #f2efe4; }

/* ---------- Formularios ---------- */
input, select, textarea { transition: border-color 140ms ease, box-shadow 140ms ease; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: var(--ring); outline: none; }

/* ---------- Scrollbars discretos ---------- */
.cobros-board::-webkit-scrollbar, .page-container ::-webkit-scrollbar { height: 8px; width: 8px; }
.cobros-board::-webkit-scrollbar-thumb, .page-container ::-webkit-scrollbar-thumb {
  border-radius: 8px; background: rgba(110, 113, 56, 0.28);
}
.cobros-board::-webkit-scrollbar-track, .page-container ::-webkit-scrollbar-track { background: transparent; }

/* ---------- Pantalla de acceso ---------- */
.login-screen {
  background:
    repeating-linear-gradient(45deg, rgba(110, 113, 56, 0.045) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(-45deg, rgba(110, 113, 56, 0.045) 0 1px, transparent 1px 26px),
    radial-gradient(circle at 50% 0%, rgba(14, 110, 115, 0.10), transparent 34rem),
    var(--cream);
}
.login-card { border: 1px solid rgba(110, 113, 56, 0.16); box-shadow: var(--shadow-lg); }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Íconos dentro de botones y celdas */
.primary-button svg, .secondary-button svg, .text-button svg, .ghost-button svg {
  width: 14px; height: 14px; flex: none;
}
.document-type svg { width: 14px; height: 14px; display: block; }
.payment-proof > span svg { width: 16px; height: 16px; display: block; }
.payment-metrics i svg, .payment-summary i svg { width: 16px; height: 16px; display: block; }
.empty-page-icon svg { width: 30px; height: 30px; display: block; }

/* Búsqueda global: panel de resultados */
.global-search { position: relative; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 330px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}
.search-results button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.search-results button:hover,
.search-results button.activo { background: #f1f4ec; }
.search-results .search-texto { display: grid; min-width: 0; }
.search-results .search-texto strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .search-texto small { color: #8a8a70; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { margin: 0; padding: 10px 12px; color: #8a8a70; font-size: 10.5px; }

/* Contactos del expediente y avisos de lote con íconos alineados */
.exp-contact span { display: inline-flex; align-items: center; gap: 5px; }
.exp-contact svg { width: 12px; height: 12px; flex: none; opacity: .75; }
.lot-alert-icon svg { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; color: #b6772e; }
#mapaZoomReset svg { width: 14px; height: 14px; display: block; margin: auto; }

/* ---------- Móvil: correcciones de jerarquía ---------- */
@media (max-width: 1120px) {
  /* la variante de 5 tarjetas ganaba por especificidad a la media query */
  .admin-clients-page .client-summary-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  /* el título de la sección sí se muestra (solo se oculta el eyebrow) */
  .topbar .breadcrumb { display: block; }
  .topbar .breadcrumb span { display: none; }
  .topbar .breadcrumb strong { font-size: 15px; }
  /* tarjetas resumen: carrusel horizontal con snap en lugar de recortarse */
  .client-summary-strip,
  .admin-clients-page .client-summary-strip {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .client-summary-card { flex: 0 0 47%; min-height: 92px; scroll-snap-align: start; }
}

/* ---------- Bandeja "Para hoy" de cobranza ---------- */
.hoy-bandeja {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.hoy-bandeja-limpia { border-left-color: #4a9150; }
.hoy-head p { margin: 4px 0 0; color: #5c5f44; font-size: 11px; }
.hoy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.hoy-grupo { border: 1px solid #ece9d8; border-radius: 11px; background: #fbfaf4; padding: 8px; min-width: 0; }
.hoy-grupo > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 7px; }
.hoy-grupo > header h3 { margin: 0; font-size: 11px; }
.hoy-grupo-vacia { opacity: .7; }
.hoy-vacio { margin: 2px 4px 4px; color: #9a937f; font-size: 10px; }
.hoy-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  gap: 0 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 130ms ease;
}
.hoy-item:hover { background: #f1f4ec; }
.hoy-item .hoy-nombre { font-size: 10.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hoy-item .hoy-sub { grid-column: 1; color: #8a8a70; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hoy-item .hoy-dato { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 9.5px; font-weight: 700; color: #2c6940; white-space: nowrap; }
.hoy-item .hoy-dato.alerta { color: #b94434; }
@media (max-width: 900px) { .hoy-grid { grid-template-columns: 1fr; } }

/* Cartera: riesgo y antigüedad de mora */
.cobro-meta-num.riesgo strong { color: #8d6d29; }
.cobro-meta-num.critica strong { color: #b94434; }
.mora-antiguedad { font-weight: 700; color: #8d6d29; }
.mora-antiguedad.grave { color: #b94434; }

/* Nota discreta en encabezados de panel (reemplaza botones prototipo) */
.header-hint { color: #9a937f; font-size: 9.5px; font-style: italic; align-self: center; }

/* Métricas del tablero de cobros: 4 tarjetas en una fila */
.cobros-page .payment-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1120px) { .cobros-page .payment-summary-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Marca por proyecto (despliegues sin logo propio) ---------- */
.brand-texto {
  display: block;
  padding: 4px 0;
  color: var(--conditioner);
  font-family: "Fraunces", serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.25;
}
.banner.banner-texto {
  display: grid;
  place-items: center;
  min-height: 64px;
  border-radius: 10px;
  color: var(--conditioner);
  background: var(--mustard);
  font-family: "Fraunces", serif;
  font-size: 17px;
  font-weight: 600;
}

/* Logo por proyecto en la barra lateral */
.brand-proyecto { display: block; max-width: 150px; max-height: 46px; object-fit: contain; }

/* Tema por proyecto: superficies con gradiente quemado pasan a variables */
body.tema-proyecto .sidebar {
  background:
    linear-gradient(var(--sidebar-1), var(--sidebar-2)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.05) 12px 13px);
}
body.tema-proyecto .welcome-card {
  background: linear-gradient(110deg, var(--hero-1) 0%, var(--hero-2) 62%, var(--hero-3) 100%);
}

/* La marca del proyecto va sobre tarjeta clara (los logos vienen en fondo blanco) */
.brand-proyecto {
  background: #fdeedd;             /* crema del badge del logo: la tarjeta se funde con él */
  border-radius: 11px;
  padding: 7px 12px;
  max-width: 172px;
  max-height: 56px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.login-logo { max-width: 240px; height: auto; }

/* =====================================================================
   TEMA CLARO por proyecto (Paseo del Bosque): barra lateral blanca con
   acentos vino tinto y dorado del logo; superficies casi blancas.
   ===================================================================== */
body.tema-claro .sidebar {
  background: #ffffff;
  color: #4a3a2c;
  border-right: 1px solid #efe7da;
  box-shadow: 6px 0 24px rgba(122, 48, 34, 0.05);
}
body.tema-claro .nav-heading { color: #a8894a; }
body.tema-claro .nav-link { color: #5b4a3a; }
body.tema-claro .nav-link:hover { color: #7a3022; background: #faf3e9; }
body.tema-claro .nav-link.active {
  color: #7a3022;
  background: #fdeedd;
  box-shadow: inset 3px 0 #7a3022;
}
body.tema-claro .nav-icon { color: #7a3022; }
body.tema-claro .nav-badge { color: #fff; background: #7a3022; }
body.tema-claro .workspace-button,
body.tema-claro .workspace-menu button {
  border: 1px solid #efe4d3;
  color: #4a3a2c;
  background: #faf6ee;
}
body.tema-claro .workspace-button:hover,
body.tema-claro .workspace-menu button:hover { background: #f4ecdf; }
body.tema-claro .workspace-button strong, body.tema-claro .workspace-menu strong { color: #3b2a1e; }
body.tema-claro .workspace-button small, body.tema-claro .workspace-menu small { color: #9a8468; }
body.tema-claro .workspace-icon.admin { color: #fff; background: #7a3022; }
body.tema-claro .switcher-label { color: #a8894a; }
body.tema-claro .environment-badge,
body.tema-claro .profile-button { color: #4a3a2c; border-color: #efe4d3; background: #faf6ee; }
body.tema-claro .environment-badge strong, body.tema-claro .profile-button strong { color: #3b2a1e; }
body.tema-claro .environment-badge small, body.tema-claro .profile-button small { color: #9a8468; }
body.tema-claro .profile-button .more { color: #b3a086; }
body.tema-claro .profile-button .avatar { color: #fff; background: #7a3022; }
body.tema-claro .sidebar-toggle { border-color: #efe4d3; color: #7a3022; background: #faf6ee; }
body.tema-claro .brand-texto { color: #7a3022; }
body.tema-claro .brand-proyecto { background: transparent; box-shadow: none; padding: 2px 0; }

/* Héroe del panel en claro: tarjeta crema con texto tinta */
body.tema-claro .welcome-card {
  color: #3b2a1e;
  background: linear-gradient(110deg, #fdeedd 0%, #fbf4e8 55%, #ffffff 100%);
  border: 1px solid #f3e3cd;
}
body.tema-claro .welcome-card .eyebrow { color: #8a6a2f; }
body.tema-claro .welcome-card p { color: #6b5847; }
body.tema-claro .welcome-card .secondary-button { color: #7a3022; border-color: #e3cfb4; background: #fff; }

/* Barra colapsada: el logo horizontal del proyecto no cabe en el riel */
body.sidebar-collapsed .brand-proyecto { display: none; }
