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

:root {
  --bg:         #0d0f18;
  --surface:    #161925;
  --surface2:   #1d2235;
  --border:     rgba(255,255,255,0.08);
  --text:       #e2e8f0;
  --text-muted: #6b7a99;
  --primary:    #6366f1;
  --primary-dk: #4f46e5;
  --primary-lt: rgba(99,102,241,0.12);
  --green:      #10b981;
  --yellow:     #f59e0b;
  --red:        #ef4444;
  --radius:     10px;
  --radius-sm:  6px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Login (dark, glassmorphism) ── */
.login-body {
  background: #0d0f18;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  overflow: hidden;
  position: relative;
}

.login-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  animation: blobFloat 9s ease-in-out infinite alternate;
}
.blob-1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, #6366f1, #4f46e5);
  top: -160px; left: -120px;
  animation-delay: 0s;
}
.blob-2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, #10b981, #059669);
  bottom: -100px; right: -80px;
  animation-delay: 4.5s;
}
@keyframes blobFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(28px, 22px) scale(1.07); }
}

.login-card {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.11);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-radius: 20px;
  padding: 2.75rem 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.07);
  position: relative;
  z-index: 1;
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo { text-align: center; margin-bottom: 2.25rem; }

.login-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 66px; height: 66px;
  background: rgba(99,102,241,0.18);
  border: 1px solid rgba(99,102,241,0.32);
  border-radius: 18px;
  margin-bottom: 0.8rem;
  overflow: hidden;
  animation: iconPulse 3.5s ease-in-out infinite;
}
.logo-icon-lg { font-size: 2rem; line-height: 1; }
@keyframes iconPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.25); }
  55%       { box-shadow: 0 0 0 14px rgba(99,102,241,0); }
}

.login-title {
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 0.1rem;
}
.login-subtitle { color: rgba(255,255,255,0.38); font-size: 0.875rem; margin-top: 0.25rem; }

.login-form { display: flex; flex-direction: column; gap: 1.25rem; }

.login-form .form-group label {
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.login-form .form-group input {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  padding: 0.7rem 0.95rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.login-form .form-group input::placeholder { color: rgba(255,255,255,0.2); }
.login-form .form-group input:focus {
  background: rgba(255,255,255,0.1);
  border-color: rgba(99,102,241,0.65);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

.login-card .alert-error {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.28);
  color: #fca5a5;
  animation: shake 0.38s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-7px); }
  40%, 80%  { transform: translateX(7px); }
}

.btn-login {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.75rem;
  position: relative;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-login::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.13) 0%, transparent 55%);
  pointer-events: none;
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }

