/* ============================================================
   CONTEO CÍCLICO · Hoja de estilos
   Lenguaje visual: interfaz corporativa clara, tipografía sans
   estándar (Inter), acentos en azul, semántica de color aparte
   del color de marca. Monoespaciada solo para códigos/cantidades.
   Marca de verificación: CONTEO-CICLICO-CSS-V5
   ============================================================ */

:root {
  --ink:      #0F172A;
  --ink-2:    #1E293B;
  --slate:    #64748B;
  --slate-2:  #94A3B8;
  --line:     #E2E8F0;
  --paper:    #F8FAFC;
  --card:     #FFFFFF;

  --primary:   #2563EB;   /* azul corporativo: marca, acciones, navegación activa */
  --primary-d: #1D4ED8;
  --primary-l: #EAF1FE;

  --success:   #16A34A;   /* verde: estados positivos/completados (disponible, aprobado) */
  --success-d: #15803D;
  --success-l: #E9F8EF;

  --signal:    #D97706;   /* ámbar: en proceso / pendiente de atención */
  --signal-d:  #92400E;
  --signal-l:  #FEF3E2;

  --alert:     #DC2626;
  --alert-l:   #FDECEC;
  --info:      #0891B2;
  --info-l:    #E5F6F9;

  --sidebar:    #0B1220;
  --sidebar-2:  #151E33;

  --radius:   12px;
  --radius-s: 8px;
  --shadow:   0 1px 2px rgba(15,23,42,.05), 0 6px 18px rgba(15,23,42,.06);
  --shadow-lg:0 18px 48px rgba(15,23,42,.24);

  --font:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-c:'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-m:'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --side-w: 244px;
  --tab-h: 62px;
}

* { box-sizing: border-box; }


html, body {
  margin: 0; padding: 0;
  width: 100%; max-width: 100%; overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 {
  font-family: var(--font-c);
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
  line-height: 1.2;
}
h1 { font-size: 1.55rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }

a { color: var(--primary); }
p { margin: 0 0 .6rem; }

.mono { font-family: var(--font-m); font-variant-numeric: tabular-nums; }
.muted { color: var(--slate); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; }

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

/* ---------------------------------------------------------- marca */
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }

.side-brand-text { min-width: 0; }
.side-brand-text strong {
  display: block; font-family: var(--font-c); font-weight: 600;
  font-size: 1rem; letter-spacing: -.01em; line-height: 1.15; color: #fff;
}
.side-brand-text em { display: block; font-style: normal; font-size: .72rem; color: var(--slate-2); margin-top: 2px; }

/* ============================================================ LOGIN */
.login-html {
  min-height: 100%;
  background: #0B1220;
}
.login-body {
  background:
    radial-gradient(circle at 18% -10%, rgba(37,99,235,.28), transparent 55%),
    linear-gradient(165deg, #0B1220 0%, #101A2E 55%, #0B1220 100%);
  min-height: 100vh;   /* respaldo para navegadores viejos */
  min-height: 100svh;  /* alto real visible en el celular: 100vh se calcula
                           antes de que el navegador muestre su barra de
                           direcciones, así que sobra espacio negro abajo
                           y la tarjeta queda descentrada hacia arriba */
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.login-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% -10%, rgba(37,99,235,.28), transparent 55%),
    linear-gradient(165deg, #0B1220 0%, #101A2E 55%, #0B1220 100%);
}
.login-wrap { width: 100%; max-width: 380px; }
.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px 28px 26px;
  box-shadow: var(--shadow-lg);
  border-top: 3px solid var(--primary);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-title {
  line-height: 1.15;
  font-size: 1.28rem; letter-spacing: -.01em; font-weight: 700; color: var(--ink);
}
.login-company { color: var(--slate); font-size: .82rem; margin: 2px 0 0; }
.login-error {
  background: var(--alert-l);
  border-left: 3px solid var(--alert);
  color: #8E1B1B;
  padding: 9px 12px;
  border-radius: var(--radius-s);
  font-size: .88rem;
  margin: 0 0 14px;
}
.login-foot { margin: 16px 0 0; font-size: .74rem; color: var(--slate-2); text-align: center; }
.field-pass { position: relative; display: block; }
.field-pass input { padding-right: 62px; }
.pass-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--primary);
  font-family: var(--font); font-size: .84rem; font-weight: 600;
  cursor: pointer; padding: 6px 8px;
}

/* ============================================================ ESTRUCTURA */
.shell { min-height: 100vh; min-height: 100svh; }

