/* ==========================================================================
   Serafin — Liquid Glass design system
   Single source of truth for the UI skin. Tokens and component classes are
   extracted 1:1 from the approved design (claude.ai/design "Serafin Sistema").
   Sections:
     1. Tokens          2. Base & reset      3. App shell (bg, sidebar, topbar)
     4. Buttons         5. Cards & panels    6. KPI cards
     7. Tables          8. Badges & chips    9. Forms & inputs
    10. Segmented tabs 11. Stepper          12. Timeline
    13. Scanner        14. Toasts           15. Modals & drawer
    16. Utilities      17. Animations       18. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* type */
  --font-sans: 'Lato', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* ink */
  --ink: #1e293b;
  --ink-2: #475569;
  --ink-3: #64748b;
  --muted: #94a3b8;
  --faint: #cbd5e1;

  /* brand */
  --primary: #2563eb;
  --primary-2: #1e40af;
  --primary-grad: linear-gradient(150deg, #2563eb, #1e40af);
  --link: #1e40af;
  --link-hover: #1e3a8a;

  /* surfaces */
  --page-bg: #dfe7f5;
  --page-grad: linear-gradient(135deg, #e6edfb 0%, #f3f7fd 46%, #e7f0fb 100%);
  --glass-bg: rgba(255, 255, 255, .5);
  --glass-bg-strong: rgba(255, 255, 255, .55);
  --glass-bd: rgba(255, 255, 255, .7);
  --glass-line: rgba(148, 163, 184, .16);
  --row-line: rgba(148, 163, 184, .1);
  --input-bd: rgba(148, 163, 184, .4);
  --input-bg: rgba(255, 255, 255, .7);

  /* effects */
  --blur-panel: blur(22px) saturate(160%);
  --blur-side: blur(26px) saturate(165%);
  --shadow-panel: 0 10px 30px rgba(30, 64, 175, .08), inset 0 1px 0 rgba(255, 255, 255, .6);
  --shadow-kpi: 0 8px 24px rgba(30, 64, 175, .07), inset 0 1px 0 rgba(255, 255, 255, .6);
  --shadow-primary: 0 6px 16px rgba(37, 99, 235, .3);
  --radius-panel: 18px;
  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-input: 12px;

  /* estado colors (caja lifecycle) */
  --st-bodega: #16a34a;
  --st-pabellon: #64748b;
  --st-recepcion: #2563eb;
  --st-lavado: #0ea5e9;
  --st-armado: #d97706;
  --st-esterilizacion: #0d9488;
  --st-reparacion: #dc2626;
  --st-disponible: #16a34a;
  --st-no-utilizable: #94a3b8;

  /* movement/type tones */
  --tone-salida: #2563eb;
  --tone-recepcion: #0d9488;
  --tone-transicion: #7c3aed;
  --tone-revision: #d97706;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #0ea5e9;

  /* layout */
  --sidebar-w: 250px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 62px;
}

/* 2. Base & reset ----------------------------------------------------------- */
* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .3); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

