:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef1f6;
  --border: #e4e8ef;
  --border-2: #d5dbe5;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8592a6;
  --primary: #2a78d6;
  --primary-hover: #1f65bb;
  --primary-soft: #e8f1fc;
  --primary-ink: #1a5fb4;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #a16207;
  --warn-soft: #fdf4dc;
  --danger: #c4332f;
  --danger-soft: #fdecec;
  --violet: #6250d6;
  --violet-soft: #efedfc;
  --wa: #1fa855;
  --sidebar: #0d1424;
  --sidebar-2: #131d33;
  --sidebar-text: #b7c0d1;
  --sidebar-active: #2a78d6;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0e14; --surface: #141821; --surface-2: #1a1f2a; --surface-3: #212734; --border: #262c38; --border-2: #323a48;
    --text: #e9edf3; --text-2: #b3bccb; --muted: #7d8799;
    --primary: #3987e5; --primary-hover: #5a9cec; --primary-soft: #182a42; --primary-ink: #7fb2f0;
    --series-1: #3987e5; --series-2: #d95926;
    --ok: #4cc38a; --ok-soft: #12301f; --warn: #f0b545; --warn-soft: #362a0f; --danger: #f07070; --danger-soft: #3a1919;
    --violet: #9085e9; --violet-soft: #231f42;
    --sidebar: #080b11; --sidebar-2: #0e131d;
    --shadow-sm: none; --shadow: 0 1px 3px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e14; --surface: #141821; --surface-2: #1a1f2a; --surface-3: #212734; --border: #262c38; --border-2: #323a48;
  --text: #e9edf3; --text-2: #b3bccb; --muted: #7d8799;
  --primary: #3987e5; --primary-hover: #5a9cec; --primary-soft: #182a42; --primary-ink: #7fb2f0;
  --series-1: #3987e5; --series-2: #d95926;
  --ok: #4cc38a; --ok-soft: #12301f; --warn: #f0b545; --warn-soft: #362a0f; --danger: #f07070; --danger-soft: #3a1919;
  --violet: #9085e9; --violet-soft: #231f42;
  --sidebar: #080b11; --sidebar-2: #0e131d;
  --shadow-sm: none; --shadow: 0 1px 3px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01";
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 23px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: .92em; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); color: var(--sidebar-text);
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 1px;
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.marca { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; color: #fff; }
.logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; flex: none; color: #fff;
  background: linear-gradient(135deg, #3b8cf0 0%, #2a62d0 100%); box-shadow: 0 4px 14px rgba(42, 120, 214, .45); letter-spacing: -.02em;
}
.marca .nombre { font-weight: 650; font-size: 14px; line-height: 1.2; }
.marca .eslogan { font-size: 11px; color: #7e8aa2; margin-top: 2px; }
.nav-grupo { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #5f6b82; padding: 16px 12px 6px; font-weight: 650; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8.5px 12px; border-radius: 9px; color: var(--sidebar-text); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.activo { background: var(--sidebar-active); color: #fff; box-shadow: 0 4px 14px rgba(42, 120, 214, .35); }
.nav a.activo svg { opacity: 1; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-pie { margin-top: auto; padding: 16px 12px 4px; font-size: 11px; color: #5f6b82; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 28px; min-height: 62px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 15;
}
.topbar .fecha-hoy { color: var(--muted); font-size: 12.5px; white-space: nowrap; display: inline-block; }
.topbar .fecha-hoy::first-letter { text-transform: uppercase; }
.busqueda-global { flex: 1; max-width: 520px; position: relative; }
.busqueda-global input { padding-left: 38px; background: var(--surface-2); border-color: transparent; height: 40px; border-radius: 11px; }
.busqueda-global input:focus { background: var(--surface); }
.busqueda-global > svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.busqueda-global kbd { position: absolute; right: 10px; top: 10px; font: 11px var(--font); color: var(--muted); border: 1px solid var(--border-2); border-radius: 5px; padding: 1px 6px; background: var(--surface); }
.topbar .usuario { display: flex; align-items: center; gap: 10px; color: var(--text-2); margin-left: auto; }
.topbar .usuario .quien { display: flex; align-items: center; gap: 9px; line-height: 1.2; }
.topbar .usuario .quien small { display: block; color: var(--muted); font-size: 11.5px; }
.btn.menu-btn { display: none; }
#vista { padding: 26px 28px 56px; max-width: 1440px; width: 100%; animation: aparecer .18s ease-out; }
@keyframes aparecer { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.cabecera .titulo { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cabecera .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.sub { color: var(--text-2); margin-top: 3px; }
.ic-pagina { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.ic-pagina svg { width: 22px; height: 22px; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.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-venta { grid-template-columns: minmax(0, 1.5fr) minmax(350px, 1fr); align-items: start; }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.espaciar { justify-content: space-between; }

.tile { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.tile .tile-txt { min-width: 0; flex: 1; }
.tile .etq { color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.tile .val { font-size: clamp(16px, 1.35vw, 22px); font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.tile .det { color: var(--muted); font-size: 12px; margin-top: 3px; }
.tile.alerta .val { color: var(--danger); }
.tile-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.tile-ic svg { width: 21px; height: 21px; }
.tile-ic.ok { background: var(--ok-soft); color: var(--ok); }
.tile-ic.warn { background: var(--warn-soft); color: var(--warn); }
.tile-ic.danger { background: var(--danger-soft); color: var(--danger); }
.tile-ic.violet { background: var(--violet-soft); color: var(--violet); }
.tile-ic.gris { background: var(--surface-3); color: var(--text-2); }

.accesos { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.acceso {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text); font-weight: 600; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.acceso:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.acceso small { display: block; font-weight: 450; color: var(--muted); font-size: 12px; }
.bienvenida {
  border-radius: var(--radius); padding: 22px 26px; margin-bottom: 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #1d4f9e 0%, #2a78d6 55%, #4b95ea 100%); box-shadow: 0 10px 30px rgba(42, 120, 214, .25);
}
.bienvenida h1 { font-size: 24px; }
.bienvenida p { margin: 6px 0 0; opacity: .9; }
.bienvenida::after { content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.bienvenida::before { content: ""; position: absolute; right: 120px; bottom: -120px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.bienvenida .fila { position: relative; z-index: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 1px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primario { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(42, 120, 214, .3); }
.btn.primario:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.bienvenida .btn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); color: #fff; box-shadow: none; }
.bienvenida .btn:hover { background: rgba(255, 255, 255, .24); }
.bienvenida .btn.blanco { background: #fff; color: #1d4f9e; border-color: #fff; }
.btn.peligro { color: var(--danger); }
.btn.peligro:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.exito { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.exito:hover { filter: brightness(1.07); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { filter: brightness(1.08); }
.btn.fantasma { border-color: transparent; box-shadow: none; background: transparent; }
.btn.fantasma:hover { background: var(--surface-3); }
.btn.chico { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.grande { padding: 12px 18px; font-size: 15px; border-radius: 11px; }
.btn svg { width: 16px; height: 16px; }

label.campo { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 550; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 9px 11px; width: 100%; min-width: 0; transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[readonly] { background: var(--surface-2); }
textarea { resize: vertical; min-height: 64px; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); }
label.check { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--text); cursor: pointer; font-weight: 500; }
.form { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .ancho { grid-column: 1 / -1; }
.form.f3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.f1 { grid-template-columns: 1fr; }

.filtros { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.filtros label.campo { min-width: 140px; }
.buscador { max-width: 360px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 11px; padding: 4px; background: var(--surface-3); gap: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button.activo { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 11px 14px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.activo { color: var(--primary); border-bottom-color: var(--primary); }

/* tablas */
.tabla-wrap { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; }
.tabla th, .tabla td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tabla th { font-size: 11px; font-weight: 650; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; text-transform: uppercase; letter-spacing: .05em; }
.tabla tbody tr { transition: background .1s; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr.clic:hover { background: var(--primary-soft); }
.tabla tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-2); border-bottom: 0; }
.tabla tr.anulado td { color: var(--muted); text-decoration: line-through; }
.tabla .vacio { text-align: center; color: var(--muted); padding: 36px 20px; }
.tabla input { padding: 6px 9px; }
.tabla-pie { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: var(--muted); font-size: 12.5px; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.celda-persona { display: flex; align-items: center; gap: 10px; }
.celda-persona .avatar { width: 32px; height: 32px; font-size: 12px; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 14px;
  background: var(--primary-soft); color: var(--primary-ink); letter-spacing: -.02em;
}
.avatar.grande { width: 56px; height: 56px; font-size: 19px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.6; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary-ink); }

.datos { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.datos dt { color: var(--muted); font-size: 13px; }
.datos dd { margin: 0; font-weight: 550; }

.totales { display: grid; gap: 7px; }
.totales .linea { display: flex; justify-content: space-between; gap: 12px; }
.totales .linea.grande { font-size: 19px; font-weight: 750; border-top: 1px dashed var(--border-2); padding-top: 10px; margin-top: 4px; }

.resultados { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 400px; overflow-y: auto; padding: 4px; }
.resultados .item { padding: 9px 12px; cursor: pointer; border-radius: 8px; }
.resultados .item:hover, .resultados .item.sel { background: var(--primary-soft); }
.res-global { display: flex; align-items: center; gap: 10px; }
.res-global .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.res-global .ic svg { width: 16px; height: 16px; }
.rel { position: relative; }

.cuenta-card { border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; cursor: pointer; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.cuenta-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.cuenta-card.sel { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.aviso { padding: 11px 15px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 550; }
.aviso.info { background: var(--primary-soft); color: var(--primary-ink); }
.aviso.peligro { background: var(--danger-soft); color: var(--danger); }

.progreso { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progreso > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-marca {
  background: linear-gradient(150deg, #0d1424 0%, #16305e 55%, #2a78d6 130%); color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.login-marca::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; right: -140px; bottom: -140px; background: rgba(255, 255, 255, .05); }
.login-marca h2 { font-size: 32px; line-height: 1.15; font-weight: 750; max-width: 460px; letter-spacing: -.02em; }
.login-marca ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; color: #c6d3ea; }
.login-marca li { display: flex; gap: 10px; align-items: center; }
.login-marca li::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: #fff; font-size: 12px; flex: none; }
.login-form { display: grid; place-items: center; padding: 32px 24px; }
.login-form .caja { width: 100%; max-width: 380px; }
.login-form h1 { font-size: 26px; margin-bottom: 4px; }

/* modal */
.modal-fondo { position: fixed; inset: 0; background: rgba(8, 12, 20, .55); backdrop-filter: blur(3px); display: grid; place-items: start center; padding: 6vh 16px; z-index: 50; overflow-y: auto; animation: fundido .15s; }
@keyframes fundido { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 580px; box-shadow: var(--shadow-lg); animation: subir .18s ease-out; border: 1px solid var(--border); }
@keyframes subir { from { transform: translateY(10px); opacity: .6; } }
.modal.grande { max-width: 880px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.x { border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; width: 32px; height: 32px; border-radius: 8px; }
.x:hover { background: var(--surface-3); color: var(--text); }

#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); max-width: 400px; font-weight: 550; animation: subir .2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* gráfico */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .eje { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: default; }
.chart .col:hover rect.hit { fill: var(--surface-3); opacity: .6; }
.leyenda { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; min-width: 170px; z-index: 3; }
.tooltip .t { font-weight: 650; margin-bottom: 4px; }

/* venta: catálogo rápido y selector de planes */
.chip { border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.activo { background: var(--primary); border-color: var(--primary); color: #fff; }
.catalogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; max-height: 330px; overflow-y: auto; padding: 2px; }
.prod-btn { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font: inherit; color: var(--text); cursor: pointer; }
.prod-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.prod-btn[data-agotado] { opacity: .6; }
.prod-btn b { font-size: 13px; line-height: 1.3; }
.opciones-plan { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opcion { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 11px; background: var(--surface); font: inherit; color: var(--text); cursor: pointer; }
.opcion b { font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.opcion span { white-space: nowrap; }
.input-serie { margin-top: 6px; padding: 4px 8px !important; font-size: 12.5px; max-width: 230px; }
.opcion:hover { border-color: var(--primary); }
.opcion.activo { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.opcion.activo b { color: var(--primary-ink); }

/* cotizador */
.planes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.plan-col h3 { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.plan-op { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 8px; background: var(--surface); }
.plan-op:hover { border-color: var(--primary); }
.plan-op .monto { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

#print { display: none; }

@media (max-width: 1200px) {
  .accesos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-venta { grid-template-columns: 1fr; }
  .planes { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-marca { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.abierto { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
  .btn.menu-btn { display: inline-flex; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .accesos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #vista { padding: 18px 16px 44px; }
  .topbar { padding: 10px 16px; }
  .topbar .fecha-hoy, .busqueda-global kbd { display: none; }
  .form, .form.f3 { grid-template-columns: 1fr; }
  .bienvenida { padding: 18px; }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: 1fr; }
  .topbar .usuario .quien { display: none; }
  .ic-pagina { display: none; }
}

/* ---------- impresión ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; color: #000; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; }
}
.doc { font: 12.5px/1.45 Arial, Helvetica, sans-serif; color: #000; }
.doc h1 { font-size: 18px; }
.doc h2 { font-size: 15px; margin: 14px 0 6px; }
.doc .enc { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
.doc .enc .der { text-align: right; }
.doc table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.doc th, .doc td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
.doc th { background: #eee; text-transform: none; letter-spacing: 0; color: #000; font-size: 12px; position: static; }
.doc .num { text-align: right; }
.doc .caja-monto { border: 2px solid #000; padding: 6px 12px; font-size: 18px; font-weight: 700; display: inline-block; }
.doc .firmas { display: flex; justify-content: space-around; gap: 30px; margin-top: 50px; }
.doc .firmas div { border-top: 1px solid #000; padding-top: 4px; text-align: center; min-width: 200px; }
.doc .recibo { border: 1px solid #000; padding: 14px 18px; margin-bottom: 14px; page-break-inside: avoid; }
.doc .linea-r { margin: 6px 0; }
.doc .linea-r b { display: inline-block; min-width: 120px; }
.doc .copia { text-align: right; font-size: 10px; color: #444; }
.doc.ticket { width: 72mm; font-size: 11.5px; }
.doc.ticket .enc { display: block; text-align: center; }
.doc.ticket .enc .der { text-align: center; }
.doc.ticket td, .doc.ticket th { border: 0; padding: 2px 0; }
.doc .anulado-sello { color: #c00; border: 3px solid #c00; display: inline-block; padding: 4px 12px; font-size: 20px; font-weight: 800; transform: rotate(-8deg); }

/* pagarés */
.doc .pagare { border: 2px solid #000; padding: 16px 20px; page-break-inside: avoid; }
.doc .pagare.compacto { padding: 10px 14px; font-size: 11px; }
.doc .pagare.compacto .pg-firmas { margin-top: 26px; }
.doc .pg-cab { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.doc .pg-titulo { font-size: 18px; font-weight: 800; letter-spacing: .04em; }
.doc .pagare.compacto .pg-titulo { font-size: 15px; }
.doc .pg-monto { border: 2px solid #000; padding: 6px 14px; font-size: 18px; font-weight: 800; }
.doc .pg-fechas { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.doc .pg-texto { text-align: justify; line-height: 1.6; margin: 8px 0; }
.doc .pg-clausulas { text-align: justify; font-size: .88em; margin: 6px 0; }
.doc .pg-deudor { border-top: 1px dashed #666; padding-top: 6px; margin-top: 6px; line-height: 1.6; }
.doc .pg-firmas { display: flex; justify-content: space-around; gap: 30px; margin-top: 44px; }
.doc .pg-firma { min-width: 230px; font-size: .92em; line-height: 1.6; }
.doc .pg-linea { border-top: 1px solid #000; margin-bottom: 2px; }
.doc .pg-blanco { display: inline-block; min-width: 150px; border-bottom: 1px dotted #000; }
.doc .pg-corte { text-align: center; color: #555; font-size: 10px; margin: 8px 0; letter-spacing: 1px; white-space: nowrap; overflow: hidden; }
.doc .pg-plan { page-break-before: always; }

/* celdas compactas en listados */
.tabla .celda-persona > div { min-width: 0; }
.tabla .celda-persona .muted { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-op .monto { white-space: nowrap; }
.plan-op .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* barras horizontales (gastos) */
.barra-h { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.barra-h .etq { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-h .pista { height: 10px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.barra-h .pista i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.barra-h b { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* arqueo de caja */
.arqueo { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.tabla tr.fila-error td { background: var(--danger-soft); }
.detalle-aud { display: inline-block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
