@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --background: oklch(0.97 0.003 264.5);
  --foreground: oklch(0.18 0.019 255.8);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.18 0.019 255.8);
  --primary: oklch(0.601 0.19 257.9);
  --primary-foreground: oklch(1 0 0);
  --secondary: oklch(0.939 0.005 258.3);
  --secondary-foreground: oklch(0.279 0.021 257.3);
  --muted: oklch(0.95 0.004 236.5);
  --muted-foreground: oklch(0.479 0.02 256.3);
  --accent: oklch(0.921 0.029 257.8);
  --accent-foreground: oklch(0.323 0.138 260.8);
  --destructive: oklch(0.621 0.22 24.9);
  --destructive-foreground: oklch(1 0 0);
  --success: oklch(0.62 0.17 145);
  --border: oklch(0.899 0.006 255.5);
  --input: oklch(0.921 0.005 247.9);
  --ring: oklch(0.601 0.19 257.9);
  --sidebar: oklch(0.95 0.004 236.5);
  --sidebar-foreground: oklch(0.18 0.019 255.8);
  --sidebar-primary: oklch(0.601 0.19 257.9);
  --sidebar-primary-foreground: oklch(1 0 0);
  --sidebar-accent: oklch(0.921 0.029 257.8);
  --sidebar-accent-foreground: oklch(0.323 0.138 260.8);
  --sidebar-border: oklch(0.899 0.006 255.5);
  --radius: 1.5rem;
  --radius-sm: 1rem;
  --radius-lg: 1.75rem;
  --shadow-sm: 0 2px 28px 0 hsl(215 11% 34% / 0.08);
  --shadow: 0 2px 28px 0 hsl(215 11% 34% / 0.1), 0 1px 2px -1px hsl(215 11% 34% / 0.08);
  --shadow-lg: 0 4px 40px 0 hsl(215 11% 34% / 0.12);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", "Menlo", "Consolas", monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* legacy aliases */
  --bg: var(--background);
  --text: var(--foreground);
  --blue: var(--primary);
  --green: var(--success);
  --red: var(--destructive);
  --line: var(--border);
}

