/* ──────────────────────────────────────────────────────────────
   Findex · Sistema visual (aplica a todas las vistas)
   Misma paleta del tema DaisyUI "corporate". Solo agrega tonos
   suaves y variantes oscuras del mismo color para fondos de
   etiquetas y textos con contraste AA.
   ────────────────────────────────────────────────────────────── */

:root {
  --ui-bg: #f6f7f9;
  --ui-border: #dfe1e5;
  --ui-line: #eef0f3;
  --ui-muted: #5f6275;
  --ui-ink-2: #3e4152;
  --ui-primary-strong: #425ff7;
  --ui-primary-hover: #2f48d0;
  --ui-primary-text: #3d59f0;
  --ui-primary-soft: #f1f5ff;
  --ui-success-text: #007d51;
  --ui-success-soft: #e1f8eb;
  --ui-error-text: #cc2537;
  --ui-error-soft: #ffedec;
  --ui-warning-text: #8a5600;
  --ui-warning-soft: #fff4de;
  --ui-info-text: #006d92;
  --ui-info-soft: #e3f5ff;
  --ui-radius: 0.875rem;
  --ui-radius-sm: 0.625rem;
}

/* ── Fondo y tipografía ───────────────────────────────────── */
body.bg-base-200 { background-color: var(--ui-bg); }
main { font-variant-numeric: tabular-nums; }
main h1.text-2xl { font-size: 1.625rem; letter-spacing: -0.01em; }
.ui-sub { margin: 0.25rem 0 0; color: var(--ui-muted); font-size: 0.875rem; }
.ui-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.ui-page-head h1 { margin: 0; }
.ui-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; }

/* ── Menú lateral: activo en azul, no en negro ────────────── */
.drawer-side .menu li > a.active {
  background-color: var(--ui-primary-soft) !important;
  color: var(--ui-primary-text) !important;
  font-weight: 600;
}
.drawer-side .menu li > a:not(.active):hover { background-color: var(--ui-line); }

