/* ============================================
   Sistema de Gastos v2.0 — Design System
   Diseño minimalista, limpio y moderno
   ============================================ */

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

/* ============================================
   TOKENS DE DISEÑO (Custom Properties)
   ============================================ */
:root {
  /* Fondos */
  --bg-primary: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-hover: #F5F5F5;
  --bg-input: #FFFFFF;
  --bg-overlay: rgba(0, 0, 0, 0.4);

  /* Bordes */
  --border: #E5E5E5;
  --border-focus: #2563EB;
  --border-light: #F0F0F0;

  /* Texto */
  --text-primary: #171717;
  --text-secondary: #737373;
  --text-tertiary: #A3A3A3;
  --text-inverse: #FFFFFF;

  /* Acento */
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-light: #EFF6FF;
  --accent-subtle: #DBEAFE;

  /* Estados semánticos */
  --success: #16A34A;
  --success-light: #F0FDF4;
  --success-border: #BBF7D0;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --warning-border: #FDE68A;
  --error: #DC2626;
  --error-light: #FEF2F2;
  --error-border: #FECACA;
  --info: #2563EB;
  --info-light: #EFF6FF;

  /* Colores de personas */
  --color-josselyn: #DC2626;
  --color-evelyn: #0EA5E9;
  --color-luisa: #F59E0B;
  --color-katty: #16A34A;
  --color-sebastian: #6B7280;

  /* Bordes redondeados */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Tipografía */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-xs: 0.75rem;    /* 12px */
  --font-sm: 0.8125rem;  /* 13px */
  --font-base: 0.875rem; /* 14px */
  --font-md: 1rem;       /* 16px */
  --font-lg: 1.125rem;   /* 18px */
  --font-xl: 1.25rem;    /* 20px */
  --font-2xl: 1.5rem;    /* 24px */
  --font-3xl: 1.875rem;  /* 30px */

  /* Espaciado */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */

  /* Transiciones */
  --transition: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --navbar-height: 56px;
  --container-max: 1200px;
  --sidebar-width: 240px;
}


/* ============================================
   CSS RESET / NORMALIZACIÓN
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: var(--font-3xl); }
h2 { font-size: var(--font-2xl); }
h3 { font-size: var(--font-xl); }
h4 { font-size: var(--font-lg); }

p {
  color: var(--text-secondary);
  line-height: 1.6;
}


/* ============================================
   UTILIDADES DE LAYOUT
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Utilidades de texto */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-xs { font-size: var(--font-xs); }
.text-sm { font-size: var(--font-sm); }
.text-base { font-size: var(--font-base); }
.text-md { font-size: var(--font-md); }
.text-lg { font-size: var(--font-lg); }
.text-xl { font-size: var(--font-xl); }
.text-2xl { font-size: var(--font-2xl); }
.text-3xl { font-size: var(--font-3xl); }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Utilidades de espaciado */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }

/* Visibilidad */
.hidden { display: none !important; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.w-full { width: 100%; }
.relative { position: relative; }


/* ============================================
   COMPONENTES — BOTONES
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-family);
  font-weight: 500;
  font-size: var(--font-base);
  line-height: 1;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* Botón primario */
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Botón secundario */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: #D4D4D4;
}

/* Botón fantasma (ghost) */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Botón de peligro */
.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
  border-color: var(--error);
}

.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}

/* Botón de éxito */
.btn-success {
  background: var(--success);
  color: var(--text-inverse);
  border-color: var(--success);
}

.btn-success:hover {
  background: #15803D;
  border-color: #15803D;
}

/* Tamaños de botón */
.btn-sm {
  font-size: var(--font-xs);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  font-size: var(--font-md);
  padding: 14px 24px;
  border-radius: var(--radius-md);
}

/* Estado de carga del botón */
.btn-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-secondary.btn-loading::after {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--text-primary);
}

/* Botón como ícono */
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}


/* ============================================
   COMPONENTES — INPUTS
   ============================================ */
.input {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--font-base);
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  outline: none;
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input:hover {
  border-color: #D4D4D4;
}

