/* ═══════════════════════════════════════════════════════════════
   ERP Gremio — Design System (fiel al CRM Gremio 2)
   Variables: mismos valores HSL que el CRM usa en :root
   ═══════════════════════════════════════════════════════════════ */
:root {
  --background: hsl(222, 49%, 8%);
  --foreground: hsl(210, 40%, 95%);
  --card: hsl(222, 47%, 11%);
  --popover: hsl(222, 47%, 13%);
  --primary: hsl(217, 91%, 60%);
  --primary-fg: hsl(0, 0%, 100%);
  --muted: hsl(222, 40%, 16%);
  --muted-fg: hsl(215, 20%, 55%);
  --destructive: hsl(0, 72%, 51%);
  --border: hsl(222, 40%, 18%);

  /* Sidebar (mismos que el CRM) */
  --sidebar-bg: hsl(222, 49%, 5%);
  --sidebar-active: hsl(217, 60%, 22%);
  --sidebar-accent: hsl(217, 91%, 70%);
  --sidebar-fg: hsl(0, 0%, 100%);
  --sidebar-muted-fg: hsl(215, 15%, 55%);

  /* Helpers semánticos */
  --success: hsl(142, 71%, 45%);
  --success-bg: hsla(142, 71%, 45%, 0.15);
  --success-border: hsla(142, 71%, 45%, 0.25);
  --warning: hsl(38, 92%, 50%);
  --warning-bg: hsla(38, 92%, 50%, 0.15);
  --warning-border: hsla(38, 92%, 50%, 0.25);
  --destructive-bg: hsla(0, 72%, 51%, 0.15);
  --destructive-border: hsla(0, 72%, 51%, 0.25);
  --primary-bg: hsla(217, 91%, 60%, 0.15);
  --primary-border: hsla(217, 91%, 60%, 0.25);
  --amber-color: hsl(38, 92%, 60%);
  --amber-bg: hsla(38, 92%, 50%, 0.20);
  --amber-border: hsla(38, 92%, 50%, 0.35);
  --indigo-color: hsl(239, 84%, 67%);
  --indigo-bg: hsla(239, 84%, 67%, 0.15);
  --indigo-border: hsla(239, 84%, 67%, 0.30);
  --emerald-color: hsl(160, 84%, 39%);
  --emerald-bg: hsla(160, 84%, 39%, 0.15);
  --emerald-border: hsla(160, 84%, 39%, 0.25);
  --purple-color: hsl(271, 81%, 65%);
  --purple-bg: hsla(271, 81%, 65%, 0.15);
  --purple-border: hsla(271, 81%, 65%, 0.25);
  --pink-color: hsl(330, 81%, 60%);
  --pink-bg: hsla(330, 81%, 60%, 0.15);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
  --shadow-glass: 0 8px 32px rgba(0,0,0,0.45);

  /* ── Backward compatibility aliases (used by other admin PHP files) ── */
  --surface: hsl(222, 47%, 11%);        /* = --card */
  --background: hsl(222, 49%, 8%);
  --text-primary: hsl(210, 40%, 95%);   /* = --foreground */
  --text-secondary: hsl(215, 20%, 55%); /* = --muted-fg */
  --danger: hsl(0, 72%, 51%);           /* = --destructive */
  --secondary: hsl(222, 40%, 17%);
  --success-color: hsl(142, 71%, 45%);
  --border-light: hsl(222, 40%, 21%);
  --radius-sm: 6px;
  --radius-md: 10px;

  /* Nuevas variables del modo oscuro */
  --input-bg: hsla(222, 40%, 16%, 0.8);
  --table-stripe: hsla(222, 40%, 16%, 0.4);
  --scrollbar-thumb: hsl(222, 40%, 22%);
  --scrollbar-thumb-hover: hsl(222, 40%, 28%);
  --sidebar-border: hsla(0, 0%, 100%, 0.07);
  --sidebar-hover: hsla(0, 0%, 100%, 0.07);
  --secondary-hover: hsl(222, 40%, 22%);
}