/* ── Form group (shared) ── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.form-group input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.6rem 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--primary); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }
.btn-full { width: 100%; padding: 0.7rem; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; }

/* ── Alerts ── */
.alert { border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 1rem; padding: 0.65rem 0.9rem; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #f87171; }

/* ── Topbar ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 6px rgba(0,0,0,.35);
}
.topbar-left { display: flex; align-items: center; gap: 0.6rem; }
.logo-icon-sm { font-size: 1.3rem; }
.topbar-title { font-weight: 700; font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.topbar-user { color: var(--text-muted); font-size: 0.88rem; }

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Month nav ── */
.month-nav-arrow {
  display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding: 0.25rem 0;
}
.month-arrow {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 1.1rem; font-weight: 600; padding: 0.3rem 1rem;
  transition: all 0.15s;
}
.month-arrow:hover { border-color: var(--primary); color: var(--primary); }
.month-arrow-disabled { opacity: 0.3; pointer-events: none; }
.month-current { font-size: 1.1rem; font-weight: 700; min-width: 160px; text-align: center; }

/* ── Hero section (new 2+1 layout) ── */
.hero-section { display: flex; flex-direction: column; gap: 0.75rem; }

.hero-top-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 600px) { .hero-top-row { grid-template-columns: 1fr; } }

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.hero-income::before  { background: linear-gradient(90deg, #10b981, #34d399); }
.hero-expense::before { background: linear-gradient(90deg, #6366f1, #818cf8); }

.hero-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}
.hero-amount {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.hero-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.45rem; }

/* ── Net flow bar (full-width, below income+expense) ── */
.hero-net-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  border: 1px solid transparent;
  gap: 1rem;
}
.hero-net-bar-positive {
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.22);
}
.hero-net-bar-negative {
  background: rgba(239,68,68,0.07);
  border-color: rgba(239,68,68,0.2);
}
.hero-net-bar-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.hero-net-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.hero-net-verdict {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hero-net-amount {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hero-net-bar-positive .hero-net-amount { color: #34d399; }
.hero-net-bar-negative .hero-net-amount { color: #f87171; }

/* ── Saldo section ── */
.saldo-section { display: flex; flex-direction: column; gap: 0.5rem; }
.saldo-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-left: 0.1rem;
}

/* ── Two-column layout ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; min-width: 0; }
.two-col > * { min-width: 0; overflow: hidden; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* ── Panels ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  min-width: 0; /* prevent grid blowout */
  overflow: hidden;
}
.panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

/* ── Budget items (compact version) ── */
.budget-list-compact { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; }
.budget-item-compact { display: flex; flex-direction: column; gap: 0.3rem; }
.budget-compact-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.budget-compact-name { font-weight: 500; }
.budget-compact-pct { font-weight: 700; font-size: 0.8rem; }

.budget-ok      .budget-compact-pct { color: #34d399; }
.budget-warning .budget-compact-pct { color: #fbbf24; }
.budget-exceeded .budget-compact-pct { color: #f87171; }

.budget-compact-bottom { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-muted); }
.budget-compact-amount { font-variant-numeric: tabular-nums; }
.badge-shared-sm, .badge-personal-sm { font-size: 0.68rem; padding: 0.1rem 0.4rem; }

/* ── Budget items (original, kept for reference) ── */
.budget-list { display: flex; flex-direction: column; gap: 1rem; }
.budget-item { display: flex; flex-direction: column; gap: 0.35rem; }
.budget-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; }
.budget-name { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.budget-pct { font-weight: 700; font-size: 0.85rem; }

.budget-ok      .budget-pct { color: #34d399; }
.budget-warning .budget-pct { color: #fbbf24; }
.budget-exceeded .budget-pct { color: #f87171; }

.progress-track { background: var(--surface2); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.progress-ok       { background: var(--green); }
.progress-warning  { background: var(--yellow); }
.progress-exceeded { background: var(--red); }

.budget-amounts { color: var(--text-muted); font-size: 0.8rem; }

/* ── Chart ── */
.chart-wrap { max-width: 220px; margin: 0 auto 1rem; }
.chart-legend {
  list-style: none; display: flex; flex-direction: column; gap: 0.45rem;
  font-size: 0.85rem; max-height: 240px; overflow-y: auto;
}
.chart-legend li { display: flex; align-items: center; gap: 0.5rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-cat { flex: 1; color: var(--text); }
.legend-amt { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Delta badges ── */
.delta-up {
  font-size: 0.7rem; font-weight: 700; color: #f87171;
  background: rgba(239,68,68,0.15); border-radius: 99px; padding: 0.05rem 0.4rem;
}
.delta-down {
  font-size: 0.7rem; font-weight: 700; color: #34d399;
  background: rgba(16,185,129,0.15); border-radius: 99px; padding: 0.05rem 0.4rem;
}

/* ── Category drill-down ── */
.chart-legend-clickable li {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.4rem;
  margin: 0 -0.4rem;
  transition: opacity 0.18s, background 0.18s;
}
.chart-legend-clickable li:hover { background: var(--surface2); }
.legend-item-active { background: rgba(99,102,241,0.12) !important; }
.legend-item-faded { opacity: 0.35 !important; }

.ownership-split {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: -0.25rem 0 0.75rem;
}

.cat-drilldown-header {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem;
}
.cat-drilldown-title {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.btn-volver {
  background: none; border: 1px solid var(--border); border-radius: 99px;
  color: var(--text-muted); cursor: pointer; font-size: 0.72rem;
  padding: 0.18rem 0.6rem; transition: color 0.15s, border-color 0.15s;
  margin-left: auto;
}
.btn-volver:hover { color: var(--text); border-color: var(--text-muted); }

.cat-accordion {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.cat-accordion-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.85rem;
  transition: background 0.15s; border-bottom: 1px solid var(--border);
}
.cat-accordion-row:last-of-type { border-bottom: none; }
.cat-accordion-row:hover,
.cat-accordion-row.open { background: var(--surface2); }
.accordion-arrow { font-size: 0.6rem; color: var(--text-muted); width: 10px; flex-shrink: 0; }
.cat-accordion-month { flex: 1; }
.cat-accordion-total { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 0.82rem; }

.cat-accordion-items {
  background: var(--bg); padding: 0.35rem 0.75rem 0.35rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.cat-accordion-items:last-child { border-bottom: none; }
.cat-accordion-items.hidden { display: none; }
.cat-accordion-item {
  display: flex; gap: 0.5rem; font-size: 0.8rem; padding: 0.18rem 0;
}
.cat-accordion-date {
  width: 32px; flex-shrink: 0; color: var(--text-muted); font-size: 0.75rem;
}
.cat-accordion-desc { flex: 1; color: var(--text); }
.cat-accordion-amt { font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.cat-accordion-loading,
.cat-accordion-empty { font-size: 0.78rem; color: var(--text-muted); padding: 0.25rem 0; }
.cat-accordion-more {
  font-size: 0.75rem; color: var(--text-muted); padding: 0.25rem 0;
  font-style: italic; border-top: 1px solid var(--border); margin-top: 0.2rem;
}

/* ── Category filter bar ── */
.filter-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 99px;
  color: var(--text-muted); cursor: pointer; font-size: 0.78rem; font-weight: 500;
  padding: 0.25rem 0.7rem; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-btn:hover { background: var(--primary-lt); color: var(--primary); border-color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Date filter bar ── */
.filter-bar-date { align-items: center; margin-bottom: 0.5rem; }
.date-range-sep { color: var(--text-muted); margin: 0 0.4rem; font-size: 0.85rem; }
.date-range-inputs { display: flex; align-items: center; gap: 0.35rem; }
.date-range-arrow { color: var(--text-muted); font-size: 0.78rem; }
.date-input {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 99px;
  color: var(--text-muted); padding: 0.25rem 0.7rem; font-size: 0.78rem; cursor: pointer;
  font-weight: 500; color-scheme: dark;
  transition: border-color 0.15s, color 0.15s;
}
.date-input:hover { border-color: var(--primary); color: var(--text-primary); }
.date-input:focus { outline: none; border-color: var(--primary); color: var(--text-primary); }
.date-input.has-value { border-color: var(--primary); color: var(--text-primary); }
.date-filter-summary { font-size: 0.82rem; color: var(--text-muted); padding: 0 0 0.6rem; }

/* ── Expense table ── */
.table-scroll { overflow-x: auto; }
.expense-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.expense-table th {
  color: var(--text-muted); font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.55rem 0.75rem; text-align: left;
  border-bottom: 2px solid var(--border); white-space: nowrap;
  background: var(--surface2);
}
.expense-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.expense-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.expense-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.expense-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.expense-table tbody tr:hover { background: var(--primary-lt); }
.expense-table tbody tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); }

/* ── Badges ── */
.badge { border-radius: 99px; font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.55rem; white-space: nowrap; }
.badge-personal    { background: rgba(99,102,241,0.15);  color: #a5b4fc; }
.badge-shared      { background: rgba(16,185,129,0.15);  color: #34d399; }
.badge-shared .spender-name { font-weight: 400; opacity: 0.85; }
.badge-cat         { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-installment { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-hist-cc     { background: rgba(99,102,241,0.15); color: #818cf8; font-size: 0.65rem; padding: 1px 4px; border-radius: 3px; margin-left: 4px; vertical-align: middle; }
.row-historical-cc td:first-child { color: var(--text-muted); }

/* ── Day-count badges ── */
.badge-ok      { background: rgba(16,185,129,0.15);  color: #34d399; }
.badge-warning { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,0.15);   color: #f87171; }

/* ── Card cycle list ── */
.cycle-list { display: flex; flex-direction: column; gap: 0.6rem; }
.cycle-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface2); border-radius: var(--radius-sm); font-size: 0.875rem;
}
.cycle-name { font-weight: 600; flex: 1; }
.cycle-dates { color: var(--text-muted); font-size: 0.8rem; }
.cycle-amount { font-weight: 600; color: var(--text-primary); margin-left: auto; white-space: nowrap; }
.cycle-badge { border-radius: 99px; font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.6rem; white-space: nowrap; }

/* ── Empty state ── */
.empty-state { color: var(--text-muted); font-size: 0.9rem; padding: 1rem 0; text-align: center; }

/* ── Panel header row ── */
.panel-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.panel-header-row .panel-title { margin-bottom: 0; }

/* ── Tab bar ── */
.tab-bar { display: flex; gap: 0.25rem; }
.tab-btn {
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer; font-size: 0.82rem; font-weight: 500;
  padding: 0.3rem 0.8rem; transition: all 0.15s;
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-panel.hidden { display: none; }
.income-amount { color: #34d399; font-weight: 600; }

/* ── Three-column layout ── */
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; min-width: 0; }
.three-col > * { min-width: 0; overflow: hidden; }
@media (max-width: 900px) { .three-col { grid-template-columns: 1fr; } }

/* ── Saldo row ── */
.saldo-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.saldo-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.1rem;
  min-width: 148px;
  position: relative;
  transition: border-color 0.15s;
}
.saldo-card:hover { border-color: rgba(255,255,255,0.15); }
.saldo-card.saldo-negative { border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.06); }
.saldo-card.saldo-usd { border-color: rgba(245,158,11,0.25); }
.saldo-name { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saldo-amount { font-size: 1.05rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.saldo-card.saldo-negative .saldo-amount { color: #f87171; }
.saldo-card.saldo-usd .saldo-amount { color: #fbbf24; }
.saldo-currency-tag {
  position: absolute;
  top: 0.4rem; right: 0.55rem;
  font-size: 0.6rem; font-weight: 700;
  color: #f59e0b;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

/* ── Hero USD sub-line ── */
.hero-sub-usd { font-size: 0.75rem; opacity: 0.7; margin-top: 2px; color: var(--text-muted); }

/* ── Task list ── */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem;
}
.task-item:last-child { border-bottom: none; }
.task-desc { flex: 1; }
.task-date { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; margin-left: 0.5rem; }
.task-overdue .task-desc { color: #f87171; }
.task-overdue .task-date { color: #f87171; font-weight: 600; }
.task-today .task-desc   { color: #fbbf24; font-weight: 500; }
.task-today .task-date   { color: #fbbf24; font-weight: 600; }

/* ── Muted small ── */
.muted-sm { color: var(--text-muted); font-size: 0.8rem; }

/* ── Obligations section ── */
.obl-list { display: flex; flex-direction: column; gap: 0.5rem; }
.obl-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem;
}
.obl-item:last-child { border-bottom: none; }
.obl-info { display: flex; flex-direction: column; gap: 2px; }
.obl-name { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.obl-status { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.badge-obl-paid    { background: rgba(16,185,129,0.15);  color: #34d399; }
.badge-obl-overdue { background: rgba(239,68,68,0.15);   color: #f87171; }
.badge-obl-urgent  { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-obl-pending { background: rgba(99,102,241,0.15);  color: #a5b4fc; }

/* ── Hero sub split (personal / compartido) ── */
.hero-sub-split { font-size: 0.75rem; opacity: 0.8; margin-top: 4px; }

/* ── Logo image ── */
.login-logo-img {
  width: 64px; height: 64px;
  object-fit: cover; border-radius: 14px; display: block;
}
.topbar-logo-img {
  width: 28px; height: 28px; max-width: 28px; max-height: 28px;
  object-fit: cover; border-radius: 6px; display: block; flex-shrink: 0;
}

/* ── Ownership filter bar (above category chips) ── */
.filter-bar-own { padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); margin-bottom: 0.6rem; }
.filter-bar-own .filter-btn[data-own="personal"].active  { background: rgba(99,102,241,0.25); border-color: #6366f1; color: #a5b4fc; }
.filter-bar-own .filter-btn[data-own="compartido"].active { background: rgba(16,185,129,0.2); border-color: #10b981; color: #34d399; }

/* ── Analytics / Tarjetas page ── */
.btn-active-page { color: var(--primary) !important; border-color: var(--primary) !important; }

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.5rem 0 1.25rem;
}

.cc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.cc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.cc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.cc-card-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.cc-badge-nolimit {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 99px;
  padding: 0.15rem 0.55rem;
}

.cc-badge {
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 0.15rem 0.55rem;
}
.cc-badge-warn { color: #f59e0b; background: rgba(245,158,11,0.15); }
.cc-badge-over { color: #f87171; background: rgba(239,68,68,0.15); }

.cc-nolimit-note {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.cc-amounts {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.cc-amount-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cc-amount-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.cc-amount-value {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.cc-amount-value.cc-warn { color: #f59e0b; }
.cc-amount-value.cc-over { color: #f87171; }

.cc-bar-wrap {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.cc-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
  min-width: 4px;
}
.bar-ok   { background: #10b981; }
.bar-warn { background: #f59e0b; }
.bar-over { background: #f87171; }

.cc-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Presupuesto page ── */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1rem;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.month-nav-inline {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

.cc-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.cc-card-clickable:hover { border-color: var(--primary); background: var(--primary-lt); }

.cc-chevron {
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  line-height: 1;
}
.cc-chevron-open { transform: rotate(90deg); }

.cc-detail {
  display: none;
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
}
.cc-detail-open { display: block; }

.cc-detail-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}
.cc-detail-row:last-child { border-bottom: none; }

.cc-detail-date {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 2.5rem;
}
.cc-detail-cat {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.cc-detail-desc {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-detail-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.cc-detail-empty {
  color: var(--text-muted);
  font-size: 0.84rem;
  margin: 0;
  padding: 0.25rem 0;
}

.budget-badge {
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 99px;
  padding: 0.15rem 0.55rem;
}
.budget-badge-personal { color: #a5b4fc; background: rgba(99,102,241,0.15); }
.budget-badge-shared   { color: #34d399; background: rgba(16,185,129,0.15); }

.font-mono { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-muted); }

/* ── LLM Stats styles ── */
.llm-page-title { margin: 1.5rem 0 1rem; font-size: 1.4rem; }
.llm-cell-mono { white-space: nowrap; font-size: .8rem; }
.llm-cell-mono-sm { font-size: .8rem; }
.llm-cell-model { font-size: .75rem; color: var(--text-muted, #888); }
.llm-cell-num { text-align: right; }
.llm-detail-row { display: none; }
.llm-detail-cell { background: var(--bg-secondary, #1d2235); padding: 1rem; }
.llm-error { color: #c0392b; margin-bottom: .5rem; }
.llm-summary { cursor: pointer; font-weight: 600; margin-bottom: .25rem; }
.llm-summary-response { margin-top: .5rem; }
.llm-pre { white-space: pre-wrap; font-size: .75rem; max-height: 200px; overflow-y: auto; }

/* ── Row action buttons ── */
.row-actions { width: 52px; text-align: right; white-space: nowrap; opacity: 0; transition: opacity 0.15s; }
tr:hover .row-actions { opacity: 1; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 0.8rem; padding: 3px 5px; border-radius: 4px;
  line-height: 1; vertical-align: middle;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); }

/* ── Edit modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #1e2235; border-radius: 12px; padding: 24px;
  width: 420px; max-width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.modal-close-btn {
  background: none; border: none; color: #9aa5c0;
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.modal-close-btn:hover { color: #e8eaf6; }
.modal-warning {
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
  color: #f59e0b; border-radius: 8px; padding: 9px 12px;
  font-size: 0.82rem; margin-bottom: 16px;
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.78rem; color: #9aa5c0; margin-bottom: 5px; }
.form-input {
  width: 100%; box-sizing: border-box;
  background: #13172a; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; padding: 8px 10px;
  color: #e8eaf6; font-size: 0.9rem;
}
.form-input:focus { outline: none; border-color: #6366f1; }
select.form-input { appearance: auto; }
.form-note { font-size: 0.75rem; color: #9aa5c0; font-weight: 400; }
.modal-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 20px; gap: 8px;
}
.modal-right-actions { display: flex; gap: 8px; }
.btn-danger {
  background: rgba(239,68,68,0.15); color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.28); }
