/* ============================================================================
   Tema "Mosaic" (inspirado en Cruip Mosaic) — capa de estilo sobre main.css
   Se apoya en las variables --surface-* y --primary-* para respetar modo oscuro.
   No cambia el HTML/JS: solo reestiliza las clases existentes.
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary:        #6366f1;   /* indigo-500 */
  --primary-hover:  #4f46e5;   /* indigo-600 */
  --primary-dark:   #4338ca;   /* indigo-700 */
  --primary-light:  #eef2ff;   /* indigo-50  */
  --primary-text:   #ffffff;
  --m-radius:       16px;
  --m-radius-sm:    10px;
  --m-shadow:       0 1px 2px rgba(15,23,42,.06), 0 3px 10px rgba(15,23,42,.07);
  --m-shadow-md:    0 8px 24px rgba(15,23,42,.12);
  --m-ring:         0 0 0 3px rgba(99,102,241,.25);
}

body, input, select, textarea, button {
  font-family: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
}
body { background: #e7ecf4; color: var(--surface-900); }   /* modo día: fondo más marcado para que las tarjetas resalten */

/* Scrollbar discreta */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(100,116,139,.35); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.55); background-clip: content-box; }

/* ── Barra lateral (oscura, estilo Mosaic) ───────────────────────────────── */
/* Blanca en modo día, oscura en modo noche (usa las variables --surface-*). */
.sidebar {
  background: var(--surface-0);
  border-right: 1px solid var(--surface-200);
}
.sidebar .sidebar-logo { background: transparent !important; border-bottom: 1px solid var(--surface-200); padding-bottom: 16px; }
.sidebar .sidebar-logo h1 { color: var(--surface-900) !important; font-weight: 800; }
.sidebar .sidebar-logo p  { color: var(--surface-600) !important; }

.nav { padding: 10px 12px; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  color: var(--surface-700); font-weight: 500; font-size: 14px;
  padding: 10px 12px; border-radius: var(--m-radius-sm);
  margin: 1px 0; transition: background .15s, color .15s; cursor: pointer;
  border: none;
}
.nav-link .icon { font-size: 17px; width: 22px; text-align: center; }
.nav-link:hover { background: var(--surface-100); color: var(--surface-900); }
.nav-link.active {
  background: var(--primary-light); color: var(--primary-dark);
  font-weight: 700; box-shadow: inset 3px 0 0 0 var(--primary);
}

.sidebar-user { border-top: 1px solid var(--surface-200); }
.sidebar .sidebar-user .user-nombre, #sidebar-user .user-nombre { color: var(--surface-900) !important; font-weight: 600; }
.sidebar .sidebar-user .user-rol, #sidebar-user .user-rol { color: var(--surface-600) !important; }
.user-avatar { border-radius: 12px; font-weight: 700; box-shadow: var(--m-shadow); }

