/* public/styles.css */
/* ============================================
   TEMAS — noche (por defecto) y día
   Activar modo día añadiendo data-theme="light" en <html>
   Activar modo auto siguiendo prefers-color-scheme
   ============================================ */
:root,
html,
html[data-theme="dark"] {
  --bg: #0f172a;
  --bg-2: #0b1220;
  --panel: #1e293b;
  --panel-2: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-bg: rgba(16,185,129,0.15);
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #475569;
  --shadow: 0 10px 30px rgba(0,0,0,0.3);
  --highlight: rgba(59,130,246,0.15);
  --hover-row: rgba(255,255,255,0.05);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-2: #e2e8f0;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --success-bg: rgba(5,150,105,0.10);
  --danger: #dc2626;
  --warning: #d97706;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --shadow: 0 4px 14px rgba(15,23,42,0.08);
  --highlight: rgba(37,99,235,0.10);
  --hover-row: rgba(15,23,42,0.04);
  color-scheme: light;
}

html[data-theme="auto"] {
  color-scheme: light dark;
}
@media (prefers-color-scheme: light) {
  html[data-theme="auto"] {
    --bg: #f1f5f9;
    --bg-2: #e2e8f0;
    --panel: #ffffff;
    --panel-2: #f1f5f9;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --success-bg: rgba(5,150,105,0.10);
    --danger: #dc2626;
    --warning: #d97706;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --shadow: 0 4px 14px rgba(15,23,42,0.08);
    --highlight: rgba(37,99,235,0.10);
    --hover-row: rgba(15,23,42,0.04);
  }
}

/* Smooth transition entre temas */
body, .card, .panel, .app-header, .tabs button, table th, table td,
input, select, textarea, .btn, .badge {
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- LOGIN ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #581c87 100%);
  padding: 1rem;
}

.login-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
}

.brand { text-align: center; margin-bottom: 2rem; }
.brand .logo { font-size: 4rem; margin-bottom: 0.5rem; }
.brand h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.brand .subtitle { color: var(--text-muted); font-size: 0.875rem; }

.login-form label { display: block; margin-bottom: 1rem; }
.login-form label span { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.login-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}
.login-form input:focus { outline: none; border-color: var(--primary); }

