/* =========================================================
   URBALIMP – Sistema Digital de Pañol
   main.css – Dark Mode Profesional v2.0
   ========================================================= */

/* ─── Google Fonts ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── CSS Custom Properties (Tema Oscuro) ──────────────── */
:root {
  /* Tipografía */
  --font-family: 'Inter', 'Roboto', sans-serif;

  /* Fondos principales */
  --bg-color:      #0d1117;   /* Fondo raíz - GitHub dark */
  --panel-bg:      #161b22;   /* Tarjetas / paneles */
  --panel-bg-2:    #1c2128;   /* Paneles secundarios */
  --panel-bg-3:    #21262d;   /* Hover states */
  --sidebar-bg:    #0d1117;   /* Sidebar */

  /* Textos */
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;

  /* Bordes */
  --border-color:   #21262d;
  --border-light:   #30363d;

  /* Colores de marca */
  --primary-color:  #2f81f7;
  --primary-hover:  #1f6feb;
  --primary-dim:    rgba(47,129,247,0.12);

  /* Sidebar */
  --sidebar-color:  #8b949e;
  --sidebar-hover:  #161b22;
  --sidebar-active: #1c2128;
  --sidebar-border: #21262d;

  /* Header */
  --header-bg:          #161b22;
  --header-border:      #21262d;
  --search-bg:          #0d1117;
  --search-border:      #30363d;
  --search-text:        #e6edf3;
  --search-placeholder: #484f58;

  /* Tablas */
  --table-header-bg:  #0d1117;
  --table-row-bg:     #161b22;
  --table-row-alt:    #1c2128;
  --table-row-hover:  #1c2f4a;
  --table-text:       #c9d1d9;
  --table-border:     #21262d;

  /* Inputs / formularios */
  --input-bg:         #0d1117;
  --input-border:     #30363d;
  --input-focus:      #2f81f7;
  --input-text:       #e6edf3;
  --input-placeholder:#484f58;

  /* Estados / badges */
  --status-green:    #3fb950;
  --status-green-bg: rgba(63,185,80,0.10);
  --status-red:      #f85149;
  --status-red-bg:   rgba(248,81,73,0.12);
  --status-yellow:   #d29922;
  --status-yellow-bg:rgba(187,128,9,0.15);
  --status-orange:   #db6d28;
  --status-orange-bg:rgba(219,109,40,0.12);
  --status-gray:     #6e7681;
  --status-gray-bg:  rgba(110,118,129,0.12);
  --status-dark-red: #b91c1c;
  --status-dark-red-bg: rgba(185,28,28,0.15);

  /* Roles */
  --role-admin:    #8957e5;
  --role-panolero: #0ea5e9;
  --role-lectura:  #6e7681;

  /* Sombras */
  --shadow-sm:  0 1px 4px rgba(1,4,9,0.5);
  --shadow-md:  0 4px 16px rgba(1,4,9,0.6);
  --shadow-lg:  0 10px 30px rgba(1,4,9,0.7);
  --shadow-xl:  0 20px 50px rgba(1,4,9,0.8);

  /* Bordes radios */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transición */
  --transition: 0.2s ease;
}

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

/* ─── Base Body ─────────────────────────────────────────── */
body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Scrollbar (Webkit) ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ═══════════════════════════════════════════════════════════
   UTILIDADES DE COLOR / TEXTO
═══════════════════════════════════════════════════════════ */
.text-green     { color: var(--status-green); }
.text-red       { color: var(--status-red); }
.text-yellow    { color: var(--status-yellow); }
.text-orange    { color: var(--status-orange); }
.text-gray      { color: var(--status-gray); }
.text-dark-red  { color: var(--status-dark-red); }
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-c { color: var(--text-primary); }
.text-blue      { color: var(--primary-color); }

