/* ═══════════════════════════════════════════════════════════
   IPCI v2.5 — Estilos compartidos del Panel
   Look corporativo profesional refrescado (Montserrat + #0b4ea2)
   100% retrocompatible con los HTML existentes
═══════════════════════════════════════════════════════════ */

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

:root {
  /* ─── Paleta principal ─── */
  --bg: #f4f6fb;
  --bg-deep: #eef2f8;
  --surface: #ffffff;
  --surface-soft: #f0f5fb;
  --surface-hover: #e8f0fa;

  --text: #0f1d2e;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;

  --primary: #0b4ea2;
  --primary-dark: #073b80;
  --primary-light: #e6f1fb;
  --primary-soft: #f0f7ff;
  --primary-glow: rgba(11, 78, 162, 0.15);

  --gold: #C8982E;
  --gold-light: #fef4d6;

  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --line-strong: #cbd5e1;

  --green: #15803d;
  --green-bg: #dcfce7;
  --green-soft: #f0fdf4;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --red-soft: #fef2f2;
  --yellow: #b45309;
  --yellow-bg: #fef3c7;
  --yellow-soft: #fffbeb;
  --info: #0369a1;
  --info-bg: #e0f2fe;

  /* ─── Sombras (más sutiles, profesionales) ─── */
  --shadow-xs: 0 1px 2px rgba(15, 29, 46, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 29, 46, 0.06), 0 1px 2px rgba(15, 29, 46, 0.04);
  --shadow: 0 4px 12px rgba(15, 29, 46, 0.06), 0 2px 4px rgba(15, 29, 46, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 29, 46, 0.08), 0 4px 8px rgba(15, 29, 46, 0.04);
  --shadow-lg: 0 20px 40px rgba(15, 29, 46, 0.10), 0 8px 16px rgba(15, 29, 46, 0.06);
  --shadow-soft: var(--shadow-sm);

  /* ─── Geometría ─── */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* ─── Transiciones ─── */
  --t-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --t: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Scrollbar fina y elegante */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ───── LAYOUT PRINCIPAL ───── */
.layout {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

/* ───── SIDEBAR ───── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 20px 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 16px;
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  padding: 2px;
  background: white;
  box-shadow: var(--shadow-xs);
}

.sidebar-brand-text strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.sidebar-brand-text span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 3px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-soft);
  transition: all var(--t);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar-link:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.sidebar-link.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}

/* Badge en sidebar (ej. históricos pendientes) */
.sidebar-link .badge {
  margin-left: auto;
  background: var(--yellow-bg);
  color: var(--yellow);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.sidebar-link.active .badge {
  background: rgba(255, 255, 255, 0.22);
  color: white;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--line-soft);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid var(--line-soft);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.user-role {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 1px;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

/* ───── MAIN CONTENT ───── */
.main {
  padding: 32px 40px;
  overflow-x: hidden;
  max-width: 100%;
}

.main-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.main-header > div { flex: 1; min-width: 0; }

.main-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.main-subtitle {
  font-size: 14px;
  color: var(--muted);
}

/* ───── CARDS ───── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  margin-bottom: 20px;
  transition: box-shadow var(--t);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}

/* ───── BOTONES ───── */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: all var(--t);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 2px rgba(11, 78, 162, 0.15);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border-color: var(--line);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--text);
}

.btn-success {
  background: var(--green);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #166534;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(21, 128, 61, 0.25);
}

.btn-danger {
  background: white;
  color: var(--red);
  border-color: var(--line);
}

.btn-danger:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: var(--red);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  gap: 6px;
}

.btn svg { width: 16px; height: 16px; stroke-width: 2; }

/* ───── INPUTS ───── */
.field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--text);
  transition: all var(--t);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--line-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-light);
}

.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ───── TABLAS ───── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: white;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr {
  transition: background var(--t-fast);
}

.table tbody tr:hover { background: var(--surface-soft); }

.table .col-actions {
  text-align: right;
  white-space: nowrap;
}

/* ───── BADGES / CHIPS ───── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.3;
}

.chip-green   { background: var(--green-bg); color: var(--green); }
.chip-red     { background: var(--red-bg);   color: var(--red); }
.chip-yellow  { background: var(--yellow-bg); color: var(--yellow); }
.chip-blue    { background: var(--primary-light); color: var(--primary); }
.chip-gold    { background: var(--gold-light); color: var(--gold); }
.chip-purple  { background: #f3e8ff; color: #7c3aed; }
.chip-info    { background: var(--info-bg); color: var(--info); }
.chip-gray    { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--line); }

.chip-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ───── ESTADOS VACÍOS / LOADING / ERROR ───── */
.empty,
.loading,
.error-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.4;
}

