/* =========================================================
   FACTURACION BAUMANN — mismos tokens de marca que el sitio y
   el inventario (css/styles.css, inventario-app/public/styles.css):
   sidebar en desktop, barra inferior en mobile, chips tonales,
   tarjetas de KPI arriba. Proyecto independiente, mismo lenguaje
   visual para que las dos apps se sientan parte de la misma familia.
   ========================================================= */
:root {
  --black:      #0a0a0a;
  --black-soft: #141414;
  --black-card: #1b1b1b;
  --line:       #2b2b2b;
  --red:        #e21210;
  --red-dark:   #b40e0c;
  --red-soft:   rgba(226, 18, 16, .14);
  --green:      #2ea043;
  --green-dark: #23843a;
  --green-soft: rgba(46, 160, 67, .16);
  --amber:      #d29922;
  --amber-soft: rgba(210, 153, 34, .16);
  --white:      #ffffff;
  --gray-100:   #f5f5f5;
  --gray-300:   #cfcfcf;
  --gray-500:   #8a8a8a;

  --font-display: 'Anton', Impact, sans-serif;
  --font-body:    'Inter', -apple-system, Segoe UI, Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --nav-w: 248px;
  --bottom-nav-h: 68px;

  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--black);
  color: var(--gray-100);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0;
}

.hidden { display: none !important; }
.icon { display: block; width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* =========================== BUTTONS =========================== */

button {
  font: inherit;
  cursor: pointer;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-size: .95rem;
  font-weight: 700;
  width: 100%;
  box-shadow: 0 8px 22px rgba(226, 18, 16, .28);
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease;
}
button:hover { background: var(--red-dark); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .6; cursor: default; transform: none; }

button.secundario {
  background: transparent;
  color: var(--gray-100);
  border: 1px solid var(--line);
  box-shadow: none;
  margin-top: 10px;
}
button.secundario:hover { border-color: var(--red); color: var(--red); background: transparent; }

button.chico { padding: 9px 14px; font-size: .82rem; width: auto; box-shadow: none; }

/* =========================== LOGIN =========================== */

#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(226, 18, 16, .16), transparent 60%),
    var(--black);
}

.login-card {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin-bottom: 16px;
  box-shadow: 0 0 0 3px var(--line);
}

.login-card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.login-card p { color: var(--gray-500); margin: 0 0 20px; font-size: .9rem; }

.login-card input {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  background: var(--black-soft);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.login-card input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.login-card button { margin-top: 6px; }

/* =========================== APP SHELL / NAV =========================== */

#app-view { min-height: 100vh; }

.app-nav {
  position: fixed;
  z-index: 100;
  display: flex;
  background: var(--black-soft);
}

.nav-brand { display: none; align-items: center; gap: 10px; }
.nav-logo { width: 34px; height: 34px; border-radius: 50%; }
.nav-brand-text { font-family: var(--font-display); font-size: 1rem; letter-spacing: .4px; display: flex; flex-direction: column; line-height: 1.15; }
.nav-brand-text small { font-size: .58rem; letter-spacing: 2.5px; color: var(--red); font-weight: 700; }

.nav-items { display: contents; }

.nav-section-label {
  display: none;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--gray-500);
  font-weight: 700;
  padding: 16px 14px 4px;
}
.nav-items > .nav-section-label:first-child { padding-top: 0; }

.tab-btn, .nav-logout {
  background: none;
  box-shadow: none;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  font-size: .68rem;
  font-weight: 600;
  width: auto;
}
.tab-btn:hover, .nav-logout:hover { background: rgba(255, 255, 255, .05); color: var(--white); transform: none; }
.tab-btn.active { color: var(--red); }

main {
  padding: 20px 16px calc(var(--bottom-nav-h) + 24px);
  max-width: 820px;
  margin: 0 auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 1.15rem; color: var(--white); }
.subhead { font-size: .95rem; color: var(--gray-300); text-transform: none; letter-spacing: 0; margin: 20px 0 10px; }
.section-hint { color: var(--gray-500); font-size: .85rem; margin: -8px 0 16px; }