html, body { margin: 0; min-height: 100%; }
body {
  background: var(--page-bg);
  font-family: var(--font-sans);
  color: var(--ink);
  font-size: 14px;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
input, button, select, textarea { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
.mono { font-family: var(--font-mono); }

/* 3. App shell --------------------------------------------------------------- */
.app-bg {
  position: relative;
  min-height: 100vh;
  /* `clip` y NO `hidden`. Los dos recortan igual los blobs de ::before/::after, pero
     `hidden` deja un contenedor SCROLLEABLE: el código puede scrollearlo y el usuario no
     puede devolverlo con el mouse. Al saltar a un #fragmento el navegador scrollea todos
     los ancestros scrolleables, así que con `hidden` el salto a #cajas empujaba el shell
     hacia arriba y se llevaba puestos el topbar y la marca del sidebar, de forma
     permanente hasta recargar. Medido: hidden -> scrollTop queda en 62.4; clip -> 0. */
  overflow: clip;
  background: var(--page-grad);
}
/* blurred color blobs behind the glass */
.app-bg::before, .app-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(50px);
}
.app-bg::before {
  width: 560px; height: 560px; top: -160px; left: 200px;
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  opacity: .16;
}
.app-bg::after {
  width: 480px; height: 480px; bottom: -140px; right: -60px;
  background: radial-gradient(circle, #14b8a6 0%, transparent 70%);
  opacity: .14;
}
.app-frame { position: relative; z-index: 1; display: flex; height: 100vh; }

/* sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  transition: width .2s ease, transform .25s ease;
  overflow: hidden;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--blur-side);
  -webkit-backdrop-filter: var(--blur-side);
  border-right: 1px solid rgba(255, 255, 255, .6);
}
.sidebar.is-collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 18px; }
.brand-logo {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  background: var(--primary-grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .32), inset 0 1px 0 rgba(255, 255, 255, .4);
}
/* Variante con el isotipo oficial en vez de un icono. El re-skin de julio dejo
   un matraz generico como marca — no era el logo de Serafin. Cuando el tile
   lleva la imagen, el degradado azul y su sombra de color sobran: la pieza trae
   su propio campo crema y compite con el fondo. */
.brand-logo--img {
  background: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .16);
  overflow: hidden;
}
.brand-logo--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-name { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.3px; color: var(--ink); }
.brand-sub { display: block; font-size: 11px; color: var(--ink-3); }

.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 12px; }
.nav-section {
  display: flex; align-items: center; gap: 7px;
  width: 100%; text-align: left;
  padding: 13px 10px 7px 18px;
  border: none; background: transparent; cursor: pointer;
  font: 700 11px var(--font-sans);
  color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 1.1px;
}
.nav-section svg { transition: transform .18s; }
.nav-section.is-closed svg { transform: rotate(-90deg); }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  padding: 9px 11px; margin-bottom: 2px;
  border-radius: 10px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 400;
  background: transparent; color: var(--ink);
}
.nav-item svg, .nav-item .nav-ico { color: var(--muted); flex: none; display: flex; }
.nav-item:hover { background: rgba(255, 255, 255, .5); color: var(--ink); }
.nav-item.is-active { background: rgba(37, 99, 235, .12); color: var(--primary-2); font-weight: 700; }
.nav-item.is-active svg, .nav-item.is-active .nav-ico { color: var(--primary); }
.sidebar.is-collapsed .nav-item {
  justify-content: center; height: 44px; margin-bottom: 5px; border-radius: 12px; padding: 0;
}
.sidebar.is-collapsed .nav-item span.nav-label,
.sidebar.is-collapsed .nav-section,
.sidebar.is-collapsed .brand-text,
.sidebar.is-collapsed .user-info,
.sidebar.is-collapsed .user-chevron { display: none; }
/* The collapsed rail renders the design's FLAT icon list: section headers are
   hidden above, so a section closed via its toggle (persisted state) would
   become unreachable. Force bodies open on desktop; the mobile drawer keeps
   its toggles because it always shows the headers. */
@media (min-width: 901px) {
  .sidebar.is-collapsed [data-lg-section-body] { display: block !important; }
}

.sidebar-footer { flex: none; position: relative; border-top: 1px solid rgba(255, 255, 255, .6); padding: 12px 14px; }
.user-button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 0; border: none; background: transparent; cursor: pointer; }
.avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-name { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.user-role { display: block; font-size: 11.5px; color: var(--ink-3); }

/* role switcher popover */
.role-menu {
  position: absolute; bottom: 100%; left: 12px; right: 12px;
  margin-bottom: 8px; padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 14px 34px rgba(30, 64, 175, .16);
  animation: sf-up .18s ease;
  z-index: 30;
}
.role-menu-title {
  font: 700 10px var(--font-sans); color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 8px 10px 6px;
}
.role-option {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; padding: 9px 10px;
  border-radius: 9px; border: none; cursor: pointer;
  font-size: 13px; background: transparent; color: var(--ink);
}
.role-option:hover { background: rgba(37, 99, 235, .06); }
.role-option.is-active { background: rgba(37, 99, 235, .1); font-weight: 700; }

/* main column */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  flex: none; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .45);
  backdrop-filter: var(--blur-panel);
  -webkit-backdrop-filter: var(--blur-panel);
  border-bottom: 1px solid rgba(255, 255, 255, .55);
  /* SS-05: el backdrop-filter de arriba crea un stacking context propio. Sin z-index,
     el topbar entero (y con el su popover de ubicacion, .role-menu z-index:30) queda
     por debajo de <main>, que viene despues en el DOM => las cards del contenido
     tapaban el desplegable. Escala vigente: tabbar 20 · role-menu 30 · [topbar 40] ·
     modal 60 · drawer 70 · sidebar movil 75 · toast 90. */
  position: relative;
  z-index: 40;
}
.topbar-search {
  flex: 1; max-width: 400px;
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 15px;
  border-radius: 12px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-bd);
  color: var(--muted); font-size: 13.5px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
}
.topbar-search input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-size: 13.5px; color: var(--ink);
}
.main-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 30px 40px; }
/* Destino de los filtros (?filter=, ?modalidad=, el buscador del panel admin). Cada filtro
   es una navegación completa, así que sin ancla el navegador deja la página arriba de todo
   y hay que scrollear de nuevo hasta la tabla.
   El scroll de esta app NO ocurre en el body sino acá dentro, en .main-scroll: un fix que
   guarde y restaure window.scrollY leería siempre 0 y no haría nada.
   El margen replica el padding-top del contenedor para que el panel no quede pegado al
   borde superior al aterrizar. */