.side {
  display: none;
  position: fixed; inset: 0 auto 0 0;
  width: var(--side-w);
  background: var(--sidebar);
  color: #CBD5E1;
  flex-direction: column;
  z-index: 30;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-nav-label {
  font-family: var(--font); font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: #5B6B8C;
  padding: 14px 12px 6px;
}
.side-nav-label:first-child { padding-top: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-s);
  color: #C3CCDC; text-decoration: none;
  font-family: var(--font); font-weight: 500; font-size: .92rem;
}
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.on { background: var(--primary); color: #fff; font-weight: 600; }
.side-nav a .ico { width: 18px; height: 18px; display: inline-grid; place-items: center; opacity: .9; flex: none; }
.side-nav a .ico svg { width: 18px; height: 18px; }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08);
}
.side-user-info { flex: 1; min-width: 0; }
.side-user-info strong { display: block; font-size: .86rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-info em { font-style: normal; font-size: .74rem; color: #7C8AA6; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font); font-weight: 600; font-size: .9rem; flex: none;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: var(--sidebar); color: #fff;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar-title { flex: 1; font-family: var(--font); font-weight: 600; font-size: 1.05rem; }

.main {
  padding: 16px 14px calc(var(--tab-h) + 26px);
  width: 100%; min-width: 0;
  max-width: 1180px;
  margin: 0 auto;
  outline: none;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: var(--tab-h);
  color: var(--slate); text-decoration: none;
  font-family: var(--font); font-weight: 500; font-size: .72rem;
}
@media (max-width: 700px) {
  .tabbar a { min-width: 0; font-size: .64rem; padding-left: 2px; padding-right: 2px; }
}
.tabbar a .ico { width: 20px; height: 20px; display: inline-grid; place-items: center; line-height: 1; }
.tabbar a .ico svg { width: 20px; height: 20px; }
.tabbar a.on { color: var(--primary); font-weight: 700; box-shadow: inset 0 3px 0 var(--primary); }

@media (min-width: 900px) {
  .side { display: flex; }
  .topbar, .tabbar { display: none; }
  .main {
    margin-left: var(--side-w); padding: 26px 30px 60px;
    width: calc(100% - var(--side-w)); max-width: none;
  }
}

/* ============================================================ CABECERA DE VISTA */
.page-head {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head .grow { min-width: 200px; }
.page-head p { margin: 3px 0 0; color: var(--slate); font-size: .88rem; }
.audit-active-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #DC2626;
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  vertical-align: middle;
  letter-spacing: .02em;
}
.eyebrow {
  font-family: var(--font); font-weight: 600; letter-spacing: .02em;
  font-size: .78rem; color: var(--slate); display: block; margin-bottom: 3px;
}

/* ============================================================ BOTONES */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font); font-size: .92rem; font-weight: 600;
  padding: 9px 16px; min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); }