.empty-text,
.loading-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.empty-hint {
  font-size: 13px;
  color: var(--muted-light);
  margin-top: 6px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 18px; height: 18px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  color: var(--red);
}

.error-state .empty-text { color: var(--red); }

/* ───── KPI CARDS (Dashboard) ───── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  transition: all var(--t);
  position: relative;
  overflow: hidden;
}

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

.kpi-content { flex: 1; min-width: 0; }

.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-trend-up { background: var(--green-bg); color: var(--green); }
.kpi-trend-down { background: var(--red-bg); color: var(--red); }
.kpi-trend-flat { background: var(--surface-soft); color: var(--muted); }

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-blue   { background: var(--primary-light); color: var(--primary); }
.kpi-icon-gold   { background: var(--gold-light); color: var(--gold); }
.kpi-icon-green  { background: var(--green-bg); color: var(--green); }
.kpi-icon-yellow { background: var(--yellow-bg); color: var(--yellow); }
.kpi-icon svg { width: 22px; height: 22px; stroke-width: 2; }

/* ───── CHART CONTAINERS ───── */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}

.chart-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}

.chart-canvas-wrap {
  position: relative;
  height: 280px;
}

.chart-canvas-wrap.short { height: 220px; }
.chart-canvas-wrap.tall  { height: 340px; }

/* ───── FILTROS / TABS ───── */
.filter-bar {
  display: flex;
  gap: 6px;
  background: var(--surface-soft);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.filter-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
}

.filter-btn:hover { color: var(--text); }
.filter-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* ───── MODALES ───── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 29, 46, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn var(--t) ease-out;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--t-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 920px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  transition: all var(--t-fast);
}

.modal-close:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ───── ALERTS / TOASTS ───── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-info    { background: var(--info-bg); color: var(--info); border-color: #bae6fd; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: #bbf7d0; }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); border-color: #fde68a; }
.alert-error   { background: var(--red-bg); color: var(--red); border-color: #fecaca; }

/* Toast (notificaciones flotantes) */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  animation: slideInRight var(--t-slow) cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 3px solid var(--primary);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-success { border-left-color: var(--green); color: var(--green); }
.toast-error   { border-left-color: var(--red); color: var(--red); }
.toast-warning { border-left-color: var(--yellow); color: var(--yellow); }

/* ───── SECTION TOGGLE / VISIBILIDAD ───── */
.section { display: none; }
.section.active { display: block; animation: fadeInUp var(--t-slow) ease-out; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ───── SEARCH BOX ───── */
.search-box {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search-box .input {
  padding-left: 38px;
}

/* ───── DIVIDER ───── */
.divider {
  height: 1px;
  background: var(--line-soft);
  margin: 20px 0;
  border: none;
}

/* ───── HAMBURGER (móvil) ───── */
.hamburger {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--t);
}

.hamburger:hover { background: var(--surface-soft); }
.hamburger svg { width: 22px; height: 22px; stroke-width: 2; }

/* ───── RESPONSIVE ───── */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    transition: left var(--t-slow);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { left: 0; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 29, 46, 0.4);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t);
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .hamburger {
    display: inline-flex;
  }

  .main {
    padding: 20px 18px;
  }

  .main-title { font-size: 22px; }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .field-row { grid-template-columns: 1fr; }

  .card { padding: 18px; }

  .table th, .table td { padding: 10px 12px; font-size: 13px; }
}

@media (max-width: 520px) {
  .main { padding: 16px 14px; }
  .main-title { font-size: 20px; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: 24px; }
  .modal-body, .modal-footer { padding: 16px; }
  .modal-header { padding: 16px; }
}

/* ───── UTILIDADES ───── */
.text-muted { color: var(--muted); }
.text-soft  { color: var(--text-soft); }
.text-primary { color: var(--primary); }
.text-bold  { font-weight: 700; }
.text-sm    { font-size: 12.5px; }
.text-xs    { font-size: 11.5px; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

.hidden { display: none !important; }

/* Animaciones de entrada para listas */
.fade-in {
  animation: fadeInUp var(--t-slow) ease-out;
}

/* Hover row con animación sutil */
.row-hover {
  transition: all var(--t);
  cursor: pointer;
}

.row-hover:hover {
  background: var(--surface-soft);
  transform: translateX(2px);
}
