/* Layout: barra lateral clara con la marca, área de trabajo tipo papel de trabajo contable;
   datos fiscales (RFC, UUID, importes) en monoespaciada tabular. */
:root {
  --brand: #33593a; --brand-2: #284a2e; --on-brand: #ffffff; --brand-soft: #e7efe7; --brand-ink: #1f3a24;
  --bg: #f3f5f1; --surface: #ffffff; --surface-2: #f8faf7; --line: #dde3da; --line-2: #ebefe8;
  --text: #1b241d; --muted: #5d6b60; --faint: #8a968c;
  --ok: #1e7a4c; --ok-soft: #e2f3e9; --warn: #9a5b05; --warn-soft: #fbf0dc; --bad: #b42318; --bad-soft: #fde9e7; --info: #285c87; --info-soft: #e5eef7;
  --shadow: 0 1px 2px rgba(27, 36, 29, .05), 0 6px 18px rgba(27, 36, 29, .05);
  --r: 10px;
  --f-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --logo: url('../assets/logo.png');
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #8fbf94; --brand-2: #a8d0ac; --on-brand: #0f1d12; --brand-soft: #22332546; --brand-ink: #cfe6d1;
    --bg: #121713; --surface: #1a201b; --surface-2: #161c17; --line: #2c362e; --line-2: #232b24;
    --text: #e4ebe4; --muted: #9aa89c; --faint: #6e7b70;
    --ok: #6fcf97; --ok-soft: #1c3326; --warn: #e5b45e; --warn-soft: #362a14; --bad: #f08a80; --bad-soft: #3a1d1a; --info: #8ab8e0; --info-soft: #1a2a3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --logo: url('../assets/logo-claro.png'); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #8fbf94; --brand-2: #a8d0ac; --on-brand: #0f1d12; --brand-soft: #22332546; --brand-ink: #cfe6d1;
  --bg: #121713; --surface: #1a201b; --surface-2: #161c17; --line: #2c362e; --line-2: #232b24;
  --text: #e4ebe4; --muted: #9aa89c; --faint: #6e7b70;
  --ok: #6fcf97; --ok-soft: #1c3326; --warn: #e5b45e; --warn-soft: #362a14; --bad: #f08a80; --bad-soft: #3a1d1a; --info: #8ab8e0; --info-soft: #1a2a3a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --logo: url('../assets/logo-claro.png'); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--f-body); font-size: 14px; line-height: 1.45; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { text-wrap: balance; }
.mono { font-family: var(--f-mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .mini { font-size: 12px; color: var(--muted); }
.logo { display: block; width: 168px; height: 25px; background: var(--logo) left center / contain no-repeat; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-card .logo { width: 210px; height: 31px; }
.login-card h1 { font-size: 20px; margin: 6px 0 0; font-weight: 600; }
.login-card p { margin: 0; color: var(--muted); }
.demo-users { display: grid; gap: 6px; }
.demo-users button { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.demo-users button:hover { border-color: var(--brand); background: var(--brand-soft); }
.demo-users h6 { margin: 8px 0 0; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); font-weight: 600; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 20px 18px 14px; display: grid; gap: 6px; }
.side .brand small { font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.nav { padding: 6px 10px; flex: 1; display: grid; align-content: start; gap: 1px; }
.nav h6 { margin: 14px 10px 4px; font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.nav a .ic { width: 18px; text-align: center; color: var(--muted); }
.nav a.on .ic { color: var(--brand); }
.nav a .cnt { margin-left: auto; font-size: 11px; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 0 7px; font-weight: 600; }
.side .who { padding: 14px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: grid; gap: 2px; }
.side .who b { color: var(--text); }
.side .who button { margin-top: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding-block: 14px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; flex-wrap: wrap; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.top h2 { font-size: 17px; margin: 0; flex: 1; font-weight: 600; min-width: 0; }
.top .burger { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; padding: 4px; }
.content { padding-block: 22px 60px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); max-width: 1440px; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.demo-band { background: var(--warn-soft); color: var(--warn); padding-block: 6px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); font-size: 12.5px; border-bottom: 1px solid var(--line); }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.card > h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; }
.card > .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; flex: 1; min-width: 0; }
.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)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 2px; }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .v { font-size: 21px; font-weight: 600; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 12px; }
.kpi.main { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.kpi.main .l, .kpi.main .s { color: var(--on-brand); opacity: .82; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
label.f { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; min-width: 0; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--surface); min-width: 0; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.btn { border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--brand-2); }
.btn.sec { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.sec:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.link { background: none; border: 0; color: var(--brand); padding: 2px 4px; text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 13px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand-soft); color: var(--brand-ink); }
.seg .c { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.msg { padding: 10px 14px; border-radius: 9px; font-size: 13px; }
.msg.err { background: var(--bad-soft); color: var(--bad); } .msg.ok { background: var(--ok-soft); color: var(--ok); } .msg.info { background: var(--info-soft); color: var(--info); } .msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg ul { margin: 4px 0 0 18px; padding: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

/* tablas */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 9px; max-width: 100%; }
.tbl-wrap.tall { max-height: 620px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t tr.click { cursor: pointer; }
table.t .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
table.t tr.off td { color: var(--muted); }
table.t tr.off td .amt { text-decoration: line-through; text-decoration-color: var(--faint); }
table.t tr.manual td:first-child { box-shadow: inset 3px 0 0 var(--info); }
.why { display: grid; gap: 2px; margin-top: 3px; }
.why span { font-size: 11.5px; }
.why .excluye { color: var(--bad); } .why .alerta { color: var(--warn); } .why .info { color: var(--muted); }
.who-cell b { display: block; font-weight: 500; }
.pagos-de { display: grid; gap: 2px; margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--line); }
.who-cell .mono { color: var(--muted); font-size: 11.5px; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 12.5px; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .t { width: 36px; height: 20px; background: var(--line); border-radius: 99px; position: relative; transition: .15s; flex: none; }
.switch .t::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); top: 3px; left: 3px; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .t { background: var(--ok); }
.switch input:checked + .t::after { left: 19px; }
.switch input:focus-visible + .t { outline: 2px solid var(--brand); outline-offset: 2px; }

/* revisión */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.stick { position: sticky; top: 78px; display: grid; gap: 14px; }
.sum { display: grid; gap: 0; }
.sum .ln { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-variant-numeric: tabular-nums; }
.sum .ln span:first-child { color: var(--muted); }
.sum .ln.tot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px; font-weight: 600; font-size: 15px; }
.sum .ln.tot span:first-child { color: var(--text); }
.sum h4 { margin: 12px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); font-weight: 600; }
.sum h4:first-child { margin-top: 0; }
.steps { display: flex; gap: 0; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.steps div { flex: 1 1 120px; padding: 8px 12px; font-size: 12px; color: var(--faint); display: grid; gap: 1px; border-right: 1px solid var(--line); }
.steps div:last-child { border-right: 0; }
.steps div b { font-weight: 600; font-size: 12.5px; }
.steps div.done { color: var(--ok); } .steps div.now { color: var(--brand-ink); background: var(--brand-soft); }

/* hoja de captura del SAT */
.sat { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sat header { background: var(--brand); color: var(--on-brand); padding: 9px 14px; font-weight: 600; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.sat header span { font-weight: 400; opacity: .85; font-size: 12px; margin-left: auto; }
.sat .fld { display: grid; grid-template-columns: minmax(0, 1fr) 150px 70px; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line-2); }
.sat .fld:last-child { border-bottom: 0; }
.sat .fld .v { font-family: var(--f-mono); text-align: right; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-variant-numeric: tabular-nums; }
.sat .fld.sel .v { text-align: left; font-family: var(--f-body); font-size: 12.5px; }
.sat .fld.res { background: var(--surface-2); font-weight: 600; }
.sat .grp { padding: 7px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line-2); }

.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 30px 20px; text-align: center; color: var(--muted); background: var(--surface); cursor: pointer; display: grid; gap: 6px; justify-items: center; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.drop b { font-size: 15px; color: var(--text); }
.chk-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.chk-list label { display: flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; color: var(--text); }
.chk-list input { width: auto; }
.mail { font-family: var(--f-body); white-space: pre-wrap; line-height: 1.55; min-height: 380px; font-size: 13px; }
.timeline { display: grid; gap: 0; }
.timeline .it { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.timeline .it:last-child { border-bottom: 0; }
.bar { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--brand); }
.doclist { display: grid; gap: 6px; }
.doc { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); flex-wrap: wrap; }
.doc .ico { width: 30px; height: 36px; border-radius: 4px; background: var(--bad-soft); color: var(--bad); font-size: 9.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.doc .meta { flex: 1; min-width: 0; display: grid; }
.doc .meta b { font-weight: 500; overflow-wrap: anywhere; }

/* modal y toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 22, 17, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.modal.wide { max-width: 980px; }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal header h3 { margin: 0; flex: 1; font-size: 15.5px; }
.modal header button { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal .body { padding: 16px 18px; display: grid; gap: 12px; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); right: max(20px, env(safe-area-inset-right, 0px)); background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 9px; z-index: 60; box-shadow: var(--shadow); max-width: min(420px, calc(100vw - 40px)); }
.toast.err { background: var(--bad); color: #fff; }

@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .stick { position: static; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; width: 260px; left: -270px; transition: left .2s; box-shadow: var(--shadow); padding-top: env(safe-area-inset-top, 0px); }
  .side.open { left: 0; }
  .top .burger { display: block; }
  .content, .top, .demo-band { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .g3, .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sat .fld { grid-template-columns: minmax(0, 1fr) 120px 60px; }
  .timeline .it { grid-template-columns: minmax(0, 1fr) auto; }
  .timeline .it > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; }
  .sat .fld { grid-template-columns: minmax(0, 1fr) auto; }
  .sat .fld .cp { grid-column: 2; }
}
