/* ═══════════════════════════════════════════════════════════
   SISTEMA DE DISEÑO — Inventario y Facturación
   Paleta profesional ERP · Tablas · Híbrido escritorio/móvil
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Tokens ──────────────────────────────────────────── */
:root {
  /* superficies */
  --bg:        #f4f6fa;
  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text:      #0f172a;
  --text-2:    #334155;
  --muted:     #64748b;
  --line:      #e2e8f0;
  --line-soft: #eef2f7;

  /* acento */
  --accent:       #2563eb;
  --accent-dark:  #1d4ed8;
  --accent-light: #eff6ff;
  --accent-mid:   #bfdbfe;

  /* semánticos */
  --green:    #15803d;
  --green-lt: #f0fdf4;
  --green-bd: #bbf7d0;
  --amber:    #b45309;
  --amber-lt: #fffbeb;
  --amber-bd: #fde68a;
  --red:      #dc2626;
  --red-lt:   #fef2f2;
  --red-bd:   #fecaca;

  /* sidebar */
  --sb-bg:         #0f172a;
  --sb-bg-2:       #1e293b;
  --sb-text:       #cbd5e1;
  --sb-muted:      #64748b;
  --sb-hover:      rgba(148,163,184,0.09);
  --sb-active-bg:  rgba(37,99,235,0.18);
  --sb-active-txt: #93c5fd;
  --sb-border:     rgba(148,163,184,0.12);
  --sb-width:      236px;

  /* elevación */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 4px 10px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 28px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.06);
  --shadow-modal: 0 24px 64px rgba(15,23,42,0.25);

  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --touch: 44px;

  --ease:   cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px;  font-size: 26px; line-height: 1.15; letter-spacing: -0.5px; font-weight: 800; }
h2 { margin-bottom: 0;    font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
h3 { margin-bottom: 14px; font-size: 14px; font-weight: 700; letter-spacing: -0.1px; }

.hidden { display: none !important; }

/* ─── Auth (login) ────────────────────────────────────── */
.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 900px 500px at 85% -10%, rgba(37,99,235,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 700px 500px at 0% 110%, rgba(37,99,235,0.12) 0%, transparent 55%),
    linear-gradient(160deg, #0b1120 0%, #0f172a 55%, #111c34 100%);
}

.auth-panel {
  width: min(720px, 100%);
  padding: 32px 28px;
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

@media (min-width: 600px) {
  .auth-panel { padding: 40px 44px; }
}

/* ─── Tipografía utilitaria ───────────────────────────── */
.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

/* ─── Tabs (auth) ─────────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 22px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
}

.tab {
  min-height: 40px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  transition: all 140ms var(--ease);
}
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-weight: 700;
}

/* ─── Formularios ─────────────────────────────────────── */
.form label {
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

input, select {
  width: 100%;
  min-height: var(--touch);
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
  appearance: auto;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.13);
}
input::placeholder { color: #94a3b8; }

.check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
  min-height: 36px;
}
.check input { width: 17px; min-height: 17px; flex-shrink: 0; accent-color: var(--accent); }

.stack { display: grid; gap: 16px; }
.grid  { display: grid; gap: 12px; }
.grid.two   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ─── Botones ─────────────────────────────────────────── */
.primary, .secondary, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--touch);
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 140ms var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37,99,235,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}
.primary:hover  { background: var(--accent-dark); box-shadow: 0 3px 10px rgba(37,99,235,0.35); }
.primary:active { transform: scale(0.98); }

.secondary {
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
}
.secondary:hover  { border-color: #cbd5e1; background: var(--surface-2); color: var(--text); }
.secondary:active { transform: scale(0.98); }

.ghost {
  border: 1.5px solid transparent;
  color: var(--muted);
}
.ghost:hover  { background: var(--surface-3); color: var(--text); }
.ghost:active { transform: scale(0.98); }

/* quick logins */
.quick-logins {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}
.quick-logins .secondary {
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
  min-height: 58px;
  padding: 10px 13px;
}
.quick-logins span { color: var(--muted); font-size: 12px; font-weight: 500; }

/* ─── App shell ───────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sb-width) 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  box-shadow: 1px 0 0 rgba(148,163,184,0.08);
  overflow: hidden;
  z-index: 30;
}

/* overlay para drawer móvil */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(2px);
}