/* Badges de color semitransparente (pill) */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-green    { background: var(--status-green-bg);    color: var(--status-green);    border: 1px solid rgba(63,185,80,0.3); }
.badge-red      { background: var(--status-red-bg);      color: var(--status-red);      border: 1px solid rgba(248,81,73,0.3); }
.badge-yellow   { background: var(--status-yellow-bg);   color: var(--status-yellow);   border: 1px solid rgba(210,153,34,0.4); }
.badge-orange   { background: var(--status-orange-bg);   color: var(--status-orange);   border: 1px solid rgba(219,109,40,0.3); }
.badge-gray     { background: var(--status-gray-bg);     color: var(--status-gray);     border: 1px solid rgba(110,118,129,0.3); }
.badge-dark-red { background: var(--status-dark-red-bg); color: #f87171;                border: 1px solid rgba(185,28,28,0.4); }
.badge-primary  { background: var(--primary-dim);        color: var(--primary-color);   border: 1px solid rgba(47,129,247,0.3); }
.badge-purple   { background: rgba(137,87,229,0.12);     color: #c084fc;                border: 1px solid rgba(137,87,229,0.3); }
.badge-cyan     { background: rgba(14,165,233,0.12);     color: #38bdf8;                border: 1px solid rgba(14,165,233,0.3); }

/* Layout */
.hidden { display: none !important; }
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'Cascadia Code', 'Fira Code', monospace; }
.w-full { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   BOTONES
═══════════════════════════════════════════════════════════ */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-family);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 2px 8px rgba(47,129,247,0.25);
  border: 1px solid transparent;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(47,129,247,0.4);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* Success */
.btn-success {
  background: #238636;
  color: #fff;
  border: 1px solid #2ea043;
  box-shadow: 0 2px 8px rgba(35,134,54,0.2);
}
.btn-success:hover {
  background: #2ea043;
  box-shadow: 0 4px 14px rgba(46,160,67,0.35);
  transform: translateY(-1px);
}

/* Danger */
.btn-danger {
  background: #da3633;
  color: #fff;
  border: 1px solid #f85149;
  box-shadow: 0 2px 8px rgba(218,54,51,0.2);
}
.btn-danger:hover {
  background: #b91c1c;
  box-shadow: 0 4px 14px rgba(218,54,51,0.35);
  transform: translateY(-1px);
}

/* Warning */
.btn-warning {
  background: #9e6a03;
  color: #f0d884;
  border: 1px solid #d29922;
}
.btn-warning:hover {
  background: #d29922;
  color: #0d1117;
  transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
  background: var(--panel-bg-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover {
  background: var(--panel-bg-3);
  color: var(--text-primary);
  border-color: #484f58;
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}
.btn-outline:hover {
  background: var(--primary-dim);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--panel-bg-2);
  color: var(--text-primary);
}

/* Small */
.btn-sm { padding: 4px 10px; font-size: 12px; }
/* Full width */
.btn-block { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════════ */
.login-page {
  background: var(--bg-color);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(47,129,247,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(137,87,229,0.05) 0%, transparent 50%);
  min-height: 100vh;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}

.login-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  padding: 44px 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(47,129,247,0.06);
  width: 100%;
  max-width: 420px;
  text-align: center;
  animation: slideUp 0.3s ease;
}

.login-logo-wrapper {
  margin-bottom: 8px;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary-color), #8957e5);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(47,129,247,0.3);
}

.login-card h1 {
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 3px;
}

.login-card .login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 13px;
}

.login-hint {
  margin-top: 20px;
  padding: 10px 14px;
  background: rgba(47,129,247,0.06);
  border: 1px solid rgba(47,129,247,0.15);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
  line-height: 1.6;
}

.login-hint strong { color: var(--primary-color); }

/* ═══════════════════════════════════════════════════════════
   FORMULARIOS
═══════════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--input-text);
  font-size: 14px;
  font-family: var(--font-family);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(47,129,247,0.12);
}

.form-control::placeholder {
  color: var(--input-placeholder);
}

/* Select arrow */
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e7681' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
  cursor: pointer;
}

