/* Facturador — estilos. Producto separado de Ser.Con.T: no comparte archivos, tokens ni cuentas con ningún otro sistema. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #16202b;
  --mute: #5d6b78;
  --line: #e1e6ea;
  --line-strong: #cdd5dc;
  --sello: #16385f;        /* azul Ser.Con.T (navy-2) */
  --sello-dark: #0f2a4a;   /* navy Ser.Con.T */
  --sello-soft: #e4ebf3;
  --accent: #1fa855;       /* verde Ser.Con.T */
  --accent-ink: #16803f;
  --ok: #1f8a5b;  --ok-soft: #e3f4ec;
  --warn: #a8680c; --warn-soft: #fbf0dc;
  --bad: #b8322a; --bad-soft: #fbe7e5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 26, 46, .06), 0 6px 20px rgba(28, 26, 46, .05);
  --f-display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--f-body); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--sello); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sello); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.mute { color: var(--mute); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--sello-dark); color: #e4ecf4; padding: 1.1rem .9rem; display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marca { display: flex; align-items: center; gap: .6rem; padding: .2rem .4rem; text-decoration: none; color: #fff; }
.marca .logo { font: 800 1.25rem var(--f-display); letter-spacing: .02em; line-height: 1; }
.marca .logo i { color: var(--accent); font-style: normal; }
.marca small { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #a9bdd3; margin-top: .25rem; }

.empresa-activa { margin: 0 .2rem; padding: .6rem .7rem; border-radius: 8px; background: rgba(255,255,255,.08); font-size: .82rem; }
.empresa-activa small { display: block; color: #a9bdd3; }
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: 8px; color: #d3deea; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { background: #fff; color: var(--sello-dark); font-weight: 700; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .grupo { margin: .9rem .7rem .3rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #9fb4cc; }
.side-pie { margin-top: auto; font-size: .78rem; color: #a9bdd3; padding: 0 .4rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.4rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .burger { display: none; }
.top .demo { font-size: .76rem; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.top .espacio { flex: 1; }
.usuario-btn { display: flex; align-items: center; gap: .6rem; background: none; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem .25rem .3rem; cursor: pointer; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sello); color: #fff; display: grid; place-items: center; font: 700 .8rem var(--f-display); flex: none; }
.usuario-btn small { display: block; color: var(--mute); line-height: 1.1; font-size: .72rem; text-align: left; }
.usuario-btn div span { display: block; line-height: 1.15; font-weight: 600; font-size: .86rem; text-align: left; }
.menu-usuario { position: absolute; right: 1.4rem; top: 3.7rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; min-width: 250px; z-index: 30; }
.menu-usuario[hidden] { display: none; }
.menu-usuario label { display: block; font-size: .72rem; color: var(--mute); padding: .4rem .5rem 0; }
.menu-usuario select { width: calc(100% - 1rem); margin: .2rem .5rem .5rem; }
.menu-usuario button { width: 100%; text-align: left; background: none; border: 0; padding: .5rem; border-radius: 6px; cursor: pointer; }
.menu-usuario button:hover { background: var(--bg); }
.page { padding: 1.5rem 1.4rem 4rem; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head p { color: var(--mute); margin-top: .25rem; max-width: 60ch; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card + .card { margin-top: 1rem; }
.card > h2 { margin-bottom: .8rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid transparent; background: var(--accent); color: #fff; border-radius: 8px; padding: .6rem 1.05rem; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { background: var(--accent-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.sec { background: var(--surface); color: var(--sello); border-color: var(--line-strong); }
.btn.sec:hover { background: var(--sello-soft); }
.btn.peligro { background: var(--surface); color: var(--bad); border-color: #e7b9b5; }
.btn.chico { padding: .3rem .65rem; min-height: 32px; font-size: .85rem; }
.btn svg { width: 16px; height: 16px; }
.campo { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.campo > label { font-size: .8rem; font-weight: 600; color: var(--mute); }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=search], input[type=password], input[type=file], select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: .55rem .7rem; min-height: 40px;
}
textarea { min-height: 76px; resize: vertical; }
input:disabled, select:disabled { background: var(--bg); color: var(--mute); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.ayuda { font-size: .8rem; color: var(--mute); }
.error-campo { font-size: .8rem; color: var(--bad); }

.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 700; padding: .18rem .6rem; border-radius: 999px; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); background: var(--ok-soft); }
.chip.warn { color: var(--warn); background: var(--warn-soft); }
.chip.bad { color: var(--bad); background: var(--bad-soft); }
.chip.neutro { color: var(--mute); background: var(--bg); }
.chip.sello { color: var(--sello); background: var(--sello-soft); }

.tabla-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); padding: .7rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; background: #faf9fd; }
.tbl td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.acc { text-align: right; white-space: nowrap; }
.tbl tbody tr:hover { background: #faf9fd; }
.vacio { padding: 2.2rem 1rem; text-align: center; color: var(--mute); }
.filtros { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filtros .campo { min-width: 170px; }
.filtros .campo.crece { flex: 1; min-width: 220px; }

.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; max-width: min(92vw, 460px); }
.modal-fondo { position: fixed; inset: 0; background: rgba(28, 26, 46, .5); display: grid; place-items: center; padding: 1rem; z-index: 60; }
.modal-fondo[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 14px; padding: 1.3rem; width: min(560px, 100%); max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { margin-bottom: 1rem; }
.modal .acciones { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }

/* ---------- panel ---------- */
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.mes-total { font: 800 clamp(2rem, 4vw, 2.8rem) var(--f-display); letter-spacing: -.02em; line-height: 1; margin: .4rem 0 .2rem; }
.barras { display: flex; align-items: flex-end; gap: 5px; height: 120px; margin-top: 1rem; }
.barras i { flex: 1; background: var(--sello-soft); border-radius: 4px 4px 0 0; min-height: 4px; position: relative; }
.barras i.hoy { background: var(--sello); }
.barras-eje { display: flex; justify-content: space-between; font-size: .72rem; color: var(--mute); margin-top: .3rem; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px dashed var(--line-strong); }
.mini-stats b { display: block; font: 700 1.2rem var(--f-display); }
.mini-stats span { font-size: .78rem; color: var(--mute); }
.aviso-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.aviso-lista li { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border-radius: 8px; background: var(--bg); }
.aviso-lista li.warn { background: var(--warn-soft); }
.aviso-lista li.bad { background: var(--bad-soft); }
.aviso-lista li.ok { background: var(--ok-soft); }
.aviso-lista b { display: block; }

/* ---------- emitir: formulario + factura en papel ---------- */
.emitir-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.emitir-grid .papel-col { position: sticky; top: 4.8rem; }
.items { width: 100%; border-collapse: collapse; }
.items th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); text-align: left; padding: .3rem .4rem; }
.items td { padding: .25rem .3rem; vertical-align: top; }
.items input, .items select { min-height: 36px; padding: .35rem .5rem; }
.items .c-prod { min-width: 170px; }
.items .c-cant { width: 58px; } .items .c-precio { width: 82px; } .items .c-desc { width: 68px; } .items .c-iva { width: 76px; } .items .c-total { width: 76px; text-align: right; padding-top: .7rem; font-family: var(--f-mono); font-size: .84rem; }
.items .c-x { width: 34px; }
.items th { white-space: nowrap; }
.totales { margin-left: auto; width: min(320px, 100%); margin-top: 1rem; font-size: .92rem; }
.totales div { display: flex; justify-content: space-between; padding: .25rem 0; }
.totales .total { border-top: 2px solid var(--ink); margin-top: .3rem; padding-top: .5rem; font: 800 1.25rem var(--f-display); }
.barra-emitir { display: flex; gap: .7rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.2rem; }

.papel { background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; padding: 1.3rem 1.3rem 1.5rem; font-size: .78rem; line-height: 1.4; position: relative; box-shadow: var(--shadow); color: #222; }
.papel::before, .papel::after { content: ""; position: absolute; left: 0; right: 0; height: 8px; background: radial-gradient(circle at 6px 4px, var(--bg) 3px, transparent 3.5px) 0 0 / 12px 8px repeat-x; }
.papel::before { top: -4px; }
.papel::after { bottom: -4px; transform: scaleY(-1); }
.papel .cab { display: grid; grid-template-columns: 1.1fr 1fr; gap: .9rem; margin-bottom: .8rem; }
.papel .emisor b { display: block; font: 800 .95rem var(--f-display); }
.papel .caja { border: 1px solid #bbb; border-radius: 4px; padding: .55rem .65rem; }
.papel .caja .tit { font: 800 .9rem var(--f-display); }
.papel .caja .clave { font-family: var(--f-mono); font-size: .62rem; word-break: break-all; margin-top: .25rem; }
.papel table { width: 100%; border-collapse: collapse; margin: .7rem 0; }
.papel th { font-size: .66rem; text-transform: uppercase; text-align: left; border-bottom: 1px solid #999; padding: .2rem .25rem; }
.papel td { padding: .2rem .25rem; border-bottom: 1px dotted #ccc; vertical-align: top; }
.papel td.n, .papel th.n { text-align: right; font-family: var(--f-mono); font-size: .72rem; white-space: nowrap; }
.papel .tot { margin-left: auto; width: 55%; }
.papel .tot div { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: .74rem; padding: .1rem 0; }
.papel .tot .gran { border-top: 1px solid #333; font-weight: 700; font-size: .85rem; margin-top: .2rem; padding-top: .25rem; }
.papel .pie { margin-top: .8rem; font-size: .7rem; color: #555; }
.papel .vacio-papel { color: #999; text-align: center; padding: 1.4rem 0; }
.papel.preliminar::after { }
.marca-agua { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.marca-agua span { font: 800 2.6rem var(--f-display); color: rgba(22, 56, 95, .09); transform: rotate(-22deg); letter-spacing: .1em; }

/* sello de estado (firma del producto) */
.sello-estado { display: inline-block; border: 3px solid currentColor; border-radius: 8px; padding: .25rem .9rem; font: 800 1.25rem var(--f-display); letter-spacing: .12em; text-transform: uppercase; transform: rotate(-9deg); opacity: .9; mix-blend-mode: multiply; }
.sello-estado.ok { color: var(--ok); } .sello-estado.bad { color: var(--bad); } .sello-estado.warn { color: var(--warn); }
.papel .sello-estado { position: absolute; right: 1rem; top: 5.2rem; }
@keyframes sellar { 0% { transform: rotate(-9deg) scale(2.4); opacity: 0; } 55% { transform: rotate(-9deg) scale(.94); opacity: 1; } 100% { transform: rotate(-9deg) scale(1); opacity: .9; } }
.sello-estado.nuevo { animation: sellar .45s cubic-bezier(.2, .8, .3, 1) both; }

.pasos { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.pasos li { display: flex; gap: .7rem; align-items: center; color: var(--mute); }
.pasos li .punto { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: .7rem; flex: none; }
.pasos li.hecho { color: var(--ink); } .pasos li.hecho .punto { background: var(--ok); border-color: var(--ok); color: #fff; }
.pasos li.activo { color: var(--ink); font-weight: 600; } .pasos li.activo .punto { border-color: var(--sello); border-top-color: transparent; animation: gira .8s linear infinite; }
.pasos li.error .punto { background: var(--bad); border-color: var(--bad); color: #fff; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- usuarios / roles ---------- */
.matriz { overflow-x: auto; }
.matriz table { border-collapse: collapse; width: 100%; font-size: .86rem; }
.matriz th, .matriz td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); text-align: center; }
.matriz th:first-child, .matriz td:first-child { text-align: left; }
.matriz th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); }
.matriz .si { color: var(--ok); font-weight: 800; } .matriz .no { color: var(--line-strong); }
.rol-desc { font-size: .8rem; color: var(--mute); }

/* ---------- acceso ---------- */
.acceso { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.acceso-izq { background: linear-gradient(135deg, var(--sello-dark), var(--sello)); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; position: relative; overflow: hidden; }
.acceso-izq h1 { font-size: clamp(2rem, 4vw, 3.1rem); max-width: 14ch; }
.acceso-izq p { color: #c4d3e3; max-width: 38ch; margin-top: 1rem; }
.acceso-izq .gran-sello { position: absolute; right: -40px; bottom: -40px; width: 300px; height: 300px; border: 14px solid rgba(255,255,255,.08); border-radius: 50%; display: grid; place-items: center; font: 800 5rem var(--f-display); color: rgba(255,255,255,.08); transform: rotate(-12deg); }
.acceso-der { padding: 3rem 2rem; display: flex; align-items: center; justify-content: center; }
.acceso-caja { width: min(430px, 100%); }
.cuentas-demo { display: flex; flex-direction: column; gap: .5rem; margin: 1.2rem 0; }
.cuenta-demo { display: flex; align-items: center; gap: .8rem; text-align: left; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: .65rem .8rem; cursor: pointer; width: 100%; }
.cuenta-demo:hover { border-color: var(--sello); background: var(--sello-soft); }
.cuenta-demo b { display: block; line-height: 1.2; } .cuenta-demo small { color: var(--mute); }

/* ---------- adaptable ---------- */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); height: 100vh; transform: translateX(-102%); transition: transform .2s; z-index: 50; }
  .side.abierto { transform: none; }
  .fondo-menu { position: fixed; inset: 0; background: rgba(28,26,46,.45); z-index: 40; }
  .fondo-menu[hidden] { display: none; }
  .top .burger { display: inline-flex; }
  .top { padding: .6rem 1rem; }
  .page { padding: 1.1rem 1rem 4rem; }
  .panel-grid, .emitir-grid { grid-template-columns: 1fr; }
  .emitir-grid .papel-col { position: static; }
  .usuario-btn div { display: none; }
  .usuario-btn { padding: .25rem; }
  .menu-usuario { right: 1rem; }
  .acceso { grid-template-columns: 1fr; }
  .acceso-izq { padding: 1.6rem; min-height: 190px; } .acceso-izq .gran-sello { display: none; } .acceso-der { padding: 1.5rem 1rem; }
}
@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .top .demo { display: none; }
  .mini-stats { grid-template-columns: 1fr 1fr 1fr; }
  /* tablas como tarjetas en el celular */
  table.tbl.apilar thead { display: none; }
  table.tbl.apilar, .tbl.apilar tbody, .tbl.apilar tr, .tbl.apilar td { display: block; width: 100%; }
  .tbl.apilar tr { padding: .6rem .3rem; border-bottom: 1px solid var(--line); }
  .tbl.apilar td { border: 0; padding: .15rem .8rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .tbl.apilar td::before { content: attr(data-label); color: var(--mute); font-size: .76rem; text-align: left; flex: none; }
  .tbl.apilar td.acc { justify-content: flex-end; padding-top: .4rem; }
  .tbl.apilar td.acc::before { content: none; }
  .items thead { display: none; }
  .items, .items tbody, .items tr { display: block; width: 100%; }
  .items tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .7rem 0; border-bottom: 1px dashed var(--line-strong); }
  .items td { display: block; width: auto !important; padding: 0; }
  .items td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--mute); margin-bottom: .15rem; }
  .items td.c-prod, .items td.c-total { grid-column: 1 / -1; }
  .items td.c-total { text-align: right; padding-top: 0; }
  .items td.c-x { grid-column: 1 / -1; text-align: right; }
  .papel .cab { grid-template-columns: 1fr; }
  .papel .tot { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
  .side, .top, .no-imprimir, .fondo-menu { display: none !important; }
  body { background: #fff; }
  .app { display: block; }
  .papel { box-shadow: none; border: 0; }
  /* si hay una factura abierta en pantalla, solo ella se imprime */
  body:has(.modal-fondo) .app { display: none !important; }
  .modal-fondo { position: static; background: #fff; padding: 0; display: block; }
  .modal { box-shadow: none; width: 100%; max-height: none; padding: 0; }
  .modal h2, .modal .acciones, .modal .pasos { display: none !important; }
}

/* ---------- módulos nuevos: menú, panel visual, inventario y cuentas ---------- */
.nav a.bloq { opacity: .62; }
.nav em, .pronto em { margin-left: auto; font-style: normal; font-size: .64rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: rgba(255,255,255,.14); padding: .12rem .5rem; border-radius: 999px; }
.pronto { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; color: #a9bdd3; font-weight: 500; }
.pronto svg { width: 18px; height: 18px; flex: none; }

.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.dash-grid > .card { margin: 0; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
.card-tit { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; margin-bottom: .7rem; }
.card-tit h2 { margin: 0; } .card-tit a, .card-tit span { font-size: .82rem; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.kpi .etq { font-size: .78rem; font-weight: 600; color: var(--mute); }
.kpi .val { font: 800 clamp(1.4rem, 2.2vw, 1.9rem) var(--f-display); letter-spacing: -.02em; line-height: 1.1; margin-top: .2rem; }
.kpi .sub { font-size: .8rem; color: var(--mute); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.kpi.alerta .val { color: var(--bad); }
.delta { font-weight: 700; font-size: .78rem; padding: .08rem .45rem; border-radius: 999px; }
.delta.sube { color: var(--ok); background: var(--ok-soft); } .delta.baja { color: var(--bad); background: var(--bad-soft); } .delta.igual { color: var(--mute); background: var(--bg); }
.graf { width: 100%; height: auto; display: block; }
.dona-wrap { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.dona { width: 150px; height: 150px; flex: none; }
.leyenda { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; font-size: .86rem; }
.leyenda li { display: flex; align-items: center; gap: .55rem; padding: .22rem 0; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.leyenda b { margin-left: auto; font-size: .82rem; }
.leyenda.en-fila { display: flex; gap: .4rem 1.3rem; flex-wrap: wrap; margin-top: .8rem; }
.leyenda.en-fila li { padding: 0; } .leyenda.en-fila b { margin-left: .3rem; }
.hbar { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.hbar li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) auto; gap: .7rem; align-items: center; font-size: .88rem; }
.hbar li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .pista { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.hbar .pista i { display: block; height: 100%; background: var(--sello); border-radius: 6px; }
.hbar b { font-size: .82rem; }
.apilada { display: flex; height: 16px; border-radius: 8px; overflow: hidden; gap: 2px; background: var(--bg); }
.apilada i { display: block; min-width: 4px; }
.apilada.vacia { height: 10px; }
.c-vig { background: var(--sello); } .c-v30 { background: var(--warn); } .c-v60 { background: #d9772b; } .c-v90 { background: var(--bad); } .c-ok { background: var(--accent); }
.lista-simple { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lista-simple li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.lista-simple li:last-child { border-bottom: 0; } .lista-simple small { display: block; color: var(--mute); }
.bloqueado { text-align: center; color: var(--mute); padding: 1.6rem .8rem; }
.bloqueado b { display: block; color: var(--ink); margin-bottom: .3rem; }
.stock { display: flex; align-items: center; gap: .6rem; min-width: 150px; }
.stock .pista { flex: 1; height: 8px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.stock .pista i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.stock.bajo .pista i { background: var(--warn); } .stock.cero .pista i { background: var(--bad); }
.stock b { min-width: 34px; text-align: right; font-family: var(--f-mono); font-size: .86rem; }
.tarjetas-res { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.logo-prev { display: flex; align-items: center; justify-content: center; min-height: 92px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #fff; padding: .6rem; }
.logo-prev img { max-width: 100%; max-height: 80px; }
.papel .logo-emp { max-height: 54px; max-width: 190px; display: block; margin-bottom: .45rem; }
.papel .proveedor { margin-top: .9rem; padding-top: .5rem; border-top: 1px solid #ddd; text-align: center; font-size: .64rem; color: #777; }
@media (max-width: 980px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .hbar li { grid-template-columns: minmax(0, 1fr) auto; } .hbar .pista { grid-column: 1 / -1; order: 3; }
  .dona { margin: 0 auto; }
}
.tbl td.num { white-space: nowrap; }

/* ---------- ingreso: proporciones ---------- */
.acceso-izq { position: sticky; top: 0; height: 100vh; min-height: 520px; justify-content: flex-start; gap: 1.4rem; }
.acceso-izq > div:first-of-type { margin: auto 0; }
.acceso-izq h1 { max-width: 13ch; }
.acceso-der { align-items: center; }
.acceso-caja { padding: 1rem 0; }
.cuentas-demo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin: 1.1rem 0 0; }
.cuentas-demo > .ayuda { grid-column: 1 / -1; font-weight: 600; }
.cuenta-demo { padding: .55rem .65rem; gap: .6rem; }
.cuenta-demo .avatar { width: 34px; height: 34px; font-size: .78rem; }
.cuenta-demo b { font-size: .88rem; } .cuenta-demo small { font-size: .74rem; line-height: 1.25; }
@media (max-width: 980px) { .acceso-izq { position: static; height: auto; min-height: 0; } .acceso-izq > div:first-of-type { margin: 1rem 0 0; } }
@media (max-width: 560px) { .cuentas-demo { grid-template-columns: 1fr; } }

/* ---------- inicio de sesión (panel de marca + formulario) ---------- */
.login-grid { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.login-izq { position: relative; overflow: hidden; color: #fff; padding: 3rem 3.2rem; display: flex; flex-direction: column; justify-content: center; gap: 2rem; background: linear-gradient(150deg, var(--sello-dark) 0%, #123a66 55%, #1b5a9a 100%); }
.login-marca { display: flex; flex-direction: column; gap: .35rem; position: relative; z-index: 1; }
.logo-grande { font: 800 clamp(2.6rem, 6vw, 4.6rem) var(--f-display); letter-spacing: .01em; line-height: 1; }
.logo-grande i, .logo-mini i { color: var(--accent); font-style: normal; }
.logo-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .22em; color: #a9c2dc; font-weight: 600; }
.login-lema { position: relative; z-index: 1; max-width: 30rem; }
.login-lema h1 { font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 700; line-height: 1.25; }
.login-lema p { color: #c4d6e8; margin-top: .8rem; }
.login-nota { position: relative; z-index: 1; font-size: .78rem; color: #9fb8d2; margin: 0; font-family: var(--f-mono); }
.login-circulos i { position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); }
.login-circulos i:nth-child(1) { width: 380px; height: 380px; right: -120px; bottom: -150px; }
.login-circulos i:nth-child(2) { width: 220px; height: 220px; right: 140px; bottom: -110px; background: rgba(31,168,85,.16); }
.login-circulos i:nth-child(3) { width: 150px; height: 150px; left: -50px; top: -50px; }
.login-der { background: #fff; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; }
.login-caja { width: min(400px, 100%); }
.logo-mini { display: inline-block; font: 800 1.5rem var(--f-display); color: var(--sello-dark); letter-spacing: .01em; margin-bottom: 1.6rem; }
.login-caja h2 { font-size: 1.6rem; margin-bottom: 1.3rem; }
.login-caja .req { color: var(--bad); }
.clave-wrap { position: relative; display: flex; align-items: center; }
.clave-wrap > svg { position: absolute; left: .75rem; width: 17px; height: 17px; color: var(--mute); pointer-events: none; }
.clave-wrap input { padding-left: 2.4rem; padding-right: 2.8rem; }
.clave-wrap button { position: absolute; right: .35rem; background: none; border: 0; padding: .45rem; cursor: pointer; color: var(--mute); border-radius: 6px; display: grid; place-items: center; }
.clave-wrap button svg { width: 19px; height: 19px; }
.clave-wrap button:hover { color: var(--sello); background: var(--bg); }
.login-btn { width: 100%; margin-top: 1.2rem; min-height: 46px; font-size: 1rem; }
.login-olvido { text-align: center; margin-top: 1.1rem; font-size: .9rem; }
.login-terminos { text-align: center; margin-top: 1.6rem; font-size: .8rem; color: var(--mute); }
.login-demo { margin-top: 1.6rem; border-top: 1px dashed var(--line-strong); padding-top: 1rem; }
.login-demo summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--sello); }
.login-demo .cuentas-demo { margin-top: .8rem; }
@media (max-width: 860px) {
  .login-grid { grid-template-columns: 1fr; }
  .login-izq { padding: 1.8rem 1.4rem; gap: 1rem; min-height: 0; }
  .login-lema h1 { font-size: 1.15rem; } .login-lema p, .login-nota { display: none; }
  .login-der { padding: 1.6rem 1.2rem 2.4rem; align-items: flex-start; }
}