.btn-info { background: #E0F2FE; border-color: #7DD3FC; color: #0369A1; }
.btn-info:hover:not(:disabled) { background: #BAE6FD; border-color: #38BDF8; }
.btn-dark { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.btn-signal { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-danger { background: var(--alert); border-color: var(--alert); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--slate); }
.btn-ghost:hover { background: rgba(15,23,42,.05); color: var(--ink); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: .84rem; }
.btn-lg { min-height: 50px; font-size: 1rem; padding: 12px 22px; }
.btn-block { display: flex; width: 100%; }
.icon-btn {
  background: none; border: 0; color: inherit; cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 8px; border-radius: var(--radius-s);
}
.icon-btn:hover { background: rgba(255,255,255,.1); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================ TARJETAS */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -2px 0 12px;
}
.card-head h2, .card-head h3 { flex: 1; min-width: 140px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 14px 16px 0; margin-bottom: 10px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 780px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  border-left: 3px solid var(--primary);
}
.kpi em {
  display: block; font-style: normal;
  font-family: var(--font); font-weight: 500;
  font-size: .78rem; color: var(--slate);
}
.kpi strong {
  display: block; font-family: var(--font-m); font-weight: 600;
  font-size: 1.5rem; line-height: 1.25; margin-top: 4px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.kpi span { font-size: .76rem; color: var(--slate-2); }
.kpi.k-signal { border-left-color: var(--signal); }
.kpi.k-alert { border-left-color: var(--alert); }
.kpi.k-info { border-left-color: var(--info); }
.live-card { border-left: 4px solid var(--primary); }
.live-card .card-head { margin-bottom: 14px; }
.live-hero {
  display: grid;
  grid-template-columns: minmax(180px, .45fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
}
.live-hero em {
  display: block;
  font-style: normal;
  font-family: var(--font);
  color: var(--slate);
  font-weight: 600;
}
.live-hero strong {
  display: block;
  font-size: 2.1rem;
  line-height: 1.1;
  margin: 2px 0;
}
.live-hero small { color: var(--slate); }
.live-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  color: var(--slate);
  font-size: .78rem;
}
.live-legend span { display: inline-flex; align-items: center; gap: 5px; }
.live-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.live-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
.live-activity h4 {
  margin: 4px 0 8px;
  font-size: .9rem;
}
@media (min-width: 920px) { .live-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .live-hero { grid-template-columns: 1fr; gap: 10px; }
  .live-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) { .live-kpis { grid-template-columns: 1fr; } }

/* ============================================================ ETIQUETAS DE ESTADO */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font); font-size: .76rem; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  background: var(--paper); color: var(--slate);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.st-BORRADOR   { background: #EEF1F5; color: var(--slate); }
.pill.st-ABIERTA    { background: var(--info-l); color: #0E5F72; border-color: #BEE4EC; }
.pill.st-EN_PROCESO { background: var(--signal-l); color: var(--signal-d); border-color: #F2D9AE; }
.pill.st-EN_REVISION{ background: #F1E9FB; color: #6B2E96; border-color: #E0C8F0; }
.pill.st-APROBADA   { background: var(--success-l); color: var(--success-d); border-color: #BEE7CC; }
.pill.st-ANULADA    { background: #ECECEC; color: #6C6C6C; }
.pill.st-PENDIENTE  { background: #EEF1F5; color: var(--slate); }
.pill.st-CONTADO    { background: var(--success-l); color: var(--success-d); border-color: #BEE7CC; }
.pill.st-RECONTEO   { background: var(--alert-l); color: #A11D1D; border-color: #F4C6C6; }
.pill.st-VALIDADO   { background: var(--success); color: #fff; border-color: var(--success); }
.pill.abc-A { background: #FDECEC; color: #A32020; border-color: #F3CACA; }
.pill.abc-B { background: var(--signal-l); color: var(--signal-d); border-color: #F2D9AE; }
.pill.abc-C { background: #EDF1F5; color: #46586B; border-color: #D6DEE6; }
.pill.on  { background: var(--success-l); color: var(--success-d); border-color: #BEE7CC; }
.pill.off { background: #ECECEC; color: #767676; }
.pill.result-alert { background: var(--alert-l); color: var(--alert); border-color: #EEBCBC; }
.pill.result-missing { background: #EAF3FF; color: var(--info); border-color: #BFD7FF; }
.pill.result-ok { background: var(--success-l); color: var(--success-d); border-color: #BEE7CC; }
.pill.result-warn { background: var(--signal-l); color: var(--signal-d); border-color: #EBD08D; }

.tag-code {
  font-family: var(--font-m); font-size: .78rem;
  background: var(--ink); color: #E4EBE7;
  padding: 2px 7px; border-radius: 4px;
  letter-spacing: .02em; white-space: nowrap;
}

/* ============================================================ PROGRESO */
.progress {
  height: 10px; border-radius: 999px;
  background: #E7EBF0; overflow: hidden;
  display: flex;
}
.progress span { display: block; height: 100%; }
.progress .p-done { background: var(--success); }
.progress .p-doing { background: var(--signal); }
.progress .p-recount { background: var(--alert); }
.progress-lg { height: 16px; }
.progress-line {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-m); font-size: .82rem; margin-bottom: 5px;
}
.progress-line b { font-size: 1.15rem; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 7px; font-size: .76rem; color: var(--slate); }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 4px; }

/* ============================================================ MAPA DE RACKS (elemento firma) */
.location-create { display: flex; justify-content: center; margin-bottom: 14px; }
.rackmap { display: grid; gap: 12px; }
.rack {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); overflow: hidden;
}
.rack-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; background: var(--ink); color: #fff;
}
.rack-head b { font-family: var(--font); font-weight: 600; font-size: .96rem; }
.rack-head .rack-count { margin-left: auto; font-family: var(--font-m); font-size: .78rem; color: #9AA7C0; }
.rack-cells {
  display: grid; gap: 8px;
  padding: 10px;
}
.rack-column { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.rack-column-head { padding: 6px 9px; background: var(--paper); font: 700 .72rem var(--font-m); color: var(--slate); }
.rack-levels { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px; align-items: center; }
.rack-level-label { font-size: .68rem; color: var(--slate); margin-right: 2px; }
.count-location-choice { width: 100%; text-align: left; border: 0; cursor: pointer; background: transparent; }
.count-location-choice:hover { background: var(--paper); }
.cell {
  width: 40px; height: 34px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #F5F7FA;
  font-family: var(--font-m); font-size: .62rem; color: var(--slate);
  display: grid; place-items: center;
  cursor: pointer; position: relative;
  padding: 0; text-align: center; line-height: 1.1;
}
.cell:hover { border-color: var(--ink); }
.cell.c-PENDIENTE  { background: #F5F7FA; }
.cell.c-EN_PROCESO { background: var(--signal); border-color: var(--signal-d); color: #fff; }
.cell.c-CONTADO    { background: var(--success-l); border-color: #9CDBAF; color: var(--success-d); }
.cell.c-VALIDADO   { background: var(--success); border-color: var(--success-d); color: #fff; }
.cell.c-RECONTEO   { background: var(--alert); border-color: #A11D1D; color: #fff; }
.cell.diff::after {
  content: ''; position: absolute; top: 2px; right: 2px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--alert); box-shadow: 0 0 0 1.5px #fff;
}
.cell.sel { outline: 3px solid var(--info); outline-offset: 1px; }

/* ============================================================ LISTAS / TABLAS */
.list { border-top: 1px solid var(--line); }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  text-decoration: none; color: inherit;
  width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0;
  font: inherit; cursor: pointer;
}
.list-row:hover { background: #F8FAF8; }
.list-row .r-main { flex: 1; min-width: 0; }
.list-row .r-main strong { display: block; font-size: .95rem; }
.list-row .r-main small { display: block; color: var(--slate); font-size: .78rem; }
.list-row .count-result-factor {
  display: block;
  color: var(--primary);
  font-size: 1.05rem;
  line-height: 1.18;
  font-weight: 800;
}
.list-row .count-result-product {
  margin-top: 2px;
  color: var(--primary);
  font-size: .98rem;
  line-height: 1.18;
  font-weight: 800;
}
.list-row .count-result-code {
  margin-top: 3px;
  color: var(--slate);
  font-size: .86rem;
}
.r-side { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.list-row .r-side {
  text-align: right;
  flex: 0 0 132px;
  min-width: 132px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}
.list-row .r-side .pill { justify-content: center; min-width: 96px; }
.list-thumb {
  width: 42px; height: 42px; border-radius: var(--radius-s);
  background: var(--paper); border: 1px solid var(--line);
  object-fit: cover; flex: none;
  display: grid; place-items: center; color: var(--slate-2); font-size: .68rem;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.result-table-wrap {
  max-height: calc(100vh - 285px);
  max-height: calc(100svh - 285px);
  overflow: auto;
  overscroll-behavior: contain;
}
.result-table-wrap table.tbl th {
  top: 0;
  z-index: 3;
  box-shadow: 0 2px 0 var(--line);
}
.analysis-section { margin-top: 8px; }
.analysis-head { padding: 0 0 8px; }
.analysis-head h3 { margin: 0; font-size: .95rem; text-transform: uppercase; }
.analysis-filterbar { border-top: 0; padding: 0 0 12px; }
.analysis-table-wrap {
  max-height: calc(100vh - 205px);
  max-height: calc(100svh - 205px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.analysis-table-wrap table.tbl th {
  top: 0;
  z-index: 4;
  box-shadow: 0 2px 0 var(--line);
}
.audit-detail-cell small { display: block; margin-top: 3px; color: var(--slate); }
.audit-compare { display: grid; grid-template-columns: 1fr; gap: 12px; }
.audit-compare section { border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.audit-compare h3 { margin: 0; padding: 10px 12px; background: var(--paper); border-bottom: 1px solid var(--line); font-size: .9rem; }
.audit-lines { display: grid; }
.audit-lines > div { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.audit-lines > div:last-child { border-bottom: 0; }
.audit-lines small { display: block; color: var(--slate); margin-top: 2px; }
@media (min-width: 760px) { .audit-compare { grid-template-columns: 1fr 1fr; } }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.tbl th {
  font-family: var(--font); font-weight: 600;
  font-size: .78rem; color: var(--slate);
  text-align: left; padding: 9px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--paper); position: sticky; top: 0; z-index: 1;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }

/* Tabla editable de presentaciones/EAN por producto: inputs compactos para
   que quepan varias columnas sin ocupar tanto alto por fila. */
.tbl-compact th, .tbl-compact td { padding: 6px 8px; white-space: nowrap; }
.tbl-compact input, .tbl-compact select {
  min-height: 34px; padding: 5px 8px; font-size: .85rem;
}
.tbl-compact input[type=number] { text-align: right; }
table.tbl tr:hover td { background: #F8FAFC; }
table.tbl td.num, table.tbl th.num { text-align: right; font-family: var(--font-m); font-variant-numeric: tabular-nums; }
.diff-pos { color: var(--info); font-weight: 600; }
.diff-neg { color: var(--alert); font-weight: 600; }
.diff-ok { color: var(--success); font-weight: 600; }
.diff-zero { color: var(--slate-2); }

.empty {
  text-align: center; padding: 34px 18px; color: var(--slate);
}
.empty .empty-mark { font-size: 1.9rem; opacity: .35; display: block; margin-bottom: 6px; }
.empty h3 { margin-bottom: 4px; }

.loading { padding: 26px; text-align: center; color: var(--slate-2); font-family: var(--font); font-weight: 500; font-size: .88rem; }

/* ============================================================ FORMULARIOS */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block; font-family: var(--font); font-weight: 600;
  font-size: .84rem; color: var(--ink); margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], input[type=email], select, textarea {
  width: 100%;
  font-family: var(--font); font-size: .95rem;
  padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--card); color: var(--ink);
  appearance: none;
}
input[type=number] { font-family: var(--font-m); }
textarea { min-height: 76px; resize: vertical; }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-l); }
.force-uppercase { text-transform: uppercase; }
.result-filterbar { display:flex; align-items:center; gap:12px; padding:10px 14px; border-top:1px solid var(--line); }
.result-filterbar input { max-width:520px; }
.result-filterbar .muted { white-space:nowrap; }
.table-sort { appearance:none; border:0; background:transparent; color:inherit; font:inherit; letter-spacing:inherit; text-transform:inherit; padding:0 15px 0 0; cursor:pointer; position:relative; white-space:nowrap; }
.table-sort::after { content:'↕'; position:absolute; right:0; opacity:.35; }
.table-sort.on[data-direction="asc"]::after { content:'↑'; opacity:1; color:var(--primary); }
.table-sort.on[data-direction="desc"]::after { content:'↓'; opacity:1; color:var(--primary); }
@media (max-width:640px) { .result-filterbar { align-items:stretch; flex-direction:column; } .result-filterbar input { max-width:none; } }
.form-grid { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }
.field-hint { font-size: .78rem; color: var(--slate-2); margin-top: 4px; }

.check { display: flex; align-items: center; gap: 9px; padding: 8px 0; margin-bottom: 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; flex: none; accent-color: var(--primary); }
.check span { font-size: .92rem; }

/* Seguimiento de ubicaciones para Operario: informativo, sin acciones. */
.operator-location-status { margin-top: 14px; }
.operator-location-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:10px; }
.operator-location-head h3 { margin:0 0 3px; }
.operator-location-head p { margin:0; }
.operator-location-list { display:grid; gap:8px; }
.operator-location-row { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:11px 13px; }
.operator-location-main { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
.operator-location-main > strong { font-size:1.05rem; }
.operator-location-place,.operator-location-meta { display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; }
.operator-location-meta { border-top:1px solid var(--line); margin-top:8px; padding-top:8px; }
.operator-location-row span { min-width:0; overflow-wrap:anywhere; }
.operator-location-row em { display:block; color:var(--slate-2); font-size:.7rem; font-style:normal; font-weight: 600; margin-bottom:2px; }

@media (min-width: 760px) {
  .operator-location-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

.chips { display: flex; gap: 7px; flex-wrap: wrap; }

/* Grupos de pestañas de Data maestra: separa Almacenes/Zonas/Ubicaciones
   de Categorías y de Stock, para que no se vean como una sola lista plana. */
.tab-groups { display: flex; flex-wrap: wrap; gap: 20px 28px; margin-bottom: 16px; }
.tab-group { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tab-group-label {
  font-family: var(--font); font-weight: 600;
  font-size: .76rem; color: var(--slate-2); margin-right: 2px;
}
@media (min-width: 700px) {
  .tab-group { padding-right: 24px; border-right: 1px solid var(--line); }
  .tab-group:last-child { padding-right: 0; border-right: none; }
}
.chip {
  font-family: var(--font); font-weight: 500;
  font-size: .84rem; padding: 6px 13px; min-height: 34px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--slate); cursor: pointer;
  display: inline-flex; align-items: center;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px;
}
.toolbar input[type=search], .toolbar select { min-width: 0; width: auto; flex: 1 1 150px; }

.user-grouped-list { display: grid; gap: 0; }
.user-role-group + .user-role-group { border-top: 1px solid var(--line); }
.user-role-title {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px; background: #F3F6FA;
  color: var(--slate); font-weight: 700; font-size: .86rem;
}
.user-row-actions { justify-content: flex-end; margin-top: 5px; gap: 6px; }

/* ============================================================ CONTEO (operario) */
.count-head {
  background: var(--ink); color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
.count-head .loc-code {
  font-family: var(--font-m); font-size: 1.7rem; font-weight: 600;
  letter-spacing: .04em; display: block;
}
.count-head .loc-meta { color: #A9B3C4; font-size: .8rem; }

.scan-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.scan-bar input { flex: 1; }
.btn-location-scan {
  width: 100%;
  min-height: 58px;
  font-size: 1rem;
  font-weight: 800;
}
.btn-voice {
  flex: none;
  border-color: #1F7A5A;
  background: #ECF8F2;
  color: #166344;
  font-weight: 700;
}
.btn-voice.listening {
  background: #1F7A5A;
  color: #fff;
  border-color: #1F7A5A;
}
.voice-status {
  min-height: 18px;
  margin: -6px 0 10px;
  color: var(--slate);
  font-size: .78rem;
}

.count-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 12px 50px; margin-bottom: 9px;
  display: flex; gap: 11px; align-items: center;
  position: relative;
}
.count-item.done { border-color: var(--success); background: #F6FCF8; }
.count-item .ci-main { flex: 1; min-width: 0; }
.count-item .ci-main strong { display: block; font-size: .95rem; line-height: 1.25; }
.count-item .ci-main small { color: var(--slate); font-size: .76rem; font-family: var(--font-m); }
.count-remove {
  position: absolute; right: 12px; bottom: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px; border: 1px solid var(--alert);
  border-radius: var(--radius-s); background: #FFF7F7; color: var(--alert);
  font: 700 .8rem var(--font-c); cursor: pointer;
}
.count-remove:hover { background: #FDEAEA; }
.qty-box { display: flex; align-items: center; gap: 6px; flex: none; }
.qty-box input {
  width: 84px; text-align: right;
  font-family: var(--font-m); font-size: 1.15rem; font-weight: 600;
  min-height: 46px; padding: 6px 9px;
}
.qty-step {
  width: 38px; height: 46px; flex: none;
  border: 1px solid var(--line); background: var(--card);
  border-radius: var(--radius-s); font-size: 1.2rem; cursor: pointer; color: var(--ink);
}
.count-foot {
  position: sticky; bottom: calc(var(--tab-h) + 8px);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px; margin-top: 14px;
  box-shadow: var(--shadow);
  display: flex; gap: 9px; align-items: center;
}
@media (min-width: 900px) { .count-foot { bottom: 12px; } }
@media (max-width: 520px) {
  .scan-bar { flex-wrap: wrap; }
  .scan-bar input { flex: 1 1 100%; }
  .scan-bar .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
}

@media (max-width: 700px) {
  input[type=text], input[type=password], input[type=number], input[type=date],
  input[type=search], input[type=email], input[type=file], select, textarea {
    font-size: 16px;
  }
  .main, .card, .count-head, .count-foot, .toolbar, .product-group {
    max-width: 100%;
  }
}

/* ============================================================ MODAL */
/* Bug corregido: .modal-root llevaba "display:flex" sin condición, y esa
   regla (misma especificidad que el selector [hidden] del navegador) le
   ganaba a la que debía mantenerlo oculto. Resultado: una capa invisible
   cubría toda la pantalla e interceptaba cualquier clic, incluso con el
   atributo hidden puesto. Ahora el display solo se activa si NO está oculto,
   y [hidden] se refuerza explícitamente por si el navegador ya traía algo. */
.modal-root[hidden] { display: none !important; }
.modal-root {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15,21,18,.55);
  padding: 0;
}
.modal-root:not([hidden]) {
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .modal-root:not([hidden]) { align-items: center; padding: 24px; } }
.modal {
  background: var(--card);
  width: min(100%, 620px);
  max-height: 92vh;
  max-height: 92svh;
  border-radius: 14px 14px 0 0;
  display: flex; flex-direction: column;
  overflow: hidden; /* recorta el contenido a la caja redondeada: sin esto,
                        un formulario largo empuja los botones fuera del
                        recuadro blanco y quedan flotando sobre el fondo */
  box-shadow: var(--shadow-lg);
  animation: slideUp .16s ease-out;
}
@media (min-width: 700px) { .modal { border-radius: 14px; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } .btn { transition: none; } }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal-head h3 { flex: 1; }
.modal-body {
  flex: 1 1 auto;   /* toma el espacio disponible entre cabecera y botones */
  min-height: 0;    /* necesario para que overflow-y:auto funcione dentro de flex */
  padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal-foot {
  flex: 0 0 auto;   /* los botones siempre quedan visibles, nunca se recortan */
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.modal-wide { width: min(100%, 900px); }
.modal-history { width: min(100%, 1180px); }

/* Historial: tabla de alta densidad en PC y tarjetas legibles en celular. */
.movement-mobile { display: none; }
.movement-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--card); }
.movement-card + .movement-card { margin-top: 10px; }
.movement-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.movement-card > strong, .movement-card > small { display: block; }
.movement-meta, .movement-qty { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.movement-qty { grid-template-columns: repeat(3, 1fr); background: var(--paper); border-radius: var(--radius-s); padding: 9px; text-align: right; }
.movement-meta span, .movement-qty span { min-width: 0; }
.movement-meta b, .movement-qty b, .movement-note b { display: block; font-family: var(--font); font-weight: 600; font-size: .72rem; color: var(--slate); }
.movement-note { margin-top: 10px; font-size: .86rem; }
@media (max-width: 700px) {
  .movement-desktop { display: none; }
  .movement-mobile { display: block; }
  .movement-qty { font-size: .8rem; }
}
@media (max-width: 520px) {
  .modal-foot .btn { flex: 1 1 100%; }
}

/* ============================================================ TOASTS */
.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + 14px); z-index: 90;
  display: flex; flex-direction: column; gap: 8px;
  width: min(94vw, 440px); pointer-events: none;
}
@media (min-width: 900px) { .toast-stack { bottom: 20px; left: auto; right: 20px; transform: none; } }
.toast {
  background: var(--ink-2); color: #fff;
  padding: 11px 14px; border-radius: var(--radius);
  font-size: .89rem; box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--success);
}
.toast.err { border-left-color: var(--alert); }
.toast.warn { border-left-color: var(--signal); }

/* ============================================================ FOTO PRODUCTO */
.photo-slot {
  width: 100%; aspect-ratio: 1/1;  /* cuadrado: deja espacio parejo para fotos
                                       verticales (botellas, cajas de pie) y
                                       horizontales sin favorecer a ninguna */
  border: 2px dashed var(--line); border-radius: var(--radius);
  display: grid; place-items: center; overflow: hidden;
  background: #fff; color: var(--slate-2);
  position: relative; cursor: pointer;
}
.photo-slot img {
  width: 100%; height: 100%;
  object-fit: contain;  /* se ve la foto COMPLETA, nunca recorta el producto */
  padding: 14px;
}
.photo-actions { display: flex; gap: 8px; margin-top: 8px; }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.detail-grid > *, .product-detail-flow, .product-detail-flow > * { min-width: 0; }
@media (min-width: 700px) { .detail-grid { grid-template-columns: 240px 1fr; } }
.def-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.def-list div em {
  display: block; font-style: normal; font-family: var(--font); font-weight: 600;
  font-size: .74rem; color: var(--slate-2);
}
.def-list div strong { font-size: .92rem; font-weight: 500; }
.def-list .allergen-value { color: var(--alert); font-weight: 700; }
.result-detail-summary {
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(130px, .7fr));
  gap: 12px 18px;
  margin-bottom: 16px;
  align-items: start;
}
.result-detail-summary > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: #FBFCFD;
}
.result-detail-summary em {
  display: block;
  margin-bottom: 4px;
}
.result-detail-summary strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.result-detail-summary .summary-product strong {
  font-weight: 650;
}
.result-detail-wrap {
  padding-bottom: 4px;
}
.result-detail-table {
  min-width: 1240px;
}
.result-detail-table th,
.result-detail-table td {
  padding: 10px 12px;
}
.result-detail-table th:nth-child(2),
.result-detail-table td:nth-child(2) {
  min-width: 130px;
}
.result-detail-table th:nth-child(4),
.result-detail-table td:nth-child(4) {
  min-width: 170px;
}
.result-detail-table th:nth-child(7),
.result-detail-table td:nth-child(7),
.result-detail-table th:nth-child(10),
.result-detail-table td:nth-child(10),
.result-detail-table th:nth-child(11),
.result-detail-table td:nth-child(11) {
  min-width: 135px;
}
.location-progress-table {
  min-width: 860px;
}
.location-progress-table td strong,
.location-progress-table td small {
  display: block;
}
.location-progress-table td small {
  margin-top: 2px;
  color: var(--slate);
}
.allergen-pill { color: #9A1E1E; background: var(--alert-l); border-color: #F1C1C1; font-weight: 700; }
.allergen-check { margin-top: 4px; padding: 12px; border: 1px solid #F1C1C1; border-radius: var(--radius-s); background: #FFF9F9; }
.allergen-check span { display: grid; gap: 2px; }
.allergen-check small { color: var(--slate); font-weight: 400; }
.validation-box { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-s); font-size: .84rem; }
.validation-box p { margin: 4px 0 0; }
.validation-box ul { margin: 6px 0 0; padding-left: 18px; }
.validation-box.good { background: var(--success-l); border: 1px solid #B7E4C4; color: var(--success-d); }
.validation-box.bad { background: var(--alert-l); border: 1px solid #F1C1C1; color: #9A1E1E; }
.sap-cutoff { margin-top: 5px !important; color: var(--primary) !important; }

/* ============================================================ PRODUCTOS / PRESENTACIONES */
.product-catalog { display: grid; gap: 14px; }
.product-group {
  background: var(--card);
  border: 2px solid #B8C6D8;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}
.product-group-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  color: inherit; text-decoration: none; background: #F3F6FA; border-bottom: 1px solid #CBD5E1;
}
.product-group-head strong { display: block; font-size: 1.02rem; }
.product-group-head small { display: block; color: var(--slate); }
.presentation-list { display: grid; }
.presentation-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 14px;
  color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); min-width: 0;
}
.presentation-row:last-child { border-bottom: 0; }
.presentation-row strong, .presentation-row small { display: block; }
.presentation-row strong { color: var(--primary); }
.presentation-row small { color: var(--slate); }
.presentation-thumb {
  width: 58px; height: 58px; flex: none; object-fit: contain; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff;
}
.presentation-thumb.empty-photo { display: grid; place-items: center; color: var(--slate-2); font-size: .66rem; padding: 4px; text-align: center; }
.presentation-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.presentation-card { display: flex; gap: 13px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.presentation-photo {
  width: 112px; height: 112px; flex: none; display: grid; place-items: center; overflow: hidden;
  border: 1px dashed var(--line); border-radius: var(--radius-s); background: #fff; color: var(--slate-2); font-size: .76rem;
}
.presentation-photo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.presentation-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.presentation-title { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.presentation-title strong { color: var(--primary); }
.import-rule { margin-bottom: 12px; padding: 12px; border-left: 4px solid var(--signal); background: #FFF7ED; border-radius: var(--radius-s); }
.import-rule strong { display: block; margin-bottom: 4px; }
.import-rule p { margin: 0; color: var(--slate); }
.import-load-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .45fr); gap: 18px; align-items: start; margin-top: 12px; }
.import-validate-btn { width: 100%; margin-top: 6px; justify-content: center; }
.import-status { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); }
.import-result { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); }
.import-result p { margin: 6px 0; }
.import-ok { background: var(--primary-l); border-color: #B9DECD; }
.import-error { background: #FFF1F2; border-color: #F4B4BE; }
.import-errors { margin-top: 8px; color: #8E1B1B; }
@media (max-width:720px) { .import-load-grid { grid-template-columns: 1fr; gap: 10px; } }
.stock-location-list { display: grid; }
.stock-location-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.stock-location-row small { display: block; color: var(--slate); }

.master-subcategory-groups { display: grid; }
.master-subcategory-group { border-top: 1px solid var(--line); }
.master-subcategory-group:first-child { border-top: 0; }
.master-subcategory-title {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 10px 16px; background: #F3F6FA; color: var(--slate);
}
.master-subcategory-title strong { color: var(--ink); }
.master-subcategory-title small { color: var(--slate-2); font-size: .78rem; }
.master-subcategory-group .list { border-top: 1px solid var(--line); }
.master-subcategory-group .empty.small { padding: 12px 16px; }

@media (max-width: 520px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .grow { min-width: 0; width: 100%; }
  .page-head .btn-row { width: 100%; }
  .page-head .btn-row .btn { flex: 1 1 0; }
  .result-head { flex-direction: column; align-items: stretch; }
  .result-head .grow { flex: none; width: 100%; overflow-wrap: normal; word-break: normal; }
  .result-head .btn-row { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .result-head .btn { min-width: 0; padding: 8px 6px; font-size: .86rem; white-space: normal; line-height: 1.1; }
  .result-table-wrap {
    max-height: calc(100vh - 145px);
    max-height: calc(100svh - 145px);
  }
  .analysis-table-wrap {
    max-height: calc(100vh - 190px);
    max-height: calc(100svh - 190px);
  }
  .product-group-head { align-items: flex-start; }
  .product-group-head .r-side { max-width: 48%; }
  .presentation-card { align-items: center; }
  .presentation-photo { width: 88px; height: 88px; }
  .presentation-info .btn-row { gap: 5px; }
  .presentation-info .btn { padding-left: 8px; padding-right: 8px; }
  .def-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .def-list div { min-width: 0; }
  .def-list div strong { overflow-wrap: anywhere; }
}

@media print {
  .side, .tabbar, .topbar, .toolbar, .btn, .toast-stack { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
}