.dark {
  --background: oklch(0.149 0.009 264);
  --foreground: oklch(0.96 0.003 248);
  --card: oklch(0.199 0.011 260.7);
  --card-foreground: oklch(0.96 0.003 248);
  --primary: oklch(0.65 0.189 257.7);
  --primary-foreground: oklch(0.12 0.01 253);
  --secondary: oklch(0.241 0.01 248.2);
  --secondary-foreground: oklch(0.901 0.011 248);
  --muted: oklch(0.221 0.009 255.6);
  --muted-foreground: oklch(0.681 0.019 245.5);
  --accent: oklch(0.28 0.06 257.7);
  --accent-foreground: oklch(0.844 0.08 251);
  --destructive: oklch(0.679 0.21 22);
  --border: oklch(0.28 0.01 260.7);
  --input: oklch(0.28 0.01 260.7);
  --ring: oklch(0.65 0.189 257.7);
  --sidebar: oklch(0.181 0.01 255.6);
  --sidebar-foreground: oklch(0.96 0.003 248);
  --sidebar-primary: oklch(0.65 0.189 257.7);
  --sidebar-primary-foreground: oklch(0.12 0.01 253);
  --sidebar-accent: oklch(0.28 0.06 257.7);
  --sidebar-accent-foreground: oklch(0.844 0.08 251);
  --sidebar-border: oklch(0.259 0.01 260.7);
  --shadow-sm: 0 4px 40px 0 hsl(0 0% 0% / 0.25);
  --shadow: 0 4px 40px 0 hsl(0 0% 0% / 0.35);
  --shadow-lg: 0 8px 48px 0 hsl(0 0% 0% / 0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.47;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: color-mix(in oklch, var(--primary) 20%, transparent); color: var(--primary); }

/* Buttons */
.btn {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 12px 22px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow:
    0 1px 0 color-mix(in oklch, #fff 25%, transparent) inset,
    0 8px 20px color-mix(in oklch, var(--primary) 28%, transparent);
  transition:
    transform 0.22s var(--ease-out),
    box-shadow 0.22s var(--ease),
    background 0.22s var(--ease),
    filter 0.22s var(--ease);
}
.btn::before {
  content: "";
  position: absolute;
  inset: -40% auto -40% -30%;
  width: 40%;
  background: linear-gradient(90deg, transparent, color-mix(in oklch, #fff 35%, transparent), transparent);
  transform: translateX(-120%) skewX(-18deg);
  transition: transform 0.55s var(--ease-out);
  pointer-events: none;
}
.btn:hover::before { transform: translateX(320%) skewX(-18deg); }
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in oklch, #fff 18%, transparent), transparent 45%);
  pointer-events: none;
  opacity: 0.9;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.05);
  box-shadow:
    0 1px 0 color-mix(in oklch, #fff 32%, transparent) inset,
    0 14px 32px color-mix(in oklch, var(--primary) 40%, transparent);
}
.btn:active {
  transform: translateY(0) scale(0.98);
  filter: brightness(0.98);
  box-shadow: 0 4px 12px color-mix(in oklch, var(--primary) 22%, transparent);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}
.btn:disabled::before { display: none; }
.btn.ghost {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  box-shadow: none;
  font-weight: 550;
  border-radius: 999px;
}
.btn.ghost::after,
.btn.ghost::before { display: none; }
.btn.ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: color-mix(in oklch, var(--primary) 25%, var(--border));
  box-shadow: var(--shadow-sm);
  filter: none;
}
.btn.ok {
  background: var(--success);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in oklch, var(--success) 28%, transparent);
}
.btn.ok:hover {
  box-shadow: 0 12px 28px color-mix(in oklch, var(--success) 36%, transparent);
}
.btn.danger {
  background: transparent;
  color: var(--destructive);
  border: 1px solid color-mix(in oklch, var(--destructive) 35%, transparent);
  box-shadow: none;
  font-weight: 500;
  border-radius: 999px;
}
.btn.danger::after,
.btn.danger::before { display: none; }
.btn.danger:hover {
  background: color-mix(in oklch, var(--destructive) 10%, transparent);
  filter: none;
  box-shadow: none;
}
.btn.block { width: 100%; border-radius: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* Cards */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.28s var(--ease), box-shadow 0.28s var(--ease), transform 0.28s var(--ease-out);
}
.card:hover {
  border-color: color-mix(in oklch, var(--primary) 32%, var(--border));
  box-shadow: var(--shadow-md, var(--shadow));
  transform: translateY(-2px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s, transform 0.25s;
}
.stat:hover { border-color: color-mix(in oklch, var(--primary) 35%, var(--border)); transform: translateY(-2px); }
.stat .n { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.stat .l {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* Forms */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  margin-bottom: 12px;
}
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--foreground);
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: 14px;
  box-shadow: 0 1px 0 color-mix(in oklch, #fff 40%, transparent) inset;
  transition:
    border-color 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    transform 0.22s var(--ease-out),
    background 0.22s var(--ease);
}
html.dark input,
html.dark select,
html.dark textarea,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  box-shadow: 0 1px 0 color-mix(in oklch, #fff 6%, transparent) inset;
}
input:hover, select:hover, textarea:hover {
  border-color: color-mix(in oklch, var(--primary) 28%, var(--border));
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ring);
  background: color-mix(in oklch, var(--primary) 4%, var(--card));
  transform: translateY(-1px);
  box-shadow:
    0 0 0 4px color-mix(in oklch, var(--ring) 18%, transparent),
    0 10px 24px color-mix(in oklch, var(--primary) 12%, transparent);
}
input::placeholder, textarea::placeholder {
  color: color-mix(in oklch, var(--muted-foreground) 75%, transparent);
  transition: opacity 0.2s;
}
input:focus::placeholder, textarea:focus::placeholder {
  opacity: 0.45;
}
select {
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%),
    linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
textarea { min-height: 88px; resize: vertical; }

/* Checkboxes */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  border-radius: 6px;
  border: 2px solid color-mix(in oklch, var(--muted-foreground) 45%, var(--border));
  background: var(--card);
  box-shadow: none;
  cursor: pointer;
  transform: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
input[type="checkbox"]:hover {
  border-color: var(--primary);
  transform: none;
  box-shadow: none;
}
input[type="checkbox"]:focus {
  outline: none;
  transform: none;
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--ring) 18%, transparent);
}
input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 0.18s var(--ease-out);
  box-shadow: inset 1em 1em #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
}
input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
input[type="checkbox"]:checked::before { transform: scale(1); }
.s8-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--foreground);
  cursor: pointer;
}
.s8-check input[type="checkbox"] { flex-shrink: 0; }

