/* Sistema de Cobro de Tasas — GAMR (demo) */
:root {
  /* Verde Beni y dorado del Gobierno Autónomo Municipal de Riberalta */
  --brand: #0e5a24;
  --brand-strong: #083f18;
  --brand-deep: #052a10;
  --brand-soft: #ecf4e8;
  --brand-line: #cbe0c3;
  --gold: #c8961c;
  --gold-strong: #8f6610;
  --gold-light: #f4d14e;
  --gold-soft: #fbf4e0;
  --gold-line: #ecd9a4;
  --lib: #5a54a2;
  --lib-soft: #efedf9;
  --ink: #15241a;
  --ink-2: #405046;
  --muted: #6b786f;
  --line: #e2e7dd;
  --bg: #f5f7f1;
  --card: #fff;
  --ok: #12804a; --ok-bg: #e5f5ec;
  --warn: #9a5b00; --warn-bg: #fff3da;
  --err: #b93224; --err-bg: #fdebe8;
  --info: #2f5bd3; --info-bg: #e9effd;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(21, 36, 26, 0.05), 0 6px 20px rgba(21, 36, 26, 0.05);
  /* Superficies y estados (se redefinen en modo oscuro) */
  --fill: #eff2ec;
  --fill-2: #ebefe7;
  --hover: #f8faf4;
  --subtle: #fbfcf8;
  --line-strong: #d3dbcd;
  --placeholder: #a5afa2;
  --link: #0e5a24;
  --brand-hover: #083f18;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --toast-bg: #15241a;
  --err-line: #f0c6bf;
  --warn-soft: #fffaf0;
  --overlay: rgba(15, 25, 22, 0.42);
  --serie-efectivo: #1baf7a;
  --serie-qr: #6250d6;
  color-scheme: light;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: calc(244px * var(--letra, 1));
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: calc(14.5px * var(--letra, 1)); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--link); }
[hidden] { display: none !important; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.r { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: calc(12.5px * var(--letra, 1)); }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spin { animation: girar 0.8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes aparecer { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-brand { position: relative; overflow: hidden; padding: 44px 48px 40px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  background: radial-gradient(720px 420px at 105% -5%, rgba(236, 178, 28, 0.22) 0%, transparent 60%), radial-gradient(640px 420px at -15% 115%, rgba(31, 128, 58, 0.55) 0%, transparent 62%), linear-gradient(160deg, var(--brand-deep) 0%, #0a4419 48%, var(--brand) 100%); }
.login-brand::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, var(--gold-strong), var(--gold-light) 50%, var(--gold-strong)); }
.login-hero { max-width: 620px; }
.banner-aniv { margin: 0 0 26px; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 22px 44px rgba(2, 18, 6, 0.45), 0 0 0 1px rgba(244, 209, 78, 0.55); }
.banner-aniv img { display: block; width: 100%; height: auto; aspect-ratio: 1600 / 609; }
.login-brand h1 em { font-style: normal; color: var(--gold-light); }
.login-brand h1 { font-size: calc(40px * var(--letra, 1)); max-width: 520px; }
.login-brand p { color: rgba(255,255,255,0.82); font-size: calc(16px * var(--letra, 1)); max-width: 480px; margin-top: 14px; }
.login-brand ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.login-brand li { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,0.9); }
.login-brand li svg { width: 18px; height: 18px; flex: none; color: var(--gold-light); }
.login-brand .escudo { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: 0.02em; }
.login-brand .escudo span { width: 42px; height: 42px; border-radius: 12px; background: rgba(244, 209, 78, 0.12); color: var(--gold-light); box-shadow: inset 0 0 0 1px rgba(244, 209, 78, 0.45); display: grid; place-items: center; font-family: var(--display); font-weight: 700; }
.login-brand .powered { display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--letra, 1)); color: rgba(255,255,255,0.75); }
.login-brand .powered img { height: 18px; filter: brightness(0) invert(1); opacity: 0.9; }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: calc(24px * var(--letra, 1)); }
.login-card .card-sub { margin: 6px 0 22px; }
.demo-users { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.demo-users button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); font: inherit; cursor: pointer; text-align: left; }
.demo-users button:hover { border-color: var(--brand-line); background: var(--brand-soft); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sb-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.sb-head .ent { display: flex; gap: 10px; align-items: center; }
.sb-head .ent span { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(150deg, #083f18, #0e5a24); color: var(--gold-light); box-shadow: inset 0 0 0 1px rgba(244, 209, 78, 0.45); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: calc(14px * var(--letra, 1)); flex: none; }
.sb-head strong { display: block; font-size: calc(13.5px * var(--letra, 1)); line-height: 1.25; }
.sb-head small { color: var(--muted); font-size: calc(12px * var(--letra, 1)); }
.sb-nav { padding: 12px 10px; flex: 1; }
.sb-nav .grupo { font-size: calc(11px * var(--letra, 1)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 14px 10px 6px; }
.sb-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.sb-nav a svg { width: 18px; height: 18px; flex: none; }
.sb-nav a:hover { background: var(--bg); color: var(--ink); }
.sb-nav a.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.sb-nav a kbd { margin-left: auto; }
.sb-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: calc(12px * var(--letra, 1)); color: var(--muted); }
.sb-foot img { height: 15px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 58px; display: flex; align-items: center; gap: 14px; padding: 7px 24px; background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 68%, var(--gold) 68%, var(--gold-light) 100%) top / 100% 3px no-repeat, var(--topbar-bg); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: calc(17px * var(--letra, 1)); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .grow { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 5px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; font: inherit; color: var(--ink); min-width: 0; flex: 0 1 auto; text-align: right; line-height: 1.15; }
.user-chip > div { min-width: 0; }
.user-chip strong, .user-chip small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .av { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: calc(12px * var(--letra, 1)); font-weight: 700; }
.user-chip small { display: block; color: var(--muted); font-size: calc(11.5px * var(--letra, 1)); line-height: 1.1; }
.user-chip strong { font-size: calc(13px * var(--letra, 1)); line-height: 1.1; }
.dropdown { position: absolute; right: 24px; top: calc(100% - 2px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(21,36,26,0.12); min-width: 220px; padding: 6px; z-index: 30; animation: aparecer 0.15s; }
.dropdown button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: none; font: inherit; border-radius: 8px; cursor: pointer; text-align: left; color: var(--ink); }
.dropdown button:hover { background: var(--bg); }
.dropdown svg { width: 16px; height: 16px; }
.contenido { padding: 24px; max-width: 1320px; width: 100%; margin: 0 auto; animation: aparecer 0.2s; }

.env { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: calc(11.5px * var(--letra, 1)); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.env::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.env-simulacion { background: var(--info-bg); color: var(--info); }
.env-pruebas { background: var(--warn-bg); color: var(--warn); }
.env-produccion { background: var(--ok-bg); color: var(--ok); }

kbd { font-family: var(--mono); font-size: calc(11px * var(--letra, 1)); padding: 1px 6px; border-radius: 5px; background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; color: var(--ink-2); }

/* ---------- Componentes ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-size: calc(24px * var(--letra, 1)); }
.page-head p { color: var(--muted); margin-top: 3px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title h3 { font-size: calc(16px * var(--letra, 1)); }
.card-sub { color: var(--muted); font-size: calc(13px * var(--letra, 1)); }
.grid { display: grid; gap: 18px; }
.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)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.g-caja { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.sticky { position: sticky; top: calc(58px * var(--letra, 1) + 18px); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stack > * + * { margin-top: 12px; }
.hr { height: 1px; background: var(--line); margin: 16px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: calc(13.5px * var(--letra, 1)); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(14,90,36,0.28); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-strong); }
.btn-secondary:hover { background: var(--brand-line); }
.btn-outline { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { background: var(--bg); border-color: var(--line-strong); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--card); color: var(--err); border-color: var(--err-line); }
.btn-danger:hover { background: var(--err-bg); }
.btn-danger-solid { background: var(--err); color: #fff; }
.btn-lib { background: var(--lib); color: #fff; box-shadow: 0 4px 12px rgba(90,84,162,0.25); }
.btn-lib:hover { filter: brightness(0.93); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { filter: brightness(0.94); }
.btn-lg { height: 48px; font-size: calc(15px * var(--letra, 1)); padding: 0 20px; border-radius: 11px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: calc(12.5px * var(--letra, 1)); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icon-btn { width: 32px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > label, .label { font-size: calc(12.5px * var(--letra, 1)); font-weight: 600; color: var(--ink-2); }
.hint { font-size: calc(12px * var(--letra, 1)); color: var(--muted); }
.input, .select, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
textarea.input { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input[readonly] { background: var(--bg); color: var(--ink-2); }
.input.err { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }

/* Desplegable con buscador (reemplaza al <select> nativo) */
.dd-nativo { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; opacity: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; pointer-events: none !important; border: 0 !important; }
.dd-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.dd-btn .dd-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn > svg { width: 16px; height: 16px; flex: none; color: var(--muted); transition: transform 0.15s; }
.dd-btn:hover:not(:disabled) { border-color: var(--line-strong); }
.dd-btn.abierto { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.dd-btn.abierto > svg { transform: rotate(180deg); color: var(--brand); }
.dd-btn:disabled { background: var(--bg); color: var(--ink-2); cursor: not-allowed; }
.dd-btn:disabled > svg { opacity: 0.4; }
.toolbar .dd-btn { max-width: 300px; }
.dd-panel { position: fixed; z-index: 80; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px rgba(15, 25, 22, 0.16), 0 2px 6px rgba(15, 25, 22, 0.06); overflow: hidden; animation: aparecer 0.12s ease; }
.dd-buscar { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); flex: none; }
.dd-buscar svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.dd-buscar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: calc(14px * var(--letra, 1)); color: var(--ink); }
.dd-buscar input::placeholder { color: var(--placeholder); }
.dd-lista { flex: 1; min-height: 0; overflow-y: auto; padding: 5px; overscroll-behavior: contain; }
.dd-op { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: calc(13.5px * var(--letra, 1)); color: var(--ink); line-height: 1.3; }
.dd-op.activa { background: var(--brand-soft); }
.dd-op.sel { color: var(--brand-strong); font-weight: 600; }
.dd-op.hijo { padding-left: 26px; }
.dd-op .chk { width: 16px; flex: none; display: grid; place-items: center; color: var(--brand); }
.dd-op .chk svg { width: 15px; height: 15px; }
.dd-op .txt { flex: 1; min-width: 0; }
.dd-op .cod { font-family: var(--mono); font-size: calc(12px * var(--letra, 1)); color: var(--muted); margin-right: 8px; font-weight: 400; }
.dd-op .sub { flex: none; font-size: calc(12px * var(--letra, 1)); color: var(--muted); font-weight: 400; white-space: nowrap; }
.dd-op[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.dd-vacio { padding: 16px; text-align: center; color: var(--muted); font-size: calc(13px * var(--letra, 1)); }
.input-lg { height: 52px; font-size: calc(22px * var(--letra, 1)); font-family: var(--display); font-weight: 700; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: calc(13.5px * var(--letra, 1)); background: var(--card); }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; }
.switch strong { display: block; font-size: calc(13.5px * var(--letra, 1)); }
.switch small { color: var(--muted); font-size: calc(12px * var(--letra, 1)); }
.switch input { appearance: none; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background 0.2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.2s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--fill-2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; font: inherit; font-size: calc(13px * var(--letra, 1)); font-weight: 600; color: var(--ink-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font: inherit; font-size: calc(13px * var(--letra, 1)); font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip small { opacity: 0.75; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: calc(11.5px * var(--letra, 1)); font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-emitido { background: var(--warn-bg); color: var(--warn); }
.st-pagado { background: var(--ok-bg); color: var(--ok); }
.st-anulado { background: var(--fill); color: var(--ink-2); }
.st-cerrado { background: var(--info-bg); color: var(--info); }
.st-con_diferencias { background: var(--err-bg); color: var(--err); }
.st-revisado { background: var(--ok-bg); color: var(--ok); }
.st-pendiente, .st-registrando { background: var(--warn-bg); color: var(--warn); }
.st-vencido, .st-reemplazado { background: var(--fill); color: var(--ink-2); }
.st-fallido { background: var(--err-bg); color: var(--err); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: calc(11px * var(--letra, 1)); font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--fill); color: var(--ink-2); white-space: nowrap; }
.tag-tasa { background: #e6f1e2; color: #155c2b; }
.tag-patente { background: #e9effd; color: #2948a8; }
.tag-multa { background: #fdebe8; color: #a12c20; }
.tag-alquiler { background: #fff3da; color: #85500a; }
.tag-venta { background: #efedf9; color: #4a438f; }
.tag-otro { background: var(--fill); color: var(--ink-2); }
.tag-var { background: #fff3da; color: #85500a; }
.tag-qr { background: var(--lib-soft); color: var(--lib); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); font-size: calc(13.5px * var(--letra, 1)); }
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-info { background: var(--info-bg); color: #25458f; }
.alert-warn { background: var(--warn-bg); color: #774500; }
.alert-err { background: var(--err-bg); color: #8f2419; }
.alert-ok { background: var(--ok-bg); color: #0d5f37; }
.alert a { color: inherit; font-weight: 600; }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: calc(11.5px * var(--letra, 1)); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--display); font-size: calc(26px * var(--letra, 1)); font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: calc(12.5px * var(--letra, 1)); color: var(--muted); margin-top: 2px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: calc(13.5px * var(--letra, 1)); }
th { text-align: left; font-size: calc(11.5px * var(--letra, 1)); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--subtle); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
tfoot td { font-weight: 700; background: var(--subtle); }
td.r, th.r { text-align: right; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: calc(15px * var(--letra, 1)); margin-bottom: 4px; }
.empty .ico { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 15px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty .ico svg { width: 26px; height: 26px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar .input, .toolbar .select { height: 34px; width: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: calc(13.5px * var(--letra, 1)); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 22px; font-size: calc(13px * var(--letra, 1)); }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-line); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li.t-pagado::before { background: var(--ok); }
.timeline li.t-anulado::before, .timeline li.t-incidencia::before, .timeline li.t-qr_fallido::before { background: var(--err); }
.timeline li.t-reimpreso::before { background: var(--warn); }
.timeline li.t-qr_generado::before, .timeline li.t-callback::before { background: var(--lib); }
.timeline time { display: block; font-size: calc(11.5px * var(--letra, 1)); color: var(--muted); }
.timeline .det { display: block; color: var(--muted); font-size: calc(12.5px * var(--letra, 1)); }

/* ---------- Modal y panel lateral ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 50; display: grid; place-items: center; padding: 16px; animation: aparecer 0.15s; }
.modal { background: var(--card); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal.lg { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: calc(17px * var(--letra, 1)); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.drawer-bg { position: fixed; inset: 0; background: rgba(15,25,22,0.35); z-index: 40; animation: aparecer 0.15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,0.15); animation: entrar 0.2s ease; }
@keyframes entrar { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(460px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 11px 15px; border-radius: 11px; background: var(--toast-bg); color: #fff; font-size: calc(13.5px * var(--letra, 1)); box-shadow: 0 10px 30px rgba(0,0,0,0.25); animation: aparecer 0.2s; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }
.toast svg { width: 17px; height: 17px; flex: none; }

/* ---------- Inicio ---------- */
.saludo h2 { font-size: calc(24px * var(--letra, 1)); }
.flujo { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.flujo .paso { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: relative; }
.flujo .paso .n { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; font-size: calc(13px * var(--letra, 1)); margin-bottom: 8px; }
.flujo .paso h4 { font-size: calc(14px * var(--letra, 1)); }
.flujo .paso p { font-size: calc(12.5px * var(--letra, 1)); color: var(--muted); margin-top: 3px; }
.accesos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.acceso { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.1s; }
.acceso:hover { border-color: var(--brand-line); transform: translateY(-1px); }
.acceso .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.acceso .ico svg { width: 21px; height: 21px; }
.acceso strong { display: block; }
.acceso small { color: var(--muted); }

/* ---------- Emitir FUC ---------- */
.f-keys { display: flex; flex-wrap: wrap; gap: 14px; font-size: calc(12.5px * var(--letra, 1)); color: var(--muted); }
.f-keys span { display: inline-flex; gap: 6px; align-items: center; }
.reloj { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }
.buscador { position: relative; }
.buscador .input { padding-left: 36px; height: 42px; }
.buscador > svg { position: absolute; left: 11px; top: 12px; width: 18px; height: 18px; color: var(--muted); }
.sugerencias { position: absolute; left: 0; right: 0; top: 46px; z-index: 15; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,0.12); max-height: 360px; overflow-y: auto; padding: 4px; }
.sug-grupo { font-size: calc(11px * var(--letra, 1)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px 4px; }
.sug { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.sug:hover, .sug.sel { background: var(--brand-soft); }
.sug .cod { font-family: var(--mono); font-size: calc(12px * var(--letra, 1)); color: var(--muted); }
.sug .nom { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.items td { padding: 8px 8px; }
.items .input { height: 34px; }
.items .monto-in { width: 110px; text-align: right; }
.items .cant-in { width: 76px; text-align: right; }
.items tr.falta td { background: var(--warn-soft); }
.items .desc strong { display: block; font-weight: 600; }
.items .desc small { color: var(--muted); }
.total-box { text-align: center; padding: 6px 0 14px; }
.total-box .lbl { font-size: calc(12px * var(--letra, 1)); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.total-box .val { font-family: var(--display); font-size: calc(38px * var(--letra, 1)); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
.total-box .lit { font-size: calc(12px * var(--letra, 1)); color: var(--ink-2); margin-top: 6px; }
.checklist { list-style: none; padding: 0; margin: 0 0 14px; font-size: calc(13px * var(--letra, 1)); display: grid; gap: 6px; }
.checklist li { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.checklist li svg { width: 15px; height: 15px; }
.checklist li.ok { color: var(--ok); }
.checklist li.no { color: var(--warn); }

/* Vista previa del FUC (en pantalla) */
.fuc-prev { border: 1.5px solid #222; border-radius: 6px; font-size: calc(12.5px * var(--letra, 1)); color: #111; background: #fff; }
.fuc-prev .cab { display: grid; grid-template-columns: 1fr 1.4fr 1fr; border-bottom: 1.5px solid #222; }
.fuc-prev .cab > div { padding: 8px 10px; }
.fuc-prev .cab > div + div { border-left: 1.5px solid #222; }
.fuc-prev .tit { font-family: var(--mono); font-weight: 700; font-size: calc(14px * var(--letra, 1)); display: grid; place-items: center; text-align: center; letter-spacing: 0.04em; }
.fuc-prev .lin { padding: 6px 10px; border-bottom: 1px solid #222; }
.fuc-prev table { font-size: calc(12px * var(--letra, 1)); }
.fuc-prev th { background: none; color: #111; border-bottom: 1px solid #222; font-size: calc(11px * var(--letra, 1)); }
.fuc-prev td { border-bottom: 1px dotted #bbb; padding: 5px 8px; }
.fuc-prev .son { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-top: 1.5px solid #222; font-weight: 700; }

/* ---------- Caja ---------- */
.caja-buscar { display: flex; gap: 10px; align-items: stretch; }
.caja-buscar .input { height: 52px; font-size: calc(22px * var(--letra, 1)); font-family: var(--display); font-weight: 700; max-width: 240px; }
.cobro-total { text-align: center; padding: 6px 0 16px; }
.cobro-total .val { font-family: var(--display); font-size: calc(40px * var(--letra, 1)); font-weight: 700; font-variant-numeric: tabular-nums; }
.cambio { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg); font-size: calc(15px * var(--letra, 1)); margin: 12px 0; }
.cambio strong { font-family: var(--display); font-size: calc(22px * var(--letra, 1)); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6px 0 4px; }
.qr-frame { position: relative; padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(90,84,162,0.14); }
.qr-frame img, .qr-frame svg { display: block; width: 220px; height: 220px; object-fit: contain; }
.qr-frame .ribbon { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); background: var(--info); color: #fff; font-size: calc(10.5px * var(--letra, 1)); font-weight: 700; letter-spacing: 0.06em; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.waiting { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: calc(13px * var(--letra, 1)); color: var(--muted); margin: 10px 0; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); animation: pulso 1.6s infinite; }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(154,91,0,0.5); } 70% { box-shadow: 0 0 0 10px rgba(154,91,0,0); } 100% { box-shadow: 0 0 0 0 rgba(154,91,0,0); } }
.check-ok { width: 74px; height: 74px; margin: 4px auto 12px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
.check-ok svg { width: 38px; height: 38px; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lib-head { display: flex; align-items: center; gap: 8px; font-size: calc(12.5px * var(--letra, 1)); color: var(--muted); }
.lib-head img { height: 15px; }
pre.code { margin: 0; max-height: 300px; overflow: auto; padding: 12px; border-radius: var(--radius-sm); background: #15241a; color: #e5ece1; font-family: var(--mono); font-size: calc(11.5px * var(--letra, 1)); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
details.box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--subtle); }
details.box > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: calc(13px * var(--letra, 1)); }
details.box > div { padding: 0 12px 12px; }

/* ---------- Reportes ---------- */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 110px; gap: 10px; align-items: center; font-size: calc(12.5px * var(--letra, 1)); }
.bar-track { display: flex; height: 20px; border-radius: 5px; background: var(--fill); overflow: hidden; }
.bar-track span { display: block; height: 100%; }
.bar-track span + span { border-left: 2px solid var(--card); }
.leyenda { display: flex; gap: 14px; font-size: calc(12.5px * var(--letra, 1)); color: var(--ink-2); flex-wrap: wrap; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Plantillas ---------- */
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pl-card { display: flex; flex-direction: column; }
.pl-grid > .card + .card { margin-top: 0; }
.cab-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.cab-doc { grid-template-columns: 150px 170px 110px minmax(0, 1fr); }
.input:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.pl-card ul { list-style: none; padding: 0; margin: 10px 0 12px; font-size: calc(13px * var(--letra, 1)); display: grid; gap: 5px; flex: 1; }
.pl-card li { display: flex; justify-content: space-between; gap: 10px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 45; width: var(--sidebar); transform: translateX(-100%); visibility: hidden; transition: transform 0.2s, visibility 0s linear 0.2s; }
  .sidebar.abierto { transform: none; visibility: visible; transition: transform 0.2s; box-shadow: 10px 0 30px rgba(0,0,0,0.15); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 28px 22px; }
  .login-brand h1 { font-size: calc(28px * var(--letra, 1)); }
  .login-brand ul { display: none; }
  .contenido { padding: 16px; }
  .topbar { padding: 7px 14px; }
  .user-chip > div { display: none; }
}

/* ---------- Páginas del contribuyente (portal, link de pago, comprobante) ---------- */
.pub { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.pub-top { background: radial-gradient(420px 220px at 100% 0%, rgba(236, 178, 28, 0.2) 0%, transparent 65%), linear-gradient(160deg, var(--brand-deep) 0%, #0a4419 50%, var(--brand) 100%); color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
.pub-top-in { max-width: 600px; margin: 0 auto; padding: 18px 16px 54px; display: flex; align-items: center; gap: 12px; }
.pub-top .escudo { width: 44px; height: 44px; border-radius: 12px; background: rgba(244, 209, 78, 0.12); color: var(--gold-light); box-shadow: inset 0 0 0 1px rgba(244, 209, 78, 0.45); display: grid; place-items: center; font-family: var(--display); font-weight: 700; flex: none; }
.pub-top strong { display: block; font-size: calc(15px * var(--letra, 1)); line-height: 1.25; }
.pub-top small { color: rgba(255,255,255,0.8); font-size: calc(12.5px * var(--letra, 1)); }
.pub-main { width: 100%; max-width: 600px; margin: -38px auto 0; padding: 0 16px 28px; flex: 1; }
.pub-main > .card + .card { margin-top: 14px; }
.pub-banner { margin: 0 0 14px; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 12px 30px rgba(5, 42, 16, 0.22), 0 0 0 1px rgba(200, 150, 28, 0.45); }
.pub-banner img { display: block; width: 100%; height: auto; aspect-ratio: 1600 / 609; }
.pub-pie { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px 16px 26px; color: var(--muted); font-size: calc(12.5px * var(--letra, 1)); }
.pub-pie img { height: 16px; }
.pub-titulo { font-size: calc(20px * var(--letra, 1)); margin-bottom: 4px; }
.pub-monto { font-family: var(--display); font-size: calc(38px * var(--letra, 1)); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pasos { display: flex; gap: 6px; margin-bottom: 16px; }
.pasos span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.pasos span.on { background: var(--brand); }
.tramite { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.tramite + .tramite { margin-top: 8px; }
.tramite:hover { border-color: var(--brand-line); background: var(--hover); }
.tramite.sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.tramite .grow { flex: 1; min-width: 0; }
.tramite strong { display: block; font-size: calc(14.5px * var(--letra, 1)); }
.tramite small { color: var(--muted); font-size: calc(12.5px * var(--letra, 1)); }
.tramite .precio { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.resumen-pago { border: 1px dashed var(--brand-line); background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; }
.resumen-pago table td { border: 0; padding: 3px 0; }
.codigo-comp { font-family: var(--mono); font-size: calc(30px * var(--letra, 1)); font-weight: 700; letter-spacing: 0.12em; text-align: center; padding: 14px 10px; border: 2px dashed var(--brand); border-radius: 14px; background: var(--brand-soft); color: var(--brand-strong); word-break: break-all; }
.comp-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.comp-cab strong { font-family: var(--display); letter-spacing: 0.04em; font-size: calc(14px * var(--letra, 1)); }
.share-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.share-row .btn { min-width: 0; white-space: normal; text-align: center; line-height: 1.2; height: auto; min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
.btn-wa { background: #1f9d55; color: #fff; }
.btn-wa:hover { filter: brightness(0.95); }
@media print {
  .pub-banner { display: none !important; }
  :root[data-tema="oscuro"] { --bg: #fff; --card: #fff; --ink: #15241a; --ink-2: #405046; --muted: #6b786f; --line: #e2e7dd; --brand-soft: #ecf4e8; --brand-strong: #083f18; --fill: #eff2ec; --ok: #12804a; --ok-bg: #e5f5ec; --warn: #9a5b00; --warn-bg: #fff3da; color-scheme: light; }
  .pub-top, .pub-pie, .no-print, .toasts { display: none !important; }
  .pub { background: #fff; }
  .pub-main { margin: 0; max-width: none; padding: 0; }
  .pub-main .card { box-shadow: none; border-color: #999; }
}

/* ---------- Links de pago y canje (personal) ---------- */
.tag-linea { background: #e6f0fb; color: #1f5a96; }
.tag-canje { background: #fff3da; color: #85500a; }
.tag-ok { background: #e6f1e2; color: #155c2b; }
.timeline li.t-link::before, .timeline li.t-comprobante::before, .timeline li.t-canjeado::before { background: #1f5a96; }
.enviar-link { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--ink-2); font-size: calc(13px * var(--letra, 1)); }
.enviar-link svg { width: 16px; height: 16px; flex: none; }
.enviar-link span { flex: 1; }
.canje-box { margin-top: 14px; text-align: center; }
.canje-box .codigo-comp { font-size: calc(26px * var(--letra, 1)); margin: 6px 0; }
.link-url { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: calc(12px * var(--letra, 1)); color: var(--ink-3); }
.st-activo { background: #e6f1e2; color: #155c2b; }
.st-pausado, .st-agotado { background: var(--fill); color: var(--ink-2); }
.st-vencido { background: #fdebe8; color: #a12c20; }
.portal-card { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.portal-card code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico-sq { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); flex: none; }
.ico-sq svg { width: 20px; height: 20px; }
.msg-wa { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--hover); overflow: hidden; }
.msg-wa-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--line); }
.msg-wa pre { margin: 0; padding: 10px 12px; font-family: inherit; font-size: calc(13px * var(--letra, 1)); line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--ink); max-height: 180px; overflow: auto; }
.btn.copiado { color: var(--ok); border-color: var(--ok); }
.st-abierta { background: var(--warn-bg); color: var(--warn); }
.st-sin_cierre { background: var(--err-bg); color: var(--err); }
.st-sin_movimiento { background: var(--fill); color: var(--ink-2); }

/* ---------- Modo oscuro (data-tema="oscuro", lo fija /js/tema.js según preferencia o sistema) ---------- */
:root[data-tema="oscuro"] {
  color-scheme: dark;
  --brand: #23803e;
  --brand-strong: #a6e0b4;
  --brand-hover: #1d6f35;
  --brand-deep: #03170a;
  --brand-soft: #16301f;
  --brand-line: #2c5638;
  --gold: #d8a62a;
  --gold-strong: #e8c35c;
  --gold-soft: #2c2511;
  --gold-line: #5b4a1d;
  --lib: #a69ff0;
  --lib-soft: #25223f;
  --ink: #e5eee7;
  --ink-2: #b9c7bd;
  --muted: #8e9d92;
  --line: #25362b;
  --line-strong: #3a4e40;
  --bg: #0b130e;
  --card: #121d16;
  --fill: #1b2a20;
  --fill-2: #18251c;
  --hover: #17241c;
  --subtle: #142019;
  --placeholder: #6d7c71;
  --link: #86d39d;
  --ok: #63cf8f; --ok-bg: #12301e;
  --warn: #f1b54f; --warn-bg: #33270e; --warn-soft: #2a220f;
  --err: #f3897b; --err-bg: #3a1915; --err-line: #6b2b23;
  --info: #94b2ff; --info-bg: #19233f;
  --topbar-bg: rgba(14, 22, 17, 0.88);
  --toast-bg: #26392c;
  --overlay: rgba(0, 0, 0, 0.62);
  --serie-efectivo: #2cc58c;
  --serie-qr: #8f80f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.22);
}
[data-tema="oscuro"] .tag-tasa, [data-tema="oscuro"] .tag-ok, [data-tema="oscuro"] .st-activo { background: #173322; color: #8fdca6; }
[data-tema="oscuro"] .tag-patente { background: #1b2546; color: #9db6ff; }
[data-tema="oscuro"] .tag-multa, [data-tema="oscuro"] .st-vencido { background: #3a1915; color: #f3a397; }
[data-tema="oscuro"] .tag-alquiler, [data-tema="oscuro"] .tag-var, [data-tema="oscuro"] .tag-canje { background: #33270e; color: #f1c26e; }
[data-tema="oscuro"] .tag-venta { background: #25223f; color: #b9b1f5; }
[data-tema="oscuro"] .tag-linea { background: #172a40; color: #8cc0f2; }
[data-tema="oscuro"] .alert-info { color: #b3c8ff; }
[data-tema="oscuro"] .alert-warn { color: #f3cc85; }
[data-tema="oscuro"] .alert-err { color: #f6b0a6; }
[data-tema="oscuro"] .alert-ok { color: #9be0b3; }
[data-tema="oscuro"] .timeline li.t-link::before, [data-tema="oscuro"] .timeline li.t-comprobante::before, [data-tema="oscuro"] .timeline li.t-canjeado::before { background: #5aa0e6; }
[data-tema="oscuro"] .seg button.active { background: #26392c; }
[data-tema="oscuro"] .btn-primary { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
[data-tema="oscuro"] .btn-lib { color: #15112e; }
[data-tema="oscuro"] pre.code { background: #070d09; border: 1px solid var(--line); }
[data-tema="oscuro"] .sb-foot img, [data-tema="oscuro"] .pub-pie img, [data-tema="oscuro"] .lib-head img { filter: brightness(0) invert(1); opacity: 0.85; }
[data-tema="oscuro"] .banner-aniv, [data-tema="oscuro"] .pub-banner { box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(216, 166, 42, 0.5); }
[data-tema="oscuro"] .qr-frame { border-color: transparent; }
[data-tema="oscuro"] .fuc-prev { box-shadow: 0 0 0 4px var(--card); }

/* Botón claro/oscuro */
.tema-btn svg { width: 18px; height: 18px; }
.login-form { position: relative; }
.login-tema { position: absolute; top: 16px; right: 16px; display: flex; align-items: center; gap: 8px; }
.pub-acc { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.pub-top-in .tema-btn { color: #fff; background: rgba(255, 255, 255, 0.1); }
.pub-top-in .letra-btns { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.18); }
.pub-top-in .letra-btns button { color: #fff; }
.pub-top-in .letra-btns button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.pub-top-in .letra-val { display: none; }
.pub-top-in .tema-btn:hover { background: rgba(255, 255, 255, 0.18); }
.tema-opc { padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.tema-opc .label { display: block; margin-bottom: 6px; }
.tema-opc .seg { display: flex; }
.tema-opc .seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 8px; }
.tema-opc .seg svg { width: 14px; height: 14px; }
[data-tema="oscuro"] .btn-ok { color: #06240f; }
[data-tema="oscuro"] .btn-ok:hover { filter: brightness(1.06); }

/* ---------- Diseño de documentos (editor) ---------- */
.g-diseno { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 18px; align-items: start; }
.g-diseno > .card + .card { margin-top: 0; }
.vista-card { position: sticky; top: calc(58px * var(--letra, 1) + 18px); }
.vista-doc { border-radius: 10px; overflow: hidden; background: #e6e9e4; border: 1px solid var(--line); }
.vista-doc iframe { display: block; width: 100%; height: 520px; border: 0; background: #e6e9e4; }
.pl-ops { display: grid; gap: 8px; }
.pl-op { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px 10px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.pl-op:hover { border-color: var(--brand-line); }
.pl-op.sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pl-op:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 2px; }
.pl-op .grow { flex: 1; min-width: 0; }
.pl-op strong { display: flex; align-items: center; gap: 6px; font-size: calc(13.5px * var(--letra, 1)); }
.pl-op small { display: block; color: var(--muted); font-size: calc(12px * var(--letra, 1)); line-height: 1.35; margin-top: 2px; }
.pl-check { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.pl-check svg { width: 13px; height: 13px; }
/* Miniaturas de plantilla */
.mini { position: relative; width: 50px; height: 64px; flex: none; border-radius: 5px; background: #fff; border: 1px solid #d5dbd2; overflow: hidden; }
.mini i { position: absolute; display: block; }
.mini-clasico i:nth-child(1) { left: 5px; right: 5px; top: 6px; height: 9px; border: 1px solid #333; }
.mini-clasico i:nth-child(2) { left: 5px; right: 5px; top: 18px; height: 1px; background: #333; box-shadow: 0 5px 0 #333, 0 10px 0 #999, 0 15px 0 #999, 0 20px 0 #999; }
.mini-clasico i:nth-child(3) { left: 5px; right: 5px; top: 6px; bottom: 6px; border: 1px solid #333; }
.mini-clasico i:nth-child(4) { right: 8px; bottom: 9px; width: 13px; height: 10px; border: 1px solid #0e5a24; border-radius: 2px; transform: rotate(-6deg); }
.mini-certificado i:nth-child(1) { left: 0; right: 0; top: 0; height: 14px; background: #0e5a24; border-bottom: 2px solid #c8961c; }
.mini-institucional i:nth-child(1) { left: 5px; right: 5px; top: 15px; height: 3px; border-top: 1.5px solid #0e5a24; border-bottom: 1px solid #c8961c; }
.mini-institucional i:nth-child(2) { left: 6px; right: 6px; top: 21px; height: 2px; background: #c9d2c6; box-shadow: 0 5px 0 #c9d2c6, 0 10px 0 #e3e8e0, 0 15px 0 #e3e8e0, 0 20px 0 #e3e8e0; }
.mini-institucional i:nth-child(3) { right: 6px; bottom: 7px; width: 16px; height: 8px; border: 1px solid #0e5a24; border-radius: 2px; }
.mini-institucional i:nth-child(4) { left: 5px; top: 5px; width: 8px; height: 8px; border-radius: 2px; border: 1px solid #0e5a24; }
.mini-institucional i:nth-child(5) { right: 5px; top: 6px; width: 12px; height: 4px; background: #0e5a24; border-radius: 1px; }
.mini-ticket { width: 30px; margin: 0 10px; border-radius: 2px; }
.mini-ticket i:nth-child(1) { left: 5px; right: 5px; top: 6px; height: 2px; background: #333; }
.mini-ticket i:nth-child(2) { left: 4px; right: 4px; top: 13px; border-top: 1px dashed #777; }
.mini-ticket i:nth-child(3) { left: 5px; right: 5px; top: 18px; height: 1px; background: #999; box-shadow: 0 4px 0 #999, 0 8px 0 #999, 0 12px 0 #999, 0 16px 0 #999; }
.mini-ticket i:nth-child(4) { left: 4px; right: 4px; bottom: 9px; border-top: 2px double #333; }
.mini-ticket i:nth-child(5) { left: 8px; right: 8px; bottom: 3px; height: 4px; border: 1px solid #0e5a24; }
.mini-tarjeta { background: #f5f7f1; }
.mini-tarjeta i:nth-child(1) { left: 4px; right: 4px; top: 6px; bottom: 6px; background: #fff; border-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.mini-tarjeta i:nth-child(2) { left: 9px; right: 9px; top: 15px; height: 9px; border: 1px dashed #0e5a24; background: #ecf4e8; border-radius: 2px; }
.mini-tarjeta i:nth-child(3) { left: 9px; right: 9px; top: 30px; height: 1px; background: #c9d2c6; box-shadow: 0 5px 0 #c9d2c6, 0 10px 0 #c9d2c6, 0 15px 0 #e3e8e0; }
.mini-certificado i:nth-child(2) { left: 10px; right: 10px; top: 21px; height: 9px; border: 1.5px solid #c8961c; border-radius: 2px; }
.mini-certificado i:nth-child(3) { left: 6px; right: 6px; top: 36px; height: 2px; background: #c9d2c6; box-shadow: 0 5px 0 #e3e8e0, 0 10px 0 #e3e8e0; }
.mini-certificado i:nth-child(4) { right: 5px; top: 17px; width: 10px; height: 6px; border: 1px solid #0e5a24; border-radius: 2px; transform: rotate(8deg); }
.mini-certificado i:nth-child(5) { left: 0; right: 0; bottom: 0; height: 2px; background: #c8961c; }
/* Color */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.sel { box-shadow: 0 0 0 2px var(--ink); }
.swatch:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 2px; }
.color-libre { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; }
.color-libre input { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.color-libre input::-webkit-color-swatch-wrapper { padding: 0; }
.color-libre input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.guardar-doc { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.guardar-doc .btn-row { justify-content: flex-end; }
.punto-cambio { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); vertical-align: 2px; margin-left: 2px; }
.tam-letra { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tam-letra .btn-outline { min-width: 52px; font-weight: 700; }
.tam-letra .a-chica { font-size: calc(11px * var(--letra, 1)); margin-right: 1px; }
.tam-letra .a-grande { font-size: calc(17px * var(--letra, 1)); margin-right: 1px; }
.tam-letra output { min-width: 56px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tamaño de letra de la interfaz (A− / A+) */
.letra-btns { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--card); padding: 2px; flex: none; }
.letra-btns button { display: inline-flex; align-items: baseline; justify-content: center; min-width: 32px; height: 28px; padding: 0 7px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-weight: 700; font-size: 13px; line-height: 28px; cursor: pointer; }
.letra-btns button:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.letra-btns button:disabled { opacity: 0.38; cursor: default; }
.letra-btns button:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 1px; }
.letra-btns .a-chica { font-size: 11px; }
.letra-btns .a-grande { font-size: 16px; }
.letra-btns .letra-val { min-width: 44px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .topbar-letra .letra-val { display: none; } }

/* Barra lateral contraída: solo íconos (botón ☰ en computadora; automática si el texto grande no cabe) */
.shell { transition: grid-template-columns 0.18s ease; }
.sb-nav a span, .sb-head .ent > div { min-width: 0; }
@media (min-width: 861px) {
  .shell.riel { grid-template-columns: 68px minmax(0, 1fr); }
  .shell.riel .sidebar { overflow-x: hidden; }
  .shell.riel .sb-head { padding: 14px 0; }
  .shell.riel .sb-head .ent { justify-content: center; }
  .shell.riel .sb-head .ent > div { display: none; }
  .shell.riel .sb-nav { padding: 8px 10px; }
  .shell.riel .sb-nav .grupo { font-size: 0; padding: 0; margin: 10px 4px; border-top: 1px solid var(--line); }
  .shell.riel .sb-nav .grupo:first-child { display: none; }
  .shell.riel .sb-nav a { justify-content: center; padding: 10px 0; }
  .shell.riel .sb-nav a > span, .shell.riel .sb-nav a > kbd { display: none; }
  .shell.riel .sb-nav a.active { box-shadow: inset 3px 0 0 var(--gold); }
  .shell.riel .sb-foot { justify-content: center; padding: 12px 0; }
  .shell.riel .sb-foot > span { display: none; }
  .shell.riel .sb-foot img { height: 13px; }
}

/* Barra superior: se adapta al espacio medido en «em» (así responde también al tamaño de letra) */
.topbar { container: barra / inline-size; }
.topbar > * { flex-shrink: 0; }
.topbar > h1 { flex-shrink: 1; }
.topbar > .user-chip { flex-shrink: 1; }
@container barra (max-width: 60em) {
  .user-chip > div { display: none; }
  .user-chip { padding: 4px; }
}
@container barra (max-width: 46em) {
  .topbar .env { font-size: 0; gap: 0; padding: 6px; }
  .topbar-letra .letra-val { display: none; }
}
@container barra (max-width: 34em) {
  .topbar .env { display: none; }
}

/* Al final del archivo para que tenga prioridad sobre las reglas base de cada componente. */
/* Responsive según el espacio real del contenido medido en «em»: al agrandar la letra (A+) el contenido
   cabe en menos «em» y las columnas se reacomodan igual que en una pantalla más angosta. */
.contenido { container: contenido / inline-size; }
@container contenido (max-width: 60em) {
  .g-main, .g-caja, .g-diseno { grid-template-columns: minmax(0, 1fr); }
  .sticky, .vista-card { position: static; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flujo { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container contenido (max-width: 46em) {
  .g2, .g3, .accesos, .cab-grid { grid-template-columns: minmax(0, 1fr); }
  .flujo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cab-doc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@container contenido (max-width: 32em) {
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .caja-buscar .input { max-width: none; }
  .page-head > .btn-row, .page-head > .seg { width: 100%; }
}