select.form-control option {
  background-color: var(--panel-bg-2);
  color: var(--text-primary);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Filter row */
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-row .form-control {
  max-width: 280px;
}

/* Section divider dentro de form */
.form-section-title {
  grid-column: span 2;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   ALERTAS / MENSAJES
═══════════════════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid transparent;
}

.alert-danger {
  background: var(--status-red-bg);
  color: #fca5a5;
  border-left-color: var(--status-red);
}
.alert-success {
  background: var(--status-green-bg);
  color: #86efac;
  border-left-color: var(--status-green);
}
.alert-warning {
  background: var(--status-yellow-bg);
  color: #fde68a;
  border-left-color: var(--status-yellow);
}
.alert-info {
  background: var(--primary-dim);
  color: #93c5fd;
  border-left-color: var(--primary-color);
}

/* ─── Info box dark (reemplaza divs blancos en modales) ─── */
.info-box {
  padding: 12px 16px;
  background: var(--panel-bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
}

.info-box.info-box-blue {
  background: rgba(47,129,247,0.06);
  border-color: rgba(47,129,247,0.2);
}

.info-box strong { color: var(--text-primary); font-weight: 600; }
.info-box .label { color: var(--text-secondary); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }

/* ─── Toast Notifications ───────────────────────────────── */
#toastWrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   HEADER (barra superior)
═══════════════════════════════════════════════════════════ */
.header {
  height: 60px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 0 var(--border-color);
  flex-shrink: 0;
  z-index: 10;
}

.search-bar-container {
  display: flex;
  align-items: center;
  background: var(--search-bg);
  border: 1px solid var(--search-border);
  padding: 6px 14px;
  border-radius: 6px;
  width: 280px;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar-container:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(47,129,247,0.12);
}

.search-bar-container input {
  border: none;
  background: transparent;
  color: var(--search-text);
  outline: none;
  width: 100%;
  font-size: 13px;
  font-family: var(--font-family);
}

.search-bar-container input::placeholder {
  color: var(--search-placeholder);
}

.search-icon {
  color: var(--search-placeholder);
  font-size: 14px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.user-name-display {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.user-role-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-color), #8957e5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo svg { width: 18px; height: 18px; fill: white; }

.sidebar-brand {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.sidebar-brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.nav-menu {
  list-style: none;
  padding: 8px 8px;
  margin: 0;
  flex-grow: 1;
}

.nav-section-label {
  padding: 10px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav-item {
  padding: 9px 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  font-size: 13px;
  color: var(--sidebar-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.nav-item:hover .nav-icon { opacity: 1; }

.nav-item.active {
  background: rgba(47,129,247,0.12);
  color: var(--primary-color);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  opacity: 1;
  color: var(--primary-color);
}

.admin-only { display: none; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   ÁREA DE CONTENIDO PRINCIPAL
═══════════════════════════════════════════════════════════ */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-color);
  min-width: 0;
}

.view-container {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

/* ─── Header de vista ────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
}

/* ─── Divider ───────────────────────────────────────────── */
hr, .divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

/* ═══════════════════════════════════════════════════════════
   TARJETAS / PANELES (KPI cards, contenedores)
═══════════════════════════════════════════════════════════ */
.card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* KPI Card */
.kpi-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  animation: fadeInUp 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-accent, var(--primary-color));
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  background: var(--kpi-icon-bg, rgba(47,129,247,0.12));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.kpi-icon svg { width: 20px; height: 20px; }

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--kpi-accent, var(--text-primary));
}

/* ═══════════════════════════════════════════════════════════
   TABLAS OSCURAS
═══════════════════════════════════════════════════════════ */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--table-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.dark-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  color: var(--table-text);
  background: var(--table-row-bg);
  font-size: 13px;
}

.dark-table thead tr {
  background: var(--table-header-bg);
}

.dark-table thead th {
  padding: 10px 14px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  border-bottom: 1px solid var(--table-border);
  white-space: nowrap;
}

.dark-table tbody tr {
  background: var(--table-row-bg);
  border-bottom: 1px solid var(--table-border);
  transition: background var(--transition);
}

.dark-table tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

.dark-table tbody tr:hover {
  background: var(--table-row-hover);
}

.dark-table td {
  padding: 11px 14px;
  color: var(--table-text);
  vertical-align: middle;
}

/* Botones en tabla */
.dark-table td .btn { font-size: 11px; padding: 4px 10px; }

/* Empty state */
.table-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.table-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Panel con tabla dentro (contenedor) */
.table-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1,4,9,0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  color: var(--text-primary);
  animation: slideUp 0.2s ease;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-family: var(--font-family);
}
.modal-close:hover {
  background: var(--panel-bg-2);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Animaciones modal */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   ALERT LIST / PANELS DE ALERTAS (Dashboard)
═══════════════════════════════════════════════════════════ */
.alert-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.alert-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.alert-panel-body {
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
}

.alert-list-item {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  transition: background var(--transition);
}

.alert-list-item:last-child { border-bottom: none; }
.alert-list-item:hover { background: var(--panel-bg-2); }

.alert-ok {
  padding: 24px;
  text-align: center;
  color: var(--status-green);
  font-size: 13px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   PILLS DE ESTADO
═══════════════════════════════════════════════════════════ */
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: white;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .sidebar { display: none; }
  .view-container { padding: 14px; }
  .search-bar-container { width: 160px; }
}