[data-theme="light"] {
  --background: hsl(210, 50%, 98%); /* Soft pastel background */
  --foreground: hsl(222, 47%, 15%); /* Dark text */
  --card: hsl(0, 0%, 100%);         /* White cards */
  --popover: hsl(0, 0%, 100%);
  --primary: hsl(215, 80%, 55%);    /* Pastel blue primary */
  --primary-fg: hsl(0, 0%, 100%);
  --muted: hsl(214, 32%, 91%);
  --muted-fg: hsl(215, 16%, 47%);
  --destructive: hsl(354, 70%, 54%); /* Soft red */
  --border: hsl(214, 30%, 88%);

  /* Sidebar */
  --sidebar-bg: hsl(210, 40%, 95%);
  --sidebar-active: hsl(215, 50%, 88%);
  --sidebar-accent: hsl(215, 80%, 45%);
  --sidebar-fg: hsl(222, 47%, 15%);
  --sidebar-muted-fg: hsl(215, 16%, 45%);
  --sidebar-border: hsl(214, 30%, 88%);
  --sidebar-hover: hsla(215, 50%, 80%, 0.35);

  /* Helpers semánticos en tonos pastel suaves */
  --success: hsl(142, 60%, 40%);
  --success-bg: hsla(142, 60%, 40%, 0.1);
  --success-border: hsla(142, 60%, 40%, 0.2);
  --warning: hsl(38, 85%, 45%);
  --warning-bg: hsla(38, 85%, 45%, 0.1);
  --warning-border: hsla(38, 85%, 45%, 0.2);
  --destructive-bg: hsla(354, 70%, 54%, 0.1);
  --destructive-border: hsla(354, 70%, 54%, 0.2);
  --primary-bg: hsla(215, 80%, 55%, 0.1);
  --primary-border: hsla(215, 80%, 55%, 0.2);

  --amber-color: hsl(38, 85%, 45%);
  --amber-bg: hsla(38, 85%, 45%, 0.1);
  --amber-border: hsla(38, 85%, 45%, 0.2);
  --indigo-color: hsl(239, 70%, 60%);
  --indigo-bg: hsla(239, 70%, 60%, 0.1);
  --indigo-border: hsla(239, 70%, 60%, 0.2);
  --emerald-color: hsl(160, 70%, 35%);
  --emerald-bg: hsla(160, 70%, 35%, 0.1);
  --emerald-border: hsla(160, 70%, 35%, 0.2);
  --purple-color: hsl(271, 70%, 58%);
  --purple-bg: hsla(271, 70%, 58%, 0.1);
  --purple-border: hsla(271, 70%, 58%, 0.2);
  --pink-color: hsl(330, 70%, 58%);
  --pink-bg: hsla(330, 70%, 58%, 0.1);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.07);
  --shadow-glass: 0 8px 32px rgba(0,0,0,0.08);

  /* Backward compatibility aliases */
  --surface: hsl(0, 0%, 100%);
  --text-primary: hsl(222, 47%, 15%);
  --text-secondary: hsl(215, 16%, 47%);
  --danger: hsl(354, 70%, 54%);
  --secondary: hsl(214, 30%, 94%);
  --success-color: hsl(142, 60%, 40%);
  --border-light: hsl(214, 30%, 90%);
  --radius-sm: 6px;
  --radius-md: 10px;

  --input-bg: hsl(0, 0%, 100%);
  --table-stripe: hsla(210, 40%, 90%, 0.25);
  --scrollbar-thumb: hsl(214, 30%, 80%);
  --scrollbar-thumb-hover: hsl(214, 30%, 70%);
  --secondary-hover: hsl(214, 30%, 90%);
}

/* ───────────── RESET ───────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { text-decoration: none; }

/* ── glass-panel: alias de .card usado en todos los PHP del admin ── */
.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── Modales y side drawers: siempre fondo sólido ── */
.side-drawer {
  background: var(--surface) !important;
}
[id$="-modal"] > div,
[id$="-drawer"] > div {
  background: var(--surface);
}

/* ───────────── CARD (misma que el CRM: bg-card) ───────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.card-header {
  padding: 1rem 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
}
.card-desc {
  font-size: 0.75rem;
  color: var(--muted-fg);
  line-height: 1.4;
  margin-top: 0.25rem;
}
.card-body {
  padding: 0 1.25rem 1.25rem;
}

/* ───────────── STAT CARD (fiel al CRM: p-5, flex, gap-4, icono p-3 rounded-lg) ───────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: hsl(222, 40%, 24%); }

.stat-icon {
  padding: 0.75rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* Colores de icono — exactos del CRM (bg-primary, bg-green-600, etc.) */
.stat-icon.bg-primary  { background: hsl(217, 91%, 60%); }
.stat-icon.bg-green    { background: hsl(142, 63%, 40%); }
.stat-icon.bg-pink     { background: hsl(330, 81%, 52%); }
.stat-icon.bg-indigo   { background: hsl(239, 84%, 55%); }
.stat-icon.bg-amber    { background: hsl(38, 92%, 50%); }
.stat-icon.bg-red      { background: hsl(0, 72%, 51%); }
.stat-icon.bg-purple   { background: hsl(271, 81%, 55%); }

