/* =====================================================================
   Toldos Loreto — sistema de diseño propio (sin frameworks)
   Paleta sobria azul/gris corporativa · tipografía del sistema · responsive
   ===================================================================== */

:root {
  /* Marca */
  --brand-900: #0e2a47;
  --brand-800: #163a63;
  --brand-700: #1d4e86;
  --brand-600: #2563a8;
  --brand-500: #3b82c4;
  --accent:    #e8a13a;   /* dorado discreto (toldo) para acentos puntuales */

  /* Neutros */
  --ink:       #1f2933;
  --ink-soft:  #52606d;
  --muted:     #7b8794;
  --line:      #e4e7eb;
  --line-soft: #eef1f4;
  --bg:        #f4f6f9;
  --card:      #ffffff;

  /* Estados */
  --ok-bg:#e6f4ea; --ok-fg:#1b7a3d; --ok-bd:#a8d8b9;
  --info-bg:#e7f0fb; --info-fg:#1b5fa8; --info-bd:#b3d1f0;
  --warn-bg:#fdf3e2; --warn-fg:#9a6512; --warn-bd:#f0d8a8;
  --err-bg:#fdeaea; --err-fg:#a32525; --err-bd:#f2bcbc;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,42,71,.06), 0 4px 16px rgba(16,42,71,.06);
  --shadow-sm: 0 1px 2px rgba(16,42,71,.08);
  --sidebar-w: 244px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--brand-900); line-height: 1.25; }

/* ---------- Layout app (sidebar + contenido) ---------- */
.nav-toggle { display: none; }   /* checkbox oculto (toggle móvil) */

