/* ══════════════════════════════════════════
   BETHEL PORTAL · v6 (admin y panel de empleados)
   Barra lateral en PC, barra inferior en celular.
   Tema oscuro (por defecto) y claro: usar siempre las variables.
   color-mix() lleva antes un color fijo para navegadores viejos.
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f0d0c;
  --bg-elev:     #151210;
  --surface:     #1b1815;
  --surface-2:   #24201c;
  --surface-3:   #2d2823;
  --border:      rgba(255,255,255,0.08);
  --border-2:    rgba(255,255,255,0.14);
  --text:        #f5f1ea;
  --text-2:      rgba(245,241,234,0.70);
  --text-3:      rgba(245,241,234,0.48);
  --gold:        #d6b062;
  --gold-2:      #c9a24a;
  --gold-soft:   rgba(214,176,98,0.13);
  --gold-line:   rgba(214,176,98,0.32);
  --on-gold:     #1c1509;
  --green:       #43d17f;
  --green-soft:  rgba(67,209,127,0.13);
  --red:         #ff6b6b;
  --red-soft:    rgba(255,107,107,0.12);
  --blue:        #6fa9ff;
  --blue-soft:   rgba(111,169,255,0.13);
  --orange:      #ffae47;
  --orange-soft: rgba(255,174,71,0.13);
  --shadow:      0 10px 30px rgba(0,0,0,0.35);
  --shadow-lg:   0 30px 70px rgba(0,0,0,0.55);
  --radius:      16px;
  --radius-sm:   11px;
  --sidebar:     248px;
  --topbar:      64px;
  --bottomnav:   64px;
  color-scheme: dark;
}

:root[data-tema="claro"] {
  --bg:          #f5f1eb;
  --bg-elev:     #fbf8f3;
  --surface:     #ffffff;
  --surface-2:   #f4efe7;
  --surface-3:   #ebe4d9;
  --border:      rgba(60,40,20,0.10);
  --border-2:    rgba(60,40,20,0.18);
  --text:        #251c13;
  --text-2:      rgba(37,28,19,0.72);
  --text-3:      rgba(37,28,19,0.52);
  --gold:        #93701f;
  --gold-2:      #b48a31;
  --gold-soft:   rgba(180,138,49,0.12);
  --gold-line:   rgba(147,112,31,0.35);
  --on-gold:     #fffaf0;
  --green:       #1c9150;
  --green-soft:  rgba(28,145,80,0.10);
  --red:         #cf3f3f;
  --red-soft:    rgba(207,63,63,0.09);
  --blue:        #2c69cf;
  --blue-soft:   rgba(44,105,207,0.09);
  --orange:      #b86e00;
  --orange-soft: rgba(184,110,0,0.10);
  --shadow:      0 8px 24px rgba(60,40,20,0.08);
  --shadow-lg:   0 30px 70px rgba(60,40,20,0.20);
  color-scheme: light;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Poppins", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Pantalla de carga ── */