.stat-label {
  font-size: 0.72rem;
  color: var(--muted-fg);
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
}

/* ───────────── BADGE (fiel al CRM: bg-color/20, text-color, border-0) ───────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}
/* Equivalentes a las clases Tailwind del CRM */
.badge-orange   { background: hsla(25, 95%, 53%, 0.15); color: hsl(25, 95%, 65%); border-color: hsla(25, 95%, 53%, 0.25); }
.badge-green    { background: var(--success-bg);         color: var(--success);      border-color: var(--success-border); }
.badge-red      { background: var(--destructive-bg);     color: var(--destructive);  border-color: var(--destructive-border); }
.badge-amber    { background: var(--amber-bg);           color: var(--amber-color);  border-color: var(--amber-border); }
.badge-blue     { background: var(--primary-bg);         color: var(--primary);      border-color: var(--primary-border); }
.badge-indigo   { background: var(--indigo-bg);          color: var(--indigo-color); border-color: var(--indigo-border); }
.badge-emerald  { background: var(--emerald-bg);         color: var(--emerald-color);border-color: var(--emerald-border); }
.badge-purple   { background: var(--purple-bg);          color: var(--purple-color); border-color: var(--purple-border); }
.badge-muted    { background: hsla(215, 20%, 55%, 0.15); color: var(--muted-fg);     border-color: hsla(215, 20%, 55%, 0.2); }

/* ───────────── ALERT ROW (fiel al CRM: flex, p-2, rounded, bg-color/10) ───────────── */
.alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  gap: 0.5rem;
  font-size: 0.875rem;
}
.alert-row.amber  { background: hsla(38, 92%, 50%, 0.10); }
.alert-row.red    { background: hsla(0, 72%, 51%, 0.10); }
.alert-row.indigo { background: hsla(239, 84%, 67%, 0.10); }
.alert-row.emerald { background: hsla(160, 84%, 39%, 0.05); border: 1px solid var(--emerald-border); }

/* ───────────── DATA TABLE (fiel al CRM: SortableDataTable) ───────────── */
.data-table-wrapper {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead { background: hsla(215, 20%, 55%, 0.07); }
.data-table th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-fg);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid hsla(222, 40%, 18%, 0.5);
  vertical-align: middle;
  color: var(--foreground);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(even) td { background: var(--table-stripe); }
.data-table tbody tr:hover td { background: hsla(217, 91%, 60%, 0.05); }
.td-muted { color: var(--muted-fg); font-size: 0.8rem; }
.td-mono  { font-family: monospace; font-size: 0.8rem; color: var(--muted-fg); }
.td-small { font-size: 0.8rem; color: var(--muted-fg); margin-top: 0.1rem; }

/* ───────────── SIDEBAR (fiel al CRM: w-60, px-6, py-5, gap-3, etc.) ───────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
}
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand-sub {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: hsl(217, 91%, 70%); /* sidebar-accent */
  margin-bottom: 0.2rem;
}
.sidebar-brand-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sidebar-fg);
  line-height: 1.3;
}
.sidebar-nav { padding: 0.75rem 0.75rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sidebar-muted-fg);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, gap 0.25s, padding 0.25s;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link span.nav-label {
  flex: 1;
  transition: opacity 0.2s, width 0.25s;
  overflow: hidden;
}
.sidebar-link:hover {
  color: var(--sidebar-fg);
  background: hsla(217, 60%, 50%, 0.12);
}
.sidebar-link.active {
  color: var(--sidebar-fg);
  background: var(--sidebar-active);
}
.sidebar-link svg { flex-shrink: 0; width: 18px; height: 18px; }
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--sidebar-muted-fg);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.sidebar-footer-link:hover { color: var(--sidebar-fg); background: var(--sidebar-hover); }
.sidebar-footer-link.danger { color: hsl(0, 72%, 60%); }
.sidebar-footer-link.danger:hover { color: hsl(0, 72%, 51%); background: var(--destructive-bg); }
.sidebar-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  border-width: 1px;
  border-style: solid;
}
.sidebar-role-admin   { background: hsla(217,91%,60%,0.20); color: hsl(217,91%,70%); border-color: hsla(217,91%,60%,0.30); }
.sidebar-role-pres    { background: hsla(38,92%,50%,0.20);  color: hsl(38,92%,60%);  border-color: hsla(38,92%,50%,0.30); }
.sidebar-role-vocal   { background: hsla(271,81%,65%,0.20); color: hsl(271,81%,72%); border-color: hsla(271,81%,65%,0.30); }
.sidebar-divider {
  height: 0;
  border-top: 6px double var(--muted-fg);
  margin: 1.25rem 0.5rem;
  opacity: 0.6;
}

