/* ============================================================================
   Panel de DeBlue Factura — sistema visual (base: plataforma inmobiliaria / Lavadero)
   ----------------------------------------------------------------------------
   El chrome es deliberadamente neutro: la plataforma es white-label y el color
   de marca llega desde SiteSettings, inyectado en --brand por el layout.
   Nada del chrome puede pelearse con un color de cliente desconocido.
   ========================================================================== */

:root {
  /* Chrome — slate frio, neutro frente a cualquier marca */
  --ink:        #16202c;
  --ink-2:      #1e2b3a;
  --ink-3:      #2b3b4e;
  --on-ink:     #c7d2de;
  --on-ink-dim: #7d8ea1;

  /* Superficies */
  --paper:   #ffffff;
  --surface: #f3f6f9;
  --line:    #dde3ea;
  --line-2:  #eef2f6;

  /* Texto */
  --text:  #1d2733;
  --muted: #65768a;
  --faint: #93a1b2;

  /* Marca — la pisa el layout con el valor del cliente */
  --brand:      #1f3864;
  --brand-soft: #eaeff7;

  /* Estados */
  --ok:   #1f7a4d;
  --warn: #a96a06;
  --err:  #bc3b2e;
  --ok-soft:   #e6f3ec;
  --warn-soft: #fdf3e2;
  --err-soft:  #fbeceb;

  --radius: 6px;
  --shell:  240px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
}

/* Numerales de ancho fijo: esta pantalla es precios, km y conteos.
   Sin esto las columnas de numeros bailan al cambiar de pagina. */
table, .num, .metric-valor, input[type="number"] {
  font-variant-numeric: tabular-nums;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ===========================================================================
   Shell
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--shell);
  flex: 0 0 var(--shell);
  background: var(--ink);
  color: var(--on-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-marca {
  padding: 18px 20px;
  border-bottom: 1px solid var(--ink-3);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 61px;
}
.sidebar-marca img { max-height: 30px; max-width: 150px; }
.sidebar-marca .nombre {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }

.nav-grupo {
  color: var(--on-ink-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 16px 10px 6px;
  letter-spacing: 0.04em;
}
.nav-grupo:first-child { padding-top: 4px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--on-ink);
  font-size: 13.5px;
  margin-bottom: 1px;
}
.nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }

.nav a.on {
  background: var(--ink-3);
  color: #fff;
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }

/* Contador de pendientes al costado del item */
.nav .cuenta {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0 6px;
}

.sidebar-pie {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--ink-3);
}
.sidebar-pie .usuario-chip { flex: 1; min-width: 0; }