[id="cajas"] { scroll-margin-top: 24px; }

/* page heading */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.page-actions { display: flex; gap: 10px; flex: none; }

/* 3b. Mobile chrome ------------------------------------------------------------ */
/* Brand block shown inside the topbar on small screens (design: mobile header). */
.topbar-brand { display: none; align-items: center; gap: 11px; min-width: 0; }
.topbar-brand .brand-logo { width: 36px; height: 36px; border-radius: 11px; }
.topbar-brand .brand-name { font-size: 17px; }
.only-mobile { display: none !important; }

/* Bottom tab bar (design: mobile quick actions). Hidden on desktop. */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  gap: 2px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  border-top: 1px solid rgba(255, 255, 255, .6);
  padding: 8px 8px 12px;
}
.tabbar-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 2px;
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; text-decoration: none;
}
.tabbar-ico {
  display: flex; align-items: center; justify-content: center;
  width: 54px; height: 32px; border-radius: 11px;
  color: var(--ink-3);
}
.tabbar-label { font-size: 10.5px; color: var(--ink-3); font-weight: 400; }
.tabbar-item.is-active .tabbar-ico { background: rgba(37, 99, 235, .12); color: var(--primary-2); }
.tabbar-item.is-active .tabbar-label { color: var(--primary-2); font-weight: 700; }

/* 4. Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px;
  border-radius: var(--radius-btn);
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; border: none;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary-grad);
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-glass {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-bd);
  color: var(--primary-2);
}
.btn-glass:hover { background: rgba(255, 255, 255, .75); color: var(--primary-2); }
.btn-outline {
  background: var(--glass-bg);
  border: 1px solid var(--input-bd);
  color: var(--ink-2);
}
.btn-outline:hover { background: rgba(255, 255, 255, .7); color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 400; }
.btn-ghost:hover { color: var(--ink-2); }
.btn-danger { background: linear-gradient(150deg, #ef4444, #b91c1c); color: #fff; box-shadow: 0 6px 16px rgba(220, 38, 38, .3); }
.btn-danger:hover { color: #fff; filter: brightness(1.06); }
.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* square icon button (topbar, headers) */
.icon-btn {
  width: 40px; height: 40px; flex: none;
  border-radius: 11px;
  border: 1px solid var(--glass-bd);
  background: var(--glass-bg);
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
}
.icon-btn:hover { background: rgba(255, 255, 255, .75); color: var(--ink-2); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 1.5px solid #fff;
}

/* 5. Cards & panels ------------------------------------------------------------ */
.panel {
  border-radius: var(--radius-panel);
  background: var(--glass-bg);
  backdrop-filter: var(--blur-panel);
  -webkit-backdrop-filter: var(--blur-panel);
  border: 1px solid var(--glass-bd);
  box-shadow: var(--shadow-panel);
}
.panel-strong { background: var(--glass-bg-strong); }
.panel-pad { padding: 22px; }
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--glass-line);
}
.panel-title { font-size: 15px; font-weight: 700; }
.panel-sub { font-size: 12.5px; color: var(--ink-3); }
.panel-foot-btn {
  width: 100%; padding: 13px;
  border: none; border-top: 1px solid rgba(148, 163, 184, .12);
  background: transparent; color: var(--primary-2);
  font-family: inherit; font-weight: 700; font-size: 13.5px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
/* inner card (solid-ish, used inside panels) */
.subcard {
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 14px;
  padding: 18px;
  background: var(--glass-bg);
}
/* empty state */
.empty-state { border-radius: var(--radius-panel); padding: 70px 20px; text-align: center; background: rgba(255, 255, 255, .45); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, .6); }
.empty-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: rgba(37, 99, 235, .1);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; color: var(--primary);
}
.empty-title { font-size: 16px; font-weight: 700; }
.empty-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 6px; }