/* Responsive Form Layouts */
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.col-span-2 {
  grid-column: 1 / -1;
}

.col-span-3 {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .col-span-2 {
    grid-column: span 2;
  }
  .col-span-3 {
    grid-column: span 3;
  }
}

/* ───────────── INPUTS ───────────── */
.input-control,
select.input-control,
textarea.input-control {
  width: 100%;
  padding: 0.55rem 0.875rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.input-control::placeholder { color: var(--muted-fg); }
.input-control:focus {
  border-color: hsla(217, 91%, 60%, 0.5);
  box-shadow: 0 0 0 3px hsla(217, 91%, 60%, 0.18);
}
label {
  font-size: 0.8rem;
  color: var(--muted-fg);
  font-weight: 500;
  display: block;
  margin-bottom: 0.3rem;
}

/* ───────────── BUTTONS ───────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 20px hsla(217, 91%, 60%, 0.25);
}
.btn-primary:hover {
  background: hsl(217, 91%, 54%);
  box-shadow: 0 0 28px hsla(217, 91%, 60%, 0.35);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* btn-secondary: equivalente a variant='outline' del CRM */
.btn-secondary {
  background: var(--secondary);
  border-color: var(--border);
  color: var(--foreground);
}
.btn-secondary:hover { background: var(--secondary-hover); border-color: var(--border); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* btn-outline */
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}
.btn-outline:hover { background: var(--muted); }

/* btn-danger */
.btn-danger {
  background: var(--destructive);
  color: white;
  border-color: transparent;
}
.btn-danger:hover { background: hsl(0, 72%, 44%); }

/* btn-success */
.btn-success {
  background: var(--success);
  color: white;
  border-color: transparent;
}
.btn-success:hover { background: hsl(142, 71%, 38%); }

.btn-ghost {
  background: transparent;
  color: var(--muted-fg);
}
.btn-ghost:hover { background: hsla(0, 0%, 100%, 0.07); color: var(--foreground); }

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}
.btn-icon {
  padding: 0.35rem;
  width: 32px; height: 32px;
  border-radius: var(--radius);
}

/* ── Override hardcoded light colors used in modals (fallecidos, finanzas, etc.) ── */
/* Cheque box states: reemplaza fondos blancos/rojos con equivalentes dark */
[style*="background: #FEF2F2"],
[style*="background:#FEF2F2"],
[style*="background: #FEE2E2"],
[style*="background:#FEE2E2"] {
  background: hsla(0, 72%, 51%, 0.12) !important;
  border-color: hsla(0, 72%, 51%, 0.3) !important;
  color: var(--foreground) !important;
}
[style*="background: #ECFDF5"],
[style*="background:#ECFDF5"],
[style*="background: #D1FAE5"],
[style*="background:#D1FAE5"] {
  background: hsla(142, 71%, 45%, 0.12) !important;
  border-color: hsla(142, 71%, 45%, 0.3) !important;
  color: var(--foreground) !important;
}
/* Hardcoded card backgrounds */
[style*="background: #f3f4f6"],
[style*="background:#f3f4f6"],
[style*="background: #f9fafb"],
[style*="background:#f9fafb"],
[style*="background: white"],
[style*="background:white"] {
  background: var(--surface) !important;
}
/* Hardcoded text colors conflicting with dark mode */
[style*="color: #991B1B"] { color: var(--destructive) !important; }
[style*="color: #065F46"] { color: var(--success) !important; }

/* ───────────── LAYOUT ───────────── */
.page-container { min-height: 100vh; display: flex; flex-direction: column; }
.hover-underline:hover { text-decoration: underline; }

