@font-face { font-family: 'Inter'; src: url('/vendor/@fontsource-variable/inter/files/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: block; }

:root {
  --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f9fafb; --sunken: #f1f3f6; --hover: #f3f4f7;
  --line: #e5e7eb; --line-2: #eef0f3; --line-strong: #d4d8de;
  --ink: #0d1017; --ink-2: #353b47; --muted: #6a7180; --faint: #9aa1ad;
  --accent: #2c4bdc; --accent-2: #1f3bc0; --accent-ink: #fff; --accent-soft: #eef1fd; --accent-line: #c9d2fa;
  --green: #12805a; --green-soft: #e6f5ee; --amber: #a86812; --amber-soft: #fcf3e2; --red: #c4313b; --red-soft: #fdecec; --gray-soft: #f0f1f4;
  --b-cur: #8aa4ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .18), 0 2px 8px rgba(16, 24, 40, .08);
  --r: 10px; --r-sm: 7px; --r-lg: 14px;
  --side: 244px; --top: 44px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0c10; --panel: #11141a; --panel-2: #141820; --sunken: #0e1116; --hover: #181c25;
  --line: #222733; --line-2: #1b1f29; --line-strong: #2e3442;
  --ink: #eceef3; --ink-2: #c0c5d0; --muted: #8c93a3; --faint: #626a7a;
  --accent: #7390ff; --accent-2: #8aa2ff; --accent-ink: #0a0c10; --accent-soft: rgba(115, 144, 255, .13); --accent-line: rgba(115, 144, 255, .35);
  --green: #3ccf91; --green-soft: rgba(60, 207, 145, .12); --amber: #f0b44c; --amber-soft: rgba(240, 180, 76, .12); --red: #ff6b74; --red-soft: rgba(255, 107, 116, .12); --gray-soft: #1c2029;
  --b-cur: #5f7bea;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, .6), 0 2px 10px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; font-size: 13.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11' 1, 'ss01' 1; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1, 'cv11' 1; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .strong { font-weight: 600; }
.green { color: var(--green); } .red { color: var(--red); } .amber { color: var(--amber); }
.row { display: flex; align-items: center; gap: 8px; } .col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .end { justify-content: flex-end; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: 'Cascadia Mono', Consolas, monospace; font-size: 12px; }
svg.i { width: 16px; height: 16px; flex: none; stroke-width: 1.85; }

/* scroll */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ Shell ============ */
.app { display: grid; grid-template-columns: var(--side) 1fr; height: 100vh; }
.side { display: flex; flex-direction: column; padding: 0 10px 12px; min-height: 0; }
.side-top { height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 8px; -webkit-app-region: drag; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(140deg, var(--accent) 0%, #6a4cf0 100%); display: grid; place-items: center; color: #fff; box-shadow: 0 2px 8px rgba(44, 75, 220, .35), inset 0 1px 0 rgba(255,255,255,.25); }
.logo svg { width: 15px; height: 15px; stroke-width: 2.3; }
.appname { font-weight: 650; letter-spacing: -.2px; font-size: 14px; }
.appname small { display: block; font-size: 10.5px; color: var(--faint); font-weight: 500; letter-spacing: 0; margin-top: -2px; }
.scope { margin: 6px 0 10px; position: relative; }
.scope-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; text-align: left; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.scope-btn:hover { border-color: var(--line-strong); }
.avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; letter-spacing: .2px; }
.scope-btn .t { font-weight: 600; font-size: 13px; line-height: 1.2; }
.scope-btn .s { font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 1px; overflow: auto; flex: 1; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; position: relative; transition: background .12s, color .12s; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.nav a.on svg { color: var(--accent); }
.nav a svg { color: var(--muted); }
.nav .cnt { margin-left: auto; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); line-height: 18px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.side-foot .data { font-size: 11px; color: var(--faint); flex: 1; min-width: 0; cursor: pointer; }
.side-foot .data:hover { color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 20px 0 6px; -webkit-app-region: drag; flex: none; }
.top > * { -webkit-app-region: no-drag; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; -webkit-app-region: drag; }
.crumbs b { color: var(--ink); font-weight: 600; }
.search { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); color: var(--faint); width: 340px; cursor: text; margin-left: auto; box-shadow: var(--shadow-sm); }
.search span { flex: 1; font-size: 12.5px; }
kbd { font-family: inherit; font-size: 10.5px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
.sheet { flex: 1; min-height: 0; background: var(--panel); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-top-left-radius: var(--r-lg); overflow: auto; position: relative; }
.view { padding: 26px 32px 48px; max-width: 1640px; margin: 0 auto; animation: viewIn .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ph { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.ph h1 { font-size: 23px; letter-spacing: -.55px; margin: 0; font-weight: 680; line-height: 1.15; }
.ph p { margin: 4px 0 0; color: var(--muted); }
.ph .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ============ Controles ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(44, 75, 220, .3), inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn.sm { height: 27px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn.sm svg.i { width: 14px; height: 14px; }
.btn.icon { width: 32px; padding: 0; }
.btn.sm.icon { width: 27px; }
.btn.lg { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

.input, .select, textarea.input { height: 34px; width: 100%; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); outline: none; transition: border-color .12s, box-shadow .12s; font-size: 13.5px; }
textarea.input { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }
.input.num { text-align: right; }
.input.sm { height: 28px; font-size: 12.5px; padding: 0 8px; border-radius: 7px; }
.input[readonly] { background: var(--panel-2); color: var(--muted); }
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238c93a3' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; cursor: pointer; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.input-wrap > .input { padding-left: 32px; }
.input-wrap .suffix { position: absolute; right: 10px; color: var(--faint); font-size: 12px; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field.err .input { border-color: var(--red); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--line-strong); transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s cubic-bezier(.3,.7,.3,1); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); }

.seg { display: inline-flex; background: var(--sunken); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { white-space: nowrap; border: 0; background: transparent; height: 26px; padding: 0 11px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 550; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg .c { font-size: 11px; color: var(--faint); font-weight: 600; }
.seg button.on .c { color: var(--accent); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--gray-soft); color: var(--muted); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--sunken); border: 1px solid var(--line); color: var(--ink-2); font-weight: 550; }

/* ============ Tarjetas / KPIs ============ */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 640; letter-spacing: -.15px; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.card-h .act { margin-left: auto; display: flex; gap: 6px; }
.card-b { padding: 14px 18px 18px; }
.card.flat { box-shadow: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 15px 17px 14px; position: relative; overflow: hidden; }
.kpi .l { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 550; }
.kpi .l .ic { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.kpi .l .ic svg { width: 14px; height: 14px; }
.kpi .v { font-size: 25px; font-weight: 680; letter-spacing: -.8px; margin-top: 9px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .v .cents { font-size: 15px; color: var(--faint); font-weight: 600; letter-spacing: -.2px; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 5px; }
.kpi.accent { background: linear-gradient(155deg, var(--accent) 0%, #5240e6 100%); border-color: transparent; color: #fff; box-shadow: 0 6px 22px rgba(44, 75, 220, .28); }
.kpi.accent .l, .kpi.accent .s { color: rgba(255, 255, 255, .78); }
.kpi.accent .l .ic { background: rgba(255, 255, 255, .16); color: #fff; }
.kpi.accent .v .cents { color: rgba(255, 255, 255, .6); }
.kpi.accent::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.dash { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* barras de antigüedad */
.abar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--sunken); gap: 2px; }
.abar div { height: 100%; transition: width .6s cubic-bezier(.2, .8, .2, 1); min-width: 3px; }
.abar.lg { height: 16px; border-radius: 8px; }
.alist { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; margin-top: 16px; }
.alist .it { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); cursor: pointer; transition: border-color .12s, transform .12s; }
.alist .it:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.alist .lb { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; font-weight: 550; }
.alist .lb i { width: 8px; height: 8px; border-radius: 3px; }
.alist .am { font-weight: 650; font-size: 13.5px; margin-top: 4px; letter-spacing: -.3px; }
.alist .pc { font-size: 11.5px; color: var(--faint); }
.minibar { height: 6px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.minibar div { height: 100%; border-radius: 4px; background: var(--accent); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.conc { display: flex; flex-direction: column; gap: 12px; }
.conc .it { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: center; cursor: pointer; }
.conc .nm { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conc .minibar { grid-column: 1 / -1; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--faint); font-size: 10.5px; }
.chart .grid-l { stroke: var(--line-2); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -.5px; }
.alerts { display: flex; flex-direction: column; }
.alert { display: flex; gap: 11px; padding: 11px 0; border-top: 1px solid var(--line-2); align-items: flex-start; cursor: pointer; }
.alert:first-child { border-top: 0; padding-top: 2px; }
.alert .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.alert .ic svg { width: 15px; height: 15px; }
.alert .t { font-weight: 600; font-size: 13px; }
.alert .d { color: var(--muted); font-size: 12px; }
.feed { display: flex; flex-direction: column; gap: 0; }
.feed .it { display: flex; gap: 10px; padding: 8px 0; font-size: 12.5px; color: var(--ink-2); border-top: 1px dashed var(--line); }
.feed .it:first-child { border-top: 0; }
.feed .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.feed time { margin-left: auto; color: var(--faint); font-size: 11.5px; white-space: nowrap; }

/* ============ Tablas ============ */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--panel); }
.tbl-scroll { overflow: auto; max-height: calc(100vh - 250px); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.t th.sort { cursor: pointer; } table.t th.sort:hover { color: var(--ink); }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; vertical-align: middle; }
table.t tbody tr { transition: background .08s; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover { background: var(--hover); }
table.t tbody tr.sel { background: var(--accent-soft); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; }
table.t tfoot td { position: sticky; bottom: 0; background: var(--panel-2); font-weight: 650; border-top: 1px solid var(--line); padding: 10px 12px; }
table.t .w1 { width: 1%; }
table.t.dense td { padding: 6px 10px; } table.t.dense th { padding: 7px 10px; }
.tbl-bar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tbl-foot { display: flex; gap: 8px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; background: var(--panel-2); }
.link { color: var(--ink); font-weight: 600; }
.link:hover { color: var(--accent); }
.days { display: inline-block; min-width: 34px; text-align: center; padding: 1px 6px; border-radius: 6px; font-weight: 600; font-size: 12px; background: var(--sunken); }
.days.warn { background: var(--amber-soft); color: var(--amber); }
.days.bad { background: var(--red-soft); color: var(--red); }

/* ============ Overlays ============ */
.backdrop { position: fixed; inset: 0; background: rgba(10, 13, 20, .38); backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; animation: fade .16s ease; }
:root[data-theme="dark"] .backdrop { background: rgba(0, 0, 0, .55); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 40px)); max-height: calc(100vh - 60px); display: flex; flex-direction: column; animation: pop .2s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
.modal-h { padding: 18px 22px 4px; display: flex; align-items: flex-start; gap: 10px; }
.modal-h h2 { margin: 0; font-size: 16.5px; letter-spacing: -.3px; font-weight: 650; }
.modal-h p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.modal-b { padding: 16px 22px; overflow: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--panel-2); border-radius: 0 0 16px 16px; align-items: center; }
.drawer-bd { position: fixed; inset: 0; z-index: 40; background: rgba(10, 13, 20, .18); animation: fade .16s; }
.drawer { position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(560px, calc(100vw - 80px)); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 41; display: flex; flex-direction: column; animation: slide .26s cubic-bezier(.2, .85, .25, 1); }
.drawer.wide { width: min(900px, calc(100vw - 80px)); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-h { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer-h h2 { margin: 0; font-size: 18px; letter-spacing: -.4px; }
.drawer-b { flex: 1; overflow: auto; padding: 18px 20px; }
.drawer-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 9px 14px; font-size: 13px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 550; min-width: 0; }
.sect { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 650; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.sect::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.menu { position: absolute; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 220px; animation: pop .14s ease; max-height: 360px; overflow: auto; }
.menu button, .menu .mi { display: flex; width: 100%; align-items: center; gap: 9px; border: 0; background: none; padding: 7px 9px; border-radius: 7px; cursor: pointer; text-align: left; color: var(--ink-2); font-size: 13px; }
.menu button:hover, .menu button.hl { background: var(--hover); color: var(--ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }
.menu .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 6px 9px 3px; font-weight: 600; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: #12151c; color: #f1f3f7; padding: 10px 14px 10px 12px; border-radius: 11px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-weight: 500; animation: toastIn .25s cubic-bezier(.2, .9, .3, 1.15); max-width: 560px; }
:root[data-theme="dark"] .toast { background: #f1f3f7; color: #12151c; }
.toast .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #2b9f6f; color: #fff; flex: none; }
.toast.err .ic { background: #d0414b; }
.toast .ic svg { width: 12px; height: 12px; stroke-width: 3; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* paleta de comandos */
.cmdk { position: fixed; top: 12vh; left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 40px)); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 70; overflow: hidden; animation: pop .16s ease; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk-in input { flex: 1; border: 0; outline: none; background: none; height: 52px; font-size: 15.5px; }
.cmdk-list { max-height: 420px; overflow: auto; padding: 6px; }
.cmdk-list .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 8px 10px 4px; font-weight: 600; }
.cmdk-list button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 9px; cursor: pointer; text-align: left; color: var(--ink-2); }
.cmdk-list button.hl { background: var(--accent-soft); color: var(--ink); }
.cmdk-list button .r { margin-left: auto; color: var(--faint); font-size: 12px; }

/* estados vacíos y carga */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ic { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .ic svg { width: 24px; height: 24px; }
.empty h3 { margin: 0 0 4px; color: var(--ink); font-size: 15.5px; letter-spacing: -.2px; }
.empty p { margin: 0 auto 16px; max-width: 420px; }
.skel { background: linear-gradient(90deg, var(--sunken) 0%, var(--hover) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* captura */
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 30px; text-align: center; background: var(--panel-2); transition: border-color .15s, background .15s; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin: 0 auto 10px; background: var(--panel); border: 1px solid var(--line); color: var(--accent); box-shadow: var(--shadow-sm); }
.cap { display: grid; grid-template-columns: 250px minmax(0, 1fr) 400px; gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; height: calc(100vh - 190px); min-height: 520px; background: var(--panel); }
.cap-q { border-right: 1px solid var(--line); overflow: auto; background: var(--panel-2); }
.cap-q .it { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; align-items: center; }
.cap-q .it:hover { background: var(--hover); }
.cap-q .it.on { background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }
.cap-q .it .fi { width: 30px; height: 36px; border-radius: 5px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; color: var(--red); font-size: 8.5px; font-weight: 700; flex: none; }
.cap-v { background: var(--sunken); overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 18px; gap: 14px; }
.cap-v canvas, .cap-v img { box-shadow: var(--shadow); border-radius: 4px; background: #fff; max-width: 100%; }
.cap-f { border-left: 1px solid var(--line); overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.guess { font-size: 11px; color: var(--accent); font-weight: 600; display: inline-flex; gap: 3px; align-items: center; }
.guess svg { width: 11px; height: 11px; }
.qgrid input { border: 0; background: transparent; width: 100%; height: 30px; padding: 0 8px; outline: none; border-radius: 6px; }
.qgrid input:focus, .qgrid select:focus { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.qgrid select { border: 0; background: transparent; width: 100%; height: 30px; outline: none; border-radius: 6px; }
.qgrid td { padding: 2px 4px !important; }

/* constructor de factura / vista previa */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.paper { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; position: sticky; top: 0; height: calc(100vh - 140px); overflow: auto; }
.paper-in { width: 816px; transform-origin: top left; }
.paper iframe { width: 816px; height: 1056px; border: 0; background: #fff; box-shadow: var(--shadow); border-radius: 4px; display: block; }
.items td { padding: 4px 6px !important; }
.items .input { height: 30px; font-size: 13px; }
.sum-box { margin-left: auto; width: 320px; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.sum-box .r { display: flex; justify-content: space-between; }
.sum-box .r.t { font-size: 17px; font-weight: 700; letter-spacing: -.3px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }

/* reportes */
.rep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.rep { padding: 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.rep:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.rep.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rep .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.rep h4 { margin: 0 0 3px; font-size: 14px; }
.rep p { margin: 0; color: var(--muted); font-size: 12.5px; }
.rep-view { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }

/* programa / simulador */
.sim { padding: 16px; border-radius: 12px; background: linear-gradient(160deg, var(--accent-soft), transparent 70%); border: 1px solid var(--accent-line); }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.flow .st { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.flow .st .l { font-size: 11.5px; color: var(--muted); }
.flow .st .v { font-size: 16px; font-weight: 680; letter-spacing: -.3px; margin-top: 2px; }
.tiers { display: flex; gap: 4px; margin-top: 12px; align-items: flex-end; height: 70px; }
.tiers div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; position: relative; min-height: 4px; }
.tiers div span { position: absolute; top: -17px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); font-weight: 600; }
.tiers-l { display: flex; gap: 4px; font-size: 10px; color: var(--faint); margin-top: 4px; }
.tiers-l span { flex: 1; text-align: center; }

.client-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.ccard { padding: 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ccard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.ccard .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.ccard .stats .l { font-size: 11.5px; color: var(--muted); } .ccard .stats .v { font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.hero .avatar { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }
.hero h1 { margin: 0; font-size: 23px; letter-spacing: -.55px; }
.import-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.ok-banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--green-soft); color: var(--green); font-weight: 600; }
.warn-banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.info-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); }
.info-banner svg { color: var(--accent); margin-top: 1px; }
.hr { height: 1px; background: var(--line); margin: 18px 0; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }
@media (max-width: 1280px) { .dash { grid-template-columns: 1fr; } .cap { grid-template-columns: 210px minmax(0, 1fr) 360px; } }

.combo { position: relative; display: flex; align-items: center; }
.combo .suffix { position: absolute; right: 10px; color: var(--faint); pointer-events: none; display: flex; }
.items-scroll { overflow-x: auto; }
.builder { grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.8fr); }
.items .input { padding: 0 7px; }

.side-foot .data { text-decoration: none; display: block; }
.install { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 9px 11px; border-radius: var(--r); border: 1px dashed var(--accent-line); background: var(--accent-soft); color: var(--accent); cursor: pointer; text-align: left; font-weight: 600; }
.install small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.install:hover { border-style: solid; }
.update { position: fixed; top: 54px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--accent-line); box-shadow: var(--shadow-lg); font-weight: 600; animation: toastIn .3s ease; }
.update svg { color: var(--accent); }