/* Verify search field */
.input-glow {
  position: relative;
}
.input-glow::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.25s, transform 0.25s var(--ease-out);
  pointer-events: none;
}
.input-glow:focus-within::after {
  opacity: 1;
  transform: scaleX(1);
}

.stack { display: grid; gap: 6px; }

/* ── Alerts / toasts ── */
.alert {
  position: relative;
  border-radius: var(--radius-sm);
  padding: 14px 16px 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  animation: alertSlide 0.4s var(--ease-out);
}
.alert::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--border);
}
@keyframes alertSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.alert.ok {
  background: color-mix(in oklch, var(--success) 10%, var(--card));
  color: color-mix(in oklch, var(--success) 78%, var(--foreground));
  border-color: color-mix(in oklch, var(--success) 22%, var(--border));
}
.alert.ok::before { background: var(--success); }
.alert.err {
  background: color-mix(in oklch, var(--destructive) 9%, var(--card));
  color: color-mix(in oklch, var(--destructive) 75%, var(--foreground));
  border-color: color-mix(in oklch, var(--destructive) 22%, var(--border));
}
.alert.err::before { background: var(--destructive); }
.alert.info {
  background: color-mix(in oklch, var(--primary) 9%, var(--card));
  color: var(--primary);
  border-color: color-mix(in oklch, var(--primary) 22%, var(--border));
}
.alert.info::before { background: var(--primary); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}
code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Estado: rojo rechazado · amarillo en proceso · verde registrado */
.st-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}
.st-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.st-badge.st-ok {
  color: color-mix(in oklch, var(--success) 85%, var(--foreground));
  background: color-mix(in oklch, var(--success) 12%, var(--card));
  border-color: color-mix(in oklch, var(--success) 28%, var(--border));
}
.st-badge.st-warn {
  color: #b45309;
  background: color-mix(in oklch, #f59e0b 14%, var(--card));
  border-color: color-mix(in oklch, #f59e0b 30%, var(--border));
}
html.dark .st-badge.st-warn,
[data-theme="dark"] .st-badge.st-warn {
  color: #fbbf24;
}
.st-badge.st-err {
  color: color-mix(in oklch, var(--destructive) 80%, var(--foreground));
  background: color-mix(in oklch, var(--destructive) 12%, var(--card));
  border-color: color-mix(in oklch, var(--destructive) 28%, var(--border));
}
.st-badge.st-pulse::before {
  animation: stPulse 1s ease-in-out infinite;
}
@keyframes stPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}
#ecidLiveStatus { min-height: 28px; margin: 0 0 10px; }

/* Recargas / ECID panels */
.panel-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.panel-window {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
}
.panel-window-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-window-head h2 { margin: 0 0 6px; }
.panel-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-recargas {
  border-color: color-mix(in oklch, #f59e0b 28%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in oklch, #f59e0b 7%, var(--card)), var(--card));
}
.panel-ecids {
  border-color: color-mix(in oklch, var(--primary) 28%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in oklch, var(--primary) 8%, var(--card)), var(--card));
}
a.panel-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.2s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
}
a.panel-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
a.panel-link h2 { margin: 0 0 8px; }
.panel-link-cta {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 650;
  color: var(--primary);
}

/* ── Typography helpers ── */
.brand {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 14px; }
.muted { color: var(--muted-foreground); font-size: 14px; }