/* ── Botones ──────────────────────────────────────────────── */
.btn {
  height: 2.75rem; min-height: 2.75rem;
  border-radius: var(--ui-radius-sm);
  font-weight: 600; font-size: 0.875rem;
  text-transform: none; padding-inline: 1.125rem;
  animation: none;
}
.btn-sm { height: 2.5rem; min-height: 2.5rem; padding-inline: 1rem; font-size: 0.875rem; }
.btn-xs { height: 2rem; min-height: 2rem; padding-inline: 0.75rem; font-size: 0.8125rem; }
.btn-primary:not(.btn-outline) {
  background-color: var(--ui-primary-strong); border-color: var(--ui-primary-strong); color: #fff;
}
.btn-primary:not(.btn-outline):hover { background-color: var(--ui-primary-hover); border-color: var(--ui-primary-hover); }
.btn-outline:not(.btn-primary):not(.btn-error):not(.btn-success):not(.btn-warning):not(.btn-info) {
  background-color: oklch(var(--b1)); border-color: var(--ui-border); color: oklch(var(--bc));
}
.btn-outline:not(.btn-primary):not(.btn-error):not(.btn-success):not(.btn-warning):not(.btn-info):hover {
  background-color: oklch(var(--b1)); border-color: oklch(var(--p)); color: var(--ui-primary-text);
}
.btn-outline.btn-primary { border-color: var(--ui-border); color: var(--ui-primary-text); background: oklch(var(--b1)); }
.btn-outline.btn-primary:hover { background: var(--ui-primary-soft); border-color: oklch(var(--p)); color: var(--ui-primary-text); }
.btn-outline.btn-error { border-color: #ffd3d3; color: var(--ui-error-text); background: var(--ui-error-soft); }
.btn-outline.btn-error:hover { background: #ffdcdc; border-color: var(--ui-error-text); color: var(--ui-error-text); }
.btn-error:not(.btn-outline) { background-color: var(--ui-error-text); border-color: var(--ui-error-text); color: #fff; }
.btn-success:not(.btn-outline) { background-color: var(--ui-success-text); border-color: var(--ui-success-text); color: #fff; }
.btn-ghost { color: var(--ui-ink-2); }
.btn-link { color: var(--ui-primary-text); }

/* Botón de ícono (editar / eliminar en tablas) */
.ui-icon-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ui-muted); background: transparent; border: 0; cursor: pointer;
  transition: background-color .12s, color .12s;
}
.ui-icon-btn:hover { background: var(--ui-line); color: oklch(var(--bc)); }
.ui-icon-btn.is-danger { color: var(--ui-error-text); }
.ui-icon-btn.is-danger:hover { background: var(--ui-error-soft); }

/* ── Tarjetas y estadísticas ──────────────────────────────── */
.card, .collapse, .stat, .stats {
  border-radius: var(--ui-radius) !important;
}
.card.shadow-sm, .card.shadow, .collapse.shadow-sm, .stat.shadow-sm, .stats.shadow, .stats.shadow-sm {
  border: 1px solid var(--ui-border);
  box-shadow: none;
}
.stat .stat-title { color: var(--ui-muted); font-size: 0.8125rem; font-weight: 500; opacity: 1; }
.stat .stat-value { font-weight: 700; }

/* Bloques de color saturado (Reportes) → tarjeta blanca con punto de color */
.stat.bg-success, .stat.bg-error, .stat.bg-info, .stat.bg-primary, .stat.bg-warning {
  background-color: oklch(var(--b1)) !important;
  color: oklch(var(--bc)) !important;
  border: 1px solid var(--ui-border);
  box-shadow: none;
}
.stat.bg-success .stat-title, .stat.bg-error .stat-title, .stat.bg-info .stat-title,
.stat.bg-primary .stat-title, .stat.bg-warning .stat-title {
  color: var(--ui-muted) !important; opacity: 1 !important;
  display: flex; align-items: center; gap: 0.375rem;
}
.stat.bg-success .stat-title::before, .stat.bg-error .stat-title::before, .stat.bg-info .stat-title::before,
.stat.bg-primary .stat-title::before, .stat.bg-warning .stat-title::before {
  content: ""; width: 0.5rem; height: 0.5rem; border-radius: 999px; flex-shrink: 0;
}
.stat.bg-success .stat-title::before { background: oklch(var(--su)); }
.stat.bg-error .stat-title::before { background: oklch(var(--er)); }
.stat.bg-info .stat-title::before { background: oklch(var(--in)); }
.stat.bg-primary .stat-title::before { background: oklch(var(--p)); }
.stat.bg-warning .stat-title::before { background: oklch(var(--wa)); }
.stat.bg-error .stat-value { color: var(--ui-error-text); }

/* Franja de totales (Gastos / Ingresos) */
.ui-totals {
  display: flex; flex-wrap: wrap; margin-bottom: 1.25rem;
  background: oklch(var(--b1)); border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
}
.ui-totals > div { flex: 1 1 12rem; padding: 1.125rem 1.375rem; display: flex; flex-direction: column; gap: 0.375rem; }
.ui-totals > div + div { border-left: 1px solid var(--ui-line); }
.ui-totals span { color: var(--ui-muted); font-size: 0.8125rem; font-weight: 500; }
.ui-totals strong { font-size: 1.5rem; font-weight: 700; }
@media (max-width: 640px) { .ui-totals > div + div { border-left: 0; border-top: 1px solid var(--ui-line); } }

/* ── Tablas ───────────────────────────────────────────────── */
.table thead tr { border-bottom: 1px solid var(--ui-line) !important; }
.table thead th {
  font-size: 0.75rem; font-weight: 600; color: var(--ui-muted);
  text-transform: none; letter-spacing: 0; padding-block: 0.75rem;
}
.table tbody tr { border-color: var(--ui-line) !important; }
.table td { padding-block: 0.875rem; }
.table tbody tr:hover { background-color: #fafbfc; }
.ui-amount { font-weight: 600; white-space: nowrap; text-align: right; }
.ui-table-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem;
  padding: 0.875rem 1rem; border-top: 1px solid var(--ui-line);
  background: #fafbfc; color: var(--ui-muted); font-size: 0.8125rem;
}
.ui-table-foot strong { color: oklch(var(--bc)); }

/* ── Etiquetas (badges): fondo suave + texto oscuro ───────── */
.badge {
  height: 1.625rem; padding: 0 0.625rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; border: 0;
  background-color: var(--ui-line); color: var(--ui-ink-2);
  gap: 0.375rem;
}
.badge-outline { background-color: var(--ui-line) !important; color: var(--ui-ink-2) !important; border: 0 !important; }
.badge-primary { background-color: var(--ui-primary-soft) !important; color: var(--ui-primary-text) !important; }
.badge-success { background-color: var(--ui-success-soft) !important; color: var(--ui-success-text) !important; }
.badge-error   { background-color: var(--ui-error-soft) !important; color: var(--ui-error-text) !important; }
.badge-warning { background-color: var(--ui-warning-soft) !important; color: var(--ui-warning-text) !important; }
.badge-info    { background-color: var(--ui-info-soft) !important; color: var(--ui-info-text) !important; }
.badge-ghost, .badge-neutral { background-color: var(--ui-line) !important; color: var(--ui-ink-2) !important; }
.drawer-side .badge-error { background-color: var(--ui-error-text) !important; color: #fff !important; }

/* ── Campos de formulario ─────────────────────────────────── */
.input, .select, .textarea, .file-input {
  border-radius: var(--ui-radius-sm);
  border-color: var(--ui-border);
}
.input, .select { height: 2.75rem; min-height: 2.75rem; }
.label-text { font-weight: 600; color: oklch(var(--bc)); }
.checkbox, .toggle { border-color: #b9bdcc; }
.checkbox:checked { --chkbg: oklch(var(--p)); }

/* Formularios estándar (campos_formulario) */
.ui-form { display: flex; flex-direction: column; gap: 1.125rem; }
.ui-form .form-control { margin: 0; }
.ui-form .label { padding: 0 0 0.375rem; }
.ui-check {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.875rem 1rem; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); cursor: pointer;
}
.ui-help { margin: 0.375rem 0 0; color: var(--ui-muted); font-size: 0.8125rem; }
.ui-error { margin: 0.375rem 0 0; color: var(--ui-error-text); font-size: 0.8125rem; }
.ui-form-actions {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.625rem;
  margin: 1.5rem -2rem -2rem; padding: 1rem 2rem;
  border-top: 1px solid var(--ui-line); background: #fafbfc;
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}

/* ── Barra de filtros (siempre visible) ───────────────────── */
.ui-filters { background: oklch(var(--b1)); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); padding: 1rem; margin-bottom: 1rem; }
.ui-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; align-items: end; }
.ui-filter-grid .ui-field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.ui-filter-grid .ui-field.is-wide { grid-column: span 2; }
.ui-filter-grid label > span, .ui-filter-grid .ui-field > label { font-size: 0.75rem; font-weight: 600; color: var(--ui-muted); }
.ui-filter-grid .input, .ui-filter-grid .select { height: 2.5rem; min-height: 2.5rem; }
.ui-filter-actions { display: flex; gap: 0.5rem; align-items: center; }
@media (max-width: 640px) { .ui-filter-grid .ui-field.is-wide { grid-column: auto; } }

/* ── Pestañas (Ahorros) como control segmentado ───────────── */
.tabs-boxed { background: var(--ui-line) !important; border-radius: 0.75rem; padding: 0.25rem; gap: 0.25rem; }
.tabs-boxed .tab { height: 2.375rem; border-radius: 0.5625rem; color: var(--ui-ink-2); font-weight: 500; }
.tabs-boxed .tab-active, .tabs-boxed .tab-active:hover {
  background: oklch(var(--b1)) !important; color: oklch(var(--bc)) !important; font-weight: 600;
  box-shadow: 0 1px 2px rgb(24 26 42 / 0.08);
}

/* ── Barras de progreso, alertas, enlaces ─────────────────── */
.progress { height: 0.625rem; border-radius: 999px; background-color: var(--ui-line); }
.progress::-webkit-progress-bar { background-color: var(--ui-line); border-radius: 999px; }
.alert { border-radius: var(--ui-radius-sm); }
.link-primary, a.link { color: var(--ui-primary-text); }
.text-primary { color: var(--ui-primary-text) !important; }
.text-success { color: var(--ui-success-text) !important; }
.text-error { color: var(--ui-error-text) !important; }
.text-warning { color: var(--ui-warning-text) !important; }
.text-info { color: var(--ui-info-text) !important; }
.drawer-side .text-primary, .navbar .text-primary { color: oklch(var(--p)) !important; }

/* ── Paginación ───────────────────────────────────────────── */
.join .btn { height: 2.5rem; min-height: 2.5rem; border-color: var(--ui-border); background: oklch(var(--b1)); }
.join .btn-active { background: var(--ui-primary-soft); color: var(--ui-primary-text); border-color: var(--ui-border); }

/* ── Estado vacío ─────────────────────────────────────────── */
.ui-empty { display: flex; flex-direction: column; align-items: center; gap: 0.625rem; padding: 2.5rem 1rem; text-align: center; }
.ui-empty-icon { width: 3rem; height: 3rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; background: var(--ui-primary-soft); color: var(--ui-primary-text); }
.ui-empty strong { font-size: 1rem; }
.ui-empty p { margin: 0; max-width: 26rem; color: var(--ui-muted); font-size: 0.875rem; line-height: 1.5; }

/* ── Formulario de movimiento (gasto / ingreso) ───────────── */
.ui-crumbs { display: flex; gap: 0.5rem; font-size: 0.8125rem; color: var(--ui-muted); margin-bottom: 0.5rem; }
.ui-crumbs a { color: var(--ui-primary-text); font-weight: 600; text-decoration: none; }
.ui-mov-layout { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; max-width: 65rem; }
.ui-mov-form { flex: 2 1 30rem; min-width: 0; background: oklch(var(--b1)); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); }
.ui-mov-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.ui-mov-aside { flex: 1 1 16rem; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.ui-field { display: flex; flex-direction: column; gap: 0.5rem; }
.ui-field > .ui-label, .ui-legend { font-weight: 600; font-size: 0.875rem; }
.ui-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.ui-money {
  display: flex; align-items: center; gap: 0.5rem; height: 4rem; padding: 0 1.125rem;
  border: 2px solid var(--ui-border); border-radius: 0.75rem; background: oklch(var(--b1));
  transition: border-color .15s, box-shadow .15s;
}
.ui-money:focus-within { border-color: oklch(var(--p)); box-shadow: 0 0 0 4px var(--ui-primary-soft); }
.ui-money > span { font-size: 1.5rem; font-weight: 600; color: var(--ui-muted); }
.ui-money > small { font-size: 0.8125rem; color: var(--ui-muted); }
.ui-money input {
  flex-grow: 1; min-width: 0; height: auto; min-height: 0; padding: 0;
  border: 0 !important; outline: none; box-shadow: none !important; background: transparent;
  font-size: 1.75rem; font-weight: 700;
}
.ui-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; border: 0; margin: 0; padding: 0; }
.ui-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ui-chip span {
  display: inline-flex; align-items: center; height: 2.5rem; padding: 0 0.875rem;
  border-radius: 999px; border: 1px solid var(--ui-border); background: oklch(var(--b1));
  color: var(--ui-ink-2); font-weight: 600; font-size: 0.875rem; cursor: pointer;
  transition: border-color .12s, background-color .12s, color .12s;
}
.ui-chip span:hover { border-color: oklch(var(--p)); }
.ui-chip input:checked + span { border-color: oklch(var(--p)); background: var(--ui-primary-soft); color: var(--ui-primary-text); }
.ui-chip input:focus-visible + span { outline: 2px solid oklch(var(--p)); outline-offset: 2px; }
.ui-chip-add span { border-style: dashed; color: var(--ui-primary-text); }
.ui-mov-foot {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.625rem;
  padding: 1rem 1.5rem; border-top: 1px solid var(--ui-line); background: #fafbfc;
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}
.ui-side-card { background: oklch(var(--b1)); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.ui-side-card h2 { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.ui-side-row { display: flex; justify-content: space-between; gap: 1rem; }
.ui-side-row span { color: var(--ui-muted); }
.ui-tip { padding: 1rem; border-radius: var(--ui-radius); background: var(--ui-primary-soft); color: var(--ui-primary-hover); font-size: 0.8125rem; line-height: 1.55; }

/* ── Utilidades que el tailwind.css compilado no incluye ──── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overflow-hidden { overflow: hidden; }
.max-w-\[260px\] { max-width: 260px; }
.max-w-\[300px\] { max-width: 300px; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.mb-5 { margin-bottom: 1.25rem; }
.text-base-content\/40 { color: oklch(var(--bc) / 0.55); }
.text-base-content\/50 { color: oklch(var(--bc) / 0.6); }
.text-base-content\/60 { color: var(--ui-muted); }
.text-base-content\/70 { color: oklch(var(--bc) / 0.75); }
.text-base-content\/80 { color: var(--ui-ink-2); }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-2 { padding-top: 0.5rem; } .pt-4 { padding-top: 1rem; }
.font-mono { font-family: inherit; font-variant-numeric: tabular-nums; }
.h-1\.5 { height: 0.5rem; } .w-1\.5 { width: 0.375rem; } .h-1\.5.w-1\.5 { height: 0.375rem; }
.inline-flex { display: inline-flex; }
.divide-y > * + * { border-top: 1px solid var(--ui-line); }
.tracking-wider { letter-spacing: 0; }
.ml-auto { margin-left: auto; }
.flex-shrink-0 { flex-shrink: 0; }
.leading-relaxed { line-height: 1.625; }
.gap-6 { gap: 1.5rem; }
.space-y-4 > * + * { margin-top: 1rem; } .space-y-6 > * + * { margin-top: 1.5rem; }
.w-8 { width: 2rem; } .w-10 { width: 2.5rem; } .h-10 { height: 2.5rem; } .w-16 { width: 4rem; } .h-16 { height: 4rem; }
.w-24 { width: 6rem; } .w-28 { width: 7rem; } .h-28 { height: 7rem; } .w-32 { width: 8rem; }
.max-w-\[140px\] { max-width: 140px; } .max-w-\[180px\] { max-width: 180px; }
.min-h-\[60vh\] { min-height: 60vh; }
.shadow-lg { box-shadow: 0 10px 24px rgb(24 26 42 / 0.10); }
/* Barras de progreso hechas con div (metas, deudas) */
.rounded-full.h-1\.5 { height: 0.5rem; }
/* Selects sin clase dentro de filtros */
.ui-filters select:not(.select), .ui-filters input:not([type=checkbox]):not(.input) {
  height: 2.5rem; padding: 0 0.75rem; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  background: oklch(var(--b1)); font: inherit; color: oklch(var(--bc)); width: 100%;
}
.ui-filters .label { padding: 0 0 0.375rem; }
.ui-filters .label-text { font-size: 0.75rem; color: var(--ui-muted); }

/* Botón "Limpiar" de los filtros: sombreado gris para diferenciarlo de "Filtrar" */
.btn.btn-limpiar {
  background-color: #e9ebef;
  border: 1px solid var(--ui-border);
  color: var(--ui-ink-2);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
}
.btn.btn-limpiar:hover {
  background-color: #dde0e6;
  border-color: #c9ccd3;
  color: #1f2230;
}
