/* AUDAZ · Espectra. Aplicación de trabajo: barra lateral con íconos, área clara y densa.
   Estos son los colores y letras de AUDAZ; cada cliente los cambia en perfiles/<cliente>/tema.css
   (variables --side, --accent, --doc-1..3, --franja-marca, --f-ui). Tipografía: Manrope; IBM Plex Mono para códigos y lotes. */
:root {
  --navy: #4D40F0; --navy-d: #3A2DD6; --green: #13834C; --green-d: #0B6B3D; --orange: #68008A; --orange-d: #52006D;
  --bg: #F5F5F7; --surface: #FFFFFF; --surface-2: #F8F8FA; --hover: #F1F0FB; --ink: #14141A; --ink-2: #2B2B33; --muted: #5F5F6B; --line: #DEDEE5; --line-2: #EDEDF2;
  --accent: #4D40F0; --accent-hover: #3A2DD6; --accent-ink: #FFFFFF; --cta: #14141A; --cta-hover: #000000; --link: #3A2DD6; --focus: #4D40F0;
  --ok: #0B7A43; --ok-bg: #E4F4EB; --warn: #9A4F00; --warn-bg: #FDF0E3; --bad: #B42318; --bad-bg: #FCE9E7; --info: #3A2DD6; --info-bg: #ECEAFE;
  --side: #4D40F0; --side-ink: #F3F2FF; --side-muted: #D3CEFF; --side-hover: rgba(255,255,255,.10); --side-active: rgba(255,255,255,.18);
  --bar: #4D40F0;
  --doc-1: #4D40F0; --doc-2: #68008A; --doc-3: #C62A2C; --doc-3d: #A61E20;
  --franja-marca: linear-gradient(90deg, #68008A 0%, #4D40F0 33%, #C62A2C 66%, #ECB731 100%);
  /* Fondo del panel de ingreso: luces de Espectra (violeta, azul, rojo y amarillo) sobre casi negro */
  --marca-bg: #0B0A14;
  --marca-fondo: radial-gradient(55% 45% at 88% 8%, rgba(77,64,240,.95), rgba(77,64,240,0) 70%), radial-gradient(50% 42% at 8% 22%, rgba(104,0,138,.85), rgba(104,0,138,0) 70%), radial-gradient(48% 40% at 95% 92%, rgba(198,42,44,.6), rgba(198,42,44,0) 70%), radial-gradient(40% 32% at 40% 108%, rgba(236,183,49,.5), rgba(236,183,49,0) 70%);
  --f-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r: 6px; --r-lg: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E0D16; --surface: #16151F; --surface-2: #1C1B27; --hover: #23213A; --ink: #ECEBF3; --ink-2: #CFCDDB; --muted: #9C9AAD; --line: #2C2A3D; --line-2: #222032;
  --accent: #6A5EFA; --accent-hover: #7B70FF; --accent-ink: #FFFFFF; --cta: #5A4EF5; --cta-hover: #6A5EFA; --link: #ABA4FF; --focus: #ABA4FF;
  --ok: #4CC488; --ok-bg: #133628; --warn: #F2A75E; --warn-bg: #3A2614; --bad: #F2806F; --bad-bg: #3B1C19; --info: #ABA4FF; --info-bg: #221F45;
  --side: #1B1650; --side-ink: #ECEAFF; --side-muted: #A9A2E8; --bar: #7B70FF; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0E0D16; --surface: #16151F; --surface-2: #1C1B27; --hover: #23213A; --ink: #ECEBF3; --ink-2: #CFCDDB; --muted: #9C9AAD; --line: #2C2A3D; --line-2: #222032;
  --accent: #6A5EFA; --accent-hover: #7B70FF; --accent-ink: #FFFFFF; --cta: #5A4EF5; --cta-hover: #6A5EFA; --link: #ABA4FF; --focus: #ABA4FF;
  --ok: #4CC488; --ok-bg: #133628; --warn: #F2A75E; --warn-bg: #3A2614; --bad: #F2806F; --bad-bg: #3B1C19; --info: #ABA4FF; --info-bg: #221F45;
  --side: #1B1650; --side-ink: #ECEAFF; --side-muted: #A9A2E8; --bar: #7B70FF; color-scheme: dark; }

html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
h1, h2, h3 { font-family: var(--f-ui); margin: 0; text-wrap: balance; color: var(--ink); }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 650; font-variation-settings: "wdth" 108; letter-spacing: -.01em; }
h2 { font-size: 1rem; line-height: 1.3; font-weight: 620; font-variation-settings: "wdth" 104; }
h3 { font-size: .95rem; line-height: 1.3; font-weight: 620; }
a { color: var(--link); }
.mono, code { font-family: var(--f-mono); font-size: .88em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Estructura */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side-cerrar { display: none; position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; z-index: 2; width: 36px; height: 36px; place-items: center; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: var(--side-ink); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0; }
.side-cerrar:hover, .side-cerrar:focus-visible { background: rgba(255,255,255,.18); }
.side .logo { display: block; text-decoration: none; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side .logo img { width: 100%; max-width: 176px; display: block; }
.side .logo .lema { display: block; margin-top: 8px; color: var(--side-muted); font-size: .72rem; letter-spacing: .02em; }
.side nav { display: flex; flex-direction: column; padding: 8px 10px 16px; gap: 1px; }
.side nav .grupo { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); padding: 16px 10px 6px; }
.side nav a { color: var(--side-ink); text-decoration: none; padding: 7px 10px; border-radius: var(--r); display: flex; align-items: center; gap: 10px; font-weight: 500; }
.side nav a .ico { width: 18px; height: 18px; flex: none; opacity: .75; }
.side nav a .badge { margin-left: auto; }
.side nav a:hover { background: var(--side-hover); }
.side nav a.activo { background: var(--side-active); color: #fff; }
.side nav a.activo .ico { opacity: 1; }
.side .pie { margin-top: auto; padding: 14px 18px 16px; font-size: .75rem; color: var(--side-muted); border-top: 1px solid rgba(255,255,255,.08); }
.badge { background: var(--cta); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; line-height: 1; padding: 3px 7px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-block: 9px 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--franja-marca); }
.topbar .menu { display: none; }
.topbar .espacio { flex: 1; }
.sandbox-tag { background: var(--warn-bg); color: var(--warn); font-size: .72rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; padding: 5px 8px; border-radius: 4px; }
.usuario-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid transparent; background: none; text-align: left; font-weight: 400; }
.usuario-chip:hover { background: var(--hover); border-color: var(--line); }
.usuario-chip .txt { display: flex; flex-direction: column; gap: 2px; }
.usuario-chip .n { font-weight: 600; font-size: .86rem; line-height: 1.1; }
.usuario-chip .r { color: var(--muted); font-size: .74rem; line-height: 1.1; }
.contenido { padding-block: 22px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 1320px; width: 100%; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.encabezado > div:first-child { min-width: 0; }
.encabezado p { margin: 4px 0 0; color: var(--muted); max-width: 75ch; }
.eyebrow { font-size: .78rem; font-weight: 500; color: var(--muted); }

/* Avatares */
.avatar { width: var(--av, 32px); height: var(--av, 32px); border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden; color: #fff; font-weight: 650; font-size: calc(var(--av, 32px) * .38); letter-spacing: .02em; object-fit: cover; vertical-align: middle; }
.persona { display: inline-flex; align-items: center; gap: 8px; }

/* Paneles */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel > .cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel > .cuerpo { padding: 14px 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-pos { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.pila { display: flex; flex-direction: column; gap: 14px; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fila.fin { justify-content: flex-end; }

/* KPI */
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 1.6rem; line-height: 1.15; font-weight: 650; font-variation-settings: "wdth" 104; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.01em; }
.kpi .d { font-size: .8rem; margin-top: 4px; }
.sube { color: var(--ok); } .baja { color: var(--bad); }

/* Tablas */
.tabla-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
th { font-size: .74rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: var(--hover); }
tr.click { cursor: pointer; }
td.cero { color: var(--muted); }
tfoot td { font-weight: 650; border-top: 1px solid var(--line); background: var(--surface-2); }

/* Formularios */
label.campo { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--ink-2); font-weight: 550; min-width: 0; }
input, select, textarea { font: inherit; font-size: .92rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; vertical-align: -2px; }
textarea { min-height: 64px; resize: vertical; }
.campos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
button, .btn { font: inherit; font-size: .88rem; font-weight: 550; line-height: 1; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { background: var(--hover); }
button.prim, .btn.prim { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.prim:hover, .btn.prim:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.cta, .btn.cta { background: var(--cta); border-color: var(--cta); color: #fff; }
button.cta:hover, .btn.cta:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
button.ok { background: var(--green); border-color: var(--green); color: #fff; }
button.ok:hover { background: var(--green-d); }
button.peligro { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.grande { padding: 12px 20px; font-size: 1rem; font-weight: 600; }
button.mini { padding: 5px 9px; font-size: .78rem; }
button:disabled { opacity: .45; cursor: not-allowed; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 12px; text-decoration: none; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.activo { color: var(--ink); border-bottom-color: var(--accent); }

/* Estados */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.pill.ok::before, .pill.warn::before, .pill.bad::before, .pill.info::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.aviso { padding: 10px 14px; border-radius: var(--r); background: var(--info-bg); }
.aviso.warn { background: var(--warn-bg); } .aviso.bad { background: var(--bad-bg); } .aviso.ok { background: var(--ok-bg); }
.vacio { padding: 28px 16px; text-align: center; color: var(--muted); }

/* Rollos */
.metros { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.metros .b { flex: 1; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.metros .b i { display: block; height: 100%; background: var(--bar); border-radius: 3px; }
.metros.retazo .b i { background: var(--orange); }

/* Punto de venta */
.resultados { max-height: 380px; overflow-y: auto; border-top: 1px solid var(--line-2); }
.res { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line-2); cursor: pointer; border-radius: 4px; }
.res:hover, .res:focus-visible { background: var(--hover); }
.res .cod { font: 500 .78rem/1 var(--f-mono); color: var(--muted); margin-bottom: 3px; }
.total-grande { font-size: 2.2rem; line-height: 1; font-weight: 650; font-variation-settings: "wdth" 106; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.lineas td { vertical-align: middle; }
.lineas input { width: 72px; }

/* Modal */
.velo { position: fixed; inset: 0; background: rgba(9,22,30,.5); z-index: 20; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
  padding: max(28px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 760px; box-shadow: 0 24px 64px rgba(0,0,0,.28); }
.modal.angosto { max-width: 480px; }
.modal > .cab { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); gap: 10px; }
.modal > .cab h2 { font-size: 1.08rem; }
.modal > .cuerpo { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal > .pie { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.cerrar { border: none; background: none; font-size: 1.4rem; line-height: 1; padding: 4px 8px; color: var(--muted); }

/* Toast */
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #142533; color: #fff; padding: 11px 14px; border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: .9rem; }
.toast.error { background: var(--bad); }

/* Gráficos */
.barras { display: flex; flex-direction: column; gap: 8px; }
.barra { display: grid; grid-template-columns: minmax(90px, 180px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .86rem; }
.barra .b i { display: block; height: 12px; background: var(--bar); border-radius: 0 3px 3px 0; min-width: 2px; }
.barra:hover .b i { background: var(--orange); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .eje { fill: var(--muted); font: 11px var(--f-ui); }
.chart .grilla { stroke: var(--line-2); }
.chart rect.col { fill: var(--bar); }
.chart rect.col:hover { fill: var(--orange); }
.tip { position: fixed; pointer-events: none; z-index: 40; background: #142533; color: #fff; padding: 6px 9px; border-radius: 4px; font-size: .8rem; }

/* Etiquetas QR */
.etiquetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.etiqueta { background: #fff; color: #142533; border: 1px dashed #A8BAC6; border-radius: 4px; padding: 10px; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; }
.etiqueta .qr svg { width: 96px; height: 96px; display: block; }
.etiqueta .n { font-weight: 600; font-size: .78rem; line-height: 1.25; }
.etiqueta .c { font: 500 .76rem/1 var(--f-mono); margin-top: 6px; color: var(--doc-1); }
.etiqueta .p { font-weight: 700; font-size: 1.1rem; margin-top: 6px; color: var(--doc-3d); }
.etiqueta img { height: 14px; margin-bottom: 6px; }

/* Asistencia */
.kiosco { max-width: 380px; margin: 0 auto; text-align: center; }
.pin { font: 600 2rem/1 var(--f-mono); letter-spacing: .4em; min-height: 2.4rem; margin: 10px 0; }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.teclado button { font-size: 1.35rem; font-weight: 600; padding: 18px; }
.reloj { font-size: 2.8rem; line-height: 1; font-weight: 650; font-variation-settings: "wdth" 106; font-variant-numeric: tabular-nums; }

.factura { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; background: var(--surface-2); }
.historial { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.historial li { padding-left: 14px; border-left: 2px solid var(--line); }

/* Fábrica en vivo */
.cronometro { font-size: 2.3rem; line-height: 1; font-weight: 650; font-variation-settings: "wdth" 106; font-variant-numeric: tabular-nums; color: var(--ink); }
.cronometro.mini { font-size: 1rem; font-weight: 600; }
.panel.maquina.activa { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.panel.maquina.activa .cronometro { color: var(--green-d); }
.panel.maquina.pausada { border-color: color-mix(in srgb, var(--orange) 55%, var(--line)); }
.panel.maquina.pausada .cronometro { color: var(--orange-d); }
@media (prefers-reduced-motion: no-preference) { .panel.maquina.activa .cab h2::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-left: 8px; vertical-align: middle; animation: latido 1.6s ease-in-out infinite; } }
@keyframes latido { 50% { opacity: .25; } }

/* Matriz de permisos */
.matriz th.rol { white-space: normal; min-width: 84px; text-align: center; font-size: .7rem; line-height: 1.2; vertical-align: bottom; }
.matriz td.c { text-align: center; }
.matriz tr.grupo td { background: var(--surface-2); font-weight: 650; font-size: .78rem; color: var(--ink-2); }
.matriz td.cambiado { background: var(--warn-bg); }

/* Perfil */
.perfil-cab { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* Acceso */
.acceso { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.acceso .marca { position: relative; overflow: hidden; background-color: var(--marca-bg); color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: 40px 40px 40px max(40px, env(safe-area-inset-left, 0px));
  background-image: var(--marca-fondo); }
.acceso .marca::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--franja-marca); }
.acceso .marca img { width: 220px; max-width: 70%; }
.acceso .marca h1 { color: #fff; font-size: clamp(1.8rem, 3.2vw, 2.6rem); font-variation-settings: "wdth" 112; font-weight: 700; line-height: 1.08; max-width: 15ch; }
.acceso .marca p { color: #B9D1DE; max-width: 42ch; margin: 12px 0 0; }
.acceso .marca .datos { display: flex; gap: 26px; flex-wrap: wrap; color: #B9D1DE; font-size: .82rem; }
.acceso .marca .datos b { display: block; color: #fff; font-size: 1.3rem; font-weight: 650; }
.acceso .formulario { display: flex; flex-direction: column; justify-content: center; padding: 40px max(24px, env(safe-area-inset-right, 0px)) 40px 24px; }
.acceso .formulario .caja { width: 100%; max-width: 380px; margin: 0 auto; }
.acceso .formulario h2 { font-size: 1.5rem; font-variation-settings: "wdth" 108; font-weight: 650; }
.clave-w { position: relative; display: flex; }
.clave-w input { flex: 1; padding-right: 74px; }
.clave-w button { position: absolute; right: 4px; top: 4px; bottom: 4px; padding: 0 10px; font-size: .78rem; border: none; background: transparent; color: var(--link); }
.acceso .pie-acceso { margin-top: 28px; font-size: .78rem; color: var(--muted); }
.cuentas-prueba { margin-top: 22px; border: 1px solid var(--line); border-radius: var(--r); }
.cuentas-prueba summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: .85rem; }
.cuentas-prueba .lista { max-height: 260px; overflow-y: auto; border-top: 1px solid var(--line-2); }
.cuentas-prueba button { width: 100%; justify-content: space-between; border: none; border-bottom: 1px solid var(--line-2); border-radius: 0; padding: 9px 12px; font-weight: 500; }
.cuentas-prueba button span { color: var(--muted); font-size: .76rem; font-weight: 400; }
.ingreso { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--bg); padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Recursos humanos */
.cal-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dias div { border: 1px solid var(--line-2); border-radius: 4px; min-height: 54px; padding: 4px 6px; font-size: .74rem; }
.cal-dias .fds { background: var(--surface-2); }
.cal-dias .t { font-weight: 650; }

@media (max-width: 980px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-pos { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 15; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s; padding-top: env(safe-area-inset-top, 0px); }
  .side.abierto { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .side { position: fixed; }
  .side-cerrar { display: inline-grid !important; }
  body.menu-abierto::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 14; }
  .topbar .menu { display: inline-flex; }
  .usuario-chip .txt { display: none; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .barra { grid-template-columns: minmax(70px, 110px) minmax(0, 1fr) auto; }
  .acceso { grid-template-columns: minmax(0, 1fr); }
  .acceso .marca { padding: 24px max(20px, env(safe-area-inset-right, 0px)) 28px max(20px, env(safe-area-inset-left, 0px)); gap: 14px; }
  .acceso .marca .datos { display: none; }
  .acceso .marca h1 { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* Impresión de etiquetas (sin reporte) */
@media print {
  body:not(.imprimiendo) .side, body:not(.imprimiendo) .topbar, body:not(.imprimiendo) .no-print, body:not(.imprimiendo) .toasts { display: none !important; }
  body:not(.imprimiendo) .app { display: block; } body:not(.imprimiendo) .contenido { padding: 0; max-width: none; }
  .etiqueta { break-inside: avoid; }
  body { background: #fff; }
}

/* Reportes impresos */
#impresion { display: none; }
@page { size: A4 portrait; margin: 14mm 12mm 16mm; @bottom-right { content: "Página " counter(page) " de " counter(pages); font: 8pt Manrope, Arial, sans-serif; color: #5F5F6B; } }
@page apaisado { size: A4 landscape; }
@media print {
  html, body.imprimiendo { height: auto !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; background: #fff !important; }
  body.imprimiendo > :not(#impresion) { display: none !important; }
  body.imprimiendo #impresion { display: block; }
  .rep { color: #14141A; font: 9pt/1.35 var(--f-ui); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rep.apaisado { page: apaisado; }
  .rep-cab { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--doc-1); padding-bottom: 6px; position: relative; }
  .rep-cab::after { content: ""; position: absolute; right: 0; bottom: -2px; width: 120px; height: 2px; background: linear-gradient(90deg, var(--doc-2) 50%, var(--doc-3) 50%); }
  .rep-cab img { height: 38px; }
  .rep-emp { text-align: right; font-size: 8pt; color: #607386; }
  .rep-titulo { margin: 12px 0 4px; }
  .rep-titulo h1 { font: 650 17pt/1.1 var(--f-ui); color: var(--doc-1); }
  .rep-titulo div { margin-top: 3px; }
  .rep-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 8pt; color: #607386; margin-bottom: 8px; }
  .rep-sandbox { color: var(--doc-3d); font-weight: 700; }
  .rep h2 { font: 650 10.5pt/1.2 var(--f-ui); color: var(--doc-1); margin: 12px 0 5px; }
  .rep table { width: 100%; border-collapse: collapse; }
  .rep th { background: #EEF2F5 !important; color: #142533; font: 650 7.5pt/1.2 var(--f-ui); letter-spacing: .02em; padding: 4px 5px; border-bottom: 1px solid #B9C7D2; position: static; }
  .rep td { padding: 3px 5px; border-bottom: 1px solid #E6ECF0; vertical-align: top; }
  .rep tr { break-inside: avoid; }
  .rep thead { display: table-header-group; } .rep tfoot { display: table-row-group; }
  .rep tfoot td { font-weight: 700; border-top: 1.5px solid #142533; background: none; }
  .rep .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .rep .mono { font-family: 'IBM Plex Mono', monospace; font-size: 7.5pt; }
  .rep .rep-grupo td { background: #F5F8FA !important; }
  .rep .rep-sub td { font-weight: 700; }
  .rep .rep-haber { padding-left: 16px; display: inline-block; }
  .rep .rep-nota { font-size: 7.5pt; color: #607386; margin: 4px 0 0; }
  .rep .rep-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .rep .factura { border: 1px solid #DCE3E9; padding: 10px; background: none; }
  .rep-firmas { display: flex; gap: 30px; margin-top: 46px; break-inside: avoid; }
  .rep-firmas > div { flex: 1; text-align: center; font-size: 8pt; }
  .rep-firmas .linea { border-top: 1px solid #142533; margin-bottom: 4px; }
  .rep-pie { margin-top: 14px; font-size: 7pt; color: #607386; border-top: 1px solid #E6ECF0; padding-top: 4px; }
}

/* Plan de cuentas */
table.plan tr.titulo-cta td { background: var(--surface-2); }
table.plan tr.inactiva td { color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; flex-direction: row; }

/* Asistente en burbuja */
#asistente { position: fixed; right: 18px; bottom: 18px; z-index: 60; }
.as-burbuja { border-radius: 999px; padding: 12px 18px 12px 14px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 22px rgba(0, 40, 60, .28); font-size: .92rem; }
.as-burbuja:hover { background: var(--accent-hover); }
.as-panel { width: min(420px, calc(100vw - 24px)); height: min(620px, calc(100dvh - 36px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 14px 44px rgba(0, 30, 45, .3); overflow: hidden; }
.as-panel header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--side); color: var(--side-ink); border-top: 3px solid var(--orange); }
.as-panel header strong { color: #fff; }
.as-panel header .small { color: var(--side-muted); }
.as-panel header .cerrar { background: transparent; border: 0; color: #fff; font-size: 1.4rem; padding: 0 4px; }
.as-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.as-m { max-width: 92%; padding: 9px 12px; border-radius: 10px; line-height: 1.45; font-size: .9rem; overflow-x: auto; }
.as-m.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 3px; }
.as-m.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.as-m ul { margin: 4px 0; padding-left: 18px; }
.as-m table { border-collapse: collapse; margin: 6px 0; font-size: .82rem; }
.as-m th, .as-m td { border: 1px solid var(--line); padding: 3px 6px; text-align: left; }
.as-herr { margin-top: 6px; font-size: .75rem; color: var(--muted); }
.as-hola { color: var(--ink-2); font-size: .9rem; }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.as-chips button { white-space: normal; text-align: left; line-height: 1.3; }
.as-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.as-form input { flex: 1; min-width: 0; }
.as-panel footer { padding: 6px 12px 9px; background: var(--surface); }
@media print { #asistente { display: none !important; } }
@media (max-width: 640px) { .as-burbuja span { display: none; } .as-burbuja { padding: 14px; } }
body:has(#asistente) .toasts { bottom: 86px; z-index: 70; }

/* Audaz IA */
.as-logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 800; font-size: .95rem; flex: none; font-stretch: 112%; }
.as-burbuja { display: inline-flex; align-items: center; gap: 10px; }
.as-burbuja .as-logo { width: 28px; height: 28px; }
.as-panel header { align-items: center; }
.as-ico { background: transparent; border: 1px solid rgba(255,255,255,.28); color: #fff; padding: 5px 7px; border-radius: 8px; line-height: 0; }
.as-ico[aria-pressed="true"] { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.55); }
.as-mic { padding: 0 10px; line-height: 0; }
.as-mic.activo { background: var(--bad); border-color: var(--bad); color: #fff; animation: as-pulso 1.2s ease-in-out infinite; }
.as-form.escuchando input { border-color: var(--bad); background: var(--bad-bg); }
.as-micchip { display: inline-block; vertical-align: -4px; opacity: .85; }
.as-micchip svg { width: 15px; height: 15px; }
@keyframes as-pulso { 0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, .45); } 50% { box-shadow: 0 0 0 7px rgba(180, 35, 24, 0); } }
@media (prefers-reduced-motion: reduce) { .as-mic.activo { animation: none; } }

/* Resumen diario (vista tipo WhatsApp) */
.wa-burbuja { background: #E7F8DC; color: #142533; border-radius: 10px 10px 10px 2px; padding: 12px 14px; font-size: .9rem; line-height: 1.5; max-width: 520px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
/* Etapas de importación */
.etapas { display: flex; gap: 3px; margin-bottom: 4px; }
.etapas span { width: 18px; height: 6px; border-radius: 3px; background: var(--line); }
.etapas span.hecha { background: var(--green); }
.etapas span.actual { background: var(--orange); }

/* Factura: representación gráfica con el formato del SIAT (carta) */
.fac { position: relative; font-family: Arial, Helvetica, sans-serif; color: #000; font-size: 9pt; width: 100%; }
.fac-marca { position: absolute; top: 38%; left: 0; right: 0; text-align: center; font-size: 34pt; font-weight: 700; color: rgba(180, 35, 24, .18); transform: rotate(-24deg); pointer-events: none; }
.fac-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.fac-emisor { text-align: center; width: 44%; font-size: 8pt; line-height: 1.4; }
.fac-emisor img { width: 64px; display: block; margin: 0 auto 6px; }
.fac-emisor b { font-size: 10.5pt; display: block; margin-bottom: 2px; }
.fac-dir { font-size: 7pt; }
.fac-ids th { text-align: right; padding: 2px 10px; font-size: 9pt; vertical-align: top; }
.fac-ids td { font-size: 9pt; padding: 2px 0; max-width: 190px; }
.fac-ids .cuf { word-break: break-all; font-size: 8.5pt; }
.fac h1 { text-align: center; font-size: 14pt; letter-spacing: 2px; margin: 18px 0 2px; }
.fac-sub { text-align: center; margin-bottom: 26px; }
.fac table { border-collapse: collapse; }
.fac-cli { width: 100%; border: 1px solid #000; border-bottom: 0; }
.fac-cli td { padding: 4px 6px; } .fac-cli .r { text-align: left; width: 34%; }
.fac-items { width: 100%; border: 1px solid #000; }
.fac-items thead th { background: #D9D9D9; border: 1px solid #000; padding: 6px 4px; font-size: 8.5pt; }
.fac-items tbody td { border: 1px solid #000; padding: 2px 4px; font-size: 7.5pt; }
.fac-items .n { text-align: right; }
.fac-items tfoot th { border: 1px solid #000; text-align: right; padding: 2px 4px; font-size: 7.5pt; }
.fac-items tfoot td.n { border: 1px solid #000; font-weight: 700; padding: 2px 4px; }
.fac-items tfoot .vacia { border: 0; }
.fac-items .son { border-top: 1px solid #000; font-size: 10pt; padding: 4px; }
.fac-pie { display: flex; gap: 20px; margin-top: 18px; align-items: flex-start; }
.fac-leyendas { flex: 1; text-align: center; font-size: 7.5pt; }
.fac-leyendas p { margin: 0 0 8px; }
.fac-qr svg { width: 150px; height: 150px; }
@page factura { size: letter portrait; margin: 12mm 14mm; @bottom-left { content: none; } @bottom-right { content: "1/1"; font: 8pt Arial, sans-serif; color: #000; } }
.fac { page: factura; }
.fac table th, .fac table td { border-bottom: 0; background: none; letter-spacing: 0; text-transform: none; color: #000; }
.fac-items { table-layout: fixed; }
.fac-items thead th { background: #D9D9D9 !important; text-align: center; vertical-align: middle; }
.fac-items tbody td, .fac-items thead th, .fac-items tfoot th, .fac-items tfoot td.n { border: 1px solid #000 !important; }
.fac-items tfoot .vacia { border: 0 !important; border-left: 1px solid #000 !important; }
.fac-items .son { border: 1px solid #000 !important; }
.fac table th, .fac table td { white-space: normal !important; overflow-wrap: anywhere; }
.fac-items, .fac-cli { width: 100% !important; box-sizing: border-box; }
.fac-cli { border-right: 1px solid #000 !important; }
.fac-marca { white-space: nowrap; font-size: 30pt; }
.fac table th { overflow-wrap: normal; font-size: 7.5pt !important; }
.fac-items, .fac-cli { width: calc(100% - 2px) !important; }
.fac-ids th { font-size: 9pt !important; }
[hidden] { display: none !important; }

/* Aviso para instalar como app */
.aviso-app { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 55; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 10px 30px rgba(0, 30, 45, .25); max-width: 520px; margin: 0 auto; }
.aviso-app img { border-radius: 9px; }
.aviso-app .cerrar { background: transparent; border: 0; font-size: 1.3rem; padding: 0 4px; color: var(--muted); }
body:has(.aviso-app) #asistente { bottom: calc(86px + env(safe-area-inset-bottom)); }
.as-ajustes { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.as-ajustes .campo { flex: 1; min-width: 130px; }

/* Cámara del kiosco y fotos de entrada */
.k-cam { margin: 12px auto 4px; max-width: 220px; text-align: center; }
.k-cam video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #0b1620; transform: scaleX(-1); display: block; }
.k-cam-txt { margin-top: 4px; color: var(--muted); }
.foto-marca img { width: 100%; max-width: 420px; border-radius: 10px; display: block; margin: 0 auto; }
.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.foto-card { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.foto-img { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; }
.foto-img img { width: 100%; height: 100%; object-fit: cover; }
.foto-card figcaption { padding: 8px 10px; }
tr.sel td { background: var(--info-bg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.docs { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.docs-carpetas { flex: 1 1 240px; max-width: 320px; }
.docs-main { flex: 999 1 520px; min-width: 0; }
.docs-lista { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.docs-carpeta { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r); padding: 9px 10px; color: var(--ink); cursor: pointer; font: inherit; }
.docs-carpeta:hover { background: var(--hover); }
.docs-carpeta.activo { background: var(--info-bg); }
.docs-carpeta .docs-n { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.docs-carpeta .docs-n .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-ico { color: var(--accent); display: flex; }
.badge.gris { background: var(--line); color: var(--ink-2); }
.docs-drop { margin: 0 16px 12px; border: 1.5px dashed var(--line); border-radius: var(--r-lg); padding: 14px; text-align: center; font-size: .85rem; color: var(--muted); }
.docs-drop.encima { border-color: var(--accent); background: var(--info-bg); color: var(--ink); }
.docs-arch { display: inline-flex; align-items: center; gap: 8px; }
.docs-arch .pill { font-size: .66rem; font-weight: 700; }
@media (max-width: 720px) { .docs-carpetas { max-width: none; } }
.avisos-wrap { position: relative; display: inline-flex; margin-right: 6px; }
.avisos-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: none; border: 1px solid transparent; color: var(--ink-2); cursor: pointer; }
.avisos-btn:hover { background: var(--hover); }
.avisos-btn .badge { position: absolute; top: 2px; right: 0; font-size: .64rem; padding: 2px 5px; }
.avisos-panel { position: absolute; right: 0; top: 46px; width: min(360px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 12px 32px rgba(0, 0, 0, .14); z-index: 60; overflow: hidden; }
.avisos-cab { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.avisos-lista { max-height: 60vh; overflow-y: auto; }
.aviso-item { display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line-2); padding: 11px 14px; cursor: pointer; font: inherit; color: var(--ink); }
.aviso-item:hover { background: var(--hover); }
.aviso-punto { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; }
.aviso-t { display: block; font-weight: 600; font-size: .9rem; }
.aviso-d { display: block; margin-top: 2px; }
.avisos-pie { padding: 10px 14px; background: var(--surface-2); }
.avisos-btn svg { width: 22px; height: 22px; flex: none; }
.aviso-item { white-space: normal; } .aviso-d { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.chat-lista { flex: 1 1 240px; max-width: 320px; max-height: 74vh; overflow-y: auto; padding-bottom: 8px; }
.chat-main { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; max-height: 74vh; }
.ch-grupo { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 14px 4px; }
.ch-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--ink); white-space: normal; }
.ch-item:hover { background: var(--hover); }
.ch-item.activo { background: var(--info-bg); }
.ch-n { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-n .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-msgs { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 280px; background: var(--surface-2); }
.ch-dia { text-align: center; margin: 6px 0; } .ch-dia span { font-size: .72rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; }
.ch-m { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.ch-m.mio { align-self: flex-end; flex-direction: row-reverse; }
.ch-av { flex: none; }
.ch-roly { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--doc-2); color: #fff; font-weight: 800; align-items: center; justify-content: center; }
.ch-b { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 0; overflow-wrap: anywhere; }
.ch-m.mio .ch-b { background: #E3EEF4; border-color: #C8DCE7; }
.ch-m.roly .ch-b { background: #E8F5EE; border-color: #BFE2CE; }
.ch-b.oficial { border: 2px solid var(--accent); background: #FFF8F1; }
.ch-b.borrado { color: var(--muted); font-style: italic; }
.ch-of { font-size: .66rem; font-weight: 800; letter-spacing: .1em; color: var(--accent); margin-bottom: 2px; }
.ch-meta { font-size: .75rem; color: var(--muted); display: flex; gap: 6px; align-items: center; } .ch-meta strong { color: var(--ink); }
.ch-t { margin-top: 2px; font-size: .92rem; line-height: 1.45; }
.ch-pie { margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ch-x { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; }
.ch-form { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.ch-form textarea { width: 100%; box-sizing: border-box; font: inherit; resize: vertical; min-height: 44px; }
.ch-compo { gap: 8px; align-items: flex-end; flex-wrap: nowrap; }
.ch-compo textarea { flex: 1; min-width: 0; }
.ch-adj { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--muted); background: var(--surface); }
.ch-adj:hover, .ch-adj:focus-within { color: var(--ink); border-color: var(--cta); }
.ch-foto { display: block; padding: 0; margin: 4px 0 2px; border: 0; background: none; cursor: zoom-in; max-width: 100%; }
.ch-foto img { display: block; max-width: min(280px, 100%); max-height: 260px; min-width: 80px; min-height: 60px; border-radius: 8px; object-fit: cover; background: rgba(127,127,127,.15); }
.ch-arch { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(127,127,127,.06); flex-wrap: wrap; max-width: 360px; }
.ch-arch-i { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; background: var(--doc-1); color: #fff; font-size: .68rem; font-weight: 800; flex: none; }
.ch-arch-n { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ch-arch-n strong { font-size: .85rem; overflow-wrap: anywhere; }
.ch-orig { margin-top: 6px; padding: 6px 8px; border-left: 3px solid var(--cta); font-style: normal; color: var(--ink); background: rgba(127,127,127,.08); border-radius: 4px; }
.ch-visto { color: var(--muted); }
.ch-visto.si { color: #1b7f4a; }

.hilo { border-top: 1px solid var(--line); margin-top: 12px; }
.hilo-msgs { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.hilo-m { font-size: .88rem; background: var(--surface-2); border-radius: 6px; padding: 6px 10px; }
.com-franja { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #FFF4E8; border: 1px solid #F3C99F; border-left: 0; border-radius: var(--r-lg); padding: 10px 14px; margin-bottom: 14px; }
@media (max-width: 720px) { .chat-lista { max-width: none; max-height: 40vh; } .ch-m { max-width: 92%; } }
/* Mensajes: colores que funcionan en claro y oscuro */
:root { --ch-mio: #E3EEF4; --ch-mio-line: #C8DCE7; --ch-roly: #E8F5EE; --ch-roly-line: #BFE2CE; --ch-of: #FFF8F1; --franja: #FFF4E8; --franja-line: #F3C99F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ch-mio: #16384C; --ch-mio-line: #24526C; --ch-roly: #12362A; --ch-roly-line: #1F5641; --ch-of: #33230F; --franja: #33230F; --franja-line: #6B4318; } }
:root[data-theme="dark"] { --ch-mio: #16384C; --ch-mio-line: #24526C; --ch-roly: #12362A; --ch-roly-line: #1F5641; --ch-of: #33230F; --franja: #33230F; --franja-line: #6B4318; }
.ch-m.mio .ch-b { background: var(--ch-mio); border-color: var(--ch-mio-line); color: var(--ink); }
.ch-m.roly .ch-b { background: var(--ch-roly); border-color: var(--ch-roly-line); }
.ch-b.oficial { background: var(--ch-of); }
.com-franja { background: var(--franja); border-color: var(--franja-line); color: var(--ink); }
.chtop-wrap { position: relative; display: inline-flex; margin-right: 2px; }
.chtop-panel { width: min(380px, calc(100vw - 24px)); }
.chtop-panel .avisos-cab { align-items: center; }
.chtop-msgs { max-height: 46vh; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.chtop-m { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; max-width: 88%; font-size: .88rem; overflow-wrap: anywhere; }
.chtop-m.mio { align-self: flex-end; background: var(--ch-mio); border-color: var(--ch-mio-line); }
.chtop-form { padding: 8px 10px; gap: 6px; flex-wrap: nowrap; border-top: 1px solid var(--line-2); }
.chtop-form input { flex: 1; min-width: 0; }
/* Audaz: en oscuro, burbuja con el color de acento y la R con el color principal; en el celular se ve la R */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .as-burbuja { background: var(--orange); border-color: var(--orange); color: #fff; } :root:not([data-theme="light"]) .as-burbuja:hover { background: var(--orange-d); } :root:not([data-theme="light"]) .as-logo { background: var(--navy); } }
:root[data-theme="dark"] .as-burbuja { background: var(--orange); border-color: var(--orange); color: #fff; }
:root[data-theme="dark"] .as-burbuja:hover { background: var(--orange-d); }
:root[data-theme="dark"] .as-logo { background: var(--navy); }
@media (max-width: 640px) { .as-burbuja span.as-logo { display: inline-grid; } .as-burbuja { padding: 8px; } .as-burbuja .as-logo { width: 34px; height: 34px; font-size: 1.05rem; } }
@media (max-width: 640px) { .topbar { flex-wrap: nowrap; gap: 6px; } .avisos-btn { width: 36px; height: 36px; } .avisos-wrap, .chtop-wrap { margin-right: 0; } .topbar .usuario-chip { padding: 0; } .topbar [data-a=salir] { padding: 4px 8px; } }
.logo-texto { display: block; color: #fff; font-weight: 800; font-size: 1.5rem; letter-spacing: .02em; font-stretch: 110%; }
.logo-texto.grande { font-size: 3.2rem; line-height: 1; }

/* Calendario de entregas y despachos */
.cal-sem { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.cal-dia { border-right: 1px solid var(--line-2); padding: 6px; min-height: 140px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-dia:last-child { border-right: 0; }
.cal-dia.hoy { background: rgba(232,101,10,.06); }
.cal-cab { font-size: .8rem; font-weight: 700; margin-bottom: 2px; white-space: nowrap; }
.cal-vacio { color: var(--muted); font-size: .8rem; }
.cal-ev { display: flex; flex-direction: column; text-align: left; gap: 1px; width: 100%; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--line); border-left: 4px solid var(--muted); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: .76rem; line-height: 1.25; min-width: 0; }
.cal-ev .cal-h { font-weight: 700; }
.cal-ev .cal-t, .cal-ev .cal-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev .cal-s { color: var(--muted); }
.cal-ev.cal-info { border-left-color: #2f7fc1; } .cal-ev.cal-warn { border-left-color: #E8650A; } .cal-ev.cal-ok { border-left-color: #1b7f4a; }
button.cal-ev, button.cal-ev:hover { background: var(--surface); color: var(--ink); align-items: stretch; justify-content: flex-start; text-align: left; white-space: normal; overflow: hidden; height: auto; }
button.cal-ev:hover { border-color: var(--accent); }
.cal-ev > span { display: block; min-width: 0; max-width: 100%; }
.cal-ev.hecho { opacity: .55; }
.cal-ev.atr { border-color: #c0392b; box-shadow: inset 0 0 0 1px #c0392b; }
.cal-lista .cal-ev { max-width: 520px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 900px) {
  .cal-sem { grid-template-columns: 1fr; }
  .cal-dia { border-right: 0; border-bottom: 1px solid var(--line-2); min-height: 0; }
  .cal-dia:has(.cal-vacio) { display: none; }
  .cal-dia.hoy { display: flex; }
}

/* Espera mientras el servidor trabaja (emitir factura con el SIAT) */
.ocupado { position: fixed; inset: 0; z-index: 9999; background: rgba(8, 20, 30, .55); display: grid; place-items: center; padding: 16px; animation: ocu-in .15s ease-out; }
.ocupado-caja { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 26px 28px; width: min(420px, 100%); box-shadow: 0 12px 40px rgba(0,0,0,.3); text-align: center; }
.ocupado-giro { width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 50%; border: 4px solid var(--line-2); border-top-color: var(--accent); animation: ocu-giro .9s linear infinite; }
.ocupado-tit { font-weight: 600; font-size: 1.02rem; line-height: 1.35; }
.ocupado-tiempo { font-size: 2rem; font-weight: 700; margin: 10px 0 8px; font-variant-numeric: tabular-nums; }
.ocupado-barra { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.ocupado-barra > div { height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.ocupado-nota { margin-top: 12px; font-size: .86rem; color: var(--muted); line-height: 1.45; }
@keyframes ocu-giro { to { transform: rotate(360deg); } }
@keyframes ocu-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ocupado-giro { animation-duration: 3s; } .ocupado { animation: none; } }

/* Buscador de cliente en Vender */
.cli-campo { position: relative; }
.cli-sel { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--surface); min-height: 42px; }
.cli-res { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 10px 28px rgba(0,0,0,.16); max-height: 320px; overflow-y: auto; padding: 4px; }
.cli-res-tit { padding: 6px 10px; font-size: .78rem; color: var(--muted); }
.cli-op { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; white-space: normal; font-weight: 400; }
.cli-op strong { font-weight: 600; }
.cli-op.activo, .cli-op:hover { background: var(--hover); }
.cli-nuevo { color: var(--accent); font-weight: 600; border-top: 1px solid var(--line-2); border-radius: 0 0 6px 6px; }

/* Arqueo de caja por billetes y monedas */
.arqueo { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.arqueo .campo input { text-align: right; }
.pg-mix .campos { margin-bottom: 6px; }

/* Tarjetas QR para plastificar (9 × 6 cm, 6 por hoja carta) */
.etiquetas.tarjetas { grid-template-columns: repeat(auto-fill, 9cm); gap: 0; }
.etiquetas.tarjetas .etiqueta { width: 9cm; height: 6cm; border: 1px dashed #8A9BA8; border-radius: 0; padding: .45cm; grid-template-columns: 4.2cm minmax(0, 1fr); gap: .35cm; }
.etiquetas.tarjetas .qr svg { width: 4.2cm; height: 4.2cm; }
.etiquetas.tarjetas .n { font-size: 11pt; line-height: 1.2; }
.etiquetas.tarjetas .c { font-size: 10pt; margin-top: .25cm; }
.etiquetas.tarjetas img { height: .5cm; margin-bottom: .2cm; }
@media print { .etiquetas.tarjetas { grid-template-columns: repeat(2, 9cm); justify-content: center; } }

/* "Hecho con AUDAZ" (marca del producto, siempre en blanco sobre el color del cliente) */
.hecho-con { display: inline-flex; align-items: center; gap: 7px; font-size: .74rem; color: var(--side-muted); white-space: nowrap; }
.hecho-con img, .acceso .marca .hecho-con img { width: auto; max-width: none; height: 13px; display: block; opacity: .92; }
.side .pie .hecho-con { margin-top: 6px; }
.acceso .marca .hecho-con { color: rgba(255,255,255,.78); }
