/* Panel CDF. Identidad del manual de marca (Noche, Acero, Señal, Hielo y Niebla, con Poppins) en formato oscuro y letra compacta. */
:root {
  --noche: #111820;
  --acero: #2B3A4A;
  --senal: #FF5A1F;
  --hielo: #F4F2EE;
  --niebla: #C9CED6;

  /* Superficies, de más profunda a más alta */
  --bg: #111820;
  --inset: #17212B;
  --surface: #1F2A36;
  --surface-2: #26333F;
  --surface-3: #2B3A4A;
  --line: #2F3D4B;
  --line-2: #435161;
  --hover: rgba(255, 255, 255, .04);

  /* Texto */
  --text: #F4F2EE;
  --text-2: #D5DAE0;
  --muted: #A3ADB9;
  --dim: #8793A0;

  /* Acento y estados */
  --accent: #FF5A1F;
  --accent-text: #FF8A57;
  --good: #6FD6A4;
  --bad: #FF9A8F;
  --error: #FF8E84;
  --error-fill: #D64535;
  --error-bg: rgba(255, 110, 96, .15);
  --bar: #6B7F95;

  --r-panel: 14px;
  --r-control: 9px;
  --side: 212px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scrollbar-color: var(--line-2) transparent; }
body {
  margin: 0; font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; line-height: 1.25; font-weight: 700; letter-spacing: -0.2px; }
h2 { font-size: 14px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(255, 90, 31, .38); }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: 10px; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }

/* ---------- Logo ---------- */
.brand { display: block; height: auto; max-width: 100%; }
.brand.small { width: auto; height: 30px; }

/* ---------- Ingreso ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 368px; background: var(--surface); border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.login-brand { padding: 26px 28px 22px; border-bottom: 1px solid var(--line); background: var(--inset); }
.login-brand .brand { width: 188px; }
.login-body { padding: 24px 28px 28px; }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 18px; }
.login-card form .btn { margin-top: 6px; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--bg); color: var(--text); position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; padding: 16px 10px 12px; overflow: hidden; border-right: 1px solid var(--line);
}
.side-logo { display: block; margin: 0 -10px 12px; padding: 0 18px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.side-logo .brand { width: 158px; }
.side nav { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 2px; align-content: start; margin-right: -6px; padding-right: 6px; scrollbar-width: thin; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none;
  color: var(--niebla); text-decoration: none; font-size: 12.5px; font-weight: 600; text-align: left; cursor: pointer;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav-item.active { background: var(--surface-3); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.inside { color: #fff; }
.nav-ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-caret { width: 15px; height: 15px; flex: none; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.nav-group.open > .nav-toggle .nav-caret { transform: rotate(90deg); }
.nav-sub { display: grid; gap: 2px; padding: 2px 0 6px; }
.nav-sub a { display: block; padding: 6px 10px 6px 37px; border-radius: 9px; color: var(--niebla); text-decoration: none; font-size: 12px; }
.nav-sub a:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav-sub a.active { background: var(--surface-3); color: #fff; font-weight: 500; box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { display: none; }
.who { text-decoration: none; min-width: 0; }
.who strong { display: block; font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: 50px; padding: 0 28px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-logo, #menu-btn { display: none; }
.crumb { color: var(--text-2); font-size: 13px; }
.crumb strong { font-weight: 700; color: var(--text); }
.top-user { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.top-user .who { text-align: right; max-width: 220px; }
#view-host { flex: 1; padding: 22px 28px 40px; max-width: 1280px; width: 100%; }
.foot { padding: 0 28px 18px; color: var(--dim); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 + p { margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-block; font-size: 12px; color: var(--muted); text-decoration: none; margin-bottom: 4px; }
.back:hover { text-decoration: underline; color: var(--text); }
.section { margin-top: 22px; }
/* Al saltar a una parte de la pantalla, que no quede tapada por la barra de arriba */
#view section, .pend-row { scroll-margin-top: 62px; }
.lead-section { margin-bottom: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
#view h2 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; }
.panel.flush { padding: 0; overflow: hidden; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ---------- Botones y controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-control);
  border: 1px solid transparent; background: var(--accent); color: var(--noche); font-weight: 600; font-size: 12.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.35;
}
.btn:hover { filter: brightness(1.08); }
.btn.block { width: 100%; padding-block: 9px; }
.btn.dark { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }
.btn.soft { background: rgba(255, 90, 31, .14); color: var(--accent-text); border-color: rgba(255, 90, 31, .42); }
.btn.soft:hover { background: rgba(255, 90, 31, .24); filter: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); font-weight: 500; }
.btn.ghost:hover { border-color: var(--niebla); filter: none; }
.btn.danger { background: var(--error-fill); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--error); border-color: rgba(255, 142, 132, .4); font-weight: 500; }
.btn.danger-ghost:hover { border-color: var(--error); filter: none; }
.btn.small { padding: 4px 10px; font-size: 11.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.icon-btn { background: none; border: 0; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); }
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .08); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.text-link { color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; background: none; border: 0; padding: 0; cursor: pointer; }