.packs { display: grid; gap: 10px; }
.pack {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
}
.pack input[type="radio"] {
  flex-shrink: 0;
  margin: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.pack > div { min-width: 0; flex: 1; }
.pack:hover {
  border-color: color-mix(in oklch, var(--primary) 35%, var(--border));
  background: color-mix(in oklch, var(--primary) 5%, var(--card));
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.pack:has(input:checked) {
  border-color: color-mix(in oklch, var(--primary) 55%, var(--border));
  background: color-mix(in oklch, var(--primary) 10%, var(--card));
  box-shadow: var(--shadow);
}
.pack strong { display: block; font-size: 15px; font-weight: 600; }
.pack span { color: var(--muted-foreground); font-size: 13px; }

/* Emails largos: no rompen layout */
.email-clip,
.cell-email {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.email-block {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

/* ── Dashboard layout ── */
.dash { display: flex; min-height: 100vh; }

.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width 0.3s var(--ease);
  z-index: 40;
}
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-footer-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }

.sidebar-head {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--sidebar-primary);
  color: var(--sidebar-primary-foreground);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.sidebar-brand-text span {
  display: block;
  font-size: 11px;
  color: var(--muted-foreground);
}

.sidebar-toggle {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.sidebar-toggle:hover { background: var(--sidebar-accent); color: var(--sidebar-foreground); }

.sidebar-nav { padding: 12px; }
.sidebar-label {
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: color-mix(in oklch, var(--sidebar-foreground) 85%, transparent);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.nav-item:hover { text-decoration: none; background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.nav-item.active {
  background: var(--sidebar-primary);
  color: var(--sidebar-primary-foreground);
  box-shadow: var(--shadow-sm);
}
.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-foot-card {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--sidebar-accent) 50%, transparent);
  border: 1px solid var(--sidebar-border);
  font-size: 12px;
}
.sidebar-foot-card strong { display: block; font-weight: 600; }
.sidebar-foot-card span { color: var(--muted-foreground); }

.theme-toggle,
.theme-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover,
.theme-switch:hover { background: var(--sidebar-accent); }

/* Theme switch */
.theme-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted-foreground) 32%, var(--muted));
  box-shadow: inset 0 1px 4px hsl(0 0% 0% / 0.14);
  transition: background 0.28s var(--ease-out);
}
.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 2px hsl(0 0% 0% / 0.18),
    0 4px 10px hsl(0 0% 0% / 0.12);
  transition: transform 0.28s var(--ease-out), background 0.28s;
}
html.dark .theme-switch-track,
[data-theme="dark"] .theme-switch-track {
  background: var(--primary);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--primary) 40%, transparent);
}
html.dark .theme-switch-thumb,
[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(20px);
}
.theme-switch .nav-icon { display: none; }
.auth-top .theme-toggle,
.auth-top .theme-switch {
  width: auto;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.auth-top .theme-switch [data-theme-label] {
  font-size: 12px;
  color: var(--muted-foreground);
}
.nav-links .theme-switch {
  width: auto;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  gap: 8px;
}
.nav-links .theme-switch:hover { background: var(--accent); }
.nav-links .theme-switch [data-theme-label] {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}
@media (max-width: 680px) {
  .nav-links .theme-switch [data-theme-label] { display: none; }
}

.dash-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.dash-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-header > div:first-child {
  min-width: 0;
  flex: 1 1 200px;
}
.dash-header h1 { margin: 0; overflow-wrap: anywhere; }
.dash-header .muted { margin-top: 2px; font-size: 13px; }
.dash-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

.dash-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.dash-content section[id] { scroll-margin-top: 88px; }

.mobile-nav-btn {
  display: none;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.4);
  z-index: 35;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .mobile-nav-btn { display: grid; place-items: center; }
  .sidebar-toggle { display: none; }
  .dash-content { padding: 16px; }
}

/* ── Auth pages ── */
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, color-mix(in oklch, var(--primary) 12%, transparent), transparent 55%),
    var(--background);
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  animation: authIn 0.45s var(--ease-out);
  overflow: hidden;
  transition: box-shadow 0.5s var(--ease-out), border-color 0.5s var(--ease-out);
}
/* Auth loading state — spinner styles viven en includes/auth_loader.php */
.auth-card.is-loading {
  border-color: color-mix(in oklch, var(--foreground) 8%, var(--border));
  box-shadow: var(--shadow-lg);
}
.auth-body {
  transition:
    opacity 0.38s var(--ease-out),
    transform 0.38s var(--ease-out);
}
.auth-card.is-loading .auth-body {
  opacity: 0;
  transform: translateY(-6px) scale(0.99);
  pointer-events: none;
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-links { margin-top: 18px; text-align: center; font-size: 14px; color: var(--muted-foreground); }
.auth-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