.arranque {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  transition: opacity .3s ease;
}
.arranque.fuera { opacity: 0; pointer-events: none; }
.arranque b { font-size: 1.9rem; font-weight: 800; color: var(--gold); letter-spacing: -0.5px; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid var(--gold-soft); border-top-color: var(--gold);
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ══ BARRA LATERAL ══ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  width: var(--sidebar);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px;
}
.brand { display: flex; flex-direction: column; padding: 4px 10px 22px; }
.brand b { font-size: 1.6rem; font-weight: 800; color: var(--gold); letter-spacing: -0.5px; line-height: 1; }
.brand small { font-size: 0.66rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 2.4px; margin-top: 5px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  background: none; border: none; text-align: left; text-decoration: none;
  color: var(--text-2); font-size: 0.9rem; font-weight: 500;
  transition: background .15s ease, color .15s ease;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.activo { background: var(--gold-soft); color: var(--gold); font-weight: 600; }
.nav-item .cuenta {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 0.68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.sidebar-pie { display: flex; flex-direction: column; gap: 3px; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-item.salir:hover { color: var(--red); background: var(--red-soft); }

/* ══ CONTENEDOR ══ */
.app { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-marca { display: none; font-size: 1.35rem; font-weight: 800; color: var(--gold); letter-spacing: -0.5px; }
.topbar-titulo { flex: 1; min-width: 0; }
.topbar-titulo h1 { font-size: 1.12rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-titulo p { font-size: 0.76rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-acciones { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: all .15s ease;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold-line); }
.icon-btn .punto {
  position: absolute; top: -5px; right: -5px;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 0.64rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.icon-btn.girando svg { animation: girar .8s linear infinite; }

.main { padding: 26px 28px 40px; width: 100%; max-width: 1400px; margin: 0 auto; }
.vista { display: none; flex-direction: column; gap: 20px; }
.vista.activa { display: flex; animation: aparecer .25s ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ══ BARRA INFERIOR (celular) ══ */
.bottomnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: calc(var(--bottomnav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-elev);
  background: color-mix(in srgb, var(--bg-elev) 94%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.bottomnav button {
  flex: 1; background: none; border: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 0.66rem; font-weight: 500; position: relative;
}
.bottomnav button.activo { color: var(--gold); font-weight: 600; }
.bottomnav button svg.i { width: 21px; height: 21px; }
.bottomnav .cuenta {
  position: absolute; top: 7px; left: calc(50% + 6px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 0.6rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ══ TARJETAS ══ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2 { font-size: 0.98rem; font-weight: 700; }
.card-head p { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }
.card-head .acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-form { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.pegajosa { position: sticky; top: calc(var(--topbar) + 20px); }

/* ── Saludo ── */
.saludo { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.saludo h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.3px; }
.saludo p { color: var(--text-3); font-size: 0.86rem; }
.saludo p::first-letter { text-transform: uppercase; }

/* ── KPIs ── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  text-align: left; transition: border-color .15s ease, transform .15s ease;
}
button.kpi:hover { border-color: var(--gold-line); transform: translateY(-2px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 0.74rem; font-weight: 600; color: var(--text-3); }
.kpi-ico { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--gold-soft); color: var(--gold); }
.kpi-ico.rojo { background: var(--red-soft); color: var(--red); }
.kpi-ico.azul { background: var(--blue-soft); color: var(--blue); }
.kpi-ico.verde { background: var(--green-soft); color: var(--green); }
.kpi-valor { font-size: 1.95rem; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-valor.chico { font-size: 1.4rem; text-transform: capitalize; }
.kpi-desc { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta-up { color: var(--green); font-weight: 600; }
.delta-down { color: var(--red); font-weight: 600; }

/* ── Accesos rápidos ── */
.rapidos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rapido {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.86rem; font-weight: 600; text-align: left; color: var(--text);
  transition: all .15s ease;
}
.rapido:hover { border-color: var(--gold-line); background: var(--gold-soft); }
.rapido .kpi-ico { width: 36px; height: 36px; }
.rapido small { display: block; font-size: 0.72rem; color: var(--text-3); font-weight: 400; }

.grafica { position: relative; height: 240px; }
.grafica.baja { height: 200px; }

/* ══ BOTONES ══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  font-size: 0.86rem; font-weight: 600; white-space: nowrap; text-decoration: none;
  border: 1px solid transparent; transition: all .15s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primario { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--on-gold); box-shadow: 0 4px 14px rgba(201,162,74,0.22); }
.btn-primario:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn-sec { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-sec:hover:not(:disabled) { border-color: var(--gold-line); color: var(--gold); }
.btn-peligro { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); color: var(--red); }
.btn-peligro:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 20%, transparent); }
.btn-azul { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); }
.btn-verde { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.btn-full { width: 100%; }
.btn-chico { min-height: 34px; padding: 0 12px; font-size: 0.78rem; border-radius: 9px; }
.btn.cargando { color: transparent !important; position: relative; pointer-events: none; }
.btn.cargando::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-3); border-top-color: var(--text);
  animation: girar .7s linear infinite;
}
.btn-primario.cargando::after { border-color: rgba(0,0,0,.25); border-top-color: var(--on-gold); }

.mini-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: 0.76rem; font-weight: 600; white-space: nowrap; transition: all .15s ease;
}
.mini-btn:hover:not(:disabled) { color: var(--gold); border-color: var(--gold-line); }
.mini-btn.ok { color: var(--green); }
.mini-btn.ok:hover:not(:disabled) { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, transparent); color: var(--green); }
.mini-btn.del:hover:not(:disabled) { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); color: var(--red); }
.mini-btn svg.i { width: 15px; height: 15px; }
.mini-btn:disabled { opacity: .5; }

/* ══ FORMULARIOS ══ */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.campo > label { font-size: 0.76rem; font-weight: 600; color: var(--text-2); }
.campo > label em { font-style: normal; color: var(--text-3); font-weight: 400; }
.input, .campo input, .campo select, .campo textarea {
  width: 100%; min-height: 44px;
  background: var(--bg-elev); border: 1px solid var(--border-2); color: var(--text);
  padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: 0.92rem; transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none; appearance: none;
}
select.input, .campo select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a09584' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.campo textarea { resize: vertical; min-height: 96px; }
.input:focus, .campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft);
}
.input::placeholder, .campo input::placeholder, .campo textarea::placeholder { color: var(--text-3); }
.fila { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fila.tres { grid-template-columns: 2fr 1fr; }
.ayuda { font-size: 0.74rem; color: var(--text-3); line-height: 1.5; }
.ayuda a { color: var(--gold); }

.buscador { position: relative; flex: 1; min-width: 180px; }
.buscador svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; pointer-events: none; }
.buscador .input { padding-left: 36px; min-height: 40px; font-size: 0.86rem; }

.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtros select.input { width: auto; min-height: 40px; font-size: 0.84rem; flex: 0 1 auto; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: 0.78rem; font-weight: 500; white-space: nowrap; transition: all .15s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.activo { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); font-weight: 600; }
.chip .n { font-size: 0.68rem; opacity: .75; }

/* ══ INSIGNIAS ══ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; white-space: nowrap; line-height: 1.6;
}
.b-oro { background: var(--gold-soft); color: var(--gold); }
.b-verde { background: var(--green-soft); color: var(--green); }
.b-rojo { background: var(--red-soft); color: var(--red); }
.b-azul { background: var(--blue-soft); color: var(--blue); }
.b-naranja { background: var(--orange-soft); color: var(--orange); }
.b-gris { background: var(--surface-3); color: var(--text-3); }

/* ══ LISTAS GENÉRICAS ══ */
.lista { display: flex; flex-direction: column; gap: 8px; }
.lista.scroll { max-height: 560px; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; min-width: 0; transition: border-color .15s ease;
}
.item:hover { border-color: var(--border-2); }
.item.alerta { border-color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); background: color-mix(in srgb, var(--red) 5%, var(--bg-elev)); }
.item.boton { width: 100%; text-align: left; color: var(--text); }
.item.boton:hover { border-color: var(--gold-line); }
.item.sel { border-color: var(--gold); background: var(--gold-soft); }
.item-cuerpo { flex: 1; min-width: 0; }
.item-titulo { font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.item-titulo.cap::first-letter { text-transform: uppercase; }
.item-meta { font-size: 0.76rem; color: var(--text-3); margin-top: 2px; display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; overflow-wrap: anywhere; }
.item-meta b { color: var(--gold); font-weight: 600; }
.item-acciones { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.item-ico { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--gold-soft); color: var(--gold); font-size: 1.1rem; }
.item-ico.rojo { background: var(--red-soft); color: var(--red); }
.item-ico.azul { background: var(--blue-soft); color: var(--blue); }
.item-ico.naranja { background: var(--orange-soft); color: var(--orange); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--on-gold);
  font-weight: 700; font-size: 0.86rem; text-transform: uppercase;
}
.avatar.grande { width: 48px; height: 48px; font-size: 1.05rem; }

.vacio { text-align: center; padding: 30px 16px; color: var(--text-3); font-size: 0.86rem; }
.vacio svg.i { width: 34px; height: 34px; opacity: .45; margin-bottom: 8px; }
.vacio strong { display: block; color: var(--text-2); font-weight: 600; margin-bottom: 2px; }

.esqueleto { height: 58px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: brillo 1.3s ease infinite; }
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.progreso { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 7px; }
.progreso > span { display: block; height: 100%; border-radius: inherit; background: var(--gold); transition: width .3s ease; }
.progreso.listo > span { background: var(--green); }

/* ══ TABLAS ══ */
.tabla-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.tabla th {
  text-align: left; padding: 10px 12px; font-size: 0.72rem; font-weight: 600; color: var(--text-3);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tabla td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover td { background: var(--gold-soft); }
.tabla td.fuerte { color: var(--text); font-weight: 600; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.cap { text-transform: capitalize; }

.resumen-linea { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-3); margin-bottom: 10px; }
.resumen-linea b { color: var(--text); }
.mas-wrap { text-align: center; margin-top: 14px; }

.barrita-fila { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--text-3); text-transform: capitalize; }
.barrita { height: 5px; border-radius: 3px; background: var(--gold); min-width: 4px; }

/* ══ NÓMINA ══ */
.liq-cabeza { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.liq-cabeza h2 { font-size: 1.05rem; font-weight: 700; }
.liq-cabeza p { font-size: 0.78rem; color: var(--text-3); }
.volver { display: none; }
.liq-fila {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; align-items: center;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg-elev); border: 1px solid var(--border);
}
.liq-fila.extra { border-color: color-mix(in srgb, var(--blue) 30%, transparent); background: color-mix(in srgb, var(--blue) 5%, var(--bg-elev)); }
.liq-fila.sin-precio { border-color: var(--orange); border-color: color-mix(in srgb, var(--orange) 40%, transparent); }
.liq-nombre { font-size: 0.88rem; font-weight: 500; overflow-wrap: anywhere; }
.liq-nombre::first-letter { text-transform: uppercase; }
.liq-nombre .cant { color: var(--gold); font-weight: 700; margin-right: 6px; }
.liq-ctrl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.precio-wrap { position: relative; }
.precio-wrap span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 0.82rem; }
.precio-wrap input { width: 122px; min-height: 38px; padding: 6px 10px 6px 22px; font-size: 0.88rem; text-align: right; }
.liq-sub { font-size: 0.76rem; color: var(--text-3); grid-column: 1 / -1; display: flex; justify-content: space-between; }
.liq-sub b { color: var(--text); }
.panel-extra { margin-top: 12px; padding: 16px; border-radius: var(--radius-sm); background: var(--bg-elev); border: 1px dashed var(--border-2); }
.panel-extra h3 { font-size: 0.84rem; font-weight: 700; margin-bottom: 12px; }
.total-box {
  position: sticky; bottom: 12px; z-index: 5;
  margin-top: 16px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--gold-line); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.total-box small { display: block; font-size: 0.72rem; color: var(--text-3); font-weight: 600; }
.total-box strong { font-size: 1.6rem; color: var(--green); font-variant-numeric: tabular-nums; line-height: 1.2; }
.total-box .desglose { font-size: 0.72rem; color: var(--text-3); }

.comp {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden;
}
.comp summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.comp summary::-webkit-details-marker { display: none; }
.comp[open] summary { border-bottom: 1px dashed var(--border-2); }
.comp .monto { font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; white-space: nowrap; }
.comp-det { padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; color: var(--text-2); }
.comp-det .l { display: flex; justify-content: space-between; gap: 12px; }
.comp-det .l span:first-child::first-letter { text-transform: uppercase; }
.comp-det .l span:last-child { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.comp-acc { display: flex; gap: 8px; padding: 0 14px 14px; flex-wrap: wrap; }
.chev { transition: transform .2s ease; color: var(--text-3); }
.comp[open] .chev { transform: rotate(180deg); }

.zona-peligro { border-color: color-mix(in srgb, var(--red) 28%, transparent); }
.zona-peligro .card-head h2 { color: var(--red); }

/* ══ INVENTARIO ══ */
.stock { text-align: right; flex-shrink: 0; min-width: 62px; }
.stock strong { display: block; font-size: 1.15rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stock small { font-size: 0.7rem; color: var(--text-3); }
.item.alerta .stock strong { color: var(--red); }
.stepper { display: flex; align-items: center; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.stepper button { width: 36px; height: 36px; background: var(--surface-2); border: none; color: var(--text-2); font-size: 1.05rem; font-weight: 600; }
.stepper button:hover { color: var(--gold); background: var(--gold-soft); }
.stepper input { width: 46px; height: 36px; border: none; background: var(--bg-elev); color: var(--text); text-align: center; font-size: 0.86rem; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--gold-soft); }

/* ══ ANUNCIOS ══ */
.anuncio { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elev); }
.anuncio.info { border-left: 3px solid var(--blue); }
.anuncio.alerta { border-left: 3px solid var(--orange); }
.anuncio.logro { border-left: 3px solid var(--gold); }
.anuncio p { font-size: 0.84rem; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; margin-top: 2px; }
.tipo-sel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; position: relative; }
.tipo-sel label {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--bg-elev);
  font-size: 0.76rem; font-weight: 500; color: var(--text-2); cursor: pointer; text-align: center;
}
.tipo-sel input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tipo-sel label span { font-size: 1.2rem; }
.tipo-sel input:checked + label { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); font-weight: 600; }
.tipo-sel input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ══ PANEL DE EMPLEADOS ══ */
.hoy-card {
  background: linear-gradient(135deg, var(--gold-soft), transparent 70%), var(--surface);
  border: 1px solid var(--gold-line); border-radius: var(--radius); padding: 22px;
}
.hoy-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hoy-top small { display: block; font-size: 0.76rem; font-weight: 600; color: var(--text-3); }
.hoy-num { font-size: 2.6rem; font-weight: 800; line-height: 1.05; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.hoy-num span { font-size: 1rem; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.hoy-msg { font-size: 0.86rem; color: var(--text-2); font-weight: 500; }
.barra { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 14px 0 0; }
.barra > span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gold-2), var(--gold)); transition: width .7s cubic-bezier(.16,1,.3,1); }
.barra.lista > span { background: var(--green); }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.mini-stat { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; text-align: left; }
button.mini-stat:hover { border-color: var(--gold-line); }
.mini-stat small { display: block; font-size: 0.7rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stat b { display: block; font-size: 1.1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

.tipo-sel.cuatro { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tipo-sel label { min-height: 48px; justify-content: center; }
.tipo-sel.urg input:checked + label.normal { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }
.tipo-sel.urg input:checked + label.urgente { border-color: var(--orange); background: var(--orange-soft); color: var(--orange); }
.tipo-sel.urg input:checked + label.critico { border-color: var(--red); background: var(--red-soft); color: var(--red); }

.stepper.grande { width: 100%; border-radius: var(--radius-sm); }
.stepper.grande button { width: 56px; height: 50px; font-size: 1.4rem; }
.stepper.grande input { flex: 1; width: auto; height: 50px; font-size: 1.25rem; font-weight: 700; }

.sugerencias { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sugerencias .chip { height: 30px; font-size: 0.74rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.dia { font-size: 0.76rem; font-weight: 600; color: var(--text-3); display: flex; justify-content: space-between; padding: 8px 2px 2px; }
.dia:first-child { padding-top: 0; }
.dia b { color: var(--gold); }

.kpis.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#toast.con-accion { pointer-events: auto; }
#toast button { margin-left: auto; padding: 4px 8px; background: none; border: none; color: var(--gold); font-weight: 700; font-size: 0.84rem; flex-shrink: 0; }
.btn-wa { background: #25d366; color: #0b2b17; }
.btn-wa:hover:not(:disabled) { filter: brightness(1.05); }
.ok-flash { background: var(--green) !important; color: #fff !important; box-shadow: none !important; }

/* ══ VENTAS ══ */
.pedidos { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pedido {
  background: var(--bg-elev); border: 1px solid var(--border); border-left: 4px solid var(--gold-line);
  border-radius: var(--radius-sm); display: flex; flex-direction: column; min-width: 0;
}
.pedido.atrasado { border-left-color: var(--red); }
.pedido.pronto { border-left-color: var(--orange); }
.pedido.pagado { border-left-color: var(--green); }
.pedido-cuerpo { padding: 14px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.pedido-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pedido-cliente { font-size: 0.98rem; font-weight: 700; overflow-wrap: anywhere; }
.pedido-linea { font-size: 0.8rem; color: var(--text-2); display: flex; gap: 6px; align-items: baseline; overflow-wrap: anywhere; }
.pedido-linea span:first-child { flex-shrink: 0; }
.pedido-saldo { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 9px; background: var(--surface-2); font-size: 0.8rem; color: var(--text-3); }
.pedido-saldo b { font-size: 1rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.pedido-saldo b.cero { color: var(--green); }
.pedido-acc { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pedido-acc .btn { flex: 1 1 auto; }

.art-fila { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.9fr) 40px; gap: 8px; margin-bottom: 8px; }
.grid-venta { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
.art-total { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-3); margin: 2px 0 10px; }
.art-total b { color: var(--text); }
.factura { display: inline-flex; align-items: center; gap: 4px; font-size: 0.7rem; font-weight: 700; color: var(--text-3); background: var(--surface-3); padding: 2px 8px; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hoy-ventas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.hoy-ventas div { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; min-width: 0; }
.hoy-ventas small { display: block; font-size: 0.72rem; color: var(--text-3); }
.hoy-ventas b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pista { font-size: 0.72rem; color: var(--text-3); }
.pista b { color: var(--gold); }
.art-fila .mini-btn { height: 44px; min-width: 40px; }
.caja-dinero { background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; }
.caja-dinero .campo:last-child { margin-bottom: 0; }
.saldo-vivo { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 0.84rem; color: var(--text-2); }
.saldo-vivo b { font-size: 1.25rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.timeline { list-style: none; border-left: 2px solid var(--gold-line); margin: 4px 0 0 6px; padding-left: 16px; }
.timeline li { position: relative; margin-bottom: 12px; font-size: 0.8rem; color: var(--text-3); }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid var(--surface); }
.timeline li b { display: block; color: var(--green); font-size: 0.92rem; }
.detalle-sec { font-size: 0.74rem; font-weight: 700; color: var(--gold); margin: 14px 0 8px; }

/* ══ INICIO DE SESIÓN ══ */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px calc(32px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse 70% 50% at 50% 0%, var(--gold-soft), transparent 70%), var(--bg);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 24px; padding: 36px 32px 28px; box-shadow: var(--shadow-lg);
  animation: subir .35s cubic-bezier(.16,1,.3,1);
}
.login-marca { text-align: center; margin-bottom: 26px; }
.login-marca b { display: block; font-size: 2.4rem; font-weight: 800; color: var(--gold); letter-spacing: -1px; line-height: 1; }
.login-marca small { display: block; margin-top: 6px; font-size: 0.68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 3px; }
.login h1 { font-size: 1.25rem; font-weight: 700; text-align: center; }
.login .sub { font-size: 0.84rem; color: var(--text-3); text-align: center; margin: 4px 0 24px; }
.con-icono { position: relative; }
.con-icono > svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 18px; height: 18px; pointer-events: none; }
.con-icono input { padding-left: 44px !important; min-height: 50px !important; font-size: 1rem !important; }
.con-icono .ver-clave { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 9px; background: none; border: none; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.con-icono .ver-clave:hover { color: var(--gold); }
.con-icono.clave input { padding-right: 50px !important; }
.fila-login { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -2px 0 18px; flex-wrap: wrap; }
.fila-login .check { margin: 0; font-size: 0.82rem; }
.enlace { background: none; border: none; color: var(--gold); font-size: 0.82rem; font-weight: 600; padding: 4px 0; }
.enlace:hover { text-decoration: underline; }
.aviso-caps { font-size: 0.74rem; color: var(--orange); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.login-pie { text-align: center; margin-top: 22px; font-size: 0.72rem; color: var(--text-3); }
.login-tema { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 5; }
.sacudir { animation: sacudir .35s ease; }
.en-app .solo-web { display: none !important; }   /* dentro de la app Android no se ofrece descargarla */
@keyframes sacudir { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (max-width: 480px) {
  .login-card { padding: 30px 20px 24px; border-radius: 20px; }
  .login-marca b { font-size: 2.1rem; }
}

/* ══ MENSAJES ══ */
.aviso { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 0.82rem; line-height: 1.5; }
.aviso.error { background: var(--red-soft); color: var(--red); }
.aviso.info { background: var(--gold-soft); color: var(--text-2); }
.aviso.info strong { color: var(--gold); }

/* ══ MODAL (hoja inferior en celular) ══ */
.modal-fondo {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fundido .18s ease;
}
@keyframes fundido { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 20px; padding: 26px; box-shadow: var(--shadow-lg);
  animation: subir .22s cubic-bezier(.16,1,.3,1);
}
.modal.ancho { max-width: 560px; }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } }
.modal-ico { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 14px; display: flex; align-items: center; justify-content: center; background: var(--gold-soft); color: var(--gold); }
.modal-ico.peligro { background: var(--red-soft); color: var(--red); }
.modal-ico svg.i { width: 24px; height: 24px; }
.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.modal-cuerpo { font-size: 0.86rem; color: var(--text-2); line-height: 1.6; margin-bottom: 18px; }
.modal-cuerpo strong { color: var(--text); }
.modal-cuerpo ul { margin: 8px 0 0 18px; }
.modal-acciones { display: flex; flex-wrap: wrap; gap: 10px; }
/* Mismo ancho para todos, pero si no caben (celular) bajan a otra fila en vez de cortarse */
.modal-acciones .btn { flex: 1 1 0; min-width: max-content; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.84rem; color: var(--text-2); cursor: pointer; margin-top: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); margin-top: 2px; flex-shrink: 0; }

/* ── Panel de notificaciones ── */
.notif-panel {
  position: fixed; top: calc(var(--topbar) - 4px); right: 20px; z-index: 70;
  width: 380px; max-width: calc(100vw - 24px); max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 14px;
  animation: subir .18s ease;
}
.notif-panel h3 { font-size: 0.9rem; font-weight: 700; padding: 2px 4px 10px; display: flex; justify-content: space-between; align-items: center; }

/* Hoja "Más" en celular */
.hoja-mas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hoja-mas button, .hoja-mas a {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px;
  border-radius: var(--radius-sm); background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.78rem; font-weight: 500; text-decoration: none; text-align: center;
}
.hoja-mas button.activo { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.hoja-mas svg.i { width: 22px; height: 22px; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  max-width: min(400px, calc(100vw - 32px));
  padding: 13px 16px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  box-shadow: var(--shadow-lg); font-size: 0.86rem; font-weight: 500;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.16,1,.3,1);
}
#toast.show { opacity: 1; transform: none; }
#toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
#toast.warn::before { background: var(--orange); }
#toast.error::before { background: var(--red); }

/* ══ RESPONSIVE ══ */
@media (max-width: 1280px) {
  .rapidos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .grid-form, .grid-venta { grid-template-columns: minmax(0, 1fr); }
  .pegajosa { position: static; }
  .kpis, .kpis.tres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.tres > :last-child { grid-column: 1 / -1; }
  /* Nómina en una columna: se ve la lista o la liquidación, no ambas */
  .nomina-grid.liquidando .col-empleados { display: none; }
  .nomina-grid:not(.liquidando) .col-liq { display: none; }
  .volver { display: inline-flex; }
}
/* Tableta: barra lateral solo con íconos */
@media (max-width: 1024px) {
  :root { --sidebar: 76px; }
  .sidebar { padding: 16px 10px; align-items: center; }
  .brand { padding: 4px 0 18px; align-items: center; }
  .brand b { font-size: 1.35rem; }
  .brand b span, .brand small { display: none; }
  .nav, .sidebar-pie { width: 100%; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-item .txt { display: none; }
  .nav-item .cuenta { position: absolute; top: 4px; right: 6px; margin: 0; min-width: 17px; height: 17px; font-size: 0.6rem; }
  .main { padding: 22px 22px 36px; }
  .topbar { padding: 0 22px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
/* Celular */
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .tipo-sel.cuatro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pedidos { grid-template-columns: minmax(0, 1fr); }
  .art-fila { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .art-fila .mueble { grid-column: 1 / 3; }
  .art-fila .tela { grid-column: 1; grid-row: 2; }
  .art-fila .precio { grid-column: 2; grid-row: 2; }
  .art-fila .mini-btn { grid-row: 1 / span 2; grid-column: 3; height: auto; }
  .hoy-card { padding: 18px; }
  .hoy-num { font-size: 2.2rem; }
  .mini-stats { gap: 8px; }
  .mini-stat { padding: 9px 9px; }
  .mini-stat b { font-size: 0.92rem; }
  .sidebar { display: none; }
  .app { margin-left: 0; padding-bottom: calc(var(--bottomnav) + env(safe-area-inset-bottom)); }
  .bottomnav { display: flex; }
  .topbar { padding: 0 16px; gap: 10px; height: 58px; }
  :root { --topbar: 58px; }
  .topbar-marca { display: block; }
  .topbar-titulo { display: none; }
  .solo-pc { display: none; }
  .topbar-acciones { margin-left: auto; }
  .main { padding: 16px 16px 28px; }
  .vista { gap: 16px; }
  .card { padding: 16px; border-radius: 14px; }
  .saludo h2 { font-size: 1.25rem; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-valor { font-size: 1.55rem; }
  .kpi-desc { white-space: normal; }
  .kpi-valor.chico { font-size: 1.15rem; }
  .kpi-ico { width: 30px; height: 30px; }
  .rapidos { gap: 10px; }
  .rapido { padding: 12px; gap: 10px; font-size: 0.8rem; }
  .rapido small { display: none; }
  .grafica { height: 210px; }
  .fila { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .fila.dos-cel { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filtros select.input { flex: 1 1 calc(50% - 8px); }
  .notif-panel { right: 12px; left: 12px; width: auto; }
  #toast { left: 16px; right: 16px; bottom: calc(var(--bottomnav) + env(safe-area-inset-bottom) + 12px); max-width: none; }

  /* Tablas → tarjetas */
  .tabla.apilable thead { display: none; }
  .tabla.apilable, .tabla.apilable tbody, .tabla.apilable tr, .tabla.apilable td { display: block; width: 100%; }
  .tabla.apilable tr { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
  .tabla.apilable td { border: none; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tabla.apilable td::before { content: attr(data-l); color: var(--text-3); font-size: 0.74rem; font-weight: 500; text-align: left; flex-shrink: 0; }
  .tabla.apilable td.sin-l::before { display: none; }
  .tabla.apilable td.sin-l { justify-content: flex-start; text-align: left; }
  .tabla.apilable .num { text-align: right; }
  .tabla.apilable td.dist { flex-direction: column; gap: 4px; text-align: left; }
  .tabla.apilable tbody tr:hover td { background: none; }

  .liq-fila { grid-template-columns: minmax(0, 1fr); }
  .liq-ctrl { justify-content: space-between; }
  .precio-wrap { flex: 1; }
  .precio-wrap input { width: 100%; }
  .total-box { bottom: calc(var(--bottomnav) + env(safe-area-inset-bottom) + 10px); }
  .total-box strong { font-size: 1.35rem; }
  .total-box .btn { width: 100%; }

  .item { padding: 11px 12px; gap: 10px; }
  .item.inv { flex-wrap: wrap; }
  .item.inv .item-cuerpo { flex-basis: calc(100% - 130px); }
  .item.inv .inv-ctrl { width: 100%; display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }

  .modal-fondo { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; animation: hoja .25s cubic-bezier(.16,1,.3,1); }
  @keyframes hoja { from { transform: translateY(100%); } }
}
@media (max-width: 380px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi-valor { font-size: 1.35rem; }
  .bottomnav button { font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Impresión de comprobantes ── */
@media print {
  body { background: #fff; color: #000; }
}