/* ───────────── ANIMATION ───────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.4s ease-out forwards; }

/* ───────────── SCROLLBAR ───────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* ───────────── PRINT ───────────── */
@media print {
  @page { margin: 12mm 15mm; size: A4 landscape; }
  .no-print, .no-print * { display: none !important; }
  .print-only { display: block !important; }

  html, body { background: white !important; color: #000 !important; font-size: 10px !important; }
  aside, nav, footer { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; }

  .card, [class*="rounded"], [class*="border"] {
    background: white !important; border-color: #d1d5db !important; box-shadow: none !important;
  }
  .badge, [class^="badge-"] {
    background: transparent !important; border: 1px solid #6b7280 !important; color: #000 !important;
    font-size: 9px !important; padding: 1px 5px !important; border-radius: 3px !important;
  }
  table { width: 100% !important; border-collapse: collapse !important; }
  thead { display: table-header-group; }
  th {
    background: white !important; color: #000 !important;
    border-top: 2px solid #000 !important; border-bottom: 2px solid #000 !important;
    font-size: 8px !important; font-weight: 700 !important; text-transform: uppercase !important;
    letter-spacing: 0.6px !important; padding: 4px 6px !important; white-space: nowrap !important;
  }
  td {
    background: white !important; color: #000 !important;
    border-bottom: 1px solid #e5e7eb !important; font-size: 10px !important; padding: 4px 6px !important;
  }
  tbody tr:nth-child(even) td { background: #f9fafb !important; }
  .print-header {
    display: flex !important; justify-content: space-between; align-items: flex-end;
    border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px;
  }
  .print-header h2 { font-size: 16px !important; font-weight: 800; color: #000; }
  .print-header p  { font-size: 10px !important; color: #6b7280; margin-top: 2px; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE & TABLET
   ═══════════════════════════════════════════════════════ */

/* ── Mobile header (hamburger bar) ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid hsla(0,0%,100%,0.07);
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 900;
}
.mobile-header-brand {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sidebar-fg);
}
.hamburger-btn {
  background: none;
  border: none;
  color: var(--sidebar-fg);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.hamburger-btn:hover { background: hsla(0,0%,100%,0.1); }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Tablet: 769px – 1024px ── */
@media (max-width: 1024px) {
  #admin-sidebar {
    width: 200px !important;
  }
  #admin-main {
    padding: 1.5rem;
  }
}

/* ── Mobile: ≤ 768px ── */
@media (max-width: 768px) {
  /* Mostrar header móvil */
  .mobile-header { display: flex; }

  /* Sidebar como drawer lateral */
  #admin-sidebar {
    position: fixed !important;
    top: 0; left: 0;
    height: 100vh;
    width: 260px !important;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }
  #admin-sidebar.mobile-open {
    transform: translateX(0);
  }
  /* Ocultar botón de collapse en mobile (usamos hamburguesa) */
  .collapse-btn { display: none !important; }

  /* Main empieza debajo del header móvil */
  #admin-main {
    padding: 1rem;
    padding-top: calc(56px + 1rem);
    margin-left: 0 !important;
  }

  /* Stat cards: 2 columnas en mobile */
  [style*="grid-template-columns:repeat(auto-fit,minmax(160px"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(160px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Alert/info grids: 1 columna */
  [style*="grid-template-columns:repeat(auto-fit,minmax(360px"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(360px"] {
    grid-template-columns: 1fr !important;
  }

  /* Tablas con scroll horizontal */
  .data-table-wrapper,
  [style*="overflow-x: auto"],
  section.glass-panel {
    overflow-x: auto !important;
  }
  table {
    min-width: 500px;
  }

  /* Cards: reducir padding */
  .card-body { padding: 0 1rem 1rem; }
  .card-header { padding: 0.875rem 1rem 0.625rem; }

  /* Modales fullscreen en mobile */
  [id$="-modal"] > div,
  .side-drawer {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }
  /* Side drawers: ocupa toda la pantalla verticalmente */
  .side-drawer {
    height: 100% !important;
    top: 0 !important;
    right: 0 !important;
  }

  /* Botones: texto más pequeño */
  .btn { font-size: 0.8rem; padding: 0.45rem 0.875rem; }
  .btn-sm { font-size: 0.75rem; padding: 0.25rem 0.6rem; }

  /* Ocultar textos secundarios en tablas muy apretadas */
  .td-small { font-size: 0.72rem; }

  /* Filtros en columna */
  header [style*="display: flex"],
  header [style*="display:flex"] {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  /* Formularios: 1 columna */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Extra small: ≤ 480px ── */
@media (max-width: 480px) {
  /* Stat cards: 1 columna en pantallas muy chicas */
  [style*="grid-template-columns:repeat(auto-fit,minmax(160px"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(160px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .stat-card { padding: 0.875rem; }
  .stat-value { font-size: 1.4rem; }
  .stat-icon { padding: 0.6rem; }
  .stat-icon svg { width: 18px; height: 18px; }

  #admin-main { padding: 0.75rem; padding-top: calc(56px + 0.75rem); }

  /* Esconder columnas menos importantes en tablas */
  .td-hide-xs { display: none !important; }
}