/* ---- mobile: barra inferior tipo Treinta, con scroll horizontal
   (son bastantes pestañas - Nuevo/Cotizaciones/Facturas/Clientes/Productos/
   Stock/Salida/Entrada/Reportes - no entran estiradas en una pantalla chica) ---- */
@media (max-width: 899px) {
  .app-nav {
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    border-top: 1px solid var(--line);
    align-items: stretch;
    padding: 0 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }
  .nav-section-label { display: none; }
  .tab-btn, .nav-logout {
    flex: 0 0 auto;
    min-width: 66px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 8px;
    scroll-snap-align: start;
  }
  .nav-logout { min-width: 58px; }
}

/* ---- desktop: sidebar tipo Stripe/Linear ---- */
@media (min-width: 900px) {
  .app-nav {
    top: 0; left: 0; bottom: 0;
    width: var(--nav-w);
    flex-direction: column;
    border-right: 1px solid var(--line);
    padding: 22px 14px;
    gap: 4px;
  }
  .nav-brand { display: flex; padding: 4px 10px 22px; }
  .nav-items { display: flex; flex-direction: column; gap: 2px; }
  .nav-section-label { display: block; }
  .tab-btn, .nav-logout {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 14px;
    text-align: left;
    font-size: .92rem;
  }
  .tab-btn.active { background: var(--red-soft); color: var(--red); }
  .nav-logout { margin-top: auto; }

  main { margin-left: var(--nav-w); padding: 40px 44px; max-width: 960px; }
  /* "Nuevo documento" es una pantalla de trabajo (tipo POS), no una lista de
     lectura - en monitores anchos aprovecha mucho mas ancho que el resto de
     las pestañas para que items+resumen no queden con espacio muerto al lado,
     y con menos padding vertical (es la pantalla mas alta de contenido, la
     que mas necesita entrar sin scroll de pagina). */
  main:has(#tab-nuevo.active) { max-width: 1600px; padding-top: 22px; padding-bottom: 22px; }
}

/* =========================== STATS (Odoo/Treinta) =========================== */

.stats-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stat-tile {
  flex: 1;
  min-width: 130px;
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-tile .stat-value { font-family: var(--font-display); font-size: 1.5rem; color: var(--white); line-height: 1; white-space: nowrap; }
.stat-tile .stat-label { font-size: .68rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--gray-500); margin-top: 6px; display: block; }
.stat-tile.stat-alerta .stat-value { color: var(--red); }

/* =========================== SEARCH / FILTROS =========================== */

.panel-header { margin-bottom: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

.buscar, .filtro-select {
  padding: 11px 14px;
  background: var(--black-card);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.buscar { flex: 1; min-width: 180px; }
.buscar:focus, .filtro-select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.buscar::placeholder { color: var(--gray-500); }

/* =========================== LISTA / CARDS =========================== */

.lista { display: flex; flex-direction: column; gap: 8px; }

.card {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color .15s ease, background .15s ease;
}

.card-title {
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-body {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: .88rem;
  color: var(--gray-300);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.card-footer {
  font-size: .82rem;
  color: var(--gray-500);
  margin-top: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-acciones { display: flex; gap: 6px; margin-top: 8px; }
.card-acciones button { width: auto; }

.badge {
  font-size: .66rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-bajo { background: var(--red-soft); color: var(--red); }
.badge-pendiente { background: var(--amber-soft); color: var(--amber); }
.badge-neutral { background: rgba(255, 255, 255, .07); color: var(--gray-300); }

.card-bajo { border-color: rgba(226, 18, 16, .45); }

/* Medidor de nivel de stock (stock actual / stock ideal, marca en el minimo) */
.meter { margin: 8px 0 2px; }
.meter-track { position: relative; height: 10px; border-radius: 999px; background: var(--line); }
.meter-fill { height: 100%; border-radius: 999px; transition: width .2s ease; }
.meter-tick { position: absolute; top: -2px; bottom: -2px; width: 2px; border-radius: 1px; background: rgba(255, 255, 255, .55); }
.meter-ok .meter-track { background: var(--green-soft); }
.meter-ok .meter-fill { background: var(--green); }
.meter-bajo .meter-track { background: var(--red-soft); }
.meter-bajo .meter-fill { background: var(--red); }
.sugerido { color: var(--red); font-weight: 700; }

button.btn-entrada { background: var(--green); box-shadow: 0 8px 22px rgba(46, 160, 67, .28); }
button.btn-entrada:hover { background: var(--green-dark); }

.vacio { color: var(--gray-500); text-align: center; padding: 26px; font-size: .9rem; }

@media (min-width: 900px) {
  .lista:has(.card) { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--black-card); gap: 0; }
  .card {
    border: none; border-bottom: 1px solid var(--line); border-radius: 0;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
  }
  .lista .card:last-child { border-bottom: none; }
  .card:hover { background: var(--black-soft); }
  .card-title { flex: 0 0 220px; }
  .card-body { flex: 1; margin-top: 0; }
  .card-footer { flex: 0 0 auto; text-align: right; margin-top: 0; }
}

/* =========================== FORMS =========================== */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  max-width: 480px;
}
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .82rem;
  color: var(--gray-300);
  font-weight: 600;
}

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row label { flex: 1 1 140px; min-width: 0; }

.form input, .form select {
  padding: 11px 12px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: var(--font-body);
  color: var(--white);
}
.form input:focus, .form select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

.btn-scan-icon {
  width: 44px;
  flex-shrink: 0;
  padding: 0;
  background: var(--black-soft);
  border: 1px solid var(--line);
  color: var(--gray-300);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-scan-icon:hover { border-color: var(--red); color: var(--red); background: var(--black-soft); }
.btn-ver-password.activo { border-color: var(--red); color: var(--red); }

.msg { min-height: 1.2em; font-size: .85rem; margin: 0; }
.msg.ok { color: var(--green); }
.msg.error, .error { color: var(--red); }
.aviso {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(210, 153, 34, .35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  margin: -4px 0 4px;
}

/* =========================== BUILDER (Nuevo documento): items + resumen fijo =========================== */

.doc-info-panel { max-width: none; margin-bottom: 16px; padding: 16px 20px; gap: 10px; }
.doc-info-tipo-label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--gray-300); font-weight: 600; }

.builder-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  /* sin align-items: el default de grid es "stretch" - los dos cuadros
     quedan siempre a la misma altura (la del mas alto de los dos) sin
     numeros fijos, asi se acomodan solos si la ventana cambia de tamano.
     Tampoco hay max-width propio: usan todo el ancho que main les da (y
     main es mas ancho en esta pestaña especificamente, ver mas abajo). */
}
.builder-main, .builder-sidebar {
  max-width: none;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0; /* deja que los hijos con flex:1 / overflow funcionen dentro de un grid */
}
/* el resumen es la caja que mas alto natural aporta (toggle+total+desglose+
   pagado+3 botones) - achicada para que el conjunto entre mejor en pantallas
   bajas sin scroll. */
.builder-sidebar { gap: 8px; padding: 14px 16px; }
.builder-sidebar .sidebar-acciones button { padding: 10px 20px; }
.builder-sidebar .total-hero { padding: 10px 14px; }

@media (min-width: 900px) {
  .builder-layout { grid-template-columns: 1fr 340px; }
}

/* ---- pestañas de documentos abiertos (varios clientes a la vez) ---- */
.doc-tabs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.doc-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  flex: 1;
  min-width: 0;
}
.doc-tab {
  width: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--black-card);
  border: 1px solid var(--line);
  color: var(--gray-300);
  box-shadow: none;
  padding: 9px 10px 9px 16px;
  font-size: .85rem;
  font-weight: 600;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.doc-tab:hover { background: var(--black-soft); color: var(--white); transform: none; }
.doc-tab.activo { color: var(--white); border-color: var(--line); border-bottom-color: var(--red); background: var(--black-soft); }
.doc-tab .doc-tab-punto { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }
.doc-tab .doc-tab-cerrar {
  width: 18px; height: 18px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-500);
  box-shadow: none;
  font-size: .95rem;
  line-height: 1;
}
.doc-tab .doc-tab-cerrar:hover { background: var(--red-soft); color: var(--red); transform: none; }
.doc-tab-nuevo {
  width: auto;
  flex: 0 0 auto;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--gray-300);
  box-shadow: none;
  padding: 9px 14px;
  font-size: .85rem;
  border-radius: var(--radius-sm);
}
.doc-tab-nuevo:hover { border-color: var(--red); color: var(--red); background: transparent; }