.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input:disabled {
  background: var(--bg-hover);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Input grande (para lectura de medidor) */
.input-lg {
  font-size: var(--font-2xl);
  font-weight: 600;
  padding: 16px 20px;
  text-align: center;
  letter-spacing: 0.02em;
}

/* Grupo de input con label */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-group label,
.form-label {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

/* Input con sufijo (kW, S/.) */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .input {
  padding-right: 50px;
}

.input-suffix {
  position: absolute;
  right: 14px;
  color: var(--text-tertiary);
  font-size: var(--font-sm);
  font-weight: 500;
  pointer-events: none;
}

/* Input con ícono */
.input-with-icon {
  position: relative;
}

.input-with-icon .input {
  padding-left: 40px;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Select */
.select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  font-size: var(--font-base);
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Textarea */
textarea.input {
  min-height: 100px;
  resize: vertical;
}

/* Validación de formulario */
.input-error {
  border-color: var(--error) !important;
}

.input-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.error-text {
  font-size: var(--font-xs);
  color: var(--error);
  margin-top: var(--space-1);
}

.help-text {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}


/* ============================================
   COMPONENTES — CARD
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: box-shadow var(--transition);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.card-header h3 {
  font-size: var(--font-md);
  font-weight: 600;
}

.card-header .card-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.card-body {
  /* Contenido del card */
}

.card-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

/* Card sin padding — para tablas dentro */
.card-flush {
  padding: 0;
}

.card-flush .card-header {
  padding: var(--space-5) var(--space-6) 0;
}

.card-flush .card-footer {
  padding: var(--space-4) var(--space-6) var(--space-5);
  margin-top: 0;
}


/* ============================================
   COMPONENTES — BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-xs);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-warning {
  background: var(--warning-light);
  color: #B45309;
  border: 1px solid var(--warning-border);
}

.badge-error {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.badge-neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-info {
  background: var(--info-light);
  color: var(--accent);
  border: 1px solid var(--accent-subtle);
}

/* Badge de tendencia (porcentaje) */
.badge-trend {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.badge-trend.up {
  background: var(--error-light);
  color: var(--error);
}

.badge-trend.down {
  background: var(--success-light);
  color: var(--success);
}

.badge-trend.neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
}


/* ============================================
   COMPONENTES — TABLA
   ============================================ */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}

.table thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  white-space: nowrap;
}

.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

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

.table tbody tr.table-row-accent {
  border-left: 3px solid var(--row-color, var(--accent));
}

/* Fila de totales */
.table tfoot td {
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  border-top: 2px solid var(--border);
  background: var(--bg-primary);
}

.table .text-right {
  text-align: right;
}

.table .text-center {
  text-align: center;
}

.table .mono {
  font-variant-numeric: tabular-nums;
  font-family: 'Inter', monospace;
}


/* ============================================
   COMPONENTES — NAVBAR
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--font-md);
  color: var(--text-primary);
  flex-shrink: 0;
}

.navbar-brand .brand-icon {
  font-size: var(--font-lg);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-tab {
  padding: 8px 16px;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-hover);
  font-weight: 600;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Espacio para compensar el navbar fijo */
.main-content {
  padding-top: calc(var(--navbar-height) + var(--space-8));
  padding-bottom: var(--space-12);
  min-height: 100vh;
}


/* ============================================
   COMPONENTES — DROPDOWN
   ============================================ */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: all var(--transition);
  overflow: hidden;
}

.dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.dropdown-header .dropdown-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.dropdown-header .dropdown-subtitle {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.dropdown-body {
  max-height: 320px;
  overflow-y: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-sm);
  color: var(--text-primary);
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-item-danger {
  color: var(--error);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-1) 0;
}

.dropdown-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
}


/* ============================================
   COMPONENTES — NOTIFICACIONES (Bell)
   ============================================ */
.notification-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
}

.notification-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notification-btn svg,
.notification-btn i {
  width: 20px;
  height: 20px;
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: white;
  background: var(--error);
  border-radius: var(--radius-full);
  animation: pulse 2s ease-in-out infinite;
}

/* Panel de notificaciones (dropdown) */
.notification-panel {
  width: 360px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.notification-item:hover {
  background: var(--bg-hover);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background: var(--accent-light);
}

.notification-item.unread:hover {
  background: var(--accent-subtle);
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}

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

.notification-text {
  font-size: var(--font-sm);
  color: var(--text-primary);
  line-height: 1.4;
}

.notification-time {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.notification-empty {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--font-sm);
}


/* ============================================
   COMPONENTES — AVATAR
   ============================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
}

.avatar:hover {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar-lg {
  width: 40px;
  height: 40px;
  font-size: var(--font-base);
}

.avatar-xl {
  width: 56px;
  height: 56px;
  font-size: var(--font-xl);
}


/* ============================================
   COMPONENTES — TABS (dentro de contenido)
   ============================================ */
.tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
}

.tab-item {
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
  white-space: nowrap;
}

.tab-item::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  border-radius: 1px;
  transition: background var(--transition);
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.tab-item.active::after {
  background: var(--accent);
}