label, .field-label { display: block; font-size: 11.5px; font-weight: 500; margin-bottom: 4px; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--r-control); background: var(--inset);
  color: var(--text); min-height: 36px;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
textarea { min-height: 72px; resize: vertical; }
input[type=checkbox] { width: 15px; height: 15px; min-height: 0; padding: 0; margin: 0 6px 0 0; vertical-align: -2px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[readonly] { background: transparent; color: var(--muted); cursor: default; }
input[readonly]:focus { outline-color: var(--line-2); }
input:-webkit-autofill, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text); caret-color: var(--text); box-shadow: 0 0 0 1000px var(--inset) inset; transition: background-color 9999s;
}
.field { margin-bottom: 11px; min-width: 0; }
.field small { display: block; margin-top: 4px; color: var(--dim); font-size: 11px; }
.field.check label { font-weight: 400; color: var(--text); font-size: 12.5px; }
.field-static { padding: 7px 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.form-grid.cols-3x { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--error); font-size: 12px; min-height: 18px; margin: 4px 0; }
.form-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0; margin-top: 12px; background: var(--bg); border-top: 1px solid var(--line); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 150px; padding: 5px 10px; min-height: 32px; font-size: 12.5px; background: var(--surface); }
.toolbar input[type=search] { min-width: 200px; }
.toolbar .spacer, .pend-tools .spacer { flex: 1; }
.check-inline { display: inline-flex; align-items: center; margin: 0; font-size: 12px; color: var(--muted); cursor: pointer; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: transparent; color: var(--text-2); border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--niebla); }
.chip.active { background: var(--surface-3); border-color: var(--accent); color: #fff; font-weight: 500; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.badge.turn { background: var(--accent); color: var(--noche); font-weight: 700; }
.badge.dark { background: var(--hielo); color: var(--noche); }
.badge.alert { background: var(--error-bg); color: var(--error); }
.badge.line { background: transparent; border: 1px solid var(--line-2); color: var(--muted); }
.period { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-control); padding: 1px 4px; }
.period strong { font-weight: 500; min-width: 124px; text-align: center; font-size: 12.5px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---------- Tablas ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid rgba(255, 255, 255, .05); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--hover); }
tr.voided td { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--line-2); }
tr.voided td .badge, tr.voided td button { text-decoration: none; }
td .primary { font-weight: 500; display: block; }
td a.primary { text-decoration: none; }
td a.primary:hover { text-decoration: underline; text-decoration-color: var(--accent); }
td .secondary { font-size: 11.5px; color: var(--muted); display: block; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn + .btn { margin-left: 6px; }
table.plain td { padding: 7px 0; }
table.plain td.num, table.plain td.actions { padding-left: 12px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); background: transparent; border: 1px dashed var(--line-2); border-radius: var(--r-panel); }
.empty p + p, .empty p + .btn, .empty p + a { margin-top: 10px; }
.empty.small { padding: 16px 12px; border: 0; }

