/* =====================================================================
   TESORERÍA - MINISTERIO DE JÓVENES
   Sistema de diseño: modo claro/oscuro, responsive, componentes
   ===================================================================== */

/* ---------- Fuente local (Inter, sin internet) ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/inter-latin-800-normal.woff2') format('woff2');
}

/* ---------- Variables de tema ---------- */
:root {
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --primary: #4338ca;
  --primary-strong: #3730a3;
  --primary-soft: #eef2ff;
  --primary-glow: rgba(67, 56, 202, .14);

  --green: #059669;
  --green-strong: #047857;
  --green-soft: #ecfdf5;
  --green-glow: rgba(5, 150, 105, .14);

  --red: #e11d48;
  --red-strong: #be123c;
  --red-soft: #fff1f2;
  --red-glow: rgba(225, 29, 72, .13);

  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-glow: rgba(217, 119, 6, .13);

  --blue: #2563eb;
  --blue-soft: #eff6ff;

  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e4e7f2;
  --border-strong: #d3d8ea;

  --text: #1e2235;
  --text-2: #5b6175;
  --text-3: #9298ad;

  --shadow-sm: 0 1px 2px rgba(20, 24, 60, .05), 0 1px 3px rgba(20, 24, 60, .06);
  --shadow-md: 0 4px 14px rgba(20, 24, 60, .08);
  --shadow-lg: 0 12px 40px rgba(20, 24, 60, .16);

  --radius: 14px;
  --radius-sm: 10px;

  --sidebar-w: 264px;
  --topbar-h: 64px;

  --transition: .18s cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --primary: #6366f1;
  --primary-strong: #818cf8;
  --primary-soft: rgba(99, 102, 241, .14);
  --primary-glow: rgba(99, 102, 241, .18);

  --green: #34d399;
  --green-strong: #6ee7b7;
  --green-soft: rgba(16, 185, 129, .12);
  --green-glow: rgba(16, 185, 129, .16);

  --red: #fb7185;
  --red-strong: #fda4af;
  --red-soft: rgba(244, 63, 94, .12);
  --red-glow: rgba(244, 63, 94, .15);

  --amber: #fbbf24;
  --amber-soft: rgba(245, 158, 11, .12);
  --amber-glow: rgba(245, 158, 11, .15);

  --blue: #60a5fa;
  --blue-soft: rgba(59, 130, 246, .13);

  --bg: #0d1020;
  --surface: #161a2e;
  --surface-2: #1c2138;
  --border: #262c47;
  --border-strong: #333a5c;

  --text: #e8eaf6;
  --text-2: #a9aecb;
  --text-3: #6f7590;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.25; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; flex: none; }

/* =====================================================================
   LAYOUT GENERAL (app)
   ===================================================================== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform var(--transition), background var(--transition);
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.sidebar-title { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.sidebar-subtitle { font-size: 11px; color: var(--text-3); font-weight: 500; }

.nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-section { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 600; font-size: 13.5px;
  border: none; background: none; cursor: pointer; width: 100%; text-align: left;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-strong); }
.nav-item.active .icon { color: var(--primary); }
.nav-item .icon { color: var(--text-3); transition: color var(--transition); }

.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.theme-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--text-2);
  transition: border-color var(--transition);
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle span { display: flex; align-items: center; gap: 8px; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-info { min-width: 0; flex: 1; }
.user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-3); font-weight: 500; }
.logout-btn {
  border: none; background: none; cursor: pointer; color: var(--text-3);
  display: grid; place-items: center; padding: 7px; border-radius: 9px;
  transition: background var(--transition), color var(--transition);
}
.logout-btn:hover { background: var(--red-soft); color: var(--red); }

.main {
  flex: 1; margin-left: var(--sidebar-w);
  min-width: 0; display: flex; flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.hamburger {
  display: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); padding: 8px; cursor: pointer; color: var(--text);
}
.topbar-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 22px; max-width: 1500px; width: 100%; margin: 0 auto; flex: 1; }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 30, .5);
  z-index: 45; opacity: 0; pointer-events: none; transition: opacity var(--transition);
}

.page-section { display: none; }
.page-section.active { display: block; animation: fadeUp .28s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* =====================================================================
   COMPONENTES BÁSICOS
   ===================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px var(--primary-glow); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 3px 10px var(--green-glow); }
.btn-green:hover { background: var(--green-strong); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 3px 10px var(--red-glow); }
.btn-red:hover { background: var(--red-strong); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { padding: 7px; border-radius: 9px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  letter-spacing: .01em; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }

.amount-in { color: var(--green); font-weight: 700; }
.amount-out { color: var(--red); font-weight: 700; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.field input.invalid, .field select.invalid, .field textarea.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}
.field .error-msg { color: var(--red); font-size: 11.5px; font-weight: 600; display: none; }
.field.has-error .error-msg { display: block; }
.field-hint { font-size: 11px; color: var(--text-3); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239298ad' stroke-width='3' 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; padding-right: 34px !important; }
[data-theme="dark"] select { color-scheme: dark; }
input[type="date"], input[type="datetime-local"] { color-scheme: light; }
[data-theme="dark"] input[type="date"], [data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }

.file-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px; text-align: center; cursor: pointer;
  color: var(--text-2); font-size: 12.5px; font-weight: 600;
  transition: border-color var(--transition), background var(--transition);
}
.file-drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.file-drop.has-file { border-style: solid; border-color: var(--green); color: var(--green); }
.file-preview { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; }
.file-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.file-preview a { font-weight: 600; }

/* ---------- Filtros ---------- */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 14px 16px; margin-bottom: 14px;
}
.filters-bar .field { min-width: 130px; }
.filters-bar .field label { font-size: 11.5px; }
.filters-bar input, .filters-bar select { padding: 7px 10px; font-size: 13px; }
.filters-bar .grow { flex: 1; min-width: 170px; }
.filters-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); font-weight: 700;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text); }
.table th .sort-ind { font-size: 10px; margin-left: 3px; color: var(--primary); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.row-anulada { opacity: .58; }
.table .row-actions { display: flex; gap: 5px; justify-content: flex-end; align-items: center; flex-wrap: wrap; min-width: 150px; }
.table .empty {
  text-align: center; padding: 42px 16px; color: var(--text-3); font-weight: 500;
}

.table-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.totals-strip { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.totals-strip b { color: var(--text); }

.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button {
  min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-weight: 600; cursor: pointer; font-size: 12.5px;
  transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { font-size: 12px; color: var(--text-3); margin: 0 6px; }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 10, 26, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: fadeIn .18s ease;
  backdrop-filter: blur(3px);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%; max-width: 640px;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.modal-sm { max-width: 430px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; flex: 1; }
.modal-close {
  border: none; background: var(--surface-2); color: var(--text-2);
  width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center; transition: background var(--transition);
}
.modal-close:hover { background: var(--red-soft); color: var(--red); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Detalle */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.detail-grid .span-2 { grid-column: span 2; }
.detail-item { min-width: 0; }
.detail-item .dl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; margin-bottom: 2px; }
.detail-item .dd { font-weight: 600; font-size: 13.5px; word-break: break-word; }

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 380px);
}
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px; padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s cubic-bezier(.2, .9, .3, 1.15);
}
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }
.toast-icon { flex: none; margin-top: 1px; }
.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-info .toast-icon { color: var(--blue); }
.toast-warning .toast-icon { color: var(--amber); }
.toast-body { min-width: 0; }
.toast-title { font-weight: 700; font-size: 13.5px; }
.toast-msg { font-size: 12.5px; color: var(--text-2); }

