/* ============================================================
   ANALIZADOR DE GASTOS — Estilos Globales
   Paleta: Verde oscuro + crema + acentos dorados
   Tipografía: DM Serif Display + DM Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── Variables CSS ── */
:root {
  --primary:        #1a3a2a;
  --primary-light:  #2d5c42;
  --primary-dark:   #0f2219;
  --accent:         #c9a84c;
  --accent-light:   #e8c97a;
  --accent-dark:    #a07c30;
  --success:        #3d8c5e;
  --warning:        #d97a2a;
  --danger:         #c0392b;
  --danger-light:   #e74c3c;

  --bg:             #f5f2eb;
  --bg-alt:         #ede9df;
  --card-bg:        #ffffff;
  --card-shadow:    0 2px 16px rgba(26,58,42,0.10);
  --card-shadow-lg: 0 8px 40px rgba(26,58,42,0.14);

  --text:           #1a2a1e;
  --text-secondary: #4a6553;
  --text-muted:     #8a9e91;
  --border:         #d8d2c4;
  --border-light:   #eceae3;

  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      20px;
  --radius-pill:    999px;

  --transition:     0.22s cubic-bezier(.4,0,.2,1);
  --font-display:   'DM Serif Display', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;

  /* Categorías — colores */
  --cat-1:  #2e7d52;
  --cat-2:  #1565c0;
  --cat-3:  #e65100;
  --cat-4:  #6a1b9a;
  --cat-5:  #c62828;
  --cat-6:  #f57f17;
  --cat-7:  #00838f;
  --cat-8:  #558b2f;
  --cat-9:  #283593;
  --cat-10: #ad1457;
  --cat-11: #4e342e;
  --cat-12: #546e7a;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-body); }
ul, ol { list-style: none; }

/* ── Tipografía ── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--primary);
  line-height: 1.25;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1.05rem; }

p { color: var(--text-secondary); }
small { font-size: 0.82rem; color: var(--text-muted); }

/* ── Header / Nav ── */
.site-header {
  background: var(--primary);
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent-light);
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  color: rgba(255,255,255,0.72);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent-light);
  background: rgba(255,255,255,0.08);
}

/* ── Layout ── */
.page-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-container--wide {
  max-width: 1100px;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.page-header p {
  margin-top: 0.4rem;
  font-size: 1.05rem;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.card-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.card-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--primary);
  line-height: 1.1;
}

.card-value.value--accent { color: var(--accent-dark); }
.card-value.value--success { color: var(--success); }
.card-value.value--danger { color: var(--danger); }
.card-value.value--warning { color: var(--warning); }

.card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Grid de summary cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

/* ── Formularios ── */
.form-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-light);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.form-section-title {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.form-section-title h2 {
  font-size: 1.2rem;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-body);
  flex-shrink: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group:last-child { margin-bottom: 0; }

label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

label .req {
  color: var(--accent-dark);
  margin-left: 2px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45,92,66,0.12);
  background: #fff;
}

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

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a6553' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
}

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,58,42,0.2);
}
.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26,58,42,0.28);
}
.btn-primary:active { transform: translateY(0); }

.btn-accent {
  background: var(--accent);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(201,168,76,0.3);
}
.btn-accent:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,0.4);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(45,92,66,0.04);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-light);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.45rem 0.7rem;
}
.btn-ghost:hover { color: var(--danger); background: rgba(192,57,43,0.07); }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.84rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-analyze {
  background: var(--accent);
  color: var(--primary-dark);
  font-size: 1.05rem;
  padding: 0.9rem 2.2rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(201,168,76,0.35);
  font-weight: 700;
}
.btn-analyze:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(201,168,76,0.45);
}

/* ── Tabla de gastos manuales ── */
.expense-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.expense-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 480px;
}

.expense-table thead th {
  background: var(--bg-alt);
  padding: 0.7rem 0.9rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.expense-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.expense-table tbody tr:last-child { border-bottom: none; }
.expense-table tbody tr:hover { background: rgba(45,92,66,0.03); }

.expense-table td {
  padding: 0.55rem 0.9rem;
  vertical-align: middle;
}

.expense-table td input {
  border: 1.5px solid transparent;
  background: transparent;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-size: 0.92rem;
  width: 100%;
  transition: border-color var(--transition), background var(--transition);
}
.expense-table td input:focus {
  border-color: var(--primary-light);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(45,92,66,0.1);
}

/* ── Opciones de ingreso (tabs) ── */
.input-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}

.input-tab {
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: transparent;
}

.input-tab.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

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

/* ── Zona de upload ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(45,92,66,0.04);
}

.upload-zone .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.upload-zone p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.upload-zone small {
  display: block;
  margin-top: 0.35rem;
}

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

.upload-preview {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(45,92,66,0.07);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 500;
}

/* ── Gráfico ── */
.chart-container {
  max-width: 340px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.chart-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.chart-center-label .center-pct {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--primary);
  line-height: 1;
}

.chart-center-label .center-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Leyenda del gráfico ── */
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-name { flex: 1; color: var(--text-secondary); }
.legend-amount { font-weight: 600; color: var(--text); }
.legend-pct {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 38px;
  text-align: right;
}