/* ============================================
   COMPONENTES — MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
  padding: var(--space-4);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-slow);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: var(--font-md);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
}


/* ============================================
   COMPONENTES — TOAST
   ============================================ */
.toast-container {
  position: fixed;
  top: calc(var(--navbar-height) + var(--space-4));
  right: var(--space-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-sm);
  color: var(--text-primary);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  background: none;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}

.toast-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toast.toast-success {
  border-left: 3px solid var(--success);
}

.toast.toast-success .toast-icon {
  color: var(--success);
}

.toast.toast-error {
  border-left: 3px solid var(--error);
}

.toast.toast-error .toast-icon {
  color: var(--error);
}

.toast.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast.toast-warning .toast-icon {
  color: var(--warning);
}

.toast.toast-info {
  border-left: 3px solid var(--accent);
}

.toast.toast-info .toast-icon {
  color: var(--accent);
}

.toast-exit {
  animation: slideOutRight 0.25s ease forwards;
}


/* ============================================
   COMPONENTES — KPI CARD
   ============================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  transition: all var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #D4D4D4;
}

.kpi-label {
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.kpi-value {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.kpi-trend.up {
  background: var(--error-light);
  color: var(--error);
}

.kpi-trend.down {
  background: var(--success-light);
  color: var(--success);
}

.kpi-trend.flat {
  background: var(--bg-hover);
  color: var(--text-tertiary);
}

.kpi-subtitle {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}


/* ============================================
   COMPONENTES — ESTADO DE LECTURAS
   ============================================ */
