/* =====================================================================
   Control Presupuestal · CAPEX & OPEX — Sistema visual
   Montserrat · Azul profundo #15212F · Azul corporativo #2E3A47
   Azul grisáceo #8296A9 · Naranja #D98918 · Blanco
   ===================================================================== */

@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 300; font-display: swap; src: url('../fonts/montserrat-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/montserrat-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/montserrat-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/montserrat-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/montserrat-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/montserrat-latin-800-normal.woff2') format('woff2'); }

:root {
  --navy-900: #15212F;
  --navy-800: #1C2A3A;
  --navy-700: #2E3A47;
  --navy-600: #3F4D5C;
  --steel-700: #5F7488;
  --steel: #8296A9;
  --steel-300: #B4C1CE;
  --steel-200: #D3DCE5;
  --steel-100: #E9EEF3;
  --steel-50: #F5F7FA;
  --orange: #D98918;
  --orange-600: #B8720F;
  --orange-100: #FBEFD9;
  --orange-50: #FDF7EC;
  --ok: #1F8A5B;
  --ok-600: #187249;
  --ok-100: #D9F1E4;
  --ok-50: #EEF9F3;
  --danger: #C8353A;
  --danger-600: #A82B2F;
  --danger-100: #F8DCDD;
  --danger-50: #FCEFEF;
  --white: #FFFFFF;
  --text: #15212F;
  --text-2: #3F4D5C;
  --text-3: #6B7D8F;
  --line: #DDE4EB;
  --line-2: #EDF1F5;
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-xs: 0 1px 2px rgba(21, 33, 47, .05);
  --shadow-sm: 0 1px 2px rgba(21, 33, 47, .06), 0 2px 8px -2px rgba(21, 33, 47, .06);
  --shadow: 0 10px 30px -12px rgba(21, 33, 47, .18);
  --shadow-lg: 0 24px 60px -20px rgba(21, 33, 47, .30);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-weight: 400; font-size: 14.5px; line-height: 1.55;
  color: var(--text); background: var(--steel-50); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; color: var(--navy-700); }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; text-transform: uppercase; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 10px; }