/* ---- resumen de totales: numero grande arriba, desglose simetrico abajo ---- */
.total-hero {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 4px;
}
.total-hero-label { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--gray-500); }
.total-hero-value { display: block; font-family: var(--font-display); font-size: 1.9rem; color: var(--white); margin-top: 2px; }
.total-hero-hint { display: block; font-size: .72rem; color: var(--gray-500); margin-top: 2px; }

/* ---- info del documento (cliente/vehiculo/fechas) ---- */
.info-doc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (min-width: 560px) {
  .info-doc-row { grid-template-columns: repeat(4, 1fr); }
}
.info-doc-row label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--gray-300); font-weight: 600; }
.info-doc-row input, .info-doc-row select {
  padding: 11px 12px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: .95rem;
}
.info-doc-row input:focus, .info-doc-row select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* ---- toggle "Precio incluye IVA" ---- */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--gray-100);
  font-weight: 600;
  margin-bottom: 4px;
}
.switch { position: relative; display: inline-block; width: 40px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s ease; pointer-events: none; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--gray-300); transition: transform .15s ease, background .15s ease; }
.switch input:checked ~ .switch-track { background: var(--green); }
.switch input:checked ~ .switch-track .switch-thumb { transform: translateX(16px); background: var(--white); }
.switch input:focus-visible ~ .switch-track { box-shadow: 0 0 0 3px var(--red-soft); }