/* En modo noche, el ítem activo y el hover van en tono claro para buen contraste. */
html[data-theme="dark"] .nav-link.active { color: #c7d2fe; }
html[data-theme="dark"] .nav-link:hover  { color: #f1f5f9; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface-0);
  border-bottom: 1px solid var(--surface-200);
  box-shadow: var(--m-shadow);
}
.topbar-info { color: var(--surface-600); font-weight: 500; }
.topbar-info::first-letter { text-transform: uppercase; }
.topbar-saldo {
  background: var(--primary-light); color: var(--primary-dark);
  padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13.5px;
}
.btn-logout {
  background: var(--surface-0); border: 1px solid var(--surface-200);
  color: var(--surface-700); border-radius: var(--m-radius-sm);
  padding: 7px 12px; font-weight: 600; transition: background .15s;
}
.btn-logout:hover { background: var(--surface-100); }

/* ── Encabezado de página ────────────────────────────────────────────────── */
.page-header h2 { font-weight: 800; letter-spacing: -.01em; color: var(--surface-900); }
.fecha-hoy { color: var(--surface-600); font-weight: 500; }

/* ── Tarjetas (cards) ────────────────────────────────────────────────────── */
.cards-grid { gap: 16px; }
.card {
  display: flex; align-items: center; gap: 15px;
  background: var(--surface-0);
  border: 1px solid var(--surface-200);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow);
  padding: 18px 20px;
  transition: box-shadow .18s, transform .18s;
}
.card:hover { box-shadow: var(--m-shadow-md); transform: translateY(-2px); }
.card-icon {
  width: 54px; height: 54px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; font-size: 26px;
  background: var(--primary-light); color: var(--primary-dark);
}
.card-saldo  .card-icon { background: #eef2ff; }
.card-ingreso .card-icon { background: #dcfce7; }
.card-egreso  .card-icon { background: #fee2e2; }
.card-mes     .card-icon { background: #fef9c3; }
/* Franja superior de color en las tarjetas de resumen (estilo Mosaic) */
.card-saldo   { border-top: 3px solid #6366f1; }
.card-ingreso { border-top: 3px solid #22c55e; }
.card-egreso  { border-top: 3px solid #ef4444; }
.card-mes     { border-top: 3px solid #eab308; }
.card-label { color: var(--surface-600); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.card-value { color: var(--surface-900); font-weight: 800; font-size: 24px; line-height: 1.15; margin-top: 2px; }
.card-sub   { color: var(--surface-600); font-size: 12.5px; margin-top: 2px; }

/* ── Paneles ─────────────────────────────────────────────────────────────── */
.panel, .form-card {
  background: var(--surface-0);
  border: 1px solid var(--surface-200);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow);
  padding: 20px 22px;
}
.panel h3, .form-card h3 { font-weight: 700; color: var(--surface-900); letter-spacing: -.01em; }
.empty { color: var(--surface-600); }

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  border-radius: var(--m-radius-sm); font-weight: 600; font-size: 14px;
  padding: 9px 16px; transition: background .15s, box-shadow .15s, transform .05s;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.4); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--surface-0); border-color: var(--surface-300); color: var(--surface-700); }
.btn-outline:hover { background: var(--surface-100); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm {
  border-radius: 8px; padding: 5px 9px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--surface-200); background: var(--surface-0); color: var(--surface-700);
  cursor: pointer; transition: background .15s;
}
.btn-sm:hover { background: var(--surface-100); }
.btn-sm.btn-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.btn-sm.btn-danger:hover { background: #fecaca; }

/* ── Tablas ──────────────────────────────────────────────────────────────── */
.tabla { border-collapse: separate; border-spacing: 0; width: 100%; }
.tabla thead th {
  background: transparent; color: var(--surface-600);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 12px; border-bottom: 1px solid var(--surface-200); text-align: left;
}
.tabla tbody td { padding: 11px 12px; border-bottom: 1px solid var(--surface-100); font-size: 13.5px; }
.tabla tbody tr:hover { background: var(--surface-50); }
.tabla tfoot td, .tabla .total-row td { font-weight: 700; background: var(--surface-50); }
.monto-ingreso { color: #16a34a; }
.monto-egreso  { color: #dc2626; }

/* ── Insignias (badges) ──────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--surface-100); color: var(--surface-700);
}
.badge-ingreso { background: #dcfce7; color: #15803d; }
.badge-egreso  { background: #fee2e2; color: #b91c1c; }
.rol-badge { border-radius: 999px; font-weight: 700; }

/* ── Formularios ─────────────────────────────────────────────────────────── */
.form-group label { font-weight: 600; font-size: 13px; color: var(--surface-700); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"], input[type="tel"], select, textarea {
  border-radius: var(--m-radius-sm); border: 1px solid var(--surface-300);
  padding: 9px 12px; font-size: 14px; background: var(--surface-0); color: var(--surface-900);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--m-ring); }

/* ── Modales ─────────────────────────────────────────────────────────────── */
.modal-overlay { background: rgba(15,23,42,.5); backdrop-filter: blur(2px); }
.modal-content {
  border-radius: var(--m-radius); box-shadow: 0 20px 50px rgba(15,23,42,.30);
  border: 1px solid var(--surface-200); overflow: hidden;
}
.modal-header { border-bottom: 1px solid var(--surface-200); }
.modal-header h3 { font-weight: 700; }
.modal-footer { border-top: 1px solid var(--surface-200); }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-card { border-radius: 20px; box-shadow: 0 20px 50px rgba(15,23,42,.12); }
.login-titulo { font-weight: 800; letter-spacing: -.01em; }

/* ── Modo oscuro: ajustes finos sobre la capa Mosaic ─────────────────────── */
html[data-theme="dark"] body { background: var(--surface-50); }
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .form-card { background: var(--surface-0); border-color: var(--surface-200); }
html[data-theme="dark"] .btn-logout,
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .btn-sm { background: var(--surface-0); border-color: var(--surface-300); color: var(--surface-700); }
html[data-theme="dark"] .card-icon { background: rgba(99,102,241,.18); color: #c7d2fe; }
html[data-theme="dark"] .topbar-saldo { background: rgba(99,102,241,.18); color: #c7d2fe; }
html[data-theme="dark"] .tabla tbody tr:hover { background: var(--surface-100); }