/* ---------- Spinner / skeleton ---------- */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--primary);
  animation: spin .7s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row td { text-align: center; padding: 30px; color: var(--text-3); }

.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Alertas ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px;
  font-size: 13px; font-weight: 600;
  border: 1px solid;
}
.alert .icon { flex: none; margin-top: 1px; }
.alert-warning { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber); }
.alert-danger { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); color: var(--red); }
.alert-info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 35%, transparent); color: var(--blue); }

/* ---------- Tabs internos ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 8px; margin-bottom: 16px; overflow-x: auto; }
.tab-btn {
  border: none; background: none; cursor: pointer;
  padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .22s ease; }

/* ---------- Auditoría ---------- */
.audit-details {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px;
  font-size: 12px; white-space: pre-wrap; word-break: break-word; max-width: 560px;
  font-family: ui-monospace, Consolas, monospace;
}
.diff-old { color: var(--red); }
.diff-new { color: var(--green); }

/* ---------- Password temp ---------- */
.temp-password-box {
  background: var(--primary-soft); border: 1px dashed var(--primary);
  border-radius: var(--radius-sm); padding: 14px; text-align: center; margin: 14px 0;
}
.temp-password-box code {
  font-size: 22px; font-weight: 800; letter-spacing: .08em; color: var(--primary-strong);
  font-family: ui-monospace, Consolas, monospace;
}