.credentials-hint {
  margin-top: 1.5rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.error { color: var(--danger); font-size: 0.875rem; margin-top: 0.5rem; min-height: 1.25rem; }

/* ---------- LAYOUT ---------- */
header.app-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header.app-header h1 {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.connection-status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}
.connection-status.connected { background: var(--success); animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

main { padding: 1.5rem 2rem; max-width: 1600px; margin: 0 auto; }

/* ---------- BOTONES (sistema unificado) ---------- */
.btn {
  /* Base */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  /* Efectos */
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.btn:hover { transform: translateY(-1.5px); box-shadow: 0 6px 16px rgba(0,0,0,0.28); }
.btn:active { transform: translateY(0.5px); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.btn:focus-visible { outline: 3px solid rgba(59,130,246,0.45); outline-offset: 2px; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; box-shadow: none; transform: none; }

/* Primary */
.btn-primary { background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%); color: #fff; }
.btn-primary:hover { background: linear-gradient(180deg, #4b8ff7 0%, #1e6cd8 100%); }
.btn-primary:active { background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%); }

/* Secondary (neutral, puede ir sobre fondo claro) */
.btn-secondary { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #475569; border-color: #64748b; }
.btn-secondary.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Success */
.btn-success { background: linear-gradient(180deg, #10b981 0%, #059669 100%); color: #fff; }
.btn-success:hover { background: linear-gradient(180deg, #34d399 0%, #0c8464 100%); }

/* Danger */
.btn-danger { background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%); color: #fff; }
.btn-danger:hover { background: linear-gradient(180deg, #f87171 0%, #b91c1c 100%); }

/* Warning */
.btn-warning { background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%); color: #fff; }
.btn-warning:hover { background: linear-gradient(180deg, #fbbf24 0%, #b45309 100%); }

/* Info (azul claro) */
.btn-info { background: linear-gradient(180deg, #06b6d4 0%, #0891b2 100%); color: #fff; }
.btn-info:hover { background: linear-gradient(180deg, #22d3ee 0%, #0e7490 100%); }

/* Ghost (transparente) */
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); box-shadow: none; }
.btn-ghost:hover { background: var(--panel-2); border-color: var(--text-muted); }

/* Outline */
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); box-shadow: none; }
.btn-outline:hover { background: rgba(59,130,246,0.1); }

/* Variantes de tamaño */
.btn-xs { padding: 0.3rem 0.6rem; font-size: 0.75rem; border-radius: 6px; }
.btn-sm  { padding: 0.45rem 0.85rem; font-size: 0.8rem; border-radius: 6px; }
.btn-lg  { padding: 0.85rem 1.6rem; font-size: 1.05rem; border-radius: 10px; }
.btn-block { display: flex; width: 100%; }

/* Forma circular para badges */
.btn-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  padding: 0;
  font-size: 1rem;
}

/* Indicador de pulsado/cargando */
.btn.is-loading { pointer-events: none; opacity: 0.8; }
.btn.is-loading::after {
  content: '';
  width: 0.9em; height: 0.9em;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: btn-spinner 0.7s linear infinite;
  margin-left: 0.35rem;
}
@keyframes btn-spinner { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Botón con icono */
.btn .btn-icon { width: 1.1em; height: 1.1em; display: inline-block; vertical-align: middle; }

.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  background: var(--panel);
  padding: 0.55rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 60px;
  z-index: 5;
  scrollbar-width: thin;
}
.tabs button {
  padding: 0.55rem 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, transform 0.15s, border-color 0.2s;
}
.tabs button:hover { color: var(--text); transform: translateY(-1px); }
.tabs button:focus-visible { outline: 3px solid rgba(59,130,246,0.45); outline-offset: 2px; }
/* ---------- THEME TOGGLE ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  user-select: none;
  position: relative;
}
.theme-toggle:hover {
  background: var(--panel-2);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}
.theme-toggle:active { transform: translateY(0); }
.theme-toggle .icon { font-size: 1.1rem; }
.theme-toggle .label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.02em; }

.theme-toggle-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 180px;
  padding: 0.4rem;
  z-index: 300;
  display: none;
  overflow: hidden;
}
.theme-toggle-menu.open { display: block; }
.theme-toggle-menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
  text-align: left;
}
.theme-toggle-menu button:hover { background: var(--panel-2); }
.theme-toggle-menu button.active {
  background: var(--highlight);
  color: var(--primary);
  font-weight: 600;
}
.theme-toggle-menu button .check {
  margin-left: auto;
  opacity: 0;
}
.theme-toggle-menu button.active .check { opacity: 1; }

/* ---------- TABS ACTIVE STATE ---------- */
.tabs button.active {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}

/* ---------- TARJETAS / PANELES ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--panel);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border);
}
.card .label { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.card .value { font-size: 2rem; font-weight: 700; }
.card .sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.25rem; }
.card.success { border-color: var(--success); }
.card.warning { border-color: var(--warning); }
.card.primary { border-color: var(--primary); }

.panel {
  background: var(--panel);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}
.panel h2 { margin-bottom: 1rem; font-size: 1.15rem; }

/* ---------- TABLAS ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table th, table td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table th {
  background: var(--panel-2);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
}
table tr:hover td { background: var(--panel-2); }
table tr.voted td { color: var(--success); }
table tr.unvoted td { color: var(--text-muted); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.voted { background: rgba(16,185,129,0.2); color: var(--success); }
.badge.unvoted { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.badge.validated { background: rgba(16,185,129,0.2); color: var(--success); }
.badge.pending { background: rgba(245,158,11,0.2); color: var(--warning); }

/* ---------- INPUTS ---------- */
input[type="text"], input[type="search"], input[type="number"], input[type="date"], select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.form-row > * { flex: 1; min-width: 200px; }

/* ---------- BARRA PROGRESO ---------- */
.progress-bar {
  background: var(--bg);
  border-radius: 8px;
  height: 24px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.progress-bar > div {
  background: linear-gradient(90deg, var(--primary), var(--success));
  height: 100%;
  transition: width 0.5s ease;
}
.progress-bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* ---------- TABS ---------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tabs button {
  /* duplicado eliminado — estilos definidos arriba */
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- RECUENTO ---------- */
.recuento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}
.recuento-field { display: flex; flex-direction: column; }
.recuento-field label { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.4rem; }
.recuento-field input { font-size: 1.1rem; font-weight: 600; text-align: center; }

/* ---------- DHONDT RESULTADOS ---------- */
.dhondt-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.dhondt-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  border-top: 4px solid var(--primary);
}
.dhondt-card .partido { font-size: 0.9rem; color: var(--text-muted); }
.dhondt-card .concejales { font-size: 2.5rem; font-weight: 800; margin: 0.5rem 0; }
.dhondt-card .votos { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- MODAL ---------- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--panel);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 1rem; }
.modal .actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ---------- LIVE BANNER (banner destacado arriba) ---------- */
.live-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* ---------- MOBILE FRIENDLY ---------- */
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

.cards-grid-mobile {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.cards-grid-mobile .card.big { padding: 1rem; }
.cards-grid-mobile .card.big .value { font-size: 2rem; }
.cards-grid-mobile .card.big .label { font-size: 0.85rem; }

.progress-bar.big-bar { height: 32px; font-size: 1rem; }
.progress-bar.big-bar #progress-text { font-size: 1rem; }

@media (max-width: 768px) {
  .app-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 1rem; }
  .app-header h1 { font-size: 1.1rem; }
  .user-info { gap: 0.5rem; }
  .cards-grid, .cards-grid-mobile { grid-template-columns: 1fr !important; gap: 0.5rem; }
  .cards-grid-mobile .card.big .value { font-size: 2.5rem; }
  .dhondt-results { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  /* Tablas en scroll horizontal en móvil */
  table { display: block; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 0.5rem 0.75rem !important; font-size: 0.85rem; }
  /* Modal full-width en móvil */
  .modal { width: 95vw !important; max-width: none !important; max-height: 90vh; overflow-y: auto; padding: 1rem; }
  /* Inputs más grandes (touch-friendly) */
  input, textarea, select { font-size: 16px !important; } /* evitar zoom en iOS */
  /* Login más compacto */
  .login-card { padding: 1.5rem; }
  .login-card h1 { font-size: 1.3rem; }
  /* Header reducido */
  main { padding: 0.75rem; }
  /* Cards-grid-admin adaptable */
  .cards-grid:not(.cards-grid-mobile) { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .cards-grid-mobile .card.big { padding: 0.75rem; }
  .cards-grid-mobile .card.big .value { font-size: 1.75rem; }
  .live-banner { padding: 0.75rem; }
  .live-banner > div > div:last-child { font-size: 1.1rem !important; }
}

/* Para tablets en horizontal, mantener grid de 3 columnas */
@media (min-width: 769px) and (max-width: 1024px) {
  .cards-grid-mobile { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- NOTIFICACIÓN ---------- */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  background: var(--success);
  color: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 2000;
  animation: slideIn 0.3s ease;
}
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(120%); }
  to { transform: translateX(0); }
}

/* ---------- TOP BAR + NOTIFICACIONES ---------- */
header.app-header {
  background: var(--panel);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  position: sticky; top: 0; z-index: 10;
}
header.app-header h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
header.app-header .user-info { display: flex; align-items: center; gap: 0.6rem; }

/* Bell icon con badge */
.notif-bell {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.notif-bell:hover { background: var(--panel-2); transform: translateY(-1px); border-color: var(--border); }
.notif-bell .notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--panel);
  transform: translate(20%, -20%);
}
.notif-bell .notif-badge.hidden { display: none; }

/* Dropdown panel para notificaciones */
.notif-panel {
  position: absolute;
  top: 100%; right: 0;
  width: 360px; max-width: calc(100vw - 2rem);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  z-index: 100;
  margin-top: 0.5rem;
}
.notif-panel .head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.notif-panel .head strong { font-size: 0.95rem; }
.notif-panel .empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.notif-panel ul { list-style: none; padding: 0; margin: 0; }
.notif-panel ul li {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.notif-panel ul li:hover { background: var(--panel-2); }
.notif-panel ul li.unread { background: rgba(59,130,246,0.08); border-left: 3px solid var(--primary); }
.notif-panel ul li .title { font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.notif-panel ul li .body { color: var(--text-muted); font-size: 0.8rem; }
.notif-panel ul li .time { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.3rem; }

/* Botones extra */
.btn-tiny { padding: 0.2rem 0.45rem; font-size: 0.7rem; border-radius: 4px; }

/* Skeleton spinner */
.skeleton-loading {
  width: 24px; height: 24px;
  border: 3px solid var(--text-muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spinner 0.8s linear infinite;
  display: inline-block;
}

/* Toast sweet */
.toast {
  position: fixed;
  top: 1rem; right: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 200;
  max-width: 380px;
  animation: toastIn 0.25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) translateX(20px); }
  to { opacity: 1; transform: none; }
}

/* Modal base */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 150;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  padding: 1.5rem 1.75rem;
  width: 100%;
  max-width: 600px;
  border: 1px solid var(--border);
}
.modal h3 { margin-bottom: 0.75rem; font-weight: 700; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  header.app-header { padding: 0.75rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  main { padding: 1rem; }
  .card .value { font-size: 1.5rem; }
  .notif-panel { right: -1rem; width: calc(100vw - 1rem); }
  .btn { padding: 0.55rem 1rem; font-size: 0.85rem; }
}