a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--orange-600); }
small { font-size: 12px; }
strong, b { font-weight: 700; }
img, svg { display: inline-block; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--orange-100); }
:focus-visible { outline: 3px solid rgba(217, 137, 24, .45); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Iconos ---------- */
.ico { width: 18px; height: 18px; flex: 0 0 auto; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 24px; height: 24px; }
.ico-xl { width: 34px; height: 34px; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 12px; color: var(--white); text-decoration: none; }
.brand:hover { color: var(--white); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; background: var(--white); position: relative; overflow: hidden; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(21,33,47,.08);
}
.brand-mark::before { content: ''; position: absolute; left: 8px; right: 8px; bottom: 8px; height: 13px; background: var(--navy-900); border-radius: 0 0 12px 12px; }
.brand-mark::after { content: ''; position: absolute; left: 8px; top: 7px; width: 24px; height: 13px; background: var(--orange); border-radius: 12px 12px 0 0; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 10px; }
.brand-mark.sm::before { left: 6px; right: 6px; bottom: 6px; height: 9px; border-radius: 0 0 9px 9px; }
.brand-mark.sm::after { left: 6px; top: 5px; width: 18px; height: 10px; border-radius: 9px 9px 0 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-company { font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--steel-300); }
.brand-title { font-size: 15px; font-weight: 800; letter-spacing: .01em; color: var(--white); }

/* ---------- Barra superior (portal público) ---------- */
.topbar {
  background: var(--navy-900); color: var(--white); position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 66px; display: flex; align-items: center; gap: 18px; }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topnav a {
  color: var(--steel-300); font-weight: 600; font-size: 13px; padding: 9px 13px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.topnav a:hover { color: var(--white); background: rgba(255,255,255,.07); }
.topnav a.active { color: var(--white); background: rgba(255,255,255,.10); }
.topnav a.cta { background: var(--orange); color: var(--white); font-weight: 700; margin-left: 6px; }
.topnav a.cta:hover { background: var(--orange-600); }
.topnav .admin-link { color: var(--steel); font-weight: 500; }
.nav-toggle { display: none; margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,.15); color: var(--white); border-radius: 10px; padding: 8px; cursor: pointer; }

/* ---------- Estructura ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px 24px 60px; }
.page-narrow { max-width: 960px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); margin-bottom: 8px; }
.page-head .sub { color: var(--text-3); font-weight: 300; margin-top: 8px; max-width: 640px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--steel-700); }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Tarjetas ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; }
.card-head .hint { color: var(--text-3); font-size: 12.5px; font-weight: 300; }
.card-body { padding: 18px 22px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-3); font-size: 12.5px; }
.card.pad { padding: 22px; }
.card.dark { background: var(--navy-900); color: var(--white); border-color: var(--navy-800); }
.card.dark h2, .card.dark h3 { color: var(--white); }
.card.soft { background: var(--steel-50); border-color: var(--steel-100); box-shadow: none; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; box-shadow: var(--shadow-xs); }
.kpi .kpi-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--steel-700); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .kpi-value { font-size: 26px; font-weight: 800; color: var(--navy-900); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .kpi-sub { font-size: 12.5px; color: var(--text-3); display: flex; justify-content: space-between; gap: 8px; font-weight: 400; }
.kpi .kpi-sub strong { color: var(--text-2); font-variant-numeric: tabular-nums; }
.kpi.accent { background: var(--navy-900); border-color: var(--navy-900); color: var(--white); }
.kpi.accent .kpi-label { color: var(--steel-300); }
.kpi.accent .kpi-value { color: var(--white); }
.kpi.accent .kpi-sub, .kpi.accent .kpi-sub strong { color: var(--steel-200); }
.kpi.accent::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(217,137,24,.16); }
.kpi.capex { border-top: 4px solid var(--navy-700); }
.kpi.opex { border-top: 4px solid var(--steel); }

/* Barras de consumo */
.bar { height: 8px; background: var(--steel-100); border-radius: 999px; overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--navy-700); transition: width .6s var(--ease); }
.bar.verde > span { background: var(--ok); }
.bar.ambar > span { background: var(--orange); }
.bar.rojo > span { background: var(--danger); }
.bar.gris > span { background: var(--steel-300); }
.kpi.accent .bar { background: rgba(255,255,255,.14); }
.kpi.accent .bar > span { background: var(--orange); }

/* Semáforo */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--steel-300); box-shadow: 0 0 0 3px rgba(130,150,169,.15); flex: 0 0 auto; }
.dot.verde { background: var(--ok); box-shadow: 0 0 0 3px rgba(31,138,91,.15); }
.dot.ambar { background: var(--orange); box-shadow: 0 0 0 3px rgba(217,137,24,.18); }
.dot.rojo { background: var(--danger); box-shadow: 0 0 0 3px rgba(200,53,58,.16); }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; line-height: 1.4; border: 1px solid transparent; }
.chip-ok { background: var(--ok-50); color: var(--ok-600); border-color: var(--ok-100); }
.chip-danger { background: var(--danger-50); color: var(--danger-600); border-color: var(--danger-100); }
.chip-warn { background: var(--orange-50); color: var(--orange-600); border-color: var(--orange-100); }
.chip-neutral { background: var(--steel-50); color: var(--navy-700); border-color: var(--steel-100); }
.chip-muted { background: var(--steel-100); color: var(--text-3); border-color: var(--steel-100); }
.chip-navy { background: var(--navy-700); color: var(--white); }
.chip-steel { background: var(--steel); color: var(--white); }
.chip-capex { background: var(--navy-700); color: var(--white); }
.chip-opex { background: var(--steel-100); color: var(--navy-700); border-color: var(--steel-200); }
.chip .ico { width: 13px; height: 13px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: 13.5px; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
  user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--orange); color: var(--white); box-shadow: 0 6px 16px -6px rgba(217,137,24,.6); }