/* 6. KPI cards ------------------------------------------------------------------ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi {
  width: 100%; text-align: left; font-family: inherit; cursor: pointer;
  border-radius: var(--radius-card);
  padding: 16px 18px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-bd);
  box-shadow: var(--shadow-kpi);
  color: var(--ink);
  text-decoration: none;
  display: block;
}
.kpi:hover { border-color: rgba(37, 99, 235, .4); box-shadow: 0 10px 28px rgba(30, 64, 175, .16); color: var(--ink); }
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-label { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.kpi-value { font-size: 32px; font-weight: 300; margin-top: 8px; letter-spacing: -1px; }

/* 7. Tables ----------------------------------------------------------------------- */
.glass-table { width: 100%; border-collapse: collapse; }
.glass-table thead th {
  padding: 10px 20px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
  white-space: nowrap;
}
.glass-table tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--row-line);
  font-size: 14px; color: var(--ink);
  vertical-align: middle;
}
.glass-table tbody tr:last-child td { border-bottom: none; }
.glass-table tbody tr { transition: background .12s; }
.glass-table tbody tr:hover { background: rgba(255, 255, 255, .5); }
.glass-table tbody tr.is-clickable { cursor: pointer; }
.cell-main { display: block; font-size: 14px; color: var(--ink); }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }
.cell-mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); }
.table-scroll { overflow-x: auto; }

/* 8. Badges & chips ----------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}
.badge .badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* estado variants: color + 10% background of the same color */
.badge-bodega, .badge-disponible { color: var(--st-bodega); background: rgba(22, 163, 74, .1); }
.badge-pabellon { color: var(--st-pabellon); background: rgba(100, 116, 139, .1); }
.badge-recepcion { color: var(--st-recepcion); background: rgba(37, 99, 235, .1); }
.badge-lavado { color: var(--st-lavado); background: rgba(14, 165, 233, .1); }
.badge-armado { color: var(--st-armado); background: rgba(217, 119, 6, .1); }
.badge-esterilizacion { color: var(--st-esterilizacion); background: rgba(13, 148, 136, .12); }
.badge-reparacion { color: var(--st-reparacion); background: rgba(220, 38, 38, .1); }
.badge-no-utilizable { color: var(--st-no-utilizable); background: rgba(148, 163, 184, .14); }
/* movement tones */
.badge-salida { color: var(--tone-salida); background: rgba(37, 99, 235, .1); }
.badge-transicion { color: var(--tone-transicion); background: rgba(124, 58, 237, .1); }
.badge-revision { color: var(--tone-revision); background: rgba(217, 119, 6, .12); }
/* generic semantic */
.badge-ok { color: var(--ok); background: rgba(22, 163, 74, .1); }
.badge-warn { color: var(--warn); background: rgba(217, 119, 6, .12); }
.badge-danger { color: var(--danger); background: rgba(220, 38, 38, .1); }
.badge-info { color: var(--info); background: rgba(14, 165, 233, .1); }
.badge-neutral { color: var(--ink-3); background: rgba(100, 116, 139, .1); }

/* filter chips */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border-radius: 10px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 400;
  border: 1px solid rgba(148, 163, 184, .3);
  background: var(--glass-bg);
  color: var(--ink-2);
  text-decoration: none;
}
.chip:hover { background: rgba(255, 255, 255, .7); color: var(--ink-2); }
.chip.is-active {
  border-color: rgba(37, 99, 235, .3);
  background: rgba(37, 99, 235, .12);
  color: var(--primary-2); font-weight: 700;
}
.chip .chip-count { color: var(--muted); font-weight: 400; }
.chip.is-active .chip-count { color: var(--primary-2); }