/* ---- Pagado / Por pagar ---- */
.fila-por-pagar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--white);
  padding-top: 6px;
  margin-bottom: 4px;
}

/* ---- Guardar / Cotizar / Facturar ---- */
.sidebar-acciones { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 14px; }
.sidebar-acciones button { margin-top: 0; }

.col-num { width: 30px; }
.items-tabla td.col-num, .items-tabla th.col-num { text-align: center; color: var(--gray-500); }

/* =========================== TIPO DE DOCUMENTO (chips) =========================== */

.tipo-doc-selector { display: flex; flex-wrap: wrap; gap: 8px; }
/* el de tipo de documento nunca se apila en varias lineas - prefiere
   scrollear horizontal a duplicar su alto y empujar todo lo de abajo */
#tipo-doc-selector { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
#tipo-doc-selector .tipo-doc-chip { flex-shrink: 0; }
.tipo-doc-chip {
  width: auto;
  background: var(--black-soft);
  border: 1px solid var(--line);
  color: var(--gray-300);
  box-shadow: none;
  padding: 10px 16px;
  font-size: .82rem;
  border-radius: var(--radius-sm);
}
.tipo-doc-chip:hover { border-color: var(--red); color: var(--white); background: var(--black-soft); transform: none; }
.tipo-doc-chip.activo { border-color: var(--red); background: var(--red-soft); color: var(--red); }

/* =========================== FACTURA: items + totales =========================== */