.btn-primary:hover { background: var(--orange-600); color: var(--white); }
.btn-dark { background: var(--navy-900); color: var(--white); }
.btn-dark:hover { background: var(--navy-700); color: var(--white); }
.btn-outline { background: var(--white); color: var(--navy-700); border-color: var(--steel-200); }
.btn-outline:hover { border-color: var(--steel); color: var(--navy-900); }
.btn-ghost { background: transparent; color: var(--navy-700); }
.btn-ghost:hover { background: var(--steel-100); }
.btn-ok { background: var(--ok); color: var(--white); }
.btn-ok:hover { background: var(--ok-600); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-600); color: var(--white); }
.btn-danger-soft { background: var(--danger-50); color: var(--danger-600); border-color: var(--danger-100); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); border-top-color: var(--white); animation: spin .7s linear infinite; }
.btn-outline.loading::after, .btn-ghost.loading::after { border-color: rgba(21,33,47,.25); border-top-color: var(--navy-700); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.col-12 { grid-column: span 12; } .col-10 { grid-column: span 10; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-7 { grid-column: span 7; } .col-6 { grid-column: span 6; } .col-5 { grid-column: span 5; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12px; font-weight: 700; color: var(--navy-700); letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--orange); }
.help { font-size: 12px; color: var(--text-3); font-weight: 300; }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--steel-200); background: var(--white); border-radius: 12px; padding: 11px 14px; font-size: 14px; color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); min-height: 44px;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--steel-300); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(217,137,24,.14); }
.input::placeholder, .textarea::placeholder { color: var(--steel); font-weight: 300; }
.input.invalid, .select.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(200,53,58,.10); }
.input[readonly] { background: var(--steel-50); color: var(--text-2); }
.input.mono { font-variant-numeric: tabular-nums; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238296A9' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.textarea { min-height: 96px; resize: vertical; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 12px 0 0 12px; }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 14px; border: 1.5px solid var(--steel-200); border-left: 0; border-radius: 0 12px 12px 0; background: var(--steel-50); color: var(--text-3); font-weight: 600; font-size: 13px; }
.input-group .addon.pre { border-left: 1.5px solid var(--steel-200); border-right: 0; border-radius: 12px 0 0 12px; }
.input-group .addon.pre + .input { border-radius: 0 12px 12px 0; }
.field-error { font-size: 12px; color: var(--danger-600); font-weight: 600; display: none; }
.field.has-error .field-error { display: block; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.seg { display: inline-flex; background: var(--steel-100); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--text-2); cursor: pointer; transition: all .18s var(--ease); }
.seg input:checked + span { background: var(--white); color: var(--navy-900); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 3px solid rgba(217,137,24,.45); }
.seg.block { display: flex; } .seg.block label { flex: 1; } .seg.block span { width: 100%; justify-content: center; }
.seg input:checked + span.capex { background: var(--navy-900); color: var(--white); }
.seg input:checked + span.opex { background: var(--steel-700); color: var(--white); }
.seg input:checked + span.usd { background: var(--orange); color: var(--white); }

/* Stepper */
.steps { display: flex; gap: 8px; margin-bottom: 20px; counter-reset: step; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.step::before { counter-increment: step; content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--steel-100); color: var(--steel-700); font-weight: 800; font-size: 12px; flex: 0 0 auto; }
.step.active { border-color: var(--orange); color: var(--navy-900); box-shadow: 0 0 0 3px rgba(217,137,24,.12); }
.step.active::before { background: var(--orange); color: var(--white); }
.step.done { color: var(--navy-700); }
.step.done::before { background: var(--navy-900); color: var(--white); content: '✓'; }

/* ---------- Tablas ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--white); }
.card > .table-wrap { border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--steel-50); color: var(--steel-700); text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s var(--ease); }
.table tbody tr:hover { background: var(--steel-50); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.table .tight { width: 1%; white-space: nowrap; }
.table tr.total td { font-weight: 800; background: var(--steel-50); border-top: 2px solid var(--line); }
.table tr.group td { background: var(--navy-900); color: var(--white); font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 8px 14px; }
.table tr.dim td { color: var(--text-3); }
.table .cell-title { font-weight: 700; color: var(--navy-900); }
.table .cell-sub { font-size: 12px; color: var(--text-3); font-weight: 300; margin-top: 2px; }
.table a.row-link { font-weight: 700; color: var(--navy-700); }
.table a.row-link:hover { color: var(--orange-600); }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.bar-cell .bar { flex: 1; }
.bar-cell .pct { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money.pos { color: var(--ok-600); }
.money.neg { color: var(--danger-600); }
.money.muted { color: var(--text-3); font-weight: 500; }

/* ---------- Avisos ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; margin-bottom: 16px; }
.notice .ico { margin-top: 1px; }
.notice-info { background: var(--steel-50); border-color: var(--steel-200); color: var(--navy-700); }
.notice-success { background: var(--ok-50); border-color: var(--ok-100); color: var(--ok-600); }
.notice-error { background: var(--danger-50); border-color: var(--danger-100); color: var(--danger-600); }
.notice-warn { background: var(--orange-50); border-color: var(--orange-100); color: var(--orange-600); }
.notice strong { font-weight: 700; }
.notice .notice-body { flex: 1; }
.notice .notice-actions { display: flex; gap: 8px; align-items: center; }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--white); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); font-weight: 500; }
.sync-pill .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(31,138,91,.5); animation: pulse 2s infinite; }
.sync-pill.error .pulse { background: var(--danger); animation: none; }
.sync-pill.none .pulse { background: var(--steel-300); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31,138,91,.45); } 70% { box-shadow: 0 0 0 7px rgba(31,138,91,0); } 100% { box-shadow: 0 0 0 0 rgba(31,138,91,0); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: 380px; }
.toast { background: var(--navy-900); color: var(--white); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; animation: toastIn .25s var(--ease); }
.toast.success { border-left: 4px solid var(--ok); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--orange); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
dialog.modal { border: 0; border-radius: var(--radius-xl); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); background: var(--white); color: var(--text); }
dialog.modal::backdrop { background: rgba(21,33,47,.55); backdrop-filter: blur(3px); }
.modal-head { padding: 22px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 16px 24px 4px; }
.modal-foot { padding: 16px 24px 22px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: var(--steel-100); border: 0; border-radius: 10px; padding: 6px; cursor: pointer; color: var(--text-2); }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty .ico { width: 42px; height: 42px; color: var(--steel-300); margin-bottom: 10px; }
.empty h3 { color: var(--navy-700); margin-bottom: 6px; }
.empty p { font-weight: 300; max-width: 420px; margin: 0 auto 14px; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--steel-100) 25%, var(--steel-50) 50%, var(--steel-100) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Dictamen (pantalla) ---------- */
.verdict { border-radius: var(--radius-xl); padding: 28px 30px; color: var(--white); display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; position: relative; overflow: hidden; }
.verdict.green { background: linear-gradient(135deg, var(--ok-600), var(--ok)); }
.verdict.red { background: linear-gradient(135deg, var(--danger-600), var(--danger)); }
.verdict.cancel { background: linear-gradient(135deg, var(--navy-700), var(--steel-700)); }
.verdict::after { content: ''; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.10); }
.verdict .v-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
.verdict .v-title { font-size: clamp(22px, 3.2vw, 34px); font-weight: 800; letter-spacing: -.01em; line-height: 1.05; margin: 6px 0 8px; text-transform: uppercase; }
.verdict .v-sub { font-weight: 300; opacity: .95; }
.verdict .v-badge { width: 92px; height: 92px; border-radius: 50%; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.5); display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.verdict .v-badge .ico { width: 46px; height: 46px; }
.dictamen-sheet { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 28px 32px; box-shadow: var(--shadow-xs); }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.dl.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dl.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dl dt { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--steel-700); margin-bottom: 3px; }
.dl dd { margin: 0; font-weight: 600; color: var(--navy-900); word-break: break-word; }
.dl dd.big { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; }
.check-box { background: var(--steel-50); border: 1px solid var(--steel-100); border-radius: var(--radius); padding: 12px 14px; }
.check-box .lbl { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--steel-700); line-height: 1.3; }
.check-box .val { font-size: 17px; font-weight: 800; color: var(--navy-900); font-variant-numeric: tabular-nums; margin-top: 4px; }
.check-box.highlight { background: var(--navy-900); border-color: var(--navy-900); }
.check-box.highlight .lbl { color: var(--steel-300); }
.check-box.highlight .val { color: var(--white); }
.check-box.ok .val { color: var(--ok-600); }
.check-box.bad .val { color: var(--danger-600); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px var(--orange-100); }
.timeline li::after { content: ''; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t-title { font-weight: 700; font-size: 13px; color: var(--navy-900); }
.timeline .t-meta { font-size: 12px; color: var(--text-3); }
.timeline .t-body { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* Panel de cruce en vivo */
.live-check { position: sticky; top: 86px; }
.live-check .lc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.live-check .lc-row { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; color: var(--text-2); }
.live-check .lc-row strong { font-variant-numeric: tabular-nums; color: var(--navy-900); font-weight: 700; font-size: 14px; }
.live-check .lc-result { margin-top: 14px; border-radius: var(--radius); padding: 16px; text-align: center; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; background: var(--steel-100); color: var(--text-3); transition: all .25s var(--ease); }
.live-check .lc-result.green { background: var(--ok); color: var(--white); }
.live-check .lc-result.red { background: var(--danger); color: var(--white); }
.live-check .lc-result small { display: block; text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .9; margin-top: 4px; font-size: 12px; }

/* Barra móvil del cruce en vivo */
.lc-mobile { display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; background: var(--navy-900); color: var(--white); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow-lg); align-items: center; justify-content: space-between; gap: 10px; }
.lc-mobile .lcm-text { display: flex; gap: 8px 12px; flex-wrap: wrap; font-size: 12px; align-items: baseline; }
.lc-mobile .lcm-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--steel-300); }
.lc-mobile strong { font-variant-numeric: tabular-nums; font-size: 13px; }
.lc-mobile .lcm-result { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.12); white-space: nowrap; }
.lc-mobile .lcm-result.green { background: var(--ok); }
.lc-mobile .lcm-result.red { background: var(--danger); }
@media (max-width: 1100px) { .lc-mobile:not([hidden]) { display: flex; } .page { padding-bottom: 96px; } }

