/* ============================================================================
   FullPy Contable — sistema de diseño
   PHP plano, sin build step. Servido como archivo estático (cacheable).
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  color-scheme: light;

  /* Superficies */
  --bg:            #f4f7f8;
  --surface:       #ffffff;
  --surface-2:     #f8fafb;
  --surface-3:     #eef3f5;
  --overlay:       rgba(10, 24, 30, .45);

  /* Bordes */
  --border:        #e2e8ec;
  --border-strong: #cbd6dd;

  /* Texto */
  --text:          #0e1a20;
  --text-2:        #4d5f6b;
  --text-3:        #7a8b96;
  --text-inv:      #ffffff;

  /* Marca */
  --brand:         #0f6d5f;
  --brand-hover:   #0b564b;
  --brand-active:  #084339;
  --brand-soft:    #e4f2ee;
  --brand-softer:  #f1f8f6;
  --brand-ink:     #0b564b;
  --brand-ring:    rgba(15, 109, 95, .28);

  /* Semánticos */
  --ok:            #0f7a45;
  --ok-soft:       #e4f5eb;
  --warn:          #96600a;
  --warn-soft:     #fbf1de;
  --bad:           #b42318;
  --bad-soft:      #fdeceb;
  --info:          #16628f;
  --info-soft:     #e8f2f8;

  /* Datos (gráficos y series) */
  --data-1: #0f6d5f;
  --data-2: #16628f;
  --data-3: #96600a;
  --data-4: #7a3fa0;

  /* Radios */
  --r-xs: 6px;
  --r-sm: 9px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* Sombras */
  --sh-xs: 0 1px 2px rgba(13, 33, 43, .06);
  --sh-sm: 0 1px 2px rgba(13, 33, 43, .05), 0 2px 6px rgba(13, 33, 43, .04);
  --sh:    0 1px 2px rgba(13, 33, 43, .05), 0 6px 18px rgba(13, 33, 43, .06);
  --sh-lg: 0 2px 4px rgba(13, 33, 43, .05), 0 18px 40px rgba(13, 33, 43, .12);
  --sh-pop:0 10px 30px rgba(13, 33, 43, .16), 0 2px 6px rgba(13, 33, 43, .08);

  /* Tipografía */
  --font: "Inter var", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-11: .6875rem;
  --fs-12: .75rem;
  --fs-13: .8125rem;
  --fs-14: .875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-22: 1.375rem;
  --fs-28: 1.75rem;
  --fs-34: 2.125rem;

  /* Layout */
  --side-w: 256px;
  --side-w-collapsed: 68px;
  --top-h: 60px;

  --t-fast: 120ms cubic-bezier(.4, 0, .2, 1);
  --t:      180ms cubic-bezier(.4, 0, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #0a1015;
  --surface:       #111a21;
  --surface-2:     #16212a;
  --surface-3:     #1d2b35;
  --overlay:       rgba(0, 0, 0, .6);

  --border:        #223039;
  --border-strong: #33454f;

  --text:          #e9eff3;
  --text-2:        #a2b3be;
  --text-3:        #768996;
  --text-inv:      #06110e;

  --brand:         #2fbfa2;
  --brand-hover:   #46d3b6;
  --brand-active:  #58ddc2;
  --brand-soft:    #0f2f2a;
  --brand-softer:  #0d2621;
  --brand-ink:     #7ce0cb;
  --brand-ring:    rgba(47, 191, 162, .35);

  --ok:            #43c47c;
  --ok-soft:       #102a1c;
  --warn:          #e0a53c;
  --warn-soft:     #2d2210;
  --bad:           #f2776a;
  --bad-soft:      #331615;
  --info:          #62b3e8;
  --info-soft:     #102634;

  --data-1: #2fbfa2;
  --data-2: #62b3e8;
  --data-3: #e0a53c;
  --data-4: #b98ee0;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 6px rgba(0, 0, 0, .3);
  --sh:    0 1px 2px rgba(0, 0, 0, .45), 0 6px 18px rgba(0, 0, 0, .35);
  --sh-lg: 0 2px 4px rgba(0, 0, 0, .5), 0 18px 40px rgba(0, 0, 0, .5);
  --sh-pop:0 10px 30px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .4);
}