.topbar {
  display: flex; align-items: center; gap: .75rem;
  height: 56px; padding: 0 1rem;
  background: var(--brand-900);
  color: #fff;
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 2px 8px rgba(8, 22, 40, .18);
}
.topbar .brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: .55rem; }
.topbar .brand a { color: #fff; }
.topbar .brand .logo {
  width: 26px; height: 26px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, var(--accent), #d2862a);
  display: grid; place-items: center; color: #3a2606; font-weight: 800; font-size: .8rem;
}
.topbar .brand .logo-img {
  height: 40px; width: auto; max-width: 170px; flex: none; object-fit: contain;
  display: block; background: #fff; border-radius: 6px; padding: 3px 7px;
}
.topbar .spacer { flex: 1; }
.topbar .whoami { font-size: .86rem; color: #c7d6e8; }
.topbar .whoami strong { color: #fff; font-weight: 600; }
.topbar .top-link { color: #c7d6e8; font-size: .9rem; }
.topbar .top-link:hover { color: #fff; text-decoration: none; }
.hamburger { display: none; cursor: pointer; font-size: 1.4rem; line-height: 1; padding: .2rem .4rem; border-radius: 6px; }
.hamburger:hover { background: rgba(255,255,255,.12); }

.layout { display: flex; align-items: stretch; min-height: calc(100vh - 56px); }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--brand-800);
  color: #cdd9e7;
  padding: 1rem .75rem 2rem;
  position: sticky; top: 56px; align-self: flex-start;
  height: calc(100vh - 56px); overflow-y: auto;
  transition: width .22s ease, padding .22s ease, opacity .18s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }
/* Sidebar colapsado */
.sidebar-off .sidebar {
  width: 0 !important; padding: 0 !important;
  overflow: hidden !important; opacity: 0;
}
/* Botón colapsar en la topbar */
.btn-sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: #c7d6e8; font-size: 1.05rem; line-height: 1;
  padding: .25rem .45rem; border-radius: 6px;
  display: flex; align-items: center;
}
.btn-sidebar-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar .nav-group { margin-bottom: .15rem; }
.sidebar .nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  color: #7f97b3; padding: .45rem .6rem; font-weight: 700;
  cursor: pointer; user-select: none;
  display: flex; justify-content: space-between; align-items: center;
  border-radius: var(--radius-sm); margin: 0 0 .1rem;
  transition: color .15s;
}
.sidebar .nav-label:hover { color: #b0c4d8; }
.sidebar .nav-label::after {
  content: '▾'; font-size: .7rem; opacity: .6;
  transition: transform .2s ease; display: inline-block;
}
.sidebar .nav-group.collapsed .nav-label { margin-bottom: 0; }
.sidebar .nav-group.collapsed .nav-label::after { transform: rotate(-90deg); }
.sidebar .nav-items {
  overflow: hidden;
  max-height: 800px;
  transition: max-height .28s ease, opacity .2s ease;
  opacity: 1;
}
.sidebar .nav-group.collapsed .nav-items { max-height: 0; opacity: 0; }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .65rem; margin: .12rem 0;
  border-radius: var(--radius-sm);
  color: #d6e1ee; font-size: .92rem; font-weight: 500;
}
.sidebar a.nav-item:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.sidebar a.nav-item.active { background: var(--brand-600); color: #fff; box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.sidebar a.nav-item .ic { width: 18px; text-align: center; opacity: .9; flex: none; }

/* Submenú de reportes: las opciones del reporte activo se listan DEBAJO del ítem "Reportes". */
.sidebar .nav-sub { display: flex; flex-direction: column; margin: .05rem 0 .3rem; padding-left: 1.45rem; }
.sidebar a.nav-sub-item { display: block; padding: .3rem .55rem; margin: .04rem 0; font-size: .82rem;
  color: rgba(255,255,255,.72); border-left: 2px solid rgba(255,255,255,.18);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sidebar a.nav-sub-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar a.nav-sub-item.active { color: #fff; background: rgba(255,255,255,.14); border-left-color: #fff; font-weight: 600; }

.content { flex: 1; min-width: 0; padding: 1.5rem 1.75rem 3rem; }

/* ---------- Encabezado de página ---------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 1.35rem; letter-spacing: -.01em; }
.page-header .sub { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.breadcrumb { color: var(--muted); font-size: .85rem; margin-bottom: .25rem; }
.breadcrumb a { color: var(--muted); }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.15rem; margin-bottom: 1rem;
}
.card.tight { padding: 0; overflow: hidden; }
.card h2 { margin: 0 0 .9rem; font-size: 1.05rem; }
.card h3 { font-size: .98rem; }

/* Grid de métricas (dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: .85rem 1rem; transition: box-shadow .15s;
}
.stat:hover { box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.stat .value { font-size: 1.55rem; font-weight: 800; color: var(--brand-900); margin-top: .2rem; letter-spacing: -.01em; }
.stat .value small { font-size: .9rem; color: var(--ink-soft); font-weight: 600; }
.stat .foot { color: var(--muted); font-size: .78rem; margin-top: .25rem; }
.stat.accent { border-top: 3px solid var(--accent); }

/* Dashboard: gráfico de barras + columnas */
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.barchart { display: flex; gap: 1rem; align-items: flex-end; height: 200px; padding-top: 1.2rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: .72rem; color: var(--ink-soft); font-weight: 600; margin-bottom: 4px; height: 1rem; white-space: nowrap; }
.bar-track { flex: 1; width: 60%; max-width: 54px; display: flex; align-items: flex-end; background: #f1f4f7; border-radius: 6px 6px 0 0; }
.bar-fill { width: 100%; background: linear-gradient(180deg, var(--brand-500), var(--brand-700)); border-radius: 6px 6px 0 0; min-height: 2px; transition: height .3s; }
.bar-lbl { font-size: .78rem; color: var(--muted); margin-top: 6px; font-weight: 600; }
@media (max-width: 760px) { .dash-cols { grid-template-columns: 1fr; } }

/* Modal (alta rápida) */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-box { background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.25); width: 100%; max-width: 460px; padding: 1.4rem 1.5rem; }
.modal-box h3 { margin: 0 0 1rem; }

/* ---------- Tablas ---------- */
/* Listas largas: el contenedor scrollea y el encabezado queda fijo arriba. */
.table-wrap { overflow: auto; max-height: 72vh; }
table.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.table thead th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
  padding: .5rem .6rem; border: 0; border-bottom: 2px solid var(--line);
  white-space: nowrap; background: var(--card);
}
/* Encabezado fijo solo dentro de un contenedor con scroll (listados largos). */
.table-wrap table.table thead th { position: sticky; top: 0; z-index: 1; }
table.table tbody td { padding: .5rem .6rem; border: 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover td { background: #f3f7fc; }
table.table tfoot td { padding: .5rem .6rem; border: 0; border-top: 2px solid var(--line); font-weight: 700; }
table.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.table tbody tr.mov-transito td { background: #fff7e8; color: #7a5b1e; }
table.table .actions { text-align: right; white-space: nowrap; }
table.table .muted-row td { color: var(--muted); }
/* Fila con saldo pendiente (por cobrar / por pagar): tinte ámbar suave + acento a la izquierda */
table.table tbody tr.row-pending td { background: #fdf6e9; }
table.table tbody tr.row-pending td:first-child { box-shadow: inset 3px 0 0 #e0912a; }
table.table tbody tr.row-pending:hover td { background: #fbeecf; }
/* Popover: saldo pendiente en bolívares (a tasa factura y a tasa del día) al pasar el cursor por el Saldo */
.saldo-bs { position: relative; cursor: help; border-bottom: 1px dotted #b0863a; }
.saldo-bs .sb-pop { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; text-align: left;
  background: #0f172a; color: #f1f5f9; padding: 8px 11px; border-radius: 8px; font-size: .72rem; line-height: 1.55;
  white-space: nowrap; box-shadow: 0 10px 26px rgba(8,22,40,.32); font-weight: 400; }
.saldo-bs:hover .sb-pop { display: block; }
.saldo-bs .sb-h  { display: block; color: #7dd3fc; font-weight: 700; text-transform: uppercase; font-size: .6rem; letter-spacing: .04em; margin-bottom: 3px; }
.saldo-bs .sb-l  { display: block; }
.saldo-bs .sb-bs { color: #fde68a; }
.saldo-bs .sb-r  { color: #94a3b8; font-weight: 400; }
/* Puente invisible sobre el popover: al mover el mouse hacia él no se pierde el hover (no parpadea) */
.saldo-bs .sb-pop::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
/* Chips SIEMPRE VISIBLES para cobrar en Bs con un clic (formulario de cobro): la acción no vive en un hover */
.sb-chips { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; margin-top: 3px; }
.sb-chip { font-size: .68rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid #cbd5e1; background: #f5f7fa; color: #475569; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sb-chip small { font-weight: 700; font-size: .58rem; text-transform: uppercase; letter-spacing: .03em; opacity: .7; }
.sb-chip:hover { background: #e2e8f0; border-color: #94a3b8; }
.sb-chip.sb-chip-hoy { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.sb-chip.sb-chip-hoy:hover { background: #dbeafe; border-color: #60a5fa; }

/* ── Tabla de LÍNEAS (ventas / cotización / compras): compacta, tipo hoja de cálculo ── */
#lineas-tabla { border: 1px solid var(--line, #cbd5e1); font-size: .84rem; }
#lineas-tabla thead th { padding: .22rem .4rem; font-size: .72rem; }
#lineas-tabla tbody td { padding: .09rem .35rem; border-right: 1px solid #e9eef4; vertical-align: middle; }
#lineas-tabla tbody td:last-child { border-right: 0; }
#lineas-tabla tbody tr:hover td { background: #eef5ff; }
#lineas-tabla td input:not([type=checkbox]):not([type=hidden]),
#lineas-tabla td select { height: 1.72rem; padding: .1rem .35rem; font-size: .82rem; }
#lineas-tabla td .ln-desc { width: 100%; }
/* Unidad junto a la cantidad: ancho FIJO para que los inputs queden alineados en todas las filas
   (con o sin unidad). Aplica a ventas, cotizaciones y compras. */
#lineas-tabla .ln-uni { display: inline-block; width: 2.6em; text-align: left; vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lineas-tabla .ln-desc-toggle { cursor: pointer; color: var(--brand-600, #2563eb); font-size: 1rem; text-decoration: none; padding: 0 .15rem; flex: 0 0 auto; line-height: 1; }
#lineas-tabla .ln-desc-toggle:hover { color: var(--brand-700, #1d4ed8); }
#lineas-tabla .ln-nota { margin-top: .15rem !important; }
#lineas-tabla .ln-disc input { width: 30px !important; }
#lineas-tabla .ln-neto, #lineas-tabla .ln-total { font-variant-numeric: tabular-nums; white-space: nowrap; }
#lineas-tabla .btn-inline { padding: 0 .3rem; }

/* ---------- Modal de elección (askModal) ---------- */
.ask-ov { position: fixed; inset: 0; background: rgba(8,22,40,.55); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ask-box { background: var(--card, #fff); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.3); max-width: 480px; width: 100%; overflow: hidden; }
.ask-tit { background: var(--brand-700, #1f4e79); color: #fff; font-weight: 700; padding: .8rem 1.1rem; font-size: 1.02rem; }
.ask-body { padding: 1rem 1.1rem; color: var(--ink, #1f2933); line-height: 1.5; }
.ask-input { width: 100%; margin-top: .6rem; padding: .5rem .6rem; border: 1px solid var(--line, #ccd); border-radius: 7px; font-size: .95rem; }
.ask-acts { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; padding: .2rem 1.1rem 1.1rem; }
.ask-acts .btn { flex: 1 1 auto; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; line-height: 1.5; border: 1px solid transparent;
}
.badge-ok    { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.badge-muted { background: #eef1f4; color: var(--ink-soft); border-color: #dfe3e8; }
.badge-info  { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.badge-warn  { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.badge-usd   { background: #e8f3ee; color: #16734a; border-color: #bfe0cd; }
.badge-ves   { background: #eef0fb; color: #3a3f97; border-color: #c9cef0; }
.badge-danger{ background: #fdeaea; color: #b91c1c; border-color: #f3c2c2; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; background: #fff; color: var(--ink);
  transition: background .12s, border-color .12s, box-shadow .12s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); color: #fff; }
.btn-secondary { background: #fff; color: var(--brand-700); border-color: #cdd9e7; }
.btn-secondary:hover { background: #f2f6fb; }
.btn-danger { background: #fff; color: var(--err-fg); border-color: var(--err-bd); }
.btn-danger:hover { background: var(--err-bg); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #eef1f4; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-inline { padding: 0; border: 0; background: none; color: var(--brand-600); font-weight: 600; cursor: pointer; font-size: .86rem; }
.btn-inline.danger { color: var(--err-fg); }
.btn-inline:hover { text-decoration: underline; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .7rem 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: .78rem; color: var(--muted); }
.field.required > label::after { content: " *"; color: var(--err-fg); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: .55rem .65rem; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #cfd6de; border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,130,196,.18);
}
textarea { resize: vertical; min-height: 80px; }
.check { flex-direction: row; align-items: center; gap: .5rem; }
.check input { width: auto; }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line-soft); }
.form-actions .grow { flex: 1; }

/* ---------- Entrada de líneas (cotización / venta) — compacta ---------- */
.ln-desc-toggle { display: inline-block; margin-top: .25rem; font-size: .76rem; color: var(--muted); cursor: pointer; }
.ln-desc-toggle:hover { color: var(--brand-600); text-decoration: underline; }
#lineas-body td { padding: .35rem .5rem; }
#lineas-body input, #lineas-body select { padding: .4rem .55rem; }
#lineas-body .ln-prod-search { font-weight: 600; }
#lineas-body tr:hover td { background: #f3f7fc; }
#lineas-body td.ln-total, #lineas-body td.ln-neto { font-variant-numeric: tabular-nums; }

/* ---------- Flash ---------- */
.flash-stack { margin-bottom: 1.1rem; display: grid; gap: .55rem; }
.flash {
  padding: .65rem .9rem; border-radius: var(--radius-sm); font-size: .9rem;
  border: 1px solid transparent; display: flex; gap: .5rem; align-items: flex-start;
}
.flash::before { font-weight: 700; }
.flash-ok    { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.flash-ok::before { content: "✓"; }
.flash-info  { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.flash-info::before { content: "ℹ"; }
.flash-warn  { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.flash-warn::before { content: "!"; }
.flash-error { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-bd); }
.flash-error::before { content: "⚠"; }
.flash ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* Resaltado de campo con error (rojo, no el foco azul del navegador). */
.input-error,
input.input-error,
select.input-error,
textarea.input-error {
  border: 2px solid var(--err-fg) !important;
  background: var(--err-bg) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(163, 37, 37, .15) !important;
}
.row-error > td { background: var(--err-bg) !important; }
.field-error-msg { color: var(--err-fg); font-weight: 600; }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .big { font-size: 2rem; margin-bottom: .4rem; opacity: .5; }

.muted { color: var(--muted); }
.text-sm { font-size: .85rem; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(1200px 500px at 50% -10%, #1d4e86 0%, var(--brand-900) 55%);
}
.login-card {
  background: #fff; border-radius: 14px; padding: 2rem 1.9rem; width: 360px; max-width: 100%;
  box-shadow: 0 18px 50px rgba(8,22,40,.45);
}
.login-card .logo-row { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-bottom: .35rem; }
.login-card .logo-row .logo { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #d2862a); display: grid; place-items: center; color: #3a2606; font-weight: 800; }
.login-card h1 { font-size: 1.15rem; margin: 0 0 .15rem; text-align: center; }
.login-card .tagline { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 1.3rem; }
.login-card label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin: .8rem 0 .3rem; }
.login-card button { width: 100%; margin-top: 1.3rem; padding: .65rem; font-size: .95rem; }
.login-foot { text-align: center; color: #9fb3c9; font-size: .78rem; margin-top: 1.1rem; }

/* ---------- Footer ---------- */
.footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 1.5rem 0 .5rem; border-top: 1px solid var(--line); margin-top: 1.5rem; }

/* ---------- Autocompletar (combobox) ---------- */
.ac-list {
  position: fixed; z-index: 60; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  max-height: 290px; overflow-y: auto;
}
.ac-item { padding: .45rem .65rem; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.ac-item:last-child { border-bottom: 0; }
.ac-item.active, .ac-item:hover { background: #eef4fb; }
.ac-sub { font-size: .77rem; color: var(--muted); margin-top: .1rem; }
/* Ítem que es un TOLDO completo (lista de precios): fondo ámbar + franja lateral para distinguirlo. */
.ac-item.ac-toldo { background: #fff3e0; box-shadow: inset 3px 0 0 #f0a020; }
.ac-item.ac-toldo.active, .ac-item.ac-toldo:hover { background: #ffe3bd; }
.ac-item.ac-toldo .ac-sub { color: #b45309; }
.ac-empty { padding: .6rem .65rem; color: var(--muted); font-size: .85rem; }

/* ---------- Nota de despacho (documento imprimible, Carta) ---------- */
@page { size: letter portrait; margin: 14mm; }

.doc-body { background: #eef1f4; margin: 0; }
.factura-toolbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between;
  gap: 1rem; padding: .7rem 1rem; background: var(--brand-900);
}
.factura {
  width: 816px; max-width: 100%; margin: 1.2rem auto; background: #fff; color: #2a3744;
  padding: 24px 30px; box-shadow: 0 6px 24px rgba(8,22,40,.16);
  font-size: 12px; line-height: 1.38; border-top: 4px solid var(--brand-700);
}
.fac-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem;
  border-bottom: 1px solid #e2e7ec; padding-bottom: 11px; margin-bottom: 13px; }
.fac-emisor { display: flex; gap: 11px; align-items: center; }
.fac-logo { width: 46px; height: 46px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800)); color: #fff; font-weight: 800; font-size: 1.05rem; }
.fac-logo-img { height: 50px; max-width: 175px; object-fit: contain; }
.fac-empnom { font-size: 1.18rem; font-weight: 800; color: var(--brand-900); letter-spacing: .2px; }
.fac-empdet { font-size: 10.5px; color: #5b6b7b; margin-top: 2px; line-height: 1.35; }
.fac-doc { text-align: right; flex: none; }
.fac-doc-title { display: inline-block; background: var(--brand-700); color: #fff; font-size: .82rem; font-weight: 800;
  letter-spacing: .8px; padding: 4px 12px; border-radius: 5px; margin-bottom: 7px; }
.fac-doc-meta { margin-left: auto; border-collapse: collapse; font-size: 11px; }
.fac-doc-meta td { padding: 1px 0 1px 10px; text-align: right; }
.fac-doc-meta td:first-child { color: #8090a0; text-transform: uppercase; font-size: 9px; }

.fac-parties { display: flex; gap: 1rem; margin: 0 0 11px; }
.fac-party { flex: 1; background: #f7f9fb; border: 1px solid #e6ebf0; border-radius: 7px; padding: 8px 11px; }
.fac-party h4 { margin: 0 0 4px; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: #8090a0; }
.fac-pname { font-weight: 700; font-size: 12.5px; color: var(--brand-900); }
.fac-pdet { font-size: 10.5px; color: #5b6b7b; margin-top: 2px; line-height: 1.35; }
.fac-cond { width: 100%; border-collapse: collapse; font-size: 11px; }
.fac-cond td { padding: 1px 0; }
.fac-cond td:first-child { color: #8090a0; width: 42%; }
.fac-cond td:last-child { text-align: right; font-weight: 600; }

table.fac-items { width: 100%; border-collapse: collapse; margin-top: 4px; }
table.fac-items thead th { background: var(--brand-800); color: #fff; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .03em; padding: 6px 8px; text-align: left; }
table.fac-items thead th.c-num { text-align: right; }
table.fac-items thead th.c-n { text-align: center; width: 24px; }
table.fac-items tbody td { padding: 4.5px 8px; border-bottom: 1px solid #ebeff3; vertical-align: top; }
table.fac-items tbody tr:nth-child(even) td { background: #f8fafc; }
table.fac-items tbody tr { page-break-inside: avoid; }
table.fac-items .c-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.fac-items .c-n { text-align: center; color: #8090a0; }
.fac-sub { font-size: 10px; color: #6b7a89; margin-top: 1px; }

.fac-bottom { display: flex; justify-content: space-between; gap: 1.5rem; margin-top: 11px; }
.fac-notas { flex: 1; font-size: 10.5px; color: #5b6b7b; }
.fac-terms { margin-top: 5px; font-style: italic; }
.fac-totales { border-collapse: collapse; min-width: 250px; font-size: 11.5px; }
.fac-totales td { padding: 2.5px 0 2.5px 14px; }
.fac-totales td:first-child { color: #5b6b7b; }
.fac-totales td.c-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fac-totales .fac-total-usd td { border-top: 2px solid var(--brand-700); font-size: 14px; font-weight: 800; color: var(--brand-900); padding-top: 6px; }
.fac-totales .fac-total-ves td { color: var(--brand-700); font-weight: 700; }
.fac-totales .fac-saldo td { border-top: 1px solid #e0e5ea; font-weight: 800; color: #a32525; padding-top: 5px; }

.fac-firmas { display: flex; gap: 3rem; margin-top: 26px; }
.fac-firma { flex: 1; text-align: center; border-top: 1px solid #6b7a89; padding-top: 5px; font-size: 10.5px; color: #5b6b7b; }
.fac-pie { margin-top: 13px; text-align: center; font-size: 9.5px; color: #8090a0; border-top: 1px solid #ebeff3; padding-top: 7px; }

@media print {
  .doc-body { background: #fff; }
  .factura-toolbar { display: none !important; }
  .factura { width: auto; margin: 0; padding: 0; box-shadow: none; border-top: 0; }
  .fac-head { border-top: 3px solid var(--brand-700); padding-top: 10px; }
  .fac-firmas { page-break-inside: avoid; }
}

/* ---------- Libros fiscales (Ventas / Compras) ---------- */
.only-print { display: none; }
.libro-head { text-align: center; margin-bottom: 1rem; }
.libro-head h2 { margin: 0; font-size: 1.1rem; }
.libro-head h3 { margin: .35rem 0 .15rem; font-size: .98rem; letter-spacing: .05em; }
.libro-sub { font-size: .82rem; color: #5a6b7d; }
.libro-cod { font-size: .8rem; font-weight: 600; color: #5a6b7d; background: #eef2f7; border: 1px solid #d7dee7; padding: .05rem .4rem; border-radius: 4px; margin-left: .4rem; }
.libro-resumen { margin-top: 1.4rem; }
.libro-resumen h4 { margin: 0 0 .55rem; font-size: .95rem; }
.libro .table-wrap { overflow-x: auto; }
.libro table.table-compact { border-collapse: collapse; width: 100%; font-size: 11.5px; }
.libro table.table-compact th,
.libro table.table-compact td { border: 1px solid #d7dee7; padding: .3rem .5rem; white-space: nowrap; }
.libro table.table-compact thead th { background: #eef2f7; color: #1e293b; font-weight: 600; text-align: center; }
.libro table.table-compact td.num,
.libro table.table-compact th.num { text-align: right; font-variant-numeric: tabular-nums; }
.libro table.table-compact tbody tr:nth-child(even) td { background: #fafbfc; }
.libro table.table-compact tfoot td { background: #eef2f7; border-top: 2px solid #9fb0c3; font-weight: 700; }
.libro .cero { color: #b6c0cc; }
.libro .ellip { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Formato extendido SENIAT (muchas columnas, bandas de sección) */
.libro-ext { font-size: 10px; }
.libro-ext .ellip { max-width: 150px; }
.libro table.libro-ext .bandas th { background: #dde6f0; text-align: center; border-bottom: none; }
.libro table.libro-ext .banda { font-weight: 700; letter-spacing: .03em; border-bottom: 2px solid #8aa0ba; background: #cfdcec; }
.libro table.libro-ext thead th { font-size: 9.5px; line-height: 1.1; }
.libro table.libro-ext tr.fila-ret td { background: #f3f7ee; font-style: italic; color: #4a5d3a; }
@media print { .libro table.libro-ext tr.fila-ret td { background: #f3f7ee !important; } }
@media print {
  .topbar, .sidebar { display: none !important; }
  .layout { display: block; }
  .content { padding: 0 !important; }
  .only-print { display: block !important; }
  .no-print { display: none !important; }
  .card.libro { box-shadow: none; border: 0; padding: 0; margin: 0; }
  .libro table.table-compact { font-size: 8px; table-layout: fixed; width: 100%; }
  .libro table.table-compact th, .libro table.table-compact td { padding: .12rem .2rem; word-break: break-word; }
  .libro table.table-compact .mono { font-size: 7.5px; }
  .libro table.libro-ext { font-size: 6px; }
  .libro table.libro-ext th { font-size: 5.7px; }
  .libro table.libro-ext .mono { font-size: 5.7px; }
  .libro table.libro-ext th, .libro table.libro-ext td { padding: .06rem .08rem; }
  .libro .ellip { max-width: none; white-space: normal; }
  .libro table.table-compact tbody tr:nth-child(even) td { background: #fff; }
  .libro-resumen { page-break-inside: avoid; }
}

/* ---------- Recibo de cobro (media carta) ---------- */
.recibo {
  width: 760px; max-width: 100%; margin: 1.2rem auto; background: #fff; color: #2a3744;
  padding: 22px 26px; box-shadow: 0 6px 24px rgba(8,22,40,.16); font-size: 12px; line-height: 1.4;
  position: relative; overflow: hidden; border-top: 4px solid var(--brand-700);
}
.rec-stamp {
  position: absolute; top: 42%; left: 50%; transform: translate(-50%,-50%) rotate(-16deg);
  font-size: 3.6rem; font-weight: 800; letter-spacing: .12em; color: rgba(163,37,37,.16);
  border: 6px solid rgba(163,37,37,.16); border-radius: 12px; padding: .05em .25em; pointer-events: none;
}
.rec-anul-nota { margin-top: 14px; padding: 6px 10px; background: #fdeaea; border: 1px solid #f2bcbc;
  color: #a32525; font-size: 11px; border-radius: 6px; font-weight: 600; }
.rec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  border-bottom: 1px solid #e2e7ec; padding-bottom: 9px; margin-bottom: 12px; }
.rec-emisor { display: flex; gap: 10px; align-items: center; }
.rec-logo { width: 42px; height: 42px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800)); color: #fff; font-weight: 800; }
.rec-logo-img { height: 44px; max-width: 150px; object-fit: contain; }
.rec-empnom { font-size: 1.05rem; font-weight: 800; color: var(--brand-900); }
.rec-empdet { font-size: 10.5px; color: #5b6b7b; margin-top: 1px; line-height: 1.35; }
.rec-doc { text-align: right; }
.rec-title { display: inline-block; background: var(--brand-700); color: #fff; font-weight: 800;
  letter-spacing: .7px; font-size: .76rem; padding: 4px 11px; border-radius: 5px; margin-bottom: 5px; }
.rec-num { font-size: 1.05rem; font-weight: 800; color: var(--brand-900); }
.rec-fecha { font-size: 10.5px; color: #5b6b7b; }
/* Monto a la derecha, bajo la fecha. */
.rec-doc-monto { margin-top: 8px; padding-top: 7px; border-top: 1px solid #e6ebf0; }
.rec-doc-monto .rec-monto-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: #8090a0; }
.rec-doc-monto .rec-monto-val { display: block; font-size: 1.5rem; font-weight: 800; color: var(--brand-900); line-height: 1.15; }
.rec-doc-monto .rec-monto-eq { display: block; font-size: 9.5px; color: #5b6b7b; margin-top: 1px; }
.rec-monto { display: flex; align-items: baseline; gap: 12px; margin: 14px 0; padding: 10px 14px;
  background: #f7f9fb; border: 1px solid #e6ebf0; border-radius: 8px; }
.rec-monto-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #8090a0; }
.rec-monto-val { font-size: 1.55rem; font-weight: 800; color: var(--brand-900); }
.rec-monto-eq { font-size: 11px; color: #5b6b7b; margin-left: auto; }
.rec-datos { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 12px; }
.rec-datos td { padding: 4px 0; vertical-align: top; }
.rec-datos td:first-child { color: #8090a0; width: 32%; }
.rec-cuenta { width: 280px; border-collapse: collapse; font-size: 12.5px; margin-left: auto; }
.rec-cuenta td { padding: 3px 0 3px 12px; }
.rec-cuenta td:first-child { color: #5b6b7b; }
.rec-cuenta td.c-num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-cuenta .rec-saldo td { border-top: 2px solid var(--brand-700); font-weight: 800; color: #a32525; padding-top: 6px; }
.rec-firma { margin-top: 34px; width: 240px; border-top: 1px solid #5b6b7b; padding-top: 5px;
  text-align: center; font-size: 11px; color: #5b6b7b; }
.rec-pie { margin-top: 16px; text-align: center; font-size: 10px; color: #8090a0; border-top: 1px solid #e9edf1; padding-top: 7px; }
@media print {
  .recibo { width: auto; margin: 0; padding: 0; box-shadow: none; border-top: 0; }
  .recibo .rec-head { border-top: 3px solid var(--brand-700); padding-top: 9px; }
}

/* ---------- Encabezados ordenables ---------- */
.table th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.th-sort:hover { color: var(--brand-600); }
.table th.th-sort::after { content: '⇅'; opacity: .3; font-size: .82em; margin-left: .35rem; }
.table th.th-asc::after  { content: '▲'; opacity: .85; }
.table th.th-desc::after { content: '▼'; opacity: .85; }

/* ---------- Campos múltiples (teléfonos/emails) ---------- */
.multi .multi-rows { display: flex; flex-direction: column; gap: .35rem; }
.multi .multi-row { display: flex; gap: .35rem; align-items: center; }
.multi .multi-input { flex: 1; }
.multi .multi-del {
  flex: none; width: 30px; height: 30px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); border-radius: var(--radius-sm);
  cursor: pointer; line-height: 1; font-size: .85rem;
}
.multi .multi-del:hover { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-bd); }
.multi .multi-add { margin-top: .4rem; }

/* ---------- Reportes ---------- */
/* Las opciones de reporte viven en el SIDEBAR (submenú .nav-sub bajo el ítem "Reportes").
   .rep-tabs ya no se usa en página; se conserva el estilo original por si se reutiliza. */
.rep-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; border-bottom: 2px solid var(--line); }
.rep-tab { padding: .5rem .9rem; font-size: .9rem; font-weight: 600; color: var(--ink-soft);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; border: 2px solid transparent; border-bottom: none; margin-bottom: -2px; }
.rep-tab:hover { background: var(--line-soft); text-decoration: none; color: var(--brand-700); }
.rep-tab-on { color: var(--brand-700); border-color: var(--line); background: var(--card); border-bottom: 2px solid var(--card); }

.rep-filtros { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .85rem; margin-bottom: .6rem; }
.rep-presets { display: flex; flex-wrap: wrap; gap: .3rem; }
.rep-rango { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.rep-rango label { font-size: .8rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: .15rem; }
.rep-rango input[type=date] { padding: .35rem .5rem; }

.rep-acciones { display: flex; gap: .4rem; }
.rep-iva { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .85rem; margin-bottom: .8rem; }
.rep-iva-lbl { font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.rep-iva label { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; cursor: pointer; }
.rep-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .5rem; }
.rep-periodo { font-size: .85rem; color: var(--muted); }

.rep-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: .7rem; margin-bottom: .9rem; }
.rep-kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .95rem;
  box-shadow: var(--shadow-sm); transition: box-shadow .15s; }
.rep-kpi:hover { box-shadow: var(--shadow); }
.rep-kpi-val { font-size: 1.45rem; font-weight: 800; color: var(--brand-900); font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.01em; }
.rep-kpi-lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--muted); margin-top: .3rem; }
.rep-kpi-sub { font-size: .74rem; color: var(--muted); margin-top: .15rem; }

.rep-chart { width: 100%; max-width: 760px; margin: .3rem 0 .6rem; }   /* tope = tamaño de diseño del SVG (no crece de más en pantallas anchas) */
.rep-svg { width: 100%; height: auto; display: block; }
.rep-svg .rep-axis { font-size: 11px; fill: #7b8794; }
.rep-svg .rep-val { font-size: 10.5px; fill: #52606d; font-weight: 600; }
.rep-svg .rep-bar { transition: opacity .15s; }
.rep-svg .rep-bar:hover { opacity: .82; }
.rep-legend { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: .4rem; font-size: .82rem; color: var(--ink-soft); }
.rep-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.rep-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.rep-empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* ---------- Listas compactas (norma: filas bajitas tipo Excel) ---------- */
/* Úsalo en tablas de LISTA que llevan inputs/controles por fila, para que las filas
   no queden altas. Combínalo con .inp-sm en los inputs de la fila. */
table.table.table-tight th, table.table.table-tight td { padding-top: .28rem; padding-bottom: .28rem; vertical-align: middle; }
.inp-sm { padding: .22rem .45rem !important; height: auto !important; line-height: 1.3; }
.rep-subtot > td { background: var(--panel-2, #f7f7f9); border-top: 1px solid var(--border); }

/* ---------- Estado de cuenta (tabla estilo Excel) ---------- */
.rep-f { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); gap: .15rem; }
.rep-f select, .rep-f input[type=date] { font-size: .85rem; padding: .28rem .4rem; }
.est-card { padding: 0; overflow: hidden; }
.est-nota { margin-top: .6rem; }
table.tbl-estado { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.tbl-estado caption.est-cap {
  caption-side: top; text-align: left; font-weight: 700; font-size: .95rem;
  padding: .5rem .7rem; color: #1e293b; border-bottom: 2px solid #9fb0c3;
}
table.tbl-estado caption.est-usd { background: #e8f2ec; border-bottom-color: #6fae86; }
table.tbl-estado caption.est-ves { background: #eaf0f8; border-bottom-color: #7f9fc9; }
table.tbl-estado th, table.tbl-estado td { border: 1px solid #d7dee7; padding: .3rem .6rem; white-space: nowrap; }
table.tbl-estado thead th { background: #eef2f7; color: #1e293b; font-weight: 600; text-align: left; }
table.tbl-estado th.num, table.tbl-estado td.num { text-align: right; }
table.tbl-estado td.est-tipo { color: #5a6b7d; font-size: 11.5px; }
table.tbl-estado tbody tr:nth-child(even) td { background: #fafbfc; }
table.tbl-estado td.pos { color: #1b7a3d; }
table.tbl-estado td.neg { color: #a32525; }
table.tbl-estado td.fin { font-weight: 700; }
table.tbl-estado a.est-link { color: var(--brand-700); font-weight: 600; }
table.tbl-estado a.est-link:hover { text-decoration: underline; }
.est-link-ico { font-size: .8em; opacity: .5; }

/* ---------- Reporte gerencial (estado de resultados) ---------- */
.ger-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; align-items: start; }
table.ger-pl td:first-child { white-space: nowrap; }
table.ger-pl tr.ger-sub td { background: #f0f3f8; font-weight: 600; border-top: 1px solid #b9c6d6; }
table.ger-pl tr.ger-tot td { background: #dfe7f1; font-weight: 700; border-top: 2px solid #8aa0ba; font-size: 1.02em; }
table.ger-pl tr.ger-neg td:first-child { color: #7a4a4a; }
/* ---------- Valoración de inventario (filas compactas) ---------- */
.val-desync { font-size: .7rem; color: #a8791f; white-space: nowrap; margin-left: .3rem; }
#val-table td, #val-table th { padding-top: .3rem; padding-bottom: .3rem; }
#val-table td div.muted { line-height: 1.1; }
@media print {
  #val-table { font-size: 8.5px; }
  #val-table .toggle-capas { border: 0 !important; background: transparent !important; padding: 0 !important; color: #1e293b; }
  #val-table td, #val-table th { padding: .1rem .3rem; }
  .val-desync { color: #a8791f !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #val-table tr[style*="background"] td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Fila "Tipo de documento · N° factura · N° control" (compras) ---------- */
.form-grid > .doc-row { grid-column: 1 / -1; }
.doc-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.doc-row > .doc-cell { flex: 1 1 240px; min-width: 200px; margin: 0; }

.ger-alert { display: flex; align-items: center; gap: .8rem; background: #fff7e6; border: 1px solid #f0c869;
  border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; color: #7a5b12; }
.ger-alert-ic { font-size: 1.4rem; line-height: 1; }
.ger-alert div { flex: 1; }
.ger-var { font-size: .82em; font-weight: 700; white-space: nowrap; }
.ger-var.up { color: #1b7a3d; }
.ger-var.down { color: #a32525; }
@media print {
  .ger-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ger-var { font-size: 7.5px; }
}
table.tbl-estado tr.est-sub-row td { background: #f0f3f8; font-weight: 600; border-top: 1px solid #b9c6d6; }
table.tbl-estado tfoot td { background: #dfe7f1; border-top: 2px solid #8aa0ba; font-weight: 700; letter-spacing: .02em; }

@media print {
  .est-card { box-shadow: none; border: 1px solid #b9c6d6; margin: 0 0 8px; }
  table.tbl-estado { font-size: 8.5px; }
  table.tbl-estado thead { display: table-header-group; }
  table.tbl-estado caption.est-cap { font-size: 9.5px; padding: .2rem .35rem; }
  table.tbl-estado th, table.tbl-estado td { padding: .1rem .3rem; }
  table.tbl-estado caption.est-usd, table.tbl-estado caption.est-ves,
  table.tbl-estado thead th, table.tbl-estado tr.est-sub-row td, table.tbl-estado tfoot td,
  table.tbl-estado tbody tr:nth-child(even) td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .est-nota { font-size: 7.5px; }
}

/* ---------- Chips de filtro rápido (por estado, etc.) ---------- */
.chip-filtros { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .75rem;
  border-radius: 999px; font-size: .82rem; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft); cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { background: var(--line-soft); text-decoration: none; color: var(--brand-700); }
.chip-on { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.chip-on:hover { background: var(--brand-700); color: #fff; }
.chip-n { font-size: .72rem; font-weight: 700; background: rgba(0,0,0,.07); border-radius: 999px; padding: 0 .42rem; }
.chip-on .chip-n { background: rgba(255,255,255,.26); }

/* ---------- Encabezado de impresión de reportes (compartido) ---------- */
.rep-print-head, .est-print-head { text-align: center; margin-bottom: .8rem; }
.rep-print-head h2, .est-print-head h2 { margin: 0; font-size: 1.15rem; }
.rep-print-head .est-sub, .rep-print-head .rep-print-sub,
.est-print-head .est-sub { font-size: .82rem; color: #5a6b7d; margin-top: .2rem; }

/* ---------- Impresión (vistas normales) ---------- */
@media print {
  .topbar, .sidebar, .nav-overlay, .no-print, .breadcrumb { display: none !important; }
  .only-print { display: block !important; }
  body { background: #fff; }
  .layout { display: block; }
  .content { padding: 0; }
  /* Las tarjetas NO llevan break-inside:avoid: una tabla larga dentro debe poder partirse
     entre páginas (si no, el navegador empuja toda la tarjeta a la página siguiente y deja
     la primera en blanco). El avoid se aplica solo a bloques atómicos pequeños (KPI, gráfico). */
  .card { box-shadow: none; border: 1px solid #b9c6d6; padding: 6px 8px; margin: 0 0 8px; }
  .footer { border: 0; }
  a { color: #000; text-decoration: none; }
  .rep-chart, .rep-kpi { break-inside: avoid; }
  /* Repite el encabezado de la tabla en cada página impresa. */
  table.table thead { display: table-header-group; }
  .page-header h1 { font-size: 1.2rem; }
  .rep-kpis { gap: 6px; }
  .rep-kpi { padding: 6px 10px; }
  .rep-kpi-val { font-size: 1rem; }
  /* Al imprimir, las tablas no scrollean ni fijan encabezado. */
  .table-wrap { overflow: visible; max-height: none; }
  /* --- FORMATO ESTÁNDAR DE REPORTES: tabla compacta tipo hoja de cálculo --- */
  table.table {
    border-collapse: collapse; width: 100%; font-size: 8.5px;
    font-variant-numeric: tabular-nums; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  table.table th, table.table td { border: 1px solid #c2ccd8; padding: .12rem .3rem; white-space: nowrap; }
  table.table thead th {
    position: static; box-shadow: none; background: #eef2f7 !important; color: #1e293b;
    font-weight: 600; text-align: left; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  table.table td.num, table.table th.num { text-align: right; }
  table.table tbody tr:nth-child(even) td { background: #fafbfc !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.table tfoot td { background: #dfe7f1 !important; border-top: 2px solid #8aa0ba; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* La columna de acciones y badges decorativos no se imprimen. */
  table.table th.actions, table.table td.actions { display: none; }
  table.table .badge { border: 0 !important; background: transparent !important; padding: 0 !important; font-weight: 600; color: #1e293b !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .form-grid { grid-template-columns: 1fr; }
  .hamburger { display: inline-block; }
  .content { padding: 1.1rem 1rem 3rem; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; height: auto;
    transform: translateX(-100%); transition: transform .22s ease; z-index: 40;
    box-shadow: 6px 0 24px rgba(0,0,0,.25);
  }
  .nav-toggle:checked ~ .layout .sidebar { transform: translateX(0); }
  .nav-toggle:checked ~ .nav-overlay { display: block; }
  .nav-overlay { display: none; position: fixed; inset: 56px 0 0 0; background: rgba(8,22,40,.45); z-index: 35; }
}