/* =====================================================================
   LOGIN
   ===================================================================== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(67, 56, 202, .5) 0%, transparent 55%),
    radial-gradient(900px 500px at 105% 108%, rgba(124, 58, 237, .42) 0%, transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
  animation: modalIn .35s cubic-bezier(.2, .9, .3, 1.15);
}
.login-logo {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 24px var(--primary-glow);
}
.login-card h1 { text-align: center; font-size: 21px; letter-spacing: -.01em; }
.login-card .sub { text-align: center; color: var(--text-2); font-size: 13px; margin: 5px 0 22px; }
.login-error {
  display: none; align-items: flex-start; gap: 9px;
  background: var(--red-soft); color: var(--red);
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
  border-radius: var(--radius-sm); padding: 11px 13px;
  font-size: 12.5px; font-weight: 600; margin-bottom: 16px;
}
.login-error.show { display: flex; animation: fadeUp .25s ease; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer; color: var(--text-3);
  padding: 6px; border-radius: 8px; display: grid; place-items: center;
}
.password-toggle:hover { color: var(--text); }
.login-foot { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-3); }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.stat-card .stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.stat-card .stat-value { font-size: 23px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-card .stat-sub { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.stat-indigo .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat-green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-green .stat-value { color: var(--green); }
.stat-red .stat-icon { background: var(--red-soft); color: var(--red); }
.stat-red .stat-value { color: var(--red); }
.stat-amber .stat-icon { background: var(--amber-soft); color: var(--amber); }

.charts-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; margin-bottom: 14px; }
.charts-grid .card { padding: 18px; }
.chart-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.chart-sub { font-size: 11.5px; color: var(--text-3); margin-bottom: 12px; }
.chart-box { position: relative; height: 280px; }
.chart-box-sm { height: 220px; }
.chart-nodata {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-3); font-weight: 600; font-size: 13px;
}
.dash-bottom { display: grid; grid-template-columns: 1fr; gap: 14px; }
.mov-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.mov-row:last-child { border-bottom: none; }
.mov-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.mov-icon.in { background: var(--green-soft); color: var(--green); }
.mov-icon.out { background: var(--red-soft); color: var(--red); }
.mov-main { flex: 1; min-width: 0; }
.mov-desc { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-meta { font-size: 11.5px; color: var(--text-3); }
.mov-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1240px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .hamburger { display: grid; place-items: center; }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px 14px; }
}
@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .stat-value { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .span-2 { grid-column: span 1; }
  .topbar-title { font-size: 15px; }
  .page-head h1 { font-size: 19px; }
  .filters-bar .grow { min-width: 100%; }
  .table-footer { justify-content: center; }
  .modal { max-width: 100%; }
  .content { padding: 14px 10px; }
}

/* =====================================================================
   IMPRESIÓN (exportar PDF)
   ===================================================================== */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .print-sheet { padding: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }
  .print-sheet h1 { font-size: 20px; margin-bottom: 4px; }
  .print-sheet .print-meta { font-size: 11px; color: #444; margin-bottom: 16px; }
  .print-sheet table { width: 100%; border-collapse: collapse; font-size: 11px; }
  .print-sheet th, .print-sheet td { border: 1px solid #999; padding: 6px 8px; text-align: left; }
  .print-sheet th { background: #eee; }
  .print-sheet .print-total { font-size: 13px; font-weight: 700; margin-top: 12px; }
  .no-print { display: none !important; }
}