/* Partidas (items) */
.items-table { width: 100%; border-collapse: collapse; }
.items-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--steel-700); text-align: left; padding: 6px 8px; }
.items-table td { padding: 4px 6px; }
.items-table .input { min-height: 40px; padding: 8px 10px; }
.items-table .num-out { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; padding-right: 10px; }

/* ---------- Administración: shell ---------- */
.admin-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy-900); color: var(--white); padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav .group { font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--steel-700); padding: 14px 12px 6px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; color: var(--steel-300); font-weight: 600; font-size: 13.5px; transition: all .18s var(--ease); }
.side-nav a:hover { background: rgba(255,255,255,.06); color: var(--white); }
.side-nav a.active { background: var(--orange); color: var(--white); box-shadow: 0 8px 20px -8px rgba(217,137,24,.7); }
.side-nav a .ico { width: 18px; height: 18px; opacity: .9; }
.side-nav a .badge { margin-left: auto; background: rgba(255,255,255,.16); color: var(--white); font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 12px; background: var(--steel-700); color: var(--white); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who .n { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who .r { font-size: 11px; color: var(--steel); }
.side-foot form { margin: 0; }
.side-foot button { background: transparent; border: 0; color: var(--steel-300); cursor: pointer; padding: 6px; border-radius: 8px; }
.side-foot button:hover { color: var(--white); background: rgba(255,255,255,.08); }
.admin-main { min-width: 0; }
.admin-top { position: sticky; top: 0; z-index: 30; background: rgba(245,247,250,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 12px 28px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.admin-top .crumbs { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.admin-top .crumbs strong { color: var(--navy-900); font-weight: 700; }
.admin-top .tools { display: flex; align-items: center; gap: 10px; }
.admin-content { padding: 26px 28px 60px; max-width: 1400px; }
.side-toggle { display: none; }

/* Grid de dos columnas */
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.muted { color: var(--text-3); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; } .light { font-weight: 300; } .bold { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.uppercase { text-transform: uppercase; letter-spacing: .08em; }
.w-100 { width: 100%; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--steel-50); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; }
#script-box.open { display: block !important; }
pre.code-block { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--navy-900); color: var(--steel-100); padding: 16px 18px; border-radius: var(--radius); overflow: auto; line-height: 1.5; }

/* Filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 150px; flex: 1 1 150px; }
.filters .field.grow { flex: 2 1 240px; }
.filters .input, .filters .select { min-height: 42px; padding: 9px 12px; font-size: 13.5px; }
.pagination { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); background: var(--white); color: var(--text-2); }
.pagination .current { background: var(--navy-900); color: var(--white); border-color: var(--navy-900); }
.pagination .info { border: 0; background: transparent; color: var(--text-3); font-weight: 400; }

/* Gráficas */
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: var(--navy-900); color: var(--white); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: rgba(217,137,24,.14); right: -200px; bottom: -220px; }
.auth-side::after { content: ''; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(130,150,169,.12); left: -120px; top: 40%; }
.auth-side h1 { color: var(--white); font-size: 34px; max-width: 460px; text-transform: none; letter-spacing: -.02em; }
.auth-side p { color: var(--steel-300); font-weight: 300; max-width: 420px; font-size: 15px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 22px; margin-bottom: 4px; }

/* Landing hero público */
.hero { background: var(--navy-900); color: var(--white); border-radius: var(--radius-xl); padding: 30px 32px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; position: relative; overflow: hidden; margin-bottom: 20px; }
.hero::before { content: ''; position: absolute; width: 380px; height: 380px; border-radius: 50%; background: rgba(217,137,24,.16); right: -120px; top: -160px; }
.hero::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(130,150,169,.14); right: 180px; bottom: -150px; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: var(--white); font-size: clamp(22px, 2.6vw, 30px); text-transform: uppercase; }
.hero p { color: var(--steel-300); font-weight: 300; max-width: 560px; font-size: 14.5px; }
.hero .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero .hero-side { display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.period-picker { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; padding: 8px 8px 8px 14px; }
.period-picker .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--steel-300); }
.period-picker select { background: var(--white); border: 0; border-radius: 10px; padding: 9px 34px 9px 12px; font-weight: 700; color: var(--navy-900); font-size: 13.5px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232E3A47' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.period-picker.period-static { padding: 10px 14px; }
.period-picker.period-static .val { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: var(--white); }
.hero .mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero .mini { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.10); border-radius: 14px; padding: 10px 12px; }
.hero .mini .l { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--steel-300); font-weight: 700; }
.hero .mini .v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }

.hero-search { display: flex; gap: 8px; margin-top: 18px; max-width: 640px; }
@media (max-width: 640px) { .hero-search { flex-direction: column; } .hero-search .input-group { max-width: none !important; } }
.hero-search .input::placeholder { color: rgba(255,255,255,.55); text-transform: none; }
.hero-search .input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(217,137,24,.25); }
#consulta-results .card { border-color: rgba(255,255,255,.2); }

/* Sub-navegación de una sola hoja */
.subnav { position: sticky; top: 66px; z-index: 30; display: flex; gap: 6px; flex-wrap: wrap; background: rgba(245,247,250,.92); backdrop-filter: blur(8px); padding: 10px 0; margin: -6px 0 14px; border-bottom: 1px solid var(--line); }
.subnav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); font-size: 13px; font-weight: 700; color: var(--navy-700); }
.subnav a:hover { border-color: var(--orange); color: var(--orange-600); }
.howto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.how { display: flex; gap: 12px; align-items: flex-start; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.how .n { width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: var(--white); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.how strong { display: block; font-size: 13.5px; color: var(--navy-900); }
.how span:not(.n) { font-size: 12.5px; color: var(--text-3); font-weight: 300; }
@media (max-width: 900px) { .howto { grid-template-columns: 1fr; } .subnav { top: 0; } }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 18px 24px; text-align: center; color: var(--text-3); font-size: 12px; font-weight: 300; }
.footer strong { font-weight: 700; color: var(--navy-700); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .live-check { position: static; }
  .three-col { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); transition: transform .25s var(--ease); z-index: 60; height: 100vh; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .side-toggle { display: inline-flex; }
  .admin-top { padding: 10px 16px; }
  .admin-content { padding: 18px 16px 50px; }
  .hero { grid-template-columns: 1fr; padding: 22px 20px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .page { padding: 18px 16px 48px; }
  .kpis { grid-template-columns: 1fr; }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .dl, .dl.cols-3, .dl.cols-4 { grid-template-columns: 1fr 1fr; }
  .verdict { grid-template-columns: 1fr; }
  .verdict .v-badge { display: none; }
  .steps { flex-direction: column; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .dictamen-sheet { padding: 20px 16px; }
  h1 { font-size: 21px; }
  .hero .mini-stats { grid-template-columns: 1fr; }
  .topbar-inner { padding: 0 16px; }
  .filters .field { flex: 1 1 100%; }
}

/* Animaciones suaves */
.fade-in { animation: fadeIn .35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