/* ---------- 2. Reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: var(--fs-28); letter-spacing: -.025em; }
h2 { font-size: var(--fs-22); }
h3 { font-size: var(--fs-16); }
p  { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { vertical-align: middle; }
svg { flex: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--brand-ring); }

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

/* Scrollbars discretos */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ---------- 3. Utilidades ------------------------------------------------ */
.muted     { color: var(--text-2); }
.dim       { color: var(--text-3); }
.good      { color: var(--ok); }
.warn      { color: var(--warn); }
.bad       { color: var(--bad); }
.info      { color: var(--info); }
.code      { font-family: var(--mono); font-size: .95em; letter-spacing: -.01em; }
.num       { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.nowrap    { white-space: nowrap; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right     { text-align: right; }
.center    { text-align: center; }
.strong    { font-weight: 650; }
.t-xs      { font-size: var(--fs-11); }
.t-sm      { font-size: var(--fs-12); }
.mt-0 { margin-top: 0 }    .mt-1 { margin-top: 8px }  .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.stack     { display: flex; flex-direction: column; gap: 16px; }
.row       { display: flex; align-items: center; gap: 10px; }
.row-wrap  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread    { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.split     { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grow      { flex: 1 1 auto; min-width: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.grid  { display: grid; gap: 16px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-aside { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-form  { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.span2 { grid-column: span 2; }

/* ---------- 4. Shell ----------------------------------------------------- */
.app { min-height: 100vh; }

.side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width var(--t), transform var(--t);
}
:root[data-theme="dark"] .side { background: #0d151b; }

.side-head {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.brand-mark {
  width: 32px; height: 32px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), #14907d);
  color: #fff;
  box-shadow: 0 2px 6px var(--brand-ring);
}
:root[data-theme="dark"] .brand-mark { background: linear-gradient(140deg, #14907d, #0f6d5f); color: #d9fff6; }
.brand-text { min-width: 0; line-height: 1.15; }
.brand-text b { display: block; font-size: var(--fs-14); font-weight: 700; letter-spacing: -.02em; }
.brand-text span { display: block; font-size: var(--fs-11); color: var(--text-3); }

.side-scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 12px 10px 16px; }

.nav-label {
  font-size: var(--fs-11); font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: 0 10px; margin: 18px 0 6px;
}
.side-scroll > .nav-label:first-child { margin-top: 2px; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item svg { width: 17px; height: 17px; color: var(--text-3); transition: color var(--t-fast); }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item:hover svg { color: var(--text-2); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.nav-item.active svg { color: var(--brand); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item .badge { margin-left: auto; }

.side-foot { flex: none; border-top: 1px solid var(--border); padding: 10px; }

.main {
  margin-left: var(--side-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--t);
}

.top {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .top { background: var(--surface); } }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.top-search { position: relative; flex: 1 1 300px; max-width: 420px; }
.top-search .lens { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.top-search input {
  width: 100%; height: 36px;
  padding: 0 46px 0 34px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.top-search input::placeholder { color: var(--text-3); }
.top-search input:focus {
  outline: none; background: var(--surface);
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
.top-search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font); font-size: var(--fs-11); font-weight: 600;
  color: var(--text-3); background: var(--surface-3);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: var(--r-xs); padding: 1px 5px;
  pointer-events: none;
}

.content { flex: 1 1 auto; width: 100%; max-width: 1520px; margin: 0 auto; padding: 24px 24px 56px; }

/* Selector de empresa y periodo en el topbar */
.picker { position: relative; display: flex; align-items: center; }
.picker select {
  appearance: none; -webkit-appearance: none;
  height: 36px; max-width: 300px;
  padding: 0 30px 0 34px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 550;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.picker select:hover { border-color: var(--border-strong); }
.picker select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.picker .lead { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.picker .caret { position: absolute; right: 10px; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }

/* Menu de usuario */
.menu { position: relative; }
.menu-trigger {
  display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 8px 0 4px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--text); font: inherit; cursor: pointer;
  transition: background var(--t-fast);
}
.menu-trigger:hover { background: var(--surface-3); }
.menu-trigger .caret { width: 14px; height: 14px; color: var(--text-3); }
.avatar {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--brand-soft); color: var(--brand-ink);
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .02em;
}
.menu-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  min-width: 236px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--sh-pop);
}
.menu-head { padding: 9px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.menu-head b { display: block; font-size: var(--fs-13); }
.menu-head span { display: block; font-size: var(--fs-12); color: var(--text-3); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--text-2);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item svg { width: 16px; height: 16px; color: var(--text-3); }
.menu-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger svg { color: var(--bad); }
.menu-item.danger:hover { background: var(--bad-soft); }

/* Colapso del sidebar en escritorio */
:root[data-side="collapsed"] .side { width: var(--side-w-collapsed); }
:root[data-side="collapsed"] .main { margin-left: var(--side-w-collapsed); }
:root[data-side="collapsed"] .side .brand-text,
:root[data-side="collapsed"] .side .nav-label,
:root[data-side="collapsed"] .side .nav-item span,
:root[data-side="collapsed"] .side .nav-item .badge { display: none; }
:root[data-side="collapsed"] .side .nav-item { justify-content: center; padding-inline: 0; }
:root[data-side="collapsed"] .side-head { justify-content: center; padding-inline: 0; }
:root[data-side="collapsed"] .side .nav-item.active::before { left: -6px; }

.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: var(--overlay);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t);
}

/* ---------- 5. Encabezado de pagina -------------------------------------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { margin-bottom: 5px; }
.page-head .sub { color: var(--text-2); max-width: 68ch; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-3); margin-bottom: 9px; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text-2); }
.crumbs svg { width: 12px; height: 12px; opacity: .7; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 6. Tarjetas -------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-xs);
}
.card > .card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: var(--fs-14); font-weight: 650; }
.card-head .sub { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r) var(--r);
}
a.card { display: block; color: inherit; transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
a.card:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--sh); transform: translateY(-1px); }

/* Tarjeta de modulo del indice */
.mod {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px;
}
.mod-icon {
  width: 36px; height: 36px; margin-bottom: 6px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
}
.mod-icon svg { width: 19px; height: 19px; }
.mod b { font-size: var(--fs-14); font-weight: 650; }
.mod span { font-size: var(--fs-12); color: var(--text-2); }
.mod .go { margin-top: 10px; font-size: var(--fs-12); font-weight: 650; color: var(--brand); display: flex; align-items: center; gap: 5px; }
.mod .go svg { width: 13px; height: 13px; transition: transform var(--t-fast); }
a.card:hover .mod .go svg { transform: translateX(3px); }

/* ---------- 7. Metricas -------------------------------------------------- */
.metric { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.metric-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.metric-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.metric-ico svg { width: 15px; height: 15px; }
.metric-ico.brand { background: var(--brand-soft); color: var(--brand); }
.metric-ico.ok    { background: var(--ok-soft);    color: var(--ok); }
.metric-ico.warn  { background: var(--warn-soft);  color: var(--warn); }
.metric-ico.bad   { background: var(--bad-soft);   color: var(--bad); }
.metric-ico.info  { background: var(--info-soft);  color: var(--info); }
.metric .label { font-size: var(--fs-12); font-weight: 600; color: var(--text-2); }
.metric .value {
  font-size: var(--fs-28); font-weight: 700; letter-spacing: -.03em; line-height: 1.15;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  overflow-wrap: anywhere;
}
.metric .value.sm { font-size: var(--fs-22); }
.metric .hint { font-size: var(--fs-12); color: var(--text-3); margin-top: 5px; }

/* ---------- 8. Botones --------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--brand-hover); color: #fff; text-decoration: none; }
.btn:active { background: var(--brand-active); }
:root[data-theme="dark"] .btn { color: #05201b; }
:root[data-theme="dark"] .btn:hover { color: #05201b; }

.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { background: var(--bad); filter: brightness(1.08); color: #fff; }
.btn.danger-soft { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.btn.danger-soft:hover { background: var(--bad-soft); filter: brightness(.96); color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--fs-12); border-radius: var(--r-xs); }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }
.btn.lg { height: 44px; padding: 0 18px; font-size: var(--fs-14); }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn.is-busy::after {
  content: ""; width: 13px; height: 13px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* ---------- 9. Formularios ----------------------------------------------- */
.field { margin-bottom: 15px; }
.field > label, .field-label {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
}
.field .req { color: var(--bad); margin-left: 2px; }
.field .help { margin-top: 5px; font-size: var(--fs-11); color: var(--text-3); }

.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select, .field textarea {
  width: 100%; min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--text-3); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--surface-3); color: var(--text-3); cursor: not-allowed;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.field select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237a8b96' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}
:root[data-theme="dark"] .field select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23768996' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}
.field input[type="date"] { min-height: 38px; }
.field input.num, .field input[type="number"] { font-variant-numeric: tabular-nums; text-align: right; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input[type="number"] { -moz-appearance: textfield; }

/* Grupo con prefijo (moneda) */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .affix {
  position: absolute; left: 11px;
  font-size: var(--fs-12); font-weight: 650; color: var(--text-3); pointer-events: none;
}
.input-affix input { padding-left: 30px !important; }

/* Fieldset como seccion de formulario */
.form-section { border: 0; margin: 0 0 4px; padding: 0; }
.form-section > legend {
  padding: 0; margin-bottom: 12px;
  font-size: var(--fs-11); font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3);
}
.form-section + .form-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Checkbox y switch */
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: var(--fs-13); }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); flex: none; cursor: pointer; }

/* Zona de archivo */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 26px 18px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  background: var(--surface-2); color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-softer); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone svg { width: 22px; height: 22px; color: var(--text-3); }
.dropzone b { font-size: var(--fs-13); color: var(--text); }
.dropzone span { font-size: var(--fs-12); color: var(--text-3); }
.dropzone.has-file { border-style: solid; border-color: var(--brand); background: var(--brand-softer); }
.dropzone.has-file svg { color: var(--brand); }

/* Fuerza de contrasena */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px !important; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: var(--r-xs); background: transparent;
  color: var(--text-3); cursor: pointer;
}
.pw-toggle:hover { background: var(--surface-3); color: var(--text-2); }
.pw-toggle svg { width: 17px; height: 17px; }
.pw-meter { display: flex; gap: 4px; margin-top: 8px; }
.pw-meter i { height: 4px; flex: 1; border-radius: 99px; background: var(--surface-3); transition: background var(--t-fast); }
.pw-meter[data-level="1"] i:nth-child(-n+1) { background: var(--bad); }
.pw-meter[data-level="2"] i:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-level="3"] i:nth-child(-n+3) { background: var(--info); }
.pw-meter[data-level="4"] i { background: var(--ok); }

/* ---------- 10. Tablas --------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  padding: 9px 14px;
  font-size: var(--fs-11); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; white-space: nowrap; }
.table .cell-main { font-weight: 600; }
.table .cell-sub { display: block; font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; }
.table.compact td { padding: 8px 14px; }
.table td .actions { justify-content: flex-end; }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border); border-bottom: 0; }

/* ---------- 11. Pills, badges, chips ------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: var(--fs-11); font-weight: 650; line-height: 1.5;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.no-dot::before { display: none; }
.pill.good    { background: var(--ok-soft);    color: var(--ok); }
.pill.warn    { background: var(--warn-soft);  color: var(--warn); }
.pill.bad     { background: var(--bad-soft);   color: var(--bad); }
.pill.info    { background: var(--info-soft);  color: var(--info); }
.pill.brand   { background: var(--brand-soft); color: var(--brand-ink); }
.pill.neutral { background: var(--surface-3);  color: var(--text-2); }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-11); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: var(--r-xs);
  background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-12); font-weight: 600;
}

/* ---------- 12. Progreso y medidores ------------------------------------- */
.progress { height: 6px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width var(--t); }
.progress.ok > i   { background: var(--ok); }
.progress.warn > i { background: var(--warn); }
.progress.bad > i  { background: var(--bad); }

.meter-row { display: flex; align-items: center; gap: 12px; }
.meter-row .label { flex: 1 1 auto; min-width: 0; font-size: var(--fs-13); }
.meter-row .val { font-size: var(--fs-12); font-weight: 650; font-variant-numeric: tabular-nums; }

/* Barra apilada para el semaforo */
.stackbar { display: flex; height: 8px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-3); }
.stackbar > i { display: block; height: 100%; }
.stackbar > i.ok   { background: var(--ok); }
.stackbar > i.warn { background: var(--warn); }
.stackbar > i.bad  { background: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend > div { display: flex; align-items: center; gap: 7px; font-size: var(--fs-12); color: var(--text-2); }
.legend i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legend b { font-variant-numeric: tabular-nums; color: var(--text); }

/* ---------- 13. Estados vacios ------------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px; text-align: center;
}
.empty-ico {
  width: 42px; height: 42px; margin-bottom: 4px;
  display: grid; place-items: center;
  border-radius: 12px; background: var(--surface-3); color: var(--text-3);
}
.empty-ico svg { width: 21px; height: 21px; }
.empty b { font-size: var(--fs-14); font-weight: 650; }
.empty span { font-size: var(--fs-13); color: var(--text-3); max-width: 46ch; }
.empty .actions { margin-top: 10px; }

/* ---------- 14. Avisos --------------------------------------------------- */
.note {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-13);
}
.note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.note b { display: block; margin-bottom: 2px; }
.note.info { border-left-color: var(--info); background: var(--info-soft); color: var(--info); }
.note.info b, .note.info { color: var(--info); }
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.note.bad  { border-left-color: var(--bad);  background: var(--bad-soft);  color: var(--bad); }
.note.good { border-left-color: var(--ok);   background: var(--ok-soft);   color: var(--ok); }
.note .note-body { color: var(--text); }
.note.info .note-body, .note.warn .note-body, .note.bad .note-body, .note.good .note-body { color: inherit; }

/* ---------- 15. Toasts (flashes) ----------------------------------------- */
.toasts {
  position: fixed; z-index: 90;
  top: 14px; right: 14px;
  display: flex; flex-direction: column; gap: 9px;
  width: min(390px, calc(100vw - 28px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 13px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--sh-pop);
  font-size: var(--fs-13);
  pointer-events: auto;
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1.2);
}
.toast .ico { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.toast .msg { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast .close {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-xs); background: transparent;
  color: var(--text-3); cursor: pointer;
}
.toast .close:hover { background: var(--surface-3); color: var(--text); }
.toast .close svg { width: 13px; height: 13px; }
.toast.ok   { border-left: 3px solid var(--ok); }
.toast.ok   .ico { color: var(--ok); }
.toast.warn { border-left: 3px solid var(--warn); }
.toast.warn .ico { color: var(--warn); }
.toast.err  { border-left: 3px solid var(--bad); }
.toast.err  .ico { color: var(--bad); }
.toast.is-out { animation: toast-out .2s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(14px) scale(.98); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(14px) scale(.98); } }

/* ---------- 16. Login ---------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }

.auth-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 48px;
  background: #08322c;
  color: #dff3ee;
  isolation: isolate;
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 90% at 12% 8%,  #17806e 0%, transparent 58%),
    radial-gradient(95% 80% at 92% 96%, #0b5f7a 0%, transparent 60%),
    linear-gradient(155deg, #0a3b34 0%, #062a26 100%);
}
.auth-brand::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(90% 75% at 25% 25%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(90% 75% at 25% 25%, #000 20%, transparent 78%);
}
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo .brand-mark { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.14); backdrop-filter: blur(6px); box-shadow: none; }
.auth-logo b { font-size: var(--fs-18); font-weight: 700; letter-spacing: -.02em; color: #fff; }
.auth-logo span { display: block; font-size: var(--fs-12); color: #92c6bb; font-weight: 500; }

.auth-pitch { max-width: 30ch; margin: 40px 0; }
.auth-pitch h2 { font-size: clamp(1.7rem, 2.6vw, 2.35rem); line-height: 1.15; letter-spacing: -.035em; color: #fff; }
.auth-pitch p { margin-top: 14px; color: #a9d3ca; font-size: var(--fs-14); line-height: 1.6; max-width: 42ch; }

.auth-list { display: flex; flex-direction: column; gap: 11px; }
.auth-list > div { display: flex; align-items: center; gap: 11px; font-size: var(--fs-13); color: #c3e2da; }
.auth-list svg { width: 17px; height: 17px; color: #4fd0b4; flex: none; }
.auth-foot { font-size: var(--fs-12); color: #7fb3a8; display: flex; gap: 16px; flex-wrap: wrap; }
.auth-foot a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.auth-foot a:hover, .auth-foot a:focus-visible { color: #fff; }

.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 28px;
  background: var(--bg);
}
.auth-card { width: min(400px, 100%); }
.auth-card > header { margin-bottom: 24px; }
.auth-card h1 { font-size: var(--fs-22); margin-bottom: 5px; }
.auth-card header p { color: var(--text-2); font-size: var(--fs-13); }
.auth-mobile-logo { display: none; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-hint {
  margin-top: 22px; padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--fs-12); color: var(--text-2);
}
.auth-hint b { color: var(--text); }
.auth-hint code { font-family: var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.auth-legal { margin-top: 20px; text-align: center; font-size: var(--fs-11); color: var(--text-3); }
.caps-warn { display: none; margin-top: 7px; font-size: var(--fs-11); color: var(--warn); align-items: center; gap: 5px; }
.caps-warn.on { display: flex; }
.caps-warn svg { width: 13px; height: 13px; }

/* ---------- 17. Utilidades finales --------------------------------------- */
.divider-text {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; font-size: var(--fs-11); color: var(--text-3);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 650;
}
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: var(--fs-13); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 9px 13px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--text-2);
  font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
  text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- 18. Responsive ----------------------------------------------- */
@media (max-width: 1280px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .grid-aside { grid-template-columns: minmax(0, 1fr); }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-mobile-logo { display: flex; }
  .auth-panel { padding: 32px 20px; }
}

@media (max-width: 860px) {
  :root { --top-h: 56px; }

  /* Sidebar como panel deslizante */
  .side { transform: translateX(-100%); box-shadow: var(--sh-lg); }
  :root[data-side="open"] .side { transform: translateX(0); }
  :root[data-side="open"] .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0 !important; }
  :root[data-side="collapsed"] .side { width: var(--side-w); }
  :root[data-side="collapsed"] .side .brand-text,
  :root[data-side="collapsed"] .side .nav-label,
  :root[data-side="collapsed"] .side .nav-item span { display: revert; }
  :root[data-side="collapsed"] .side .nav-item { justify-content: flex-start; padding-inline: 10px; }
  :root[data-side="collapsed"] .side-head { justify-content: flex-start; padding-inline: 14px; }

  .content { padding: 18px 14px 44px; }
  .top { padding: 0 12px; gap: 8px; }
  .top-search { flex: 1 1 auto; max-width: none; }
  .top-search kbd { display: none; }
  .grid2, .grid3, .grid4, .grid-form { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: span 1; }
  h1 { font-size: var(--fs-22); }
  .page-head { margin-bottom: 18px; }

  /* Tablas: mostrar que hay scroll horizontal */
  .table-wrap { margin-inline: -18px; padding-inline: 18px; }
  .card-body.tight .table-wrap { margin-inline: 0; padding-inline: 0; }
  .table th, .table td { padding-inline: 12px; }

  .toasts { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; }
}

@media (max-width: 560px) {
  .hide-xs { display: none !important; }
  .metric .value { font-size: var(--fs-22); }
  .btn { padding: 0 12px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
}

/* Sidebar oculto por defecto en movil: no animar en la primera pintura */
:root[data-boot="1"] .side, :root[data-boot="1"] .main, :root[data-boot="1"] .scrim { transition: none !important; }

/* ---------- 19. Impresion ------------------------------------------------ */
@media print {
  :root { --bg: #fff; --surface: #fff; --border: #c8d0d6; --text: #000; --text-2: #333; --text-3: #555; }
  .side, .top, .scrim, .toasts, .actions, .btn, .icon-btn, .menu, .no-print, .top-search, .dropzone { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { max-width: none; padding: 0; }
  .card { border: 1px solid #c8d0d6; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .card + .card, .grid { margin-top: 10px; }
  .grid { display: block; }
  .grid > * + * { margin-top: 10px; }
  .table th { background: #f0f2f4 !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table { font-size: 10pt; }
  .table thead { display: table-header-group; }
  .table tr { break-inside: avoid; page-break-inside: avoid; }
  .pill { border: 1px solid #999; background: none !important; color: #000 !important; }
  .pill::before { display: none; }
  a[href]::after { content: ""; }
  .print-head { display: block !important; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid #000; }
  h1 { font-size: 16pt; }
  @page { margin: 14mm; }
}
.print-head { display: none; }

/* ---------- 20. Visibilidad por tema y por tamaño ------------------------ */
.only-dark { display: none; }
.only-light { display: inline-flex; }
:root[data-theme="dark"] .only-dark { display: inline-flex; }
:root[data-theme="dark"] .only-light { display: none; }
.icon-btn .only-light svg, .icon-btn .only-dark svg { width: 18px; height: 18px; }

.hide-desktop { display: none; }
@media (max-width: 860px) {
  .hide-desktop { display: grid; }
}

/* Tarjeta con relleno directo (sin card-head/card-body) */
.card.pad { padding: 18px; }
.card.pad > h3 { margin-bottom: 4px; }

/* Barra de herramientas dentro de una tarjeta */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r) var(--r) 0 0;
}
.toolbar .search { position: relative; flex: 1 1 220px; max-width: 320px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.toolbar .search input {
  width: 100%; height: 34px; padding: 0 11px 0 32px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
.toolbar .search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.card-head + .toolbar { border-radius: 0; }

/* Encabezado de sección dentro del contenido */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 26px 0 12px;
}
.section-head h2 { font-size: var(--fs-16); font-weight: 650; }
.section-head .sub { font-size: var(--fs-12); color: var(--text-3); }

/* Lista de definiciones apilada (resumen de liquidación) */
.summary-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: 0; }
.summary-row .k { color: var(--text-2); }
.summary-row .v { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary-row.total { border-top: 2px solid var(--border-strong); margin-top: 4px; padding-top: 14px; }
.summary-row.total .k { color: var(--text); font-weight: 650; }
.summary-row.total .v { font-size: var(--fs-18); }

/* Timeline simple para auditoría */
.trail { list-style: none; margin: 0; padding: 0; }
.trail li { position: relative; padding: 0 0 18px 26px; }
.trail li::before {
  content: ""; position: absolute; left: 4px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand);
}
.trail li::after {
  content: ""; position: absolute; left: 8px; top: 16px; bottom: 0;
  width: 1px; background: var(--border);
}
.trail li:last-child { padding-bottom: 0; }
.trail li:last-child::after { display: none; }

/* Ayuda visual de scroll horizontal en tablas anchas */
.table-wrap { position: relative; }
.scroll-hint { display: none; font-size: var(--fs-11); color: var(--text-3); padding: 8px 18px 0; }
@media (max-width: 860px) { .scroll-hint { display: block; } }

/* Estado deshabilitado de una vista completa */
.locked { opacity: .55; pointer-events: none; }