.status-list {
  display: flex;
  flex-direction: column;
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.status-item:last-child {
  border-bottom: none;
}

.status-item:hover {
  background: var(--bg-hover);
}

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

.status-name {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.status-detail {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: 1px;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}


/* ============================================
   COMPONENTES — ESTADO VACÍO
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: var(--radius-lg);
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.empty-state-icon svg,
.empty-state-icon i {
  width: 28px;
  height: 28px;
}

.empty-state-title {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
  max-width: 320px;
  line-height: 1.5;
}


/* ============================================
   COMPONENTES — SKELETON LOADER
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, #EBEBEB 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.shorter {
  width: 40%;
}

.skeleton-heading {
  height: 24px;
  width: 50%;
  margin-bottom: var(--space-4);
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
}

.skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.skeleton-chart {
  height: 250px;
  border-radius: var(--radius-md);
}


/* ============================================
   COMPONENTES — ANILLO DE PROGRESO
   ============================================ */
.progress-ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-ring-text {
  position: absolute;
  font-size: var(--font-xs);
  font-weight: 700;
  color: var(--text-primary);
}


/* ============================================
   COMPONENTES — ALERT (en línea)
   ============================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  line-height: 1.5;
}

.alert-success {
  background: var(--success-light);
  color: #15803D;
  border: 1px solid var(--success-border);
}

.alert-warning {
  background: var(--warning-light);
  color: #92400E;
  border: 1px solid var(--warning-border);
}

.alert-error {
  background: var(--error-light);
  color: #991B1B;
  border: 1px solid var(--error-border);
}

.alert-info {
  background: var(--info-light);
  color: #1E40AF;
  border: 1px solid var(--accent-subtle);
}


/* ============================================
   COMPONENTES — FILE UPLOAD
   ============================================ */
.file-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-6);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.file-upload:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.file-upload-text {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.file-upload-text strong {
  color: var(--accent);
}

.file-upload input[type="file"] {
  display: none;
}


/* ============================================
   PÁGINAS — LOGIN
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: var(--space-4);
  position: relative;
}

/* Patrón sutil de fondo */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(37, 99, 235, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-10) var(--space-8);
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 1;
  animation: fadeIn 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo .logo-icon {
  font-size: 40px;
  margin-bottom: var(--space-3);
  display: block;
}

.login-logo h1 {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.login-logo p {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.login-error {
  display: none;
  padding: var(--space-3) var(--space-4);
  background: var(--error-light);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  color: var(--error);
  text-align: center;
  animation: fadeIn 0.2s ease;
}

.login-error.show {
  display: block;
}

.login-footer {
  text-align: center;
  margin-top: var(--space-8);
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

/* Input para password con botón de visibilidad */
.password-wrapper {
  position: relative;
}

.password-wrapper .input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition);
}

.password-toggle:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}


/* ============================================
   PÁGINAS — DASHBOARD
   ============================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.page-header h1 {
  font-size: var(--font-2xl);
  font-weight: 700;
}

.page-header .page-subtitle {
  font-size: var(--font-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

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

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}


/* ============================================
   PÁGINAS — LECTURA
   ============================================ */
.lectura-hero {
  max-width: 520px;
  margin: 0 auto;
}

.lectura-period-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--accent-light);
  border: 1px solid var(--accent-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
}

.lectura-period-info .period-label {
  font-size: var(--font-sm);
  color: var(--accent);
  font-weight: 600;
}

.lectura-period-info .period-deadline {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.lectura-previous {
  text-align: center;
  padding: var(--space-4);
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
}

.lectura-previous .prev-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.lectura-previous .prev-value {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.lectura-input-section {
  text-align: center;
  margin-bottom: var(--space-6);
}

.lectura-input-section .input-label-main {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.lectura-calc {
  text-align: center;
  padding: var(--space-4);
  margin-top: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  transition: all var(--transition);
}

.lectura-calc.positive {
  background: var(--success-light);
  border: 1px solid var(--success-border);
}

.lectura-calc .calc-label {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}

.lectura-calc .calc-value {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.lectura-calc .calc-comparison {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

/* Confirmación de lectura registrada */
.lectura-registered {
  text-align: center;
  padding: var(--space-8);
}

.lectura-registered .check-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--success-light);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.lectura-registered h3 {
  font-size: var(--font-lg);
  margin-bottom: var(--space-2);
}

.lectura-registered p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}


/* ============================================
   PÁGINAS — ADMIN
   ============================================ */
.admin-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.admin-form-grid .full-width {
  grid-column: 1 / -1;
}

.period-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.period-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.period-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}


/* ============================================
   ANIMACIONES (Keyframes)
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.05);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Clases de animación reutilizables */
.animate-fade-in {
  animation: fadeIn 0.4s ease;
}

.animate-slide-down {
  animation: slideDown 0.3s ease;
}

.animate-slide-up {
  animation: slideUp 0.3s ease;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease;
}


/* ============================================
   RESPONSIVE — MÓVIL PEQUEÑO (≤ 480px)
   ============================================ */
@media (max-width: 480px) {
  h1 { font-size: var(--font-lg); }
  h2 { font-size: var(--font-md); }
  h3 { font-size: var(--font-base); }

  .container {
    padding: 0 var(--space-3);
  }

  .kpi-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .kpi-card {
    padding: var(--space-3);
  }

  .kpi-value {
    font-size: var(--font-lg);
  }

  .card {
    padding: var(--space-4);
    border-radius: var(--radius-sm);
  }

  .card-flush .card-header {
    padding: var(--space-3) var(--space-4) 0;
  }

  .page-header h1 {
    font-size: var(--font-lg);
  }

  .page-header .page-subtitle {
    font-size: var(--font-xs);
  }

  .btn {
    padding: 8px 14px;
    font-size: var(--font-xs);
  }

  .btn-lg {
    padding: 12px 18px;
    font-size: var(--font-sm);
  }

  /* Status items stack en móvil pequeño */
  .status-item {
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3);
  }

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

  .status-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: var(--space-1);
  }

  /* Period items stack */
  .period-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .period-item > div:last-child {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  /* Lectura hero */
  .lectura-hero {
    max-width: 100%;
  }

  .lectura-period-info {
    flex-direction: column;
    text-align: center;
    gap: var(--space-2);
  }

  .lectura-registered {
    padding: var(--space-6);
  }

  .lectura-registered .flex {
    flex-direction: column;
    gap: var(--space-4);
  }

  /* Input de lectura grande */
  .input-lg {
    font-size: var(--font-xl);
    padding: 14px 16px;
  }

  /* Login card */
  .login-card {
    padding: var(--space-6) var(--space-4);
    border-radius: var(--radius-md);
  }

  .login-logo h1 {
    font-size: var(--font-md);
  }

  /* Modal */
  .modal {
    max-width: calc(100% - var(--space-4));
    border-radius: var(--radius-md);
  }

  .modal-body {
    padding: var(--space-4);
  }

  .modal-header {
    padding: var(--space-3) var(--space-4);
  }

  .modal-footer {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Toast full width */
  .toast-container {
    left: var(--space-3);
    right: var(--space-3);
  }

  .toast {
    min-width: auto;
    max-width: 100%;
    width: 100%;
  }

  /* Table font smaller */
  .table {
    font-size: var(--font-xs);
  }

  .table thead th {
    padding: var(--space-2) var(--space-3);
    font-size: 10px;
  }

  .table tbody td {
    padding: var(--space-2) var(--space-3);
  }

  .table tfoot td {
    padding: var(--space-2) var(--space-3);
  }

  /* Notification panel */
  .notification-panel {
    position: fixed;
    top: var(--navbar-height);
    left: var(--space-2);
    right: var(--space-2);
    width: auto;
    max-height: 60vh;
  }

  /* Admin recibos grid */
  .admin-form-grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* Chart container */
  .chart-container {
    height: 220px;
  }

  /* Avatar sizes */
  .avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .avatar-lg {
    width: 36px;
    height: 36px;
    font-size: var(--font-sm);
  }
}


/* ============================================
   RESPONSIVE — MÓVIL (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
  :root {
    --navbar-height: 56px;
  }

  body {
    font-size: var(--font-sm);
  }

  .container {
    padding: 0 var(--space-4);
  }

  /* ---- Navbar en móvil: barra inferior fija ---- */
  .navbar {
    padding: 0 var(--space-4);
  }

  .navbar-brand .brand-text {
    display: none;
  }

  .navbar-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: 60px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-2);
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
  }

  .nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    padding: 6px 12px;
    gap: 3px;
    border-radius: var(--radius-sm);
    min-width: 0;
    flex: 1;
    max-width: 80px;
  }

  .nav-tab span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .nav-tab .nav-icon {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
  }

  .nav-tab.active {
    color: var(--accent);
    background: var(--accent-light);
  }

  /* ---- Main content con espacio inferior para la barra ---- */
  .main-content {
    padding-top: calc(var(--navbar-height) + var(--space-6));
    padding-bottom: calc(60px + var(--space-6));
  }

  /* ---- KPI grid a 2 columnas ---- */
  .kpi-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .kpi-value {
    font-size: var(--font-xl);
  }

  .kpi-card {
    padding: var(--space-4);
  }

  /* ---- Charts a 1 columna ---- */
  .charts-row {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 240px;
  }

  /* ---- Tablas con scroll horizontal limpio ---- */
  .table-container {
    margin: 0 calc(var(--space-4) * -1);
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .card-flush .table-container {
    margin: 0;
  }

  /* ---- Cards ---- */
  .card {
    padding: var(--space-4);
  }

  .card-flush .card-header {
    padding: var(--space-4) var(--space-4) 0;
  }

  .card-flush .card-footer {
    padding: var(--space-3) var(--space-4) var(--space-4);
  }

  /* ---- Page header stacks ---- */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .page-header h1 {
    font-size: var(--font-xl);
  }

  .page-header .form-group {
    width: 100% !important;
    min-width: unset !important;
  }

  .page-header .select {
    width: 100%;
  }

  /* ---- Status items ---- */
  .status-item {
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .status-detail {
    font-size: 11px;
  }

  /* ---- Login ---- */
  .login-card {
    padding: var(--space-8) var(--space-6);
  }

  /* ---- Admin ---- */
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .period-item {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* ---- Notification panel ---- */
  .notification-panel {
    position: fixed;
    top: var(--navbar-height);
    left: var(--space-3);
    right: var(--space-3);
    width: auto;
    max-height: 70vh;
  }

  /* ---- Dropdown ---- */
  .dropdown-menu {
    right: -8px;
  }

  /* ---- Grids a 1 columna ---- */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* ---- Modal ---- */
  .modal {
    max-width: calc(100% - var(--space-8));
  }

  /* ---- Toast ---- */
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
  }

  .toast {
    min-width: auto;
    max-width: 100%;
    width: 100%;
  }

  /* ---- Ocultar en móvil ---- */
  .hide-mobile {
    display: none !important;
  }

  /* Lectura hero */
  .lectura-hero {
    max-width: 100%;
  }
}


/* ============================================
   RESPONSIVE — TABLETS (769px – 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .kpi-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .admin-form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-header h1 {
    font-size: var(--font-xl);
  }

  .nav-tab .nav-icon {
    display: none;
  }

  .lectura-hero {
    max-width: 480px;
  }
}


/* ============================================
   RESPONSIVE — DESKTOP (≥ 769px)
   ============================================ */
@media (min-width: 769px) {
  .nav-tab .nav-icon {
    display: none;
  }
}

/* Preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ============================================
   UTILIDADES ADICIONALES
   ============================================ */

/* Divider horizontal */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-4) 0;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #D4D4D4;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #A3A3A3;
}

/* Selección de texto */
::selection {
  background: var(--accent-subtle);
  color: var(--accent-hover);
}

/* Focus visible global */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Cursores de interacción */
[data-clickable] {
  cursor: pointer;
}

/* Número tabular para consistencia */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Gradiente sutil para encabezados grandes */
.gradient-text {
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