/* ── Barras de progreso por categoría ── */
.category-list { display: flex; flex-direction: column; gap: 1rem; }

.category-item {}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  gap: 0.5rem;
}

.category-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.category-amount {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.category-pct {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 38px;
  text-align: right;
}

.progress-bar-bg {
  height: 8px;
  background: var(--bg-alt);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* Sub-items de categoría */
.category-items {
  margin-top: 0.6rem;
  padding-left: 1.2rem;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
}

.category-item.expanded .category-items { display: flex; }

.category-subitem {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  color: var(--text-muted);
  padding: 0.2rem 0;
  border-bottom: 1px dashed var(--border-light);
}
.category-subitem:last-child { border-bottom: none; }

.category-toggle {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--primary-light);
  font-weight: 500;
  padding: 0 4px;
  transition: color var(--transition);
}
.category-toggle:hover { color: var(--accent-dark); }

/* ── Insights ── */
.insights-section { margin-top: 2rem; }

.insight-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 1.25rem 1.4rem;
  margin-bottom: 0.85rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  transition: box-shadow var(--transition), transform var(--transition);
}

.insight-card:hover {
  box-shadow: var(--card-shadow);
  transform: translateX(2px);
}

.insight-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.insight-content {}

.insight-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.insight-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.insight-card.insight--warning {
  border-left: 3px solid var(--warning);
  background: #fffbf4;
}

.insight-card.insight--danger {
  border-left: 3px solid var(--danger);
  background: #fff8f7;
}

.insight-card.insight--success {
  border-left: 3px solid var(--success);
  background: #f4fbf7;
}

.insight-card.insight--info {
  border-left: 3px solid var(--primary-light);
  background: #f4f9f6;
}

/* ── Historial ── */
.historial-list { display: flex; flex-direction: column; gap: 0.75rem; }

.historial-item {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: box-shadow var(--transition);
  cursor: pointer;
}

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

.historial-mes {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--primary);
}

.historial-meta {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.historial-pct {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
}

.historial-pct.pct--low    { background: #e8f5e9; color: #2e7d32; }
.historial-pct.pct--mid    { background: #fff8e1; color: #f57f17; }
.historial-pct.pct--high   { background: #fce4ec; color: #c62828; }

/* ── Admin tabla ── */
.admin-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 700px;
}

.admin-table thead th {
  background: var(--primary);
  color: rgba(255,255,255,0.85);
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.admin-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(45,92,66,0.04); }

.admin-table td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  color: var(--text-secondary);
}

.admin-table td:first-child { color: var(--text); font-weight: 500; }

/* ── Stats globales ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,34,25,0.65);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.25s cubic-bezier(.4,0,.2,1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* ── Spinner / Loading ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245,242,235,0.88);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  backdrop-filter: blur(4px);
}

.loading-overlay.show { display: flex; }

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  max-width: 260px;
  line-height: 1.5;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border-light) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
  min-height: 1em;
}

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

/* ── Alertas / Toasts ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 340px;
}

.toast {
  background: var(--primary-dark);
  color: #fff;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  animation: toastIn 0.3s cubic-bezier(.4,0,.2,1);
}

.toast.toast--success { background: var(--success); }
.toast.toast--warning { background: var(--warning); }
.toast.toast--error   { background: var(--danger); }

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

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  padding: 1.5rem;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.25);
}

.login-card .logo {
  justify-content: center;
  color: var(--primary);
  margin-bottom: 2rem;
  font-size: 1.5rem;
}

.login-card .logo .logo-icon {
  background: var(--primary);
}

.login-card h1 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.login-card .subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.login-error {
  background: #fce4ec;
  color: #c62828;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  display: none;
}

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

/* ── Divider ── */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* ── Chips/badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge--primary  { background: rgba(26,58,42,0.1);  color: var(--primary); }
.badge--accent   { background: rgba(201,168,76,0.15); color: var(--accent-dark); }
.badge--success  { background: rgba(61,140,94,0.12);  color: var(--success); }
.badge--warning  { background: rgba(217,122,42,0.12); color: var(--warning); }
.badge--danger   { background: rgba(192,57,43,0.12);  color: var(--danger); }

/* ── Sección de acciones ── */
.actions-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

/* ── Footer ── */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 1.25rem;
  font-size: 0.82rem;
  margin-top: auto;
}

/* ── Responsive ── */
@media (min-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(4, 1fr);
  }

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

  .page-container {
    padding: 2.5rem 2rem 5rem;
  }

  .form-section {
    padding: 2rem;
  }

  .chart-and-legend {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
  }

  .chart-container { margin: 0; }
}

@media (min-width: 1024px) {
  .page-container {
    padding: 3rem 2rem 6rem;
  }
}

/* ── Utilidades ── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none !important; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1  { gap: 0.5rem; }
.gap-2  { gap: 1rem; }
.w-full { width: 100%; }

/* ── Número en formato argentino ── */
.monto { font-variant-numeric: tabular-nums; }

/* ── Animaciones de entrada ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.45s cubic-bezier(.4,0,.2,1) both;
}

.fade-in-up:nth-child(2) { animation-delay: 0.06s; }
.fade-in-up:nth-child(3) { animation-delay: 0.12s; }
.fade-in-up:nth-child(4) { animation-delay: 0.18s; }