.items-tabla-wrap {
  overflow: auto;
  /* limite real del cuadro Y limite que usa el grid para calcular el alto de
     fila - sin esto, con muchos items el cuadro (y el grid entero) crece sin
     fin en vez de scrollear adentro. Es relativo al alto de la ventana, asi
     se achica o agranda solo si la ventana cambia de tamano. */
  max-height: min(60vh, 480px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
@media (min-width: 900px) {
  /* .builder-main queda estirado por el grid a la misma altura que
     .builder-sidebar (el mas alto de los dos manda, dentro del limite de
     arriba) - la tabla ocupa todo lo que sobra ahi adentro despues del
     titulo y los botones, con su propio scroll si hay mas filas de las
     que entran. */
  .items-tabla-wrap { flex: 1 1 auto; min-height: 260px; margin-bottom: 0; }
}
.items-tabla { width: 100%; border-collapse: collapse; font-size: .88rem; }
.items-tabla th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  background: var(--black-soft);
  color: var(--gray-300);
  font-weight: 600;
  text-transform: uppercase;
  font-size: .64rem;
  letter-spacing: .6px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.items-tabla th:last-child, .items-tabla td:last-child { border-right: none; }
.items-tabla td { padding: 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: middle; }
.items-tabla tr:last-child td { border-bottom: none; }
.items-tabla input, .items-tabla select {
  padding: 8px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  width: 100%;
}
.items-tabla .col-monto { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.items-tabla .col-quitar { width: 36px; text-align: center; }
.btn-quitar-item {
  width: 28px; height: 28px; padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--gray-500);
  box-shadow: none;
  font-size: 1rem;
  line-height: 1;
}
.btn-quitar-item:hover { border-color: var(--red); color: var(--red); background: transparent; }

.factura-totales {
  margin-left: auto;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}
.factura-totales .fila { display: flex; justify-content: space-between; gap: 16px; color: var(--gray-300); }
.factura-totales .fila.total { color: var(--white); font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }

/* =========================== COMPROBANTE (vista / impresion) =========================== */

.comprobante {
  background: var(--white);
  color: #111;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 560px;
  font-family: var(--font-body);
}
.comprobante-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 14px; }
.comprobante-head h2 { color: #111; font-size: 1.2rem; }
.comprobante-tipo { font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; color: #555; }
.comprobante-numero { font-family: var(--font-display); font-size: 1.3rem; text-align: right; }
.comprobante-datos { font-size: .85rem; color: #333; margin-bottom: 14px; line-height: 1.6; }
.comprobante table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 14px; }
.comprobante th { text-align: left; border-bottom: 1px solid #ccc; padding: 6px 4px; color: #555; font-size: .7rem; text-transform: uppercase; }
.comprobante td { border-bottom: 1px solid #eee; padding: 6px 4px; }
.comprobante .col-monto { text-align: right; font-variant-numeric: tabular-nums; }
.comprobante-totales { margin-left: auto; max-width: 260px; font-size: .88rem; }
.comprobante-totales .fila { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.comprobante-totales .fila.total { font-weight: 700; font-size: 1.05rem; border-top: 1px solid #111; padding-top: 6px; margin-top: 4px; }
.comprobante-foot { margin-top: 18px; font-size: .72rem; color: #777; text-align: center; }

@media print {
  body * { visibility: hidden; }
  .comprobante, .comprobante * { visibility: visible; }
  .comprobante { position: absolute; inset: 0; margin: 0; max-width: 100%; box-shadow: none; }
}

/* =========================== REPORTES =========================== */

.reporte-bloque {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  max-width: 620px;
}
.reporte-bloque h3 { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 700; margin-bottom: 10px; }

.config-titulo { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 700; margin: 0 0 4px; }

.enviar-con-formato { display: flex; gap: 8px; margin-top: 10px; }
.enviar-con-formato select {
  flex: 0 0 100px;
  padding: 11px 10px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: .9rem;
}
.enviar-con-formato button { margin-top: 0; width: auto; }

.reporte-contenido table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.reporte-contenido td, .reporte-contenido th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.reporte-contenido th { color: var(--gray-500); font-weight: 600; text-transform: uppercase; font-size: .68rem; letter-spacing: .6px; }
.reporte-contenido p { color: var(--gray-300); font-size: .9rem; }

/* =========================== MODAL SIMPLE =========================== */

.simple-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 10, .8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.simple-modal-card {
  background: var(--black-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.simple-modal-card.ancho { max-width: 600px; }
.simple-modal-card h3 { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-size: 1.05rem; margin-bottom: 16px; }
.simple-modal-card form { display: flex; flex-direction: column; gap: 12px; }
.simple-modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--gray-300); font-weight: 600; }
.simple-modal-card input, .simple-modal-card select {
  padding: 11px 12px;
  background: var(--black-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: .95rem;
}
.simple-modal-card input:focus, .simple-modal-card select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

/* =========================== SCANNER (cámara, código de barras) =========================== */

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 10, .96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
}

.scanner-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-guide {
  position: absolute;
  inset: 20% 8%;
  border: 2px solid var(--red);
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35);
  pointer-events: none;
}

#scanner-msg { color: var(--gray-100); font-size: .9rem; text-align: center; }
#btn-scanner-cancelar { max-width: 220px; }