/* ---------- Números ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 12px 14px; display: grid; gap: 2px; text-decoration: none; align-content: start; }
a.tile:hover { border-color: var(--accent); }
.tile-label { font-size: 11px; color: var(--muted); }
.tile-value { font-size: 19px; font-weight: 700; line-height: 1.25; letter-spacing: -0.2px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tile-hint { font-size: 11px; color: var(--dim); }
.tile.hero { background: var(--surface-3); border-color: #3E5063; grid-row: span 2; align-content: center; padding: 16px 18px; box-shadow: inset 3px 0 0 var(--accent); }
.tile.hero .tile-label { color: var(--niebla); font-size: 11.5px; }
.tile.hero .tile-value { font-size: 40px; letter-spacing: -1px; line-height: 1.1; }
.tile.hero .tile-hint { color: var(--niebla); }
.tile.alert .tile-value { color: var(--accent-text); }

.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(226px, 1fr)); gap: 10px; }
.acct {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-content: start; padding: 14px 16px 12px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s ease;
}
.acct:hover { border-color: var(--accent); }
.acct.on { border-color: var(--accent); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.acct-name { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.acct-cur { align-self: start; font-size: 9.5px; border: 1px solid var(--line-2); border-radius: 5px; padding: 0 6px; color: var(--muted); }
.acct-value { grid-column: 1 / -1; margin-top: 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.acct-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; color: var(--dim); }
.acct-go { width: 14px; height: 14px; fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acct-lock { grid-column: 1 / -1; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 0 7px; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line-2); font-size: 11.5px; line-height: 1.35; color: var(--text-2); }
.acct-lock svg { width: 14px; height: 14px; fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acct-lock small { grid-column: 2 / -1; font-size: 10.5px; color: var(--dim); }
.acct-lock b { font-size: 13px; font-weight: 600; color: var(--accent-text); font-variant-numeric: tabular-nums; white-space: nowrap; }

.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.barlist li { display: grid; grid-template-columns: minmax(110px, 46%) 1fr auto; align-items: center; gap: 10px; font-size: 12px; }
.bl-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-label a { text-decoration: none; }
.bl-label a:hover { text-decoration: underline; }
.bl-track { height: 10px; display: block; }
.bl-bar { display: block; height: 10px; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 0; }
.barlist li.em .bl-bar { background: var(--accent); }
.barlist li.em .bl-label { font-weight: 700; }
.bl-value { font-variant-numeric: tabular-nums; font-weight: 500; min-width: 26px; text-align: right; }
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: inherit; }
.chart .val { font-size: 12px; font-weight: 700; fill: var(--text); font-family: inherit; }
.chart .col { fill: var(--bar); }
.chart .col.em { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart g:hover .col, .chart g:focus .col { opacity: .8; }
.chart g:focus { outline: none; }
.chart g:focus-visible .hit { stroke: var(--accent); stroke-width: 1.5; }
.chart-table summary { font-size: 11.5px; color: var(--muted); cursor: pointer; margin-top: 6px; }
.chart-table table { margin-top: 6px; }
.chart-table td { padding: 5px 8px; font-size: 12px; }
.tip { position: fixed; z-index: 90; background: var(--hielo); color: var(--noche); font-size: 11.5px; padding: 5px 9px; border-radius: 7px; pointer-events: none; max-width: 280px; }

/* ---------- Tesorería ---------- */
.sums { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.sums strong { margin-left: 4px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.mv-ico { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; }
.mv-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mv-ico.in { background: rgba(111, 214, 164, .14); color: var(--good); }
.mv-ico.out { background: rgba(255, 154, 143, .14); color: var(--bad); }
.mv-ico.swap { background: rgba(201, 206, 214, .12); color: var(--niebla); }
.mv-ico.lock { background: rgba(255, 90, 31, .17); color: var(--accent-text); }

.pend { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.pend-row + .pend-row { border-top: 1px solid var(--line); }
.pend-row > summary {
  display: grid; grid-template-columns: 28px auto minmax(0, 1fr) auto 16px; align-items: center; gap: 12px; padding: 11px 16px;
  cursor: pointer; list-style: none;
}
.pend-row > summary::-webkit-details-marker { display: none; }
.pend-row > summary:hover { background: var(--hover); }
.pend-row[open] > summary { background: var(--surface-2); }
.pend-title { font-weight: 600; }
.pend-meta { color: var(--muted); font-size: 11.5px; }
.pend-amount { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.pend-row.zero .pend-title { font-weight: 500; color: var(--text-2); }
.pend-row.zero .pend-amount { font-weight: 500; color: var(--dim); }
.pend-row.zero .mv-ico { background: rgba(201, 206, 214, .08); color: var(--dim); }
.pend-caret { width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.pend-row[open] > summary .pend-caret { transform: rotate(90deg); }
.pend-body { border-top: 1px solid var(--line); background: var(--inset); padding: 2px 0 4px; }
.pend-body .table-wrap { border: 0; border-radius: 0; background: transparent; }
.pend-body .empty { border: 0; text-align: left; padding: 14px 16px; }
.pend-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 16px 6px; }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; padding: 11px 16px; margin-bottom: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-panel); }
.figures span { display: block; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.figures strong { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.figures .in { color: var(--good); }
.figures .out { color: var(--bad); }
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.ledger ul { list-style: none; margin: 0; padding: 0; }
.ledger-day { padding: 6px 16px; font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-block: 1px solid var(--line); }
.ledger-day:first-child { border-top: 0; }
.mv { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 2px 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.mv:last-child { border-bottom: 0; }
.mv-main { min-width: 0; }
.mv-title { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-detail { display: block; font-size: 11.5px; color: var(--muted); }
.mv-act { display: flex; gap: 12px; align-items: center; }
.mv-link { background: none; border: 0; padding: 0; font-size: 11.5px; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; cursor: pointer; }
.mv-link:hover { color: var(--text); text-decoration-color: var(--accent); }
.mv-link.danger:hover { color: var(--error); text-decoration-color: var(--error); }
.mv-side { text-align: right; min-width: 108px; }
.mv-amount { display: block; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mv-amount.in { color: var(--good); }
.mv-amount.out { color: var(--bad); }
.mv-balance { display: block; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mv.voided .mv-title, .mv.voided .mv-amount { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--line-2); }
.mv.voided .mv-ico { background: rgba(201, 206, 214, .08); color: var(--dim); }
#mov-host.busy { opacity: .55; transition: opacity .15s ease; }

/* ---------- La ruta de cada carpeta ---------- */
.route { display: block; flex: none; }
.route .cv, .lg.locked { fill: #3A4A5B; background: #3A4A5B; }
.route .cv.ok, .lg.ok { fill: #E7EAEE; background: #E7EAEE; }
.route .cv.ok.dim { fill: var(--dim); }
.route .cv.ready, .lg.ready { fill: var(--accent); background: var(--accent); }
.route .cv.rejected, .lg.rejected { fill: #FF6B5E; background: #FF6B5E; }
.route-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 8px; }
.route-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.sale-list { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.sale-row {
  display: grid; grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1.1fr) auto minmax(150px, 1fr); gap: 4px 18px; align-items: center;
  padding: 10px 16px; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .05); border-left: 3px solid transparent;
}
.sale-row:last-child { border-bottom: 0; }
.sale-row:hover { background: var(--hover); }
.sale-row.mine { border-left-color: var(--accent); }
.sale-row .who-col strong { display: block; font-weight: 500; }
.sale-row .sub { font-size: 11.5px; color: var(--muted); display: block; }
.sale-row .state-col { text-align: right; min-width: 0; }

.sale-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 20px; }
.facts div span { display: block; font-size: 11px; color: var(--muted); }
.facts div strong { font-weight: 500; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 20px 0 16px; overflow-x: auto; }
.tabs a { padding: 8px 13px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; font-size: 12.5px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.fase { margin-bottom: 16px; }
.fase > h3 { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 0 0 6px 2px; }
.steps { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0 12px; padding: 11px 16px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.step:last-child { border-bottom: 0; }
.step .mark { width: 20px; height: 22px; margin-top: 1px; }
.step .mark polygon { fill: #3A4A5B; }
.step.ok .mark polygon { fill: #E7EAEE; }
.step.ready .mark polygon { fill: var(--accent); }
.step.rejected .mark polygon { fill: #FF6B5E; }
.step .title { font-weight: 500; }
.step.locked .title { color: var(--dim); font-weight: 400; }
.step .info { font-size: 11.5px; color: var(--muted); }
.step .info.warn { color: var(--error); }
.step .act { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.step .who-tag { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 8px; margin-left: 6px; font-weight: 400; white-space: nowrap; }
.step .hist { margin: 6px 0 0; padding: 0; list-style: none; font-size: 11.5px; color: var(--muted); }

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.doc-list li:last-child { border-bottom: 0; }
.doc-list .primary { display: block; font-weight: 500; }
.doc-list .secondary { display: block; font-size: 11.5px; color: var(--muted); }
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-control); padding: 10px 14px; margin-bottom: 12px; }
.notice.error { border-left-color: var(--error); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 0; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; padding-left: 16px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { padding-top: 7px; margin-top: 3px; border-top: 1px solid var(--line); font-weight: 700; color: var(--text); }
.diff del { color: var(--dim); }
.diff ins { text-decoration: none; font-weight: 500; background: rgba(255, 90, 31, .24); padding: 0 4px; border-radius: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.timeline li:last-child { border-bottom: 0; }
pre.json { background: var(--inset); border-radius: 8px; padding: 10px; font-size: 11.5px; overflow-x: auto; margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Ventanas y avisos ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(6, 10, 14, .72); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; width: 100%; max-width: 500px; max-height: calc(100dvh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 740px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 4px; }
.modal-head h2 { font-size: 15px; }
.modal-body { padding: 8px 18px 18px; overflow-y: auto; }
.modal-text { color: var(--text-2); margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140px); background: var(--hielo); color: var(--noche); font-weight: 500;
  padding: 9px 16px; border-radius: 10px; font-size: 12.5px; transition: transform .22s ease, visibility 0s .22s; z-index: 100; max-width: calc(100% - 32px); text-align: center;
  visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .22s ease; }
#toast.error { background: var(--error-fill); color: #fff; }
.print-area { display: none; }

/* ---------- Celular ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .topbar { justify-content: space-between; padding: 8px 14px; min-height: 50px; background: var(--bg); z-index: 40; }
  .top-logo, #menu-btn { display: inline-flex; }
  .crumb, .top-user { display: none; }
  .side { position: fixed; inset: 50px 0 0 0; height: auto; z-index: 39; transform: translateX(-102%); transition: transform .2s ease; padding-top: 12px; border-right: 0; }
  .side-logo { display: none; }
  .side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); margin-top: 12px; padding: 12px 6px 0; }
  .app.menu-open .side { transform: none; }
  .nav-item { padding: 12px; font-size: 14.5px; }
  .nav-sub a { padding: 10px 12px 10px 42px; font-size: 14px; }
  #view-host { padding: 16px 14px 32px; }
  .foot { padding: 0 14px 16px; }
  input, select, textarea { font-size: 16px; }
  .toolbar input[type=search], .toolbar select { font-size: 16px; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid.cols-3x { grid-template-columns: minmax(0, 1fr); }
  .sale-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .sale-row .state-col { text-align: left; }
  .sale-top { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile.hero { grid-row: auto; grid-column: 1 / -1; }
  .tile.hero .tile-value { font-size: 34px; }
  .tile-value { font-size: 17px; }
  .acct-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .acct { padding: 12px 12px 10px; border-radius: 14px; }
  .acct-value { font-size: 17px; }
  .toolbar input[type=search] { min-width: 0; flex: 1 1 160px; }
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); margin-bottom: 8px; padding: 8px 0; }
  .table-wrap td { border: 0; padding: 4px 14px; text-align: left; display: grid; grid-template-columns: 38% minmax(0, 1fr); gap: 8px; }
  .table-wrap td::before { content: attr(data-label); font-size: 11px; color: var(--muted); }
  .table-wrap td > .cell { min-width: 0; }
  .table-wrap td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  .table-wrap td[data-label=""]::before { display: none; }
  .table-wrap td.actions { text-align: left; }
  .pend-row > summary { grid-template-columns: 28px minmax(0, 1fr) auto 16px; gap: 0 10px; padding: 10px 12px; }
  .pend-row > summary .mv-ico, .pend-row > summary .pend-amount, .pend-row > summary .pend-caret { grid-row: 1 / span 2; }
  .pend-row > summary .pend-title { grid-column: 2; grid-row: 1; }
  .pend-row > summary .pend-meta { grid-column: 2; grid-row: 2; }
  .pend-row > summary .pend-amount { grid-column: 3; font-size: 14px; }
  .pend-row > summary .pend-caret { grid-column: 4; }
  .pend-body { padding: 8px 8px 2px; }
  .pend-body .table-wrap tr { background: var(--surface); }
  .pend-tools { padding: 4px 4px 10px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mv { grid-template-columns: 28px minmax(0, 1fr) auto; padding: 9px 12px; }
  .mv-title { white-space: normal; }
  .mv-side { grid-column: 3; grid-row: 1; min-width: 0; }
  .mv-act { grid-column: 2 / -1; grid-row: 2; }
  .mv-act:empty { display: none; }
  .ledger-day { padding: 6px 12px; }
  .modal-wrap { padding: 0; place-items: end center; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; border-width: 1px 0 0; max-height: 92dvh; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body > *:not(.print-area) { display: none !important; }
  html, body { background: #fff; }
  .print-area { display: block; padding: 0; font-size: 12px; color: #000; }
  .print-area h1 { font-size: 18px; margin-bottom: 4px; }
  .print-area table { margin-top: 10px; }
  .print-area th, .print-area td { padding: 5px 8px; border-bottom: 1px solid #ccc; color: #000; }
}