/* Salir: a la derecha del chip, discreto pero siempre a la vista. */
.salir {
  flex: 0 0 auto; order: 2;
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  background: none; border: 0; border-radius: var(--radius);
  color: var(--on-ink-dim); cursor: pointer;
}
.salir:hover { background: var(--ink-2); color: #fff; }
.salir svg { width: 17px; height: 17px; }
.usuario-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--on-ink);
}
.usuario-chip:hover { background: var(--ink-2); text-decoration: none; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  flex: 0 0 32px;
  object-fit: cover;
}
.usuario-chip .datos { min-width: 0; }
.usuario-chip .nom {
  color: #fff; font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.usuario-chip .rol { color: var(--on-ink-dim); font-size: 11.5px; }

/* ===========================================================================
   Área principal
   ========================================================================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  min-height: 61px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .der { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.contenido { padding: 24px; flex: 1; }
.contenido > :first-child { margin-top: 0; }

/* ===========================================================================
   Avisos
   ========================================================================== */
.aviso {
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border-left: 3px solid;
  font-size: 13.5px;
}
.aviso-ok   { background: var(--ok-soft);   border-color: var(--ok);   color: #10543a; }
.aviso-err  { background: var(--err-soft);  border-color: var(--err);  color: #8d241a; }
.aviso-warn { background: var(--warn-soft); border-color: var(--warn); color: #7a4c05; }

/* ===========================================================================
   Panel
   ========================================================================== */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.panel-cab {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel-cab h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-cab .der { margin-left: auto; }
.panel-cuerpo { padding: 18px; }
.panel-cuerpo.sin-pad { padding: 0; }

/* ===========================================================================
   Métricas del tablero
   Una fila de cifras con su etiqueta, separadas por linea. Sin tarjetas:
   seis cards con sombra para seis numeros es ruido, no jerarquia.
   ========================================================================== */
.metricas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.metrica {
  padding: 16px 18px;
  border-right: 1px solid var(--line-2);
}
.metrica:last-child { border-right: 0; }
.metrica-valor {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.metrica-etq { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.metrica a { color: inherit; }
.metrica.alerta .metrica-valor { color: var(--warn); }
.metrica.urgente .metrica-valor { color: var(--err); }

/* ===========================================================================
   Tablas
   ========================================================================== */
.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tabla td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #fafbfd; }
.tabla .der, .tabla th.der { text-align: right; }

/* Miniatura: un listado de propiedades sin foto no sirve para nada */
.mini {
  width: 56px; height: 42px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--line-2);
  display: block;
}
.mini-vacia {
  width: 56px; height: 42px;
  border-radius: 4px;
  background: var(--line-2);
  display: grid; place-items: center;
  color: var(--faint);
}

.celda-titulo { font-weight: 500; }
.celda-sub { color: var(--muted); font-size: 12.5px; }
.codigo {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Estado como punto + palabra. Un pill de color por estado convierte
   la grilla en un semaforo y deja de leerse. */
.estado { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.estado::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 7px;
}

/* ===========================================================================
   Formularios
   ========================================================================== */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.ayuda { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
select, textarea {
  width: 100%;
  padding: 8px 11px;
  font: inherit;
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[readonly], input:disabled, select:disabled {
  background: var(--surface);
  color: var(--muted);
}
textarea { resize: vertical; min-height: 90px; }

.campo { margin-bottom: 16px; }
.fila { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 9px; }
.check input { width: 16px; height: 16px; margin-top: 2px; flex: 0 0 16px; accent-color: var(--brand); }
.check label { margin: 0; font-weight: 400; }

.error { color: var(--err); font-size: 12.5px; margin-top: 4px; }
.field-validation-error { color: var(--err); font-size: 12.5px; }
.input-validation-error { border-color: var(--err); }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }

/* ===========================================================================
   Botones
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primario { background: var(--brand); color: #fff; }
.btn-primario:hover { filter: brightness(1.1); }

.btn-borde { border-color: var(--line); }
.btn-borde:hover { background: var(--surface); border-color: #c8d2de; }

.btn-plano { color: var(--muted); }
.btn-plano:hover { background: var(--surface); color: var(--text); }

.btn-peligro { color: var(--err); border-color: var(--line); }
.btn-peligro:hover { background: var(--err-soft); border-color: var(--err); }

.btn-chico { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-fila { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===========================================================================
   Vacío
   ========================================================================== */
.vacio { padding: 52px 24px; text-align: center; }
.vacio svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 12px; }
.vacio h3 { margin: 0 0 5px; font-size: 15px; font-weight: 600; }
.vacio p { margin: 0 0 18px; color: var(--muted); }

/* ===========================================================================
   Login — la única pantalla que no es superficie de trabajo
   ========================================================================== */
.acceso { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }

.acceso-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--paper);
}
.acceso-caja { width: 100%; max-width: 348px; }
.acceso-marca { margin-bottom: 34px; }
.acceso-marca img { max-height: 46px; max-width: 200px; }
.acceso-marca .nombre {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--brand);
}
.acceso h1 { font-size: 23px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.02em; }
.acceso .intro { color: var(--muted); margin: 0 0 26px; }
.acceso .btn { width: 100%; justify-content: center; padding: 10px; }
.acceso-pie { margin-top: 22px; font-size: 13px; color: var(--muted); }

/* Panel derecho: lineas de plano dibujadas con CSS en el color de marca.
   Dibujado y no fotografiado para que funcione con cualquier marca de
   cliente, y porque una foto de casa de stock no dice nada. */
.acceso-plano {
  background: var(--ink);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
}
/* Grilla de papel milimetrado: blanca y muy tenue. En el color de marca
   sobre el slate oscuro no se ve, y la grilla tiene que leerse como papel. */
.acceso-plano::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 32px 32px;
}
.acceso-plano svg {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: block;
}
.acceso-leyenda {
  position: relative;
  z-index: 2;
  color: #fff;
  max-width: 420px;
  margin: 40px auto 0;
}
.acceso-leyenda p {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 300;
  margin: 0;
  color: rgba(255,255,255,.88);
}

@media (max-width: 900px) {
  .acceso { grid-template-columns: 1fr; }
  .acceso-plano { display: none; }
}

/* ===========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1000px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .18s ease;
  }
  .sidebar.abierta { transform: none; }
  .velo { position: fixed; inset: 0; background: rgba(12,20,30,.45); z-index: 50; }
  .contenido { padding: 16px; }
  .topbar { padding: 0 16px; }
}
@media (min-width: 1001px) { .menu-btn, .velo { display: none; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===========================================================================

/* ===========================================================================
   DEBLUE FACTURA — componentes propios
   ========================================================================== */

.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.chico { font-size: 12.5px; }
.oculto { display: none !important; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex .der, .ml-auto { margin-left: auto; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-3-1 { display: grid; gap: 20px; grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .grid-2, .grid-3-1 { grid-template-columns: 1fr; } }

/* Estados de comprobante: punto + palabra */
.estado-ok::before     { background: var(--ok); }
.estado-warn::before   { background: var(--warn); }
.estado-err::before    { background: var(--err); }
.estado-neutro::before { background: #c3ccd7; }

.pastilla {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--muted);
}
.pastilla-ok   { background: var(--ok-soft); color: var(--ok); }
.pastilla-warn { background: var(--warn-soft); color: var(--warn); }
.pastilla-err  { background: var(--err-soft); color: var(--err); }

/* Ambiente: en homologacion se ve siempre, para que nadie crea que factura en serio */
.franja-homo {
  background: repeating-linear-gradient(-45deg, #fdf3e2, #fdf3e2 10px, #fbe9c8 10px, #fbe9c8 20px);
  color: #7a4c05; font-size: 12.5px; font-weight: 500; text-align: center; padding: 5px 12px;
  border-bottom: 1px solid #f0d9ae;
}

/* Selector de empresa en la barra lateral */
.empresa-actual {
  display: block; margin: 10px 10px 0; padding: 9px 10px; border-radius: var(--radius);
  background: var(--ink-2); color: #fff; font-size: 13px;
}
.empresa-actual:hover { background: var(--ink-3); text-decoration: none; }
.empresa-actual .cuit { color: var(--on-ink-dim); font-size: 11.5px; display: block; }

/* Accesos grandes del tablero */
.accesos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.acceso-rapido {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.acceso-rapido:hover { border-color: var(--brand); text-decoration: none; }
.acceso-rapido svg { width: 22px; height: 22px; color: var(--brand); flex: 0 0 22px; }
.acceso-rapido b { display: block; font-weight: 600; }
.acceso-rapido span { color: var(--muted); font-size: 12.5px; }
.acceso-rapido kbd { margin-left: auto; }

kbd {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 1px 6px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--muted);
}

/* Barras de ventas por dia */
.barras { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 6px 0 0; }
.barras .b { flex: 1; background: var(--brand); opacity: .85; border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.barras .b:hover { opacity: 1; }
.barras .b.hoy { background: var(--ok); }
.barras-eje { display: flex; justify-content: space-between; color: var(--faint); font-size: 11px; margin-top: 4px; }

.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.lista-simple li:last-child { border-bottom: 0; }

/* Paginador */
.paginador { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 14px; color: var(--muted); font-size: 13px; }

/* Filtros en linea */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filtros .campo { margin: 0; min-width: 140px; }
.filtros .campo.ancho { flex: 1; min-width: 220px; }

/* ===========================================================================
   Autocompletar
   ========================================================================== */
.ac { position: relative; }
.ac-lista {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 40;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(22,32,44,.12); max-height: 320px; overflow-y: auto;
}
.ac-item { padding: 8px 11px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.ac-item:hover, .ac-item.activo { background: var(--brand-soft); }
.ac-item .sec { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.ac-vacio { padding: 10px 11px; color: var(--muted); }

/* ===========================================================================
   Facturador
   ========================================================================== */
.fac-cab { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.fac-tipo {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.fac-letra {
  width: 46px; height: 46px; border: 2px solid var(--text); display: grid; place-items: center;
  font-size: 26px; font-weight: 600; background: var(--paper);
}
.fac-tipo .nombre { font-weight: 600; font-size: 15px; }
.fac-tipo .det { color: var(--muted); font-size: 12.5px; }

.receptor-ficha { padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.receptor-ficha b { font-weight: 600; }

.items { width: 100%; border-collapse: collapse; }
.items th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.items td { padding: 5px 4px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.items input, .items select { padding: 6px 8px; }
.items .c-cant { width: 92px; } .items .c-precio { width: 130px; } .items .c-bon { width: 72px; }
.items .c-iva { width: 96px; } .items .c-total { width: 120px; text-align: right; padding-top: 11px; font-weight: 500; }
.items .c-x { width: 34px; }
.items input.num { text-align: right; }
.items .item-cod { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.items .quitar { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 6px; }
.items .quitar:hover { color: var(--err); }

.totales { margin-left: auto; width: 100%; max-width: 340px; }
.totales .t { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); }
.totales .t b { color: var(--text); font-weight: 500; }
.totales .t.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; color: var(--text); }
.totales .t.total b { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }

.barra-emitir {
  position: sticky; bottom: 0; z-index: 15; background: var(--paper); border-top: 1px solid var(--line);
  margin: 20px -24px -24px; padding: 14px 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.barra-emitir .total-grande { font-size: 20px; font-weight: 600; margin-left: auto; }
.envio-wa { display: flex; gap: 8px; align-items: center; }
.envio-wa input[type="text"] { width: 190px; }

/* Resultado de emision */
.resultado { text-align: center; padding: 28px 20px; }
.resultado .icono { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; }
.resultado .icono svg { width: 28px; height: 28px; }
.resultado.ok .icono { background: var(--ok-soft); color: var(--ok); }
.resultado.err .icono { background: var(--err-soft); color: var(--err); }
.resultado.warn .icono { background: var(--warn-soft); color: var(--warn); }
.resultado h2 { margin: 0 0 4px; font-size: 19px; }
.resultado .cae { font-family: 'IBM Plex Mono', monospace; color: var(--muted); }
.resultado ul { text-align: left; max-width: 560px; margin: 14px auto; color: var(--err); }
.resultado .btn-fila { justify-content: center; margin-top: 18px; }

/* Modal */
.modal-fondo { position: fixed; inset: 0; background: rgba(12,20,30,.5); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--paper); border-radius: 8px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal-cab { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal-cab h3 { margin: 0; font-size: 16px; }
.modal-cab .cerrar { margin-left: auto; background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; }
.modal-cuerpo { padding: 20px; }
.modal-pie { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; }

/* ===========================================================================
   Punto de venta (pantalla completa)
   ========================================================================== */
body.pos-body { background: var(--ink); overflow: hidden; }
.pos-shell { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100vh; }
.pos-izq { display: flex; flex-direction: column; background: var(--surface); min-width: 0; }
.pos-top { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--ink); color: var(--on-ink); }
.pos-top a { color: var(--on-ink); }
.pos-top select { width: auto; background: var(--ink-2); color: #fff; border-color: var(--ink-3); padding: 5px 8px; }
.pos-top .marca { color: #fff; font-weight: 600; }
.pos-scan { padding: 14px; background: var(--paper); border-bottom: 1px solid var(--line); }
.pos-scan .ac input {
  font-size: 20px; padding: 13px 16px 13px 46px; border-width: 2px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a1b2' stroke-width='2'%3E%3Cpath d='M3 5v14M7 5v14M10 5v14M14 5v14M17 5v14M21 5v14'/%3E%3C/svg%3E") no-repeat 14px center / 22px;
}
.pos-scan .ayuda kbd { margin: 0 2px; }
.pos-lista { flex: 1; overflow-y: auto; padding: 0 14px 14px; }
.pos-lista table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.pos-lista th { position: sticky; top: 0; background: var(--paper); font-size: 12px; color: var(--muted); text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.pos-lista td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); font-size: 15px; }
.pos-lista tr.sel td { background: var(--brand-soft); }
.pos-lista .cant input { width: 80px; text-align: right; font-size: 15px; padding: 5px 8px; }
.pos-lista .desc small { display: block; color: var(--muted); font-size: 12px; }
.pos-vacio { text-align: center; color: var(--muted); padding: 60px 20px; }
.pos-vacio svg { width: 48px; height: 48px; color: var(--faint); }

.pos-der { background: var(--paper); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.pos-cliente { padding: 14px; border-bottom: 1px solid var(--line-2); }
.pos-cliente .actual { display: flex; align-items: center; gap: 8px; }
.pos-cliente .actual b { font-weight: 600; }
.pos-resumen { padding: 14px; flex: 1; overflow-y: auto; }
.pos-total { padding: 18px 14px; border-top: 1px solid var(--line); background: var(--ink); color: #fff; }
.pos-total .etq { color: var(--on-ink-dim); font-size: 13px; }
.pos-total .monto { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pos-total .btn { width: 100%; justify-content: center; font-size: 17px; padding: 14px; margin-top: 12px; }
.pos-tipo { display: flex; gap: 6px; margin-bottom: 12px; }
.pos-tipo label { flex: 1; margin: 0; }
.pos-tipo input { display: none; }
.pos-tipo span { display: block; text-align: center; padding: 8px 6px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.pos-tipo input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.medios-pago { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.medios-pago button { padding: 10px 4px; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); font: inherit; font-size: 12.5px; cursor: pointer; }
.medios-pago button:hover { border-color: var(--brand); }
.pagos-cargados .pago { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.pagos-cargados .pago input { width: 120px; text-align: right; }
.cobro-resumen { margin-top: 12px; }
.cobro-resumen .t { display: flex; justify-content: space-between; padding: 3px 0; }
.cobro-resumen .vuelto b { color: var(--ok); font-size: 20px; }
.cobro-resumen .falta b { color: var(--err); }

@media (max-width: 900px) {
  .pos-shell { grid-template-columns: 1fr; height: auto; }
  body.pos-body { overflow: auto; }
}

/* ===========================================================================
   Detalle de comprobante
   ========================================================================== */
.cbte-hoja { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.cbte-cab { display: grid; grid-template-columns: 1fr 64px 1fr; border-bottom: 1px solid var(--line); }
.cbte-cab > div { padding: 16px 18px; }
.cbte-cab .letra { border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; padding: 10px 0; }
.cbte-cab .letra b { font-size: 34px; display: block; line-height: 1.1; }
.cbte-cab .letra small { font-size: 10.5px; color: var(--muted); }
.cbte-cab h3 { margin: 0 0 4px; font-size: 17px; }
.cbte-dato { color: var(--muted); font-size: 12.5px; }
.cbte-dato b { color: var(--text); font-weight: 500; }
.cbte-receptor { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 20px; }
.cbte-pie { display: flex; gap: 18px; align-items: center; padding: 16px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.cbte-pie img { width: 96px; height: 96px; }
.cbte-pie .cae { font-family: 'IBM Plex Mono', monospace; }
.cbte-marca-agua { color: var(--err); font-weight: 600; text-align: center; padding: 6px; background: var(--err-soft); }

/* Certificados: pasos del alta */
.pasos { counter-reset: paso; list-style: none; padding: 0; margin: 0; }
.pasos li { counter-increment: paso; position: relative; padding: 0 0 16px 38px; }
.pasos li::before {
  content: counter(paso); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 600; display: grid; place-items: center; font-size: 13px;
}
.pasos li.hecho::before { content: '✓'; background: var(--ok-soft); color: var(--ok); }

pre.log { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; margin: 6px 0 0; }
details summary { cursor: pointer; }

/* Etiquetas para imprimir */
.etiquetas { display: grid; grid-template-columns: repeat(auto-fill, 63mm); gap: 2mm; }
.etiqueta { width: 63mm; height: 38mm; border: 1px dashed #c9d2dc; padding: 3mm; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; break-inside: avoid; background: #fff; }
.etiqueta .n { font-size: 10pt; font-weight: 600; line-height: 1.15; max-height: 2.4em; overflow: hidden; }
.etiqueta .p { font-size: 16pt; font-weight: 600; }
.etiqueta svg { width: 100%; height: 14mm; }
@media print {
  .sidebar, .topbar, .no-print, .franja-homo { display: none !important; }
  .contenido { padding: 0; }
  body { background: #fff; }
  .etiqueta { border-color: transparent; }
}
.txt-ok { color: var(--ok); } .txt-err { color: var(--err); } .txt-warn { color: var(--warn); }
.segmento { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.segmento label { margin: 0; }
.segmento input { display: none; }
.segmento span { display: block; padding: 7px 13px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--line); background: var(--paper); }
.segmento label:last-child span { border-right: 0; }
.segmento input:checked + span { background: var(--brand); color: #fff; }

.tabla td svg, .lista-simple svg { width: 16px; height: 16px; vertical-align: middle; }
.aviso svg { width: 16px; height: 16px; }

/* ---------- Bandeja del bot de WhatsApp ---------- */
.bandeja { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 16px; align-items: start; }
.bandeja-lista .panel-cuerpo { max-height: 72vh; overflow-y: auto; }
.conv { display: grid; gap: 2px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.conv:hover { background: var(--brand-soft); }
.conv.activa { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.conv-nombre { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.conv-sub, .conv-ultimo { font-size: 12px; color: var(--muted, #65768a); }
.chat { height: 58vh; overflow-y: auto; padding: 16px; background: #efeae2; display: flex; flex-direction: column; gap: 8px; }
.msj { max-width: 78%; padding: 8px 10px; border-radius: 8px; box-shadow: 0 1px 0 rgba(0,0,0,.08); font-size: 14px; }
.msj-in { align-self: flex-start; background: #fff; border-top-left-radius: 0; }
.msj-out { align-self: flex-end; background: #dcf8c6; border-top-right-radius: 0; }
.msj-admin { background: #d6e4ff; }
.msj-sistema { background: #fff4d6; }
.msj-texto { white-space: pre-wrap; word-break: break-word; }
.msj-pie { font-size: 11px; color: #667781; text-align: right; margin-top: 2px; }
.chat-responder { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.chat-responder textarea { flex: 1; min-width: 200px; }
@media (max-width: 900px) { .bandeja { grid-template-columns: 1fr; } }