/* ─── Sidebar brand ───────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 16px 16px;
  box-shadow: 0 1px 0 var(--sb-border);
  flex-shrink: 0;
}
.brand strong {
  display: block;
  color: #f1f5f9;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.3;
}
.brand span:not(.mark) {
  display: block;
  margin-top: 2px;
  color: var(--sb-muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 145px;
}

.mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18), 0 3px 10px rgba(29,78,216,0.5);
}
.mark svg { width: 19px; height: 19px; }

/* ─── Nav ─────────────────────────────────────────────── */
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.15) transparent;
}
.nav::-webkit-scrollbar { width: 3px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.15); border-radius: 2px; }

.nav-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 5px;
  color: var(--sb-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.nav-group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sb-border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 37px;
  padding: 0 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  border: none;
  transition: all 130ms var(--ease);
  opacity: 0.72;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  overflow: visible;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}
.nav-item .nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 130ms var(--ease), color 130ms var(--ease);
}
.nav-item:hover { background: var(--sb-hover); opacity: 0.95; }
.nav-item:hover .nav-icon { opacity: 0.95; }
.nav-item.active {
  background: var(--sb-active-bg);
  color: var(--sb-active-txt);
  font-weight: 600;
  opacity: 1;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item.active .nav-icon { opacity: 1; color: #60a5fa; }
.nav-item.home-link {
  opacity: 0.9;
  font-weight: 600;
  color: var(--sb-text);
  margin-bottom: 2px;
}
.nav-item.home-link:hover { opacity: 1; }

/* ─── Sidebar user footer ─────────────────────────────── */
.sb-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  box-shadow: 0 -1px 0 var(--sb-border);
  flex-shrink: 0;
  background: rgba(30,41,59,0.5);
}
.sb-user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.22);
}
.sb-user-info { min-width: 0; flex: 1; }
.sb-user-info span {
  display: block;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-user-info small {
  display: block;
  color: var(--sb-muted);
  font-size: 10.5px;
  font-weight: 500;
  margin-top: 1px;
  text-transform: capitalize;
}

#logout-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
  border: none;
  box-shadow: 0 -1px 0 var(--sb-border);
  border-radius: 0;
  background: rgba(30,41,59,0.5);
  color: var(--sb-muted);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: all 140ms var(--ease);
  flex-shrink: 0;
  cursor: pointer;
}
#logout-btn:hover { background: rgba(220,38,38,0.14); color: #f87171; }
#logout-btn .nav-icon { width: 14px; height: 14px; flex-shrink: 0; }

/* ─── Workspace ───────────────────────────────────────── */
.workspace {
  min-width: 0;
  padding: 24px 28px 40px;
}

/* ─── Topbar ──────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -24px -28px 24px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .eyebrow { margin-bottom: 1px; font-size: 10px; }
.topbar h2 { font-size: 17px; }
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar-actions .secondary { min-height: 36px; padding: 0 14px; font-size: 12.5px; }

.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* hamburguesa (solo móvil) */
.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  place-items: center;
  flex-shrink: 0;
}
.menu-btn svg { width: 18px; height: 18px; }

/* ─── Status pills ────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.good { border-color: var(--green-bd); background: var(--green-lt); color: var(--green); }
.status-pill.warn { border-color: var(--amber-bd); background: var(--amber-lt); color: var(--amber); }

/* ─── Vistas ──────────────────────────────────────────── */
.view { display: none; }
.view.active {
  display: block;
  animation: view-in 180ms var(--ease);
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Métricas ────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 160ms var(--ease), transform 160ms var(--ease);
  position: relative;
  overflow: hidden;
}
.metric:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
}

/* ─── Panel ───────────────────────────────────────────── */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-heading h3 { margin-bottom: 0; }