/* 9. Forms & inputs ------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.input, .select, .textarea {
  width: 100%; height: 48px;
  border-radius: var(--radius-input);
  border: 1px solid var(--input-bd);
  background: var(--input-bg);
  font-size: 15px; color: var(--ink);
  padding: 0 16px; outline: none;
}
.textarea { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input-mono { font-family: var(--font-mono); font-size: 16px; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.field-help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: 6px; font-weight: 700; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: rgba(220, 38, 38, .55); }

/* checkbox row (instrument checklist) */
.check-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  text-align: left; padding: 12px 14px;
  border-radius: 12px; cursor: pointer; font-family: inherit;
  border: 1px solid rgba(148, 163, 184, .25);
  background: var(--glass-bg);
  color: var(--ink);
}
.check-row.is-checked { border-color: rgba(37, 99, 235, .35); background: rgba(37, 99, 235, .09); }
.check-box {
  width: 26px; height: 26px; flex: none;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--faint);
  background: rgba(255, 255, 255, .6);
  color: transparent;
}
.check-row.is-checked .check-box { border-color: var(--primary); background: var(--primary); color: #fff; }
.check-name { flex: 1; font-size: 14px; }
.check-qty { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* info alert strip */
.alert {
  padding: 13px 16px; border-radius: 12px;
  font-size: 13.5px;
  display: flex; gap: 10px; align-items: center;
}
.alert-info { background: rgba(37, 99, 235, .1); color: var(--primary-2); }
.alert-ok { background: rgba(22, 163, 74, .12); color: #15803d; }
.alert-warn { background: rgba(217, 119, 6, .12); color: #b45309; }
.alert-danger { background: rgba(220, 38, 38, .1); color: #b91c1c; }

/* key/value summary (confirm step) */
.kv-list { border: 1px solid rgba(148, 163, 184, .25); border-radius: 14px; overflow: hidden; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--glass-line); }
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--ink-3); font-size: 13.5px; }
.kv-val { color: var(--ink); font-size: 14px; text-align: right; }
.kv-val.mono { font-family: var(--font-mono); font-size: 13.5px; }

/* 10. Segmented tabs --------------------------------------------------------------------- */
.seg { display: flex; gap: 6px; padding: 5px; background: rgba(148, 163, 184, .14); border-radius: 12px; }
.seg-btn {
  flex: 1; height: 42px;
  border-radius: 9px; border: none; cursor: pointer;
  font-size: 14px; font-family: inherit;
  background: transparent; color: var(--ink-3); font-weight: 400;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.seg-btn:hover { color: var(--ink-2); }
.seg-btn.is-active {
  background: rgba(255, 255, 255, .9);
  color: var(--primary-2); font-weight: 700;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
}
.seg-compact .seg-btn { flex: none; height: 38px; padding: 0 16px; font-size: 13.5px; }

/* 11. Stepper ------------------------------------------------------------------------------ */
.stepper { display: flex; align-items: center; margin-bottom: 20px; }
.step { display: flex; align-items: center; }
.step:not(:last-child) { flex: 1; }
.step-node { display: flex; flex-direction: column; align-items: center; gap: 7px; flex: none; }
.step-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  border: 1px solid var(--faint);
  background: rgba(255, 255, 255, .6);
  color: var(--muted);
}
.step.is-done .step-dot, .step.is-active .step-dot {
  border-color: var(--primary); background: var(--primary); color: #fff;
}
.step.is-active .step-dot { box-shadow: 0 4px 12px rgba(37, 99, 235, .3); }
.step-label { font-size: 12px; white-space: nowrap; color: var(--muted); font-weight: 400; }
.step.is-active .step-label { color: var(--ink); font-weight: 700; }
.step.is-done .step-label { color: var(--primary-2); }
.step-line { flex: 1; height: 2px; margin: 0 6px 22px; background: #e2e8f0; }
.step.is-done .step-line { background: var(--primary); }

/* mobile progress bar variant */
.progress-track { height: 6px; border-radius: 3px; background: rgba(148, 163, 184, .25); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #1e40af); border-radius: 3px; transition: width .3s; }

/* 12. Timeline ------------------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 15px; }
.tl-rail { flex: none; width: 22px; display: flex; justify-content: center; position: relative; }
.tl-dot {
  width: 18px; height: 18px; border-radius: 50%; z-index: 1;
  border: 3px solid var(--faint); background: #fff;
}
.tl-item.is-done .tl-dot { border-color: var(--tl-color, var(--primary)); background: var(--tl-color, var(--primary)); }
.tl-item.is-current .tl-dot {
  border-color: var(--tl-color, var(--primary)); background: var(--tl-color, var(--primary));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tl-color, var(--primary)) 15%, transparent);
}
.tl-line { position: absolute; top: 18px; bottom: -4px; left: 10px; width: 2px; background: #e2e8f0; }
.tl-item.is-done .tl-line { background: var(--tl-color, var(--primary)); }
.tl-body { flex: 1; padding-bottom: 22px; }
.tl-item:last-child .tl-body { padding-bottom: 0; }
.tl-title { font-size: 15px; color: var(--muted); font-weight: 400; }
.tl-item.is-done .tl-title { color: var(--ink); }
.tl-item.is-current .tl-title { color: var(--ink); font-weight: 700; }
.tl-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tl-ts { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* 13. Scanner -------------------------------------------------------------------------------- */
.scan-area {
  position: relative; width: 100%; aspect-ratio: 16/10;
  border: none; border-radius: 14px; overflow: hidden; cursor: pointer;
  background: repeating-linear-gradient(45deg, rgba(226, 232, 240, .6), rgba(226, 232, 240, .6) 11px, rgba(203, 213, 225, .55) 11px, rgba(203, 213, 225, .55) 22px);
  display: flex; align-items: center; justify-content: center;
}
.scan-area video, .scan-area canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* html5-qrcode mounts a host div with inline position:relative and no height,
   which collapses the absolute video to 0px. Stretch the host to the full
   scan area (author !important beats the library's inline style) so the
   video's height:100% resolves against real pixels. */
.scan-area .qr-reader-host { position: absolute !important; inset: 0; }
.scan-frame { position: absolute; inset: 34px; border-radius: 12px; pointer-events: none; z-index: 2; }
.scan-corner { position: absolute; width: 28px; height: 28px; border: 0 solid var(--primary); }
.scan-corner.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 10px; }
.scan-corner.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 10px; }
.scan-corner.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 10px; }
.scan-corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 10px; }
.scan-line {
  position: absolute; left: 6px; right: 6px; top: 4px; height: 3px;
  border-radius: 2px; background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
  animation: sf-scan 1.9s ease-in-out infinite;
}
.scan-hint { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.5; position: relative; z-index: 1; }

/* 14. Toasts ------------------------------------------------------------------------------------ */
.toast-region { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: rgba(15, 23, 42, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 14px 20px; border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .3);
  animation: sf-up .25s ease;
  display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 560px);
}
.toast svg { flex: none; }
.toast .t-ok { color: #4ade80; }
.toast .t-warn { color: #fbbf24; }
.toast .t-err { color: #f87171; }
.toast.is-hiding { opacity: 0; transition: opacity .4s; }

/* 15. Modals & drawer ----------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, .4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: sf-fade .2s ease;
}
.modal {
  width: 100%; max-width: 560px; max-height: 86vh;
  display: flex; flex-direction: column;
  border-radius: 18px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 24px 80px rgba(15, 23, 42, .25);
  animation: sf-pop .22s ease;
  overflow: hidden;
}
.modal-lg { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--glass-line); }
.modal-title { flex: 1; font-size: 17px; font-weight: 700; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--glass-line); }

/* mobile drawer */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(15, 23, 42, .4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: sf-fade .2s ease;
}
.drawer {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 85%; max-width: 315px;
  display: flex; flex-direction: column;
  animation: sf-slide .26s cubic-bezier(.2, .8, .2, 1);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  border-right: 1px solid var(--glass-bd);
  box-shadow: 20px 0 60px rgba(15, 23, 42, .2);
}

/* 15a. Legacy-JS toast compat ---------------------------------------------------------------------------
   workflow_manager.js (shared, not yet migrated) injects DaisyUI-era classes
   into #toast-container: "alert alert-{error|success|warning|info} text-white
   shadow-lg", fading out via .opacity-0. Keep those toasts visible and
   state-colored until that script moves to the design system. */
.toast-region .alert {
  padding: 14px 20px;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .3);
  display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 560px);
  animation: sf-up .25s ease;
  transition: opacity .3s;
}
.toast-region .alert-info { background: rgba(37, 99, 235, .95); color: #fff; }
.toast-region .alert-success { background: rgba(22, 163, 74, .95); color: #fff; }
.toast-region .alert-warning { background: rgba(217, 119, 6, .95); color: #fff; }
.toast-region .alert-error { background: rgba(220, 38, 38, .95); color: #fff; }
.text-white { color: #fff; }
.opacity-0 { opacity: 0; }

/* 15b. Native <dialog> integration --------------------------------------------------------------------
   Pages using showModal()/close() wrap the glass .modal in a <dialog>. Both
   conventions used across templates are supported here:
     <dialog class="modal">…            (dialog IS the glass card)
     <dialog class="lg-dialog"><div class="modal">… (dialog is a transparent host)
   The :not([open]) guard matters: .modal's display:flex would otherwise
   override the UA's hidden state for closed dialogs. */
dialog.modal, dialog.lg-dialog { margin: auto; border: none; padding: 0; }
dialog.lg-dialog { background: transparent; width: min(92vw, 600px); }
dialog.lg-dialog .modal { max-width: none; width: 100%; }
dialog.lg-dialog.lg-dialog-wide { width: min(94vw, 900px); }
dialog.modal:not([open]), dialog.lg-dialog:not([open]) { display: none; }
dialog.modal::backdrop, dialog.lg-dialog::backdrop {
  background: rgba(15, 23, 42, .4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* 15c. Shared primitives (promoted from per-page TODO(lg) blocks) -------------------------------------- */
/* Layout primitives promoted from per-page blocks so their mobile behavior
   lives in one place (page-level copies would win the cascade and keep
   multi-column layouts wide on phones). */
.kpi-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.panel-body { padding: 18px 20px; }
.check-scroll {
  max-height: 150px; overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, .25); border-radius: 12px;
  padding: 8px 12px; background: var(--glass-bg);
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px;
}
/* Two-up panel row (e.g. admin "crear usuario" + "descargar QR"). */
.panel-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
/* JS visibility hook kept for scripts that toggle the legacy token. */
.hidden { display: none !important; }
/* Spinner: attach .lg-spin to any inline SVG/element to rotate it. */
@keyframes lg-spin { to { transform: rotate(360deg); } }
.lg-spin { animation: lg-spin .8s linear infinite; }
.lg-spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: lg-spin .6s linear infinite; vertical-align: -2px;
}
/* Native checkbox/radio tinted to the brand. */
.lg-check { width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.radio-input { width: 18px; height: 18px; flex: none; margin: 2px 0 0; accent-color: var(--primary); }
/* Simple content grids used by form/detail pages. */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
/* KPI card that is informative only (no hover affordance, not a link). */
.kpi.is-static { cursor: default; }
.kpi.is-static:hover { border-color: var(--glass-bd); box-shadow: var(--shadow-kpi); }
/* Movement-type tone for RECEPCION (the estado class .badge-recepcion is taken
   by the caja lifecycle state, which uses a different color). */
.badge-mov-recepcion { color: var(--tone-recepcion); background: rgba(13, 148, 136, .12); }
/* Native file input (photo evidence). Promoted from detalle_caja.html: the incident
   component `_incidente_inline.html` is mounted by the caja detail modal, the Recepcion
   station and the pabellon close screen, so the skin cannot stay page-local. */
.input-file { display: block; width: 100%; font-size: 13.5px; color: var(--ink-2); }
.input-file::file-selector-button {
  margin-right: 12px; height: 36px; padding: 0 14px; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--input-bd);
  background: var(--glass-bg-strong); color: var(--primary-2);
  font-family: inherit; font-size: 13px; font-weight: 700;
}

/* 16. Utilities ------------------------------------------------------------------------------------ */
.u-flex { display: flex; }
.u-center { align-items: center; }
.u-between { justify-content: space-between; }
.u-gap-8 { gap: 8px; }
.u-gap-10 { gap: 10px; }
.u-gap-12 { gap: 12px; }
.u-grow { flex: 1; }
.u-muted { color: var(--muted); }
.u-ink2 { color: var(--ink-2); }
.u-ink3 { color: var(--ink-3); }
.u-mb-0 { margin-bottom: 0; }
.u-mb-12 { margin-bottom: 12px; }
.u-mb-18 { margin-bottom: 18px; }
.u-mb-20 { margin-bottom: 20px; }
.u-mt-12 { margin-top: 12px; }
.u-mt-16 { margin-top: 16px; }
.u-mt-22 { margin-top: 22px; }
.u-right { text-align: right; }
.u-hide { display: none !important; }
.u-w-narrow { max-width: 780px; }
.u-w-mid { max-width: 880px; }
.u-w-wide { max-width: 1020px; }
.section-label {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  margin: 24px 0 10px;
}

/* Armador de instrumentos del modal "Nueva caja" (FIX-2026-07-30).
   En escritorio los campos van en una fila; en tablet/móvil se apilan para que
   el nombre no quede en 4 caracteres de ancho. */
.lg-inst-row { display: flex; gap: 8px; align-items: center; }
.lg-inst-row .input { height: 38px; font-size: 13.5px; }
.lg-inst-row #new-caja-inst-numero-serie { max-width: 170px; }
.lg-inst-row .select { height: 38px; font-size: 13.5px; max-width: 150px; }
.lg-inst-row .btn { height: 38px; flex: none; }
.lg-staged-inst {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 10px; background: var(--glass-bg);
}
@media (max-width: 900px) {
  .lg-inst-row { flex-wrap: wrap; }
  .lg-inst-row .input,
  .lg-inst-row #new-caja-inst-numero-serie,
  .lg-inst-row .select { max-width: none; width: 100%; }
  .lg-inst-row .btn { width: 100%; }
}

/* 17. Animations ------------------------------------------------------------------------------------ */
@keyframes sf-scan { 0% { transform: translateY(0); opacity: .4; } 50% { opacity: 1; } 100% { transform: translateY(150px); opacity: .4; } }
@keyframes sf-pop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes sf-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sf-slide { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes sf-fade { from { opacity: 0; } to { opacity: 1; } }

/* 18. Responsive -------------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  /* --- Layout primitives collapse to one column ------------------------- */
  .kpi-grid-3, .form-grid-2, .check-scroll, .panel-row-2 { grid-template-columns: 1fr; }
  .check-scroll { max-height: 210px; }
  .panel-body { padding: 16px; }

  /* --- Mobile header: brand + actions must never collide ----------------
     412px only fits so much, so the back control drops its label and the
     location chip shrinks to its icon; the brand truncates instead of
     pushing siblings off-screen. */
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar-brand { min-width: 0; flex: 1; overflow: hidden; }
  .topbar-brand .brand-name,
  .topbar-brand .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  [data-lg-back] {
    flex: none; width: 42px; padding: 0 !important;
    justify-content: center; gap: 0; overflow: hidden;
  }
  [data-lg-back] .btn-label { display: none; }
  /* The location switcher collapses to its pin icon; the name stays available
     in the popover it opens (and in the drawer footer). */
  .topbar .chip { flex: none; width: 42px; height: 42px; padding: 0; gap: 0; justify-content: center; border-radius: 11px; }
  .topbar .chip .chip-label,
  .topbar .chip .chip-caret { display: none; }
  .topbar [data-lg-location-menu] { max-width: 78vw; }

  /* --- Segmented tab bars scroll instead of clipping -------------------- */
  .seg {
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .seg::-webkit-scrollbar { display: none; }
  .seg-btn { flex: 0 0 auto; padding: 0 14px; scroll-snap-align: start; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 75;
    width: 85% !important; max-width: 315px;
    transform: translateX(-100%);
    background: rgba(255, 255, 255, .85);
    box-shadow: 20px 0 60px rgba(15, 23, 42, .2);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-collapsed { width: 85% !important; }
  .sidebar.is-collapsed .nav-item { justify-content: flex-start; height: auto; padding: 11px 10px; }
  .sidebar.is-collapsed .nav-item span.nav-label,
  .sidebar.is-collapsed .nav-section,
  .sidebar.is-collapsed .brand-text,
  .sidebar.is-collapsed .user-info,
  .sidebar.is-collapsed .user-chevron { display: block; }
  /* Mobile header: brand + hamburger (design), desktop toggle/avatar hidden. */
  .topbar-brand { display: flex; }
  .only-mobile { display: inline-flex !important; }
  .only-desktop { display: none !important; }
  .tabbar { display: flex; }
  /* Leave room for the fixed tab bar (its height plus breathing space, and
     the home-indicator inset on iOS). */
  .main-scroll { padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  /* Floating helpers must clear the tab bar. */
  .lg-fab { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  /* --- Touch targets: staff often work with gloves on ------------------- */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .icon-btn { width: 42px; height: 42px; }
  .lg-check, .radio-input, .check-native, .lg-checkbox { width: 24px; height: 24px; }
  .chip { min-height: 38px; }
  /* Whole card rows are tappable, so their inner links get a real hit area. */
  .glass-table tbody td .cell-main { display: block; padding: 10px 0; }
  /* Same for links used as list-row labels (e.g. instrument lists). */
  .glass-table tbody td > a.u-flex { padding: 9px 0; }

  /* --- Legibility: 10-11px is too small at arm's length ----------------- */
  .tabbar-label { font-size: 11.5px; }
  .role-menu-title { font-size: 11.5px; }
  .brand-sub { font-size: 11.5px; }
  .cell-sub, .panel-sub, .field-help { font-size: 12.5px; }
  .glass-table thead th { font-size: 11.5px; }
  .badge { font-size: 12px; }
  .breadcrumb { font-size: 12.5px; }
  .page-head { flex-direction: column; }
  .page-actions { flex-wrap: wrap; }
  .page-title { font-size: 22px; }
  .topbar-search { display: none; }
  .kv-row { gap: 10px; }
  .stepper .step-label { display: none; }
}
@media (max-width: 620px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 26px; }
  .btn { height: 44px; }
  /* Tables become stacked glass cards (design: mobile list cards).
     .m-hide drops secondary cells; .m-right pushes a cell to the row end. */
  .glass-table thead { display: none; }
  .glass-table, .glass-table tbody { display: block; }
  .glass-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--row-line);
  }
  .glass-table tbody td { display: block; border: none; padding: 0; }
  .glass-table td.m-hide, .glass-table th.m-hide { display: none; }
  .glass-table td.m-right { margin-left: auto; }
  .glass-table td.m-full { flex: 1 1 100%; }
}