/* ─── Acciones rápidas (dashboard) ───────────────────── */
.start-panel .panel-heading { align-items: flex-start; }
.start-panel .panel-heading p { margin: 3px 0 0; font-size: 13px; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.quick-action {
  display: flex;
  min-height: 86px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  text-align: left;
  transition: all 150ms var(--ease);
}
.quick-action:hover  { border-color: var(--accent); background: var(--accent-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-action:active { transform: scale(0.98); }
.quick-action strong { font-size: 15px; font-weight: 700; }
.quick-action span   { color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.4; }

.quick-action.primary-action {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,0.30);
}
.quick-action.primary-action span { color: rgba(255,255,255,0.82); }
.quick-action.primary-action:hover { background: linear-gradient(135deg, var(--accent-dark) 0%, #1e40af 100%); transform: translateY(-2px); }

/* ─── Action grid (reportes) ──────────────────────────── */
.action-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}
.action-grid .secondary { min-height: 40px; font-size: 12.5px; }

/* ─── Search ──────────────────────────────────────────── */
.search { width: min(280px, 100%); min-height: 38px; font-size: 13.5px; }

.section-title  { margin-top: 24px; }
.section-heading { margin-top: 24px; }

/* ─── Split layout ────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: minmax(280px, 370px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.split > .panel.form,
.split > .stack { position: sticky; top: 78px; }

/* ─── Listas (tarjetas legado) ────────────────────────── */
.list         { display: grid; gap: 8px; }
.list.compact { gap: 6px; }

.empty {
  padding: 28px 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  line-height: 1.6;
  background: var(--surface-2);
}
.compact-empty { padding: 12px; font-size: 12.5px; }

/* ═══════════════════════════════════════════════════════
   TABLAS DE DATOS — núcleo del rediseño
   ═══════════════════════════════════════════════════════ */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 100ms var(--ease); }
.data-table tbody tr:hover { background: var(--surface-2); }

.data-table .dt-main { color: var(--text); font-weight: 600; }
.data-table .dt-num  { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table th.dt-num { text-align: right; }
.data-table .dt-sub  { display: block; margin-top: 1px; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.data-table .dt-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.data-table td.dt-actions-cell { text-align: right; white-space: nowrap; }
.data-table .dt-money { font-weight: 600; color: var(--text); }

/* fila de detalle expandible */
.data-table tr.dt-detail > td {
  background: var(--surface-2);
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.data-table tr.dt-detail.hidden { display: none; }
.dt-detail .line-items { margin-top: 0; }

.dt-expand {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  transition: all 120ms var(--ease);
}
.dt-expand:hover { background: var(--surface-3); color: var(--text); }
.dt-expand.open { transform: rotate(90deg); border-color: var(--accent-mid); color: var(--accent); }

/* ─── Row cards (legado, aún usadas en varias vistas) ── */
.row {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.row:hover { border-color: #cbd5e1; box-shadow: var(--shadow-sm); }

.movement-row { background: var(--surface-2); }
.movement-row:hover { box-shadow: var(--shadow-xs); }

.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.row-title { min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 13.5px; color: var(--text); }
.row-meta  { color: var(--muted); font-size: 12.5px; }
.line-items { display: grid; gap: 3px; margin-top: 4px; color: var(--text-2); font-size: 12.5px; }

/* ─── Lot list ────────────────────────────────────────── */
.lot-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lot-list span {
  display: inline-flex;
  gap: 6px;
  min-height: 26px;
  align-items: center;
  flex-wrap: wrap;
  padding: 4px 10px;
  border: 1px solid var(--accent-mid);
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 500;
}
.lot-list .mini { min-height: 22px; margin-top: 0; padding: 0 8px; }

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ─── Mini botones ────────────────────────────────────── */
.mini {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 2px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: all 120ms var(--ease);
}
.mini:hover          { background: var(--surface-3); border-color: #cbd5e1; color: var(--text); }
.mini:active         { transform: scale(0.96); }
.mini.danger         { border-color: var(--red-bd); background: var(--red-lt); color: var(--red); }
.mini.danger:hover   { background: #fee2e2; }
.mini.good-action    { border-color: var(--green-bd); background: var(--green-lt); color: var(--green); }
.mini.good-action:hover { background: #dcfce7; }

/* ─── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.good { border-color: var(--green-bd); background: var(--green-lt); color: var(--green); }
.badge.warn { border-color: var(--amber-bd); background: var(--amber-lt); color: var(--amber); }
.badge.bad  { border-color: var(--red-bd); background: var(--red-lt); color: var(--red); }

.cat-badge {
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid var(--accent-mid);
}

/* ─── Etiquetas de rol en el nav ──────────────────────── */
.nav-role {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.7;
  pointer-events: none;
  flex-shrink: 0;
}
.nav-role { display: none; }
body.admin-mode .nav-role { display: inline-block; }

body.admin-mode .nav-role.role-all   { background: rgba(34,197,94,.18);  color: #86efac; }
body.admin-mode .nav-role.role-mgr   { background: rgba(59,130,246,.18); color: #93c5fd; }
body.admin-mode .nav-role.role-admin { background: rgba(251,191,36,.18); color: #fcd34d; }

/* ─── Banners de rol ──────────────────────────────────── */
.role-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.5;
}
.role-banner .role-pills { display: flex; flex-wrap: wrap; gap: 5px; flex-shrink: 0; }
.role-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.role-pill.v  { background: rgba(34,197,94,.14);  color: #15803d; }
.role-pill.s  { background: rgba(59,130,246,.14); color: #1d4ed8; }
.role-pill.a  { background: rgba(217,119,6,.14);  color: #b45309; }
.role-pill.no { background: rgba(239,68,68,.10);  color: #dc2626; text-decoration: line-through; opacity: .7; }
.role-banner .role-desc { font-size: 12.5px; color: var(--muted); }
.role-banner { display: none; }
body.admin-mode .role-banner { display: flex; }

body.admin-mode .role-banner.role-all   { background: var(--green-lt); border-left: 3px solid #22c55e; }
body.admin-mode .role-banner.role-mgr   { background: var(--accent-light); border-left: 3px solid var(--accent); }
body.admin-mode .role-banner.role-admin { background: var(--amber-lt); border-left: 3px solid #f59e0b; }

/* ─── Draft lines (líneas de venta/compra) ───────────── */
.draft-lines { display: grid; gap: 8px; }
.draft-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.draft-line.loss-risk { border-color: var(--amber-bd); background: var(--amber-lt); }
.draft-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.draft-line em  { display: block; margin-top: 2px; color: var(--amber); font-size: 11.5px; font-style: normal; font-weight: 700; }
.draft-line strong { font-size: 13px; font-weight: 700; }

.draft-line-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}
.draft-line-card.loss-risk { border-color: var(--amber-bd); background: var(--amber-lt); }
.draft-line-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.draft-line-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-line-fields { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 8px; align-items: end; }
.draft-field { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.draft-field input { font-size: 13px; padding: 5px 7px; width: 100%; min-height: 34px; }
.draft-field.draft-total { justify-content: flex-end; font-size: 12.5px; font-weight: 700; color: var(--text); text-align: right; padding-bottom: 2px; }

/* ─── Scanner box ─────────────────────────────────────── */
.scanner-box {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1.5px solid var(--accent-mid);
  border-radius: var(--radius-lg);
  background: var(--accent-light);
}
.scanner-box input {
  min-height: 50px;
  border-color: var(--accent-mid);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.scanner-box span   { color: var(--muted); font-size: 12px; font-weight: 500; }
.scanner-box strong { color: var(--accent-dark); font-size: 12px; font-weight: 700; }

/* ─── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(430px, calc(100vw - 32px));
  min-width: 220px;
  padding: 13px 15px;
  border-radius: var(--radius-lg);
  background: #1e293b;
  color: #fff;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.06);
  opacity: 0;
  transform: translateY(14px) scale(0.95);
  transition: opacity 200ms var(--ease), transform 200ms var(--spring);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.toast[data-type="error"]   { background: #7f1d1d; }
.toast[data-type="success"] { background: #14532d; }

.toast-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}
.toast-msg { flex: 1; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.toast-action {
  flex-shrink: 0;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  white-space: nowrap;
  transition: background 130ms var(--ease);
}
.toast-action:hover  { background: rgba(255,255,255,0.30); }
.toast-action:active { transform: scale(0.96); }

/* ─── Modal ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
  animation: modal-in 200ms var(--spring);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.modal-head h3 { margin-bottom: 0; font-size: 16px; }
.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: all 130ms var(--ease);
}
.icon-button:hover { background: var(--line); color: var(--text); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.modal-copy { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }

/* ─── Filtros de reportes ─────────────────────────────── */
.report-filters { margin-bottom: 16px; }

/* ─── Lector de precios ───────────────────────────────── */
.pr-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.pr-search-section { margin-top: 14px; display: grid; gap: 10px; }
.pr-search-label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.pr-search-label input { width: 100%; min-height: 42px; }

.pr-camera-wrap { border-radius: var(--radius-lg); overflow: hidden; background: #000; }
.pr-camera-wrap video { width: 100%; display: block; max-height: 280px; object-fit: cover; }
.pr-camera-hint { padding: 8px 12px 12px; font-size: 12.5px; margin: 0; background: var(--surface-2); }
.pr-no-camera-msg { font-size: 12.5px; margin: 0; }

.pr-empty-state { text-align: center; padding: 44px 20px; }
.pr-empty-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.pr-result-card {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: view-in 180ms var(--spring);
}

.pr-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 0;
}
.pr-product-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.pr-price-block {
  margin: 16px 22px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(140deg, #0f172a 0%, #1e3a8a 120%);
  position: relative;
  overflow: hidden;
}
.pr-price-block::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -30px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(59,130,246,0.25) 0%, transparent 70%);
  pointer-events: none;
}
.pr-price-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 6px;
}
.pr-price {
  display: block;
  font-size: 54px;
  font-weight: 800;
  letter-spacing: -2.5px;
  line-height: 1;
  color: #fff;
}
.pr-currency {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  vertical-align: 18px;
  opacity: 0.65;
  margin-right: 4px;
}

.pr-manager-strip {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.pr-manager-strip > div { display: grid; gap: 2px; }
.pr-manager-strip span { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(255,255,255,0.4); }
.pr-manager-strip strong { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.85); }
.pr-margin-good  strong { color: #4ade80; }
.pr-margin-warn  strong { color: #fbbf24; }
.pr-margin-bad   strong { color: #f87171; }

.pr-meta-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 22px 16px;
}
.pr-meta-chip {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.pr-meta-chip span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 3px;
}
.pr-meta-chip strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pr-stock-section { padding: 0 22px 16px; }
.pr-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.pr-warehouse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
}
.pr-warehouse-row + .pr-warehouse-row { margin-top: 5px; }
.pr-warehouse-row.has-stock { background: var(--green-lt); border-color: var(--green-bd); }
.pr-warehouse-row.no-stock  { background: var(--surface-3); opacity: 0.6; }
.pr-warehouse-name { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.pr-warehouse-qty  { font-weight: 700; color: var(--text); white-space: nowrap; }
.pr-warehouse-row.has-stock .pr-warehouse-qty { color: var(--green); }
.pr-no-stock-msg { color: var(--muted); font-size: 12.5px; font-style: italic; }

.pr-actions {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.pr-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 120ms var(--ease);
  font-size: 13px;
}
.pr-search-item:hover { border-color: var(--accent); background: var(--accent-light); }
.pr-search-item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-search-item-price { font-weight: 700; color: var(--accent); white-space: nowrap; flex-shrink: 0; }

.pr-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 120ms var(--ease);
}
.pr-history-item:hover { border-color: #cbd5e1; background: var(--surface-2); }
.pr-history-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-history-price { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.pr-history-stock { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pr-history-stock.good { background: var(--green-lt); color: var(--green); }
.pr-history-stock.warn { background: var(--amber-lt); color: var(--amber); }
.pr-history-stock.bad  { background: var(--red-lt); color: var(--red); }

/* ═══════════════════════════════════════════════════════
   KIOSK MODE — ?mode=kiosk
   ═══════════════════════════════════════════════════════ */
.kiosk-header { display: none; }

body.kiosk .app-shell {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}
body.kiosk .kiosk-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--sb-bg);
  border-bottom: 1px solid var(--sb-border);
  position: sticky;
  top: 0;
  z-index: 40;
  grid-column: 1 / -1;
}
.kiosk-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.kiosk-icon { width: 26px; height: 26px; color: #60a5fa; }
.kiosk-brand strong { display: block; font-size: 15px; font-weight: 700; color: #fff; line-height: 1.3; }
.kiosk-brand span { font-size: 11.5px; color: var(--sb-muted); }
.kiosk-tagline { flex: 1; text-align: center; font-size: 14px; color: rgba(255,255,255,0.3); letter-spacing: 0.02em; margin: 0; }
.kiosk-exit {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  text-decoration: none;
  padding: 5px 11px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  flex-shrink: 0;
}
.kiosk-exit:hover { color: rgba(255,255,255,0.65); border-color: rgba(255,255,255,0.3); }

body.kiosk .sidebar  { display: none; }
body.kiosk .topbar   { display: none; }
body.kiosk .workspace { padding: 28px 32px; }

body.kiosk .pr-price         { font-size: 76px; letter-spacing: -3.5px; }
body.kiosk .pr-price-block   { padding: 26px 28px 22px; }
body.kiosk .pr-empty-state   { padding: 60px 20px; }
body.kiosk .pr-empty-title   { font-size: 22px; }
body.kiosk .pr-actions        { display: none; }
body.kiosk #pr-history-panel  { display: none !important; }
body.kiosk .pr-manager-strip  { display: none !important; }
body.kiosk .pr-kiosk-controls { display: none !important; }
body.kiosk .pr-meta-row       { display: none !important; }
body.kiosk .pr-stock-section  { display: none !important; }

/* ── Kiosk controls panel ── */
.pr-kiosk-desc { font-size: 12.5px; margin: 0 0 14px; color: var(--muted); }
.pr-kiosk-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pr-kiosk-pin-setup { flex: 1; min-width: 180px; }
.pr-kiosk-label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text); }
.pr-kiosk-pin-wrap { display: flex; gap: 6px; }
.pr-kiosk-pin-wrap input { flex: 1; width: 0; font-size: 16px; letter-spacing: 4px; text-align: center; }
.pr-kiosk-activate { flex-shrink: 0; gap: 6px; }
.kiosk-pin-badge {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; background: var(--accent-light);
  color: var(--accent); letter-spacing: 0.02em;
}

/* ── PIN overlay ── */
.kiosk-pin-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 12, 22, 0.88);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.kiosk-pin-overlay.hidden { display: none; }
.kiosk-pin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.kiosk-pin-icon {
  width: 48px; height: 48px;
  background: var(--accent-light);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
}
.kiosk-pin-icon svg { width: 22px; height: 22px; stroke: var(--accent); }
.kiosk-pin-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; color: var(--text); }
.kiosk-pin-sub { font-size: 13px; color: var(--muted); margin: 0 0 24px; line-height: 1.5; }
.kiosk-pin-digits { display: flex; gap: 12px; justify-content: center; margin-bottom: 16px; }
.kiosk-pin-digit {
  width: 56px; height: 64px;
  font-size: 26px; font-weight: 700; text-align: center;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
  -webkit-text-security: disc;
}
.kiosk-pin-digit:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}
.kiosk-pin-digit:not(:placeholder-shown) {
  border-color: var(--accent);
  background: var(--accent-light);
}
.kiosk-pin-error {
  font-size: 13px; color: var(--red); font-weight: 500;
  margin: 0 0 16px; min-height: 18px;
}
.kiosk-pin-error.hidden { visibility: hidden; }
.kiosk-pin-cancel {
  background: none; border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 500;
  padding: 8px 20px; border-radius: var(--radius);
  cursor: pointer; transition: color 150ms, border-color 150ms;
}
.kiosk-pin-cancel:hover { color: var(--text); border-color: var(--muted); }

@keyframes kiosk-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}
.shake { animation: kiosk-shake 0.55s ease; }

/* ─── Notas / misc ────────────────────────────────────── */
.muted-note {
  font-size: 12.5px;
  color: var(--amber);
  background: var(--amber-lt);
  border: 1px solid var(--amber-bd);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 10px;
}

.steps { margin: 0; padding-left: 20px; color: var(--text-2); }
.steps li + li { margin-top: 8px; }

/* ─── Gráficos ────────────────────────────────────────── */
.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 12px;
  min-width: 0;
}
.dashboard-chart-panel { min-width: 0; overflow: hidden; }

/* contenedor que controla el tamaño de cada gráfico */
.chart-box {
  position: relative;
  height: 230px;
  min-width: 0;
}

.reports-charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
  margin-bottom: 16px;
  min-width: 0;
}
.reports-charts > * { min-width: 0; overflow: hidden; }
.reports-charts .chart-box { height: 210px; }

/* ─── Vencimiento de lotes ────────────────────────────── */
.lot-expired  { color: var(--red); font-weight: 700; }
.lot-expiring { color: var(--amber); font-weight: 600; }

/* ─── Notificaciones ──────────────────────────────────── */
.notif-btn {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.notif-btn svg { width: 16px; height: 16px; }
.notif-btn:hover { background: var(--surface-2); }
.notif-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
}
.notif-btn.has-notif { border-color: var(--red); }

/* ─── Divisor ─────────────────────────────────────────── */
.panel-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.panel-divider::before, .panel-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.panel-divider:empty { margin: 14px 0; }
.panel-divider:empty::after { display: none; }

/* ─── Fila compacta (categorías) ──────────────────────── */
.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.compact-row:last-child { border-bottom: none; }

/* ─── Búsqueda con filtro ─────────────────────────────── */
.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}
.search-row .search { flex: 1; max-width: 280px; }
.search-row select { min-width: 130px; flex-shrink: 0; width: auto; }

/* ─── Info tooltip ────────────────────────────────────── */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  cursor: help;
  color: #94a3b8;
  vertical-align: middle;
  line-height: 1;
}
.info-tip svg { width: 14px; height: 14px; flex-shrink: 0; }
.info-tip:hover svg { color: var(--accent); }
.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  padding: 9px 13px;
  border-radius: 8px;
  width: 250px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 200;
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}
.info-tip:hover::after { opacity: 1; }
.info-tip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 200;
}
.info-tip:hover::before { opacity: 1; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — tablet y móvil
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); }
  .reports-charts { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }

  /* sidebar → drawer off-canvas */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100dvh;
    width: min(290px, 84vw);
    transform: translateX(-102%);
    transition: transform 220ms var(--ease);
    box-shadow: none;
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(15,23,42,0.35);
  }
  body.nav-open .nav-overlay { display: block; }
  body.nav-open { overflow: hidden; }

  .menu-btn { display: inline-grid; }

  .workspace { padding: 16px 14px 80px; }

  .topbar {
    margin: -16px -14px 18px;
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  .topbar-actions { justify-content: flex-start; width: 100%; gap: 6px; }
  .status-pill { flex: 1 1 auto; justify-content: center; min-height: 32px; font-size: 11.5px; }

  /* colapsar grids a una columna */
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .split, .action-grid, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }

  .quick-action { min-height: 78px; }
  .primary, .secondary, .ghost { min-height: 48px; font-size: 14px; }
  .mini { min-height: 34px; font-size: 12.5px; }

  .lot-list { display: grid; }
  .lot-list span { justify-content: space-between; width: 100%; }

  .pr-layout { grid-template-columns: 1fr; }
  .pr-meta-row { grid-template-columns: repeat(2, 1fr); }
  .pr-price { font-size: 42px; }

  .panel-heading { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .search-row { flex-wrap: wrap; justify-content: stretch; }
  .search-row .search { max-width: none; }
  .search-row select { min-width: 0; flex: 1 1 120px; }

  .split > .panel.form,
  .split > .stack { position: static; }

  .toast { right: 10px; bottom: 10px; left: 10px; max-width: none; min-width: 0; }
  .modal { padding: 18px; }

  body.kiosk .kiosk-header { padding: 12px 16px; gap: 12px; }
  body.kiosk .kiosk-tagline { display: none; }
  body.kiosk .workspace { padding: 16px 14px; }
  body.kiosk .pr-price { font-size: 52px; letter-spacing: -2px; }

  .dashboard-charts { grid-template-columns: 1fr; }
  .reports-charts   { grid-template-columns: 1fr; }
  .draft-line-fields { grid-template-columns: repeat(2, 1fr) auto; }
}

/* ── Tablas → tarjetas apiladas en móvil ── */
@media (max-width: 760px) {
  .table-wrap { border: none; background: transparent; overflow: visible; }

  .data-table { display: block; }
  .data-table thead { display: none; }
  .data-table tbody { display: grid; gap: 8px; }
  .data-table tbody tr {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
  }
  .data-table tbody tr:hover { background: var(--surface); }
  .data-table tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 0;
    border-bottom: none;
    text-align: left;
  }
  .data-table tbody td.dt-num { text-align: right; }
  .data-table tbody td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 2px;
  }
  .data-table tbody td:not([data-label]) { justify-content: flex-start; }
  .data-table td.dt-actions-cell { padding-top: 8px; }
  .data-table .dt-actions { justify-content: flex-start; }
  .data-table tr.dt-detail > td { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; display: block; }
  .data-table tr.dt-detail { padding: 8px; background: var(--surface-2); }
}

/* Pantallas muy pequeñas (< 400px) */
@media (max-width: 400px) {
  h1 { font-size: 23px; }
  h2 { font-size: 17px; }
  .auth-panel { padding: 24px 18px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric strong { font-size: 22px; }
  .quick-logins { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .kiosk-pin-digit { width: 48px; height: 56px; }
}
