/* ==========================================================================
   UPLIFTED — components.css
   Reusable UI pieces: cards, buttons, forms, sheets, lists, chat, print.
   ========================================================================== */

/* ---- Glass card ------------------------------------------------ */
/* Solid on both themes (Release B): white with a hairline edge on light. */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
}
.card-pad { padding: var(--space-5); }
.card-hover { transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .card-hover:hover { border-color: var(--border-glass-strong); transform: translateY(-2px); }
}

/* ---- Hero balance card ------------------------------------------------ */
.hero-card {
  padding: var(--space-6) var(--space-6) var(--space-5);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 260px; height: 260px;
  background: radial-gradient(circle, var(--accent-gold-soft), transparent 70%);
  pointer-events: none;
}
.hero-label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hero-value { margin-top: var(--space-2); display: flex; align-items: baseline; gap: 6px; }
.hero-value .cur { font-size: 1.4rem; color: var(--text-secondary); font-family: var(--font-display); }
.hero-delta { display: inline-flex; align-items: center; gap: 4px; margin-top: var(--space-3); font-size: var(--fs-sm); font-weight: 600; }

/* Odometer-style digit roll for the hero number */
.digit-roll { display: inline-block; overflow: hidden; height: 1em; line-height: 1; vertical-align: bottom; }
.digit-roll span { display: inline-block; line-height: 1; animation: rollDigit var(--dur-slow) var(--ease-out) both; }
@keyframes rollDigit { from { transform: translateY(0.4em); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- Scrollable charts ------------------------------------------------
   Wraps a canvas that's rendered wider than its container so dense line
   charts (30–90 daily points) get comfortable per-day spacing instead of
   being squeezed to fit — the container scrolls horizontally instead. */
.chart-scroll { position: relative; }
.chart-scroll-track {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chart-scroll-track::-webkit-scrollbar { display: none; }
.chart-scroll-track canvas { display: block; }
.chart-scroll::before, .chart-scroll::after {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 22px;
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out);
}
.chart-scroll::before { left: 0; background: linear-gradient(90deg, var(--bg-surface), transparent); }
.chart-scroll::after { right: 0; background: linear-gradient(270deg, var(--bg-surface), transparent); }
.chart-scroll.at-start::before { opacity: 0; }
.chart-scroll.at-end::after { opacity: 0; }

/* ---- Category donut + legend ------------------------------------------------ */
.donut-legend-row { display: flex; align-items: flex-start; gap: var(--space-6); flex-wrap: wrap; max-width: 640px; }
.donut-wrap { position: relative; width: 160px; height: 160px; flex-shrink: 0; margin: 0 auto; }
.donut-wrap canvas { display: block; width: 100%; height: 100%; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.donut-center-value { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.donut-center-label { font-size: var(--fs-2xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

.donut-legend { flex: 1; min-width: 190px; display: flex; flex-direction: column; }
.legend-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border-glass); }
.legend-row:last-child { border-bottom: none; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-name { font-size: var(--fs-xs); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.legend-figures { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.legend-amt { font-size: var(--fs-xs); font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.legend-pct { font-size: var(--fs-2xs); color: var(--text-muted); }

@media (max-width: 420px) {
  .donut-wrap { width: 132px; height: 132px; }
  .donut-center-value { font-size: var(--fs-md); }
}

.score-card-wide { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--space-6); flex-wrap: wrap; }
.score-card-main { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.score-card-breakdown { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 9px; }
.score-factor-row { display: flex; align-items: center; gap: 10px; }
.score-factor-label { font-size: var(--fs-2xs); color: var(--text-muted); width: 108px; flex-shrink: 0; }
.score-factor-track { flex: 1; height: 5px; border-radius: 3px; background: var(--bg-surface-2); overflow: hidden; }
.score-factor-fill { height: 100%; border-radius: 3px; transition: width var(--dur-slow) var(--ease-out); }

/* ---- Inline text link (page-auth.js's mode-switch links reference this
   class but it had no rule of its own, so they rendered as plain
   undecorated text — fixed here, and reused by the pricing page below) ---- */
.link { color: var(--blue-t); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---- Pricing / paywall plan cards ------------------------------------------------ */
.pricing-plans {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4);
  margin: var(--space-6) 0;
}
@media (max-width: 480px) {
  .pricing-plans { grid-template-columns: 1fr; }
}
.pricing-plan {
  position: relative;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-glass-strong);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4) var(--space-4);
  text-align: left;
  display: flex; flex-direction: column; gap: var(--space-1);
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.pricing-plan.featured { border-color: var(--accent-gold); background: var(--accent-gold-soft); }
@media (hover: hover) and (pointer: fine) {
  .pricing-plan:hover { transform: translateY(-2px); }
}
.pricing-plan-name { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.pricing-plan.featured .pricing-plan-name { color: var(--gold-t); }
.pricing-price { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 500; letter-spacing: -0.01em; margin-top: 2px; }
.pricing-price-period { font-size: var(--fs-2xs); color: var(--text-muted); font-weight: 400; margin-left: 3px; }
.pricing-plan-note { font-size: var(--fs-2xs); color: var(--text-muted); margin-bottom: var(--space-4); line-height: 1.4; }
.pricing-plan .btn { margin-top: auto; }

/* ---- Onboarding (first-run currency picker) ------------------------------------------------ */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg-canvas);
  background-image: var(--canvas-glow);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-5);
  opacity: 1;
  transition: opacity 0.22s var(--ease-out);
}
.onboarding-overlay.leaving { opacity: 0; }
.onboarding-card {
  width: 100%; max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-pop);
}
.onboarding-logo { font-size: 32px; color: var(--gold-t); margin-bottom: var(--space-4); }
.onboarding-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; letter-spacing: -0.01em; margin-bottom: var(--space-3); }
.onboarding-sub { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; margin-bottom: var(--space-6); }
.onboarding-currency-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.onboarding-currency-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 14px 16px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.onboarding-currency-btn.recommended { border-color: var(--accent-gold); background: var(--accent-gold-soft); }
@media (hover: hover) and (pointer: fine) {
  .onboarding-currency-btn:hover { border-color: var(--border-glass-strong); }
  .onboarding-currency-btn.recommended:hover { border-color: var(--accent-gold-bright); }
}
.onboarding-currency-btn:active { transform: scale(0.98); }
.onboarding-currency-code { font-size: var(--fs-md); font-weight: 700; letter-spacing: 0.01em; }
.onboarding-currency-name { font-size: var(--fs-2xs); color: var(--text-muted); }
.onboarding-badge {
  position: absolute; top: -9px; right: 10px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-on-accent); background: var(--accent-gold-bright);
  padding: 2px 7px; border-radius: var(--radius-full);
}
.onboarding-footnote { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: var(--space-5); line-height: 1.5; }

/* ---- Stat cards ------------------------------------------------ */
.stat-card { padding: var(--space-4) var(--space-5); }
.stat-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-3);
}
.stat-icon svg { width: 17px; height: 17px; }
.stat-icon.gold { background: var(--accent-gold-soft); color: var(--gold-t); }
.stat-icon.blue { background: var(--accent-blue-soft); color: var(--blue-t); }
.stat-icon.green { background: var(--accent-green-soft); color: var(--green-t); }
.stat-icon.red { background: var(--accent-red-soft); color: var(--red-t); }
.stat-label { font-size: var(--fs-xs); color: var(--text-muted); }
.stat-value { font-size: var(--fs-xl); font-weight: 600; margin-top: 2px; letter-spacing: -0.01em; }
.stat-sub { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 4px; }

/* ---- Buttons ------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: linear-gradient(145deg, var(--accent-gold-bright), var(--accent-gold)); color: var(--text-on-accent); }
.btn-primary:hover { opacity: 0.92; }
.btn-secondary { background: var(--bg-surface-2); color: var(--text-primary); border: 1px solid var(--border-glass-strong); }
.btn-secondary:hover { background: var(--bg-surface-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.btn-danger { background: var(--accent-red-soft); color: var(--red-t); }
.btn-danger:hover { background: color-mix(in srgb, var(--accent-red) 24%, transparent); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: var(--fs-xs); }
.icon-btn { padding: 9px; border-radius: var(--radius-sm); background: var(--bg-surface-2); }
.icon-btn:hover { background: var(--bg-surface-hover); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---- Badges ------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-green { background: var(--accent-green-soft); color: var(--green-t); }
.badge-red { background: var(--accent-red-soft); color: var(--red-t); }
.badge-gold { background: var(--accent-gold-soft); color: var(--gold-t); }
.badge-blue { background: var(--accent-blue-soft); color: var(--blue-t); }
.badge-muted { background: var(--bg-surface-2); color: var(--text-muted); }

/* ---- Forms ------------------------------------------------ */
.form-group { margin-bottom: var(--space-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.form-label { display: block; font-size: var(--fs-xs); color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-surface-2);
  border: 1px solid var(--field-edge);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-blue); outline: none; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { resize: vertical; min-height: 64px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237D808A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 32px; }
.field-hint { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 5px; }
.field-error { font-size: var(--fs-2xs); color: var(--red-t); margin-top: 5px; display: none; }
.form-group.has-error .input, .form-group.has-error .select { border-color: var(--accent-red); }
.form-group.has-error .field-error { display: block; }

.segmented { display: flex; background: var(--bg-surface-2); border-radius: var(--radius-sm); padding: 3px; border: 1px solid var(--border-glass-strong); }
.segmented-option { flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); transition: all var(--dur-fast) var(--ease-out); }
.segmented-option.active { background: var(--bg-surface-hover); color: var(--text-primary); box-shadow: var(--shadow-glass); }

.ai-suggest-chip {
  display: none;
  align-items: center; gap: 6px;
  margin-top: 8px; padding: 7px 11px;
  background: var(--accent-blue-soft);
  border: 1px solid color-mix(in srgb, var(--accent-blue) 30%, transparent);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  color: var(--blue-t);
  cursor: pointer;
}
.ai-suggest-chip.show { display: inline-flex; animation: scaleIn var(--dur-base) var(--ease-out); }
.ai-suggest-chip b { color: var(--text-primary); }

/* ---- Overlay + bottom sheet / modal ------------------------------------------------ */
.overlay {
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.overlay.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  max-height: 88vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass-strong);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-pop);
  z-index: var(--z-sheet);
  transform: translateY(100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sheet.show { animation: slideUpSheet var(--dur-base) var(--ease-out) forwards; }
.sheet.hide { animation: slideDownSheet var(--dur-base) var(--ease-out) forwards; }

@media (min-width: 640px) {
  .sheet {
    top: 50%; bottom: auto; left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    border-radius: var(--radius-xl);
    border-bottom: 1px solid var(--border-glass-strong);
    width: 460px;
    opacity: 0;
  }
  .sheet.show { animation: modalIn var(--dur-base) var(--ease-out) forwards; }
  .sheet.hide { animation: modalOut var(--dur-fast) var(--ease-out) forwards; }
  @keyframes modalIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
  @keyframes modalOut { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -50%) scale(0.97); } }
}

.sheet-handle { width: 36px; height: 4px; background: var(--border-glass-strong); border-radius: var(--radius-full); margin: 10px auto 0; flex-shrink: 0; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); flex-shrink: 0; border-bottom: 1px solid var(--border-glass); }
.sheet-title { font-size: var(--fs-md); font-weight: 600; }
.sheet-content { padding: var(--space-5); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-footer { display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-glass); flex-shrink: 0; }

/* ---- Lists / rows ------------------------------------------------ */
.list { display: flex; flex-direction: column; gap: var(--space-2); }
.date-group-label { font-size: var(--fs-2xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: var(--space-4) 0 var(--space-2); }
.date-group-label:first-child { margin-top: 0; }

.tx-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease-out);
  cursor: pointer;
}
.tx-row:hover { background: var(--bg-surface-2); }
.tx-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-surface-2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tx-info { flex: 1; min-width: 0; }
.tx-merchant { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 2px; }
.tx-amount { font-size: var(--fs-sm); font-weight: 700; flex-shrink: 0; }
.tx-amount.in { color: var(--green-t); }
.tx-amount.out { color: var(--text-primary); }
.tx-tag { display: inline-block; background: var(--bg-surface-2); color: var(--text-muted); font-size: 10px; padding: 1px 6px; border-radius: var(--radius-full); margin-left: 6px; }

/* ---- Progress bars ------------------------------------------------ */
.progress-track { height: 8px; border-radius: var(--radius-full); background: var(--bg-surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); transition: width var(--dur-slow) var(--ease-out); }
.progress-fill.ok { background: linear-gradient(90deg, var(--accent-green), #58e0ac); }
.progress-fill.warn { background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-bright)); }
.progress-fill.over { background: linear-gradient(90deg, var(--accent-red), #ff8c80); }

.budget-item { padding: var(--space-4) var(--space-5); }
.budget-item + .budget-item { margin-top: var(--space-3); }
.budget-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.budget-top .cat { font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.budget-numbers { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 8px; display: flex; justify-content: space-between; }

/* ---- Goal / Debt cards ------------------------------------------------ */
.goal-card, .debt-card { padding: var(--space-5); }
.goal-card + .goal-card, .debt-card + .debt-card { margin-top: var(--space-4); }
.goal-top { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.goal-icon { width: 42px; height: 42px; border-radius: var(--radius-md); background: var(--accent-gold-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.goal-title { font-weight: 600; font-size: var(--fs-md); }
.goal-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }

.range-slider { width: 100%; accent-color: var(--accent-gold); margin: var(--space-3) 0; }

/* ---- Subscription cards ------------------------------------------------ */
.sub-card { padding: var(--space-4); display: flex; align-items: center; gap: var(--space-3); }
.sub-card + .sub-card { margin-top: var(--space-3); }
.sub-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-surface-2); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.sub-info { flex: 1; }
.sub-name { font-weight: 600; font-size: var(--fs-sm); }
.sub-meta { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 2px; }
.sub-cost { text-align: right; }
.sub-cost .m { font-weight: 700; font-size: var(--fs-sm); }
.sub-cost .a { font-size: var(--fs-2xs); color: var(--text-muted); }
.sub-flag { font-size: var(--fs-2xs); color: var(--red-t); margin-top: 4px; }

/* ---- AI Insight cards ------------------------------------------------ */
.insight-card {
  display: flex; gap: var(--space-3);
  padding: var(--space-4);
  border-left: 3px solid var(--accent-blue);
}
.insight-card + .insight-card { margin-top: var(--space-3); }
.insight-card.severity-high { border-left-color: var(--accent-red); }
.insight-card.severity-medium { border-left-color: var(--accent-gold); }
.insight-card.severity-low { border-left-color: var(--accent-green); }
.insight-emoji { font-size: 20px; flex-shrink: 0; }
.insight-text { font-size: var(--fs-sm); line-height: 1.5; }
.insight-text b { color: var(--text-primary); }

.ai-summary-card { padding: var(--space-5); border: 1px solid color-mix(in srgb, var(--accent-blue) 25%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--accent-blue) 7%, var(--card-bg)), var(--card-bg)); }
.ai-summary-head { display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-3); }
.ai-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; color: var(--blue-t); background: var(--accent-blue-soft); padding: 3px 8px; border-radius: var(--radius-full); }
.ai-badge svg { width: 11px; height: 11px; }

/* ---- Empty states ------------------------------------------------ */
.empty-state { text-align: center; padding: var(--space-8) var(--space-5); }
.empty-icon { font-size: 34px; margin-bottom: var(--space-3); opacity: 0.8; }
.empty-title { font-weight: 600; font-size: var(--fs-md); }
.empty-msg { font-size: var(--fs-sm); color: var(--text-muted); margin-top: 6px; max-width: 320px; margin-inline: auto; }
.empty-state .btn { margin-top: var(--space-4); }

/* ---- Skeleton loading ------------------------------------------------ */
.skel { background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--bg-surface-hover) 37%, var(--bg-surface-2) 63%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--radius-sm); }
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-card { height: 88px; border-radius: var(--radius-lg); }

/* ---- Toasts ------------------------------------------------ */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--bottom-nav-h) + 20px); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 0 16px; }
@media (min-width: 881px) { .toast-host { bottom: 24px; } }
.toast {
  max-width: 420px;
  padding: 11px 18px;
  border-radius: var(--radius-lg);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.45;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass-strong);
  box-shadow: var(--shadow-pop);
  animation: toastIn var(--dur-base) var(--ease-out);
  display: flex; align-items: center; gap: 8px;
  white-space: normal;
}
.toast.success { border-color: color-mix(in srgb, var(--accent-green) 40%, transparent); color: var(--green-t); }
.toast.error { border-color: color-mix(in srgb, var(--accent-red) 40%, transparent); color: var(--red-t); }

/* ---- Confirm dialog ------------------------------------------------ */
.confirm-box { text-align: center; padding: var(--space-2) 0; }
.confirm-box p { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 8px; }

/* ---- Chat (Ask Your Money) ------------------------------------------------ */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - var(--header-h) - var(--bottom-nav-h) - 90px); }
@media (min-width: 881px) { .chat-wrap { height: calc(100vh - var(--header-h) - 140px); } }
.chat-log { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--space-2) 0; display: flex; flex-direction: column; gap: var(--space-3); }
.chat-msg { max-width: 78%; padding: 11px 15px; border-radius: var(--radius-lg); font-size: var(--fs-sm); line-height: 1.5; animation: slideUp var(--dur-base) var(--ease-out); }
.chat-msg.user { align-self: flex-end; background: var(--accent-gold-soft); color: var(--text-primary); border-bottom-right-radius: 4px; }
.chat-msg.ai { align-self: flex-start; background: var(--bg-surface-2); border: 1px solid var(--border-glass); border-bottom-left-radius: 4px; }
.chat-typing { align-self: flex-start; display: flex; gap: 4px; padding: 14px 16px; background: var(--bg-surface-2); border-radius: var(--radius-lg); border-bottom-left-radius: 4px; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: pulseDot 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: var(--space-3) 0; }
.chat-chip { padding: 8px 13px; border-radius: var(--radius-full); background: var(--bg-surface-2); border: 1px solid var(--border-glass-strong); font-size: var(--fs-xs); color: var(--text-secondary); }
.chat-chip:hover { color: var(--text-primary); border-color: var(--accent-blue); }
.chat-input-row { display: flex; gap: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border-glass); }
.chat-input-row .input { border-radius: var(--radius-full); }
.chat-send { width: 44px; height: 44px; border-radius: var(--radius-full); background: linear-gradient(145deg, var(--accent-gold-bright), var(--accent-gold)); color: var(--text-on-accent); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

/* ---- Tabs (used by Planning and Tax/Reports pages) ------------------------------------------------ */
.tab-group { display: flex; gap: var(--space-2); margin-bottom: var(--space-5); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-btn { padding: 9px 16px; border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); background: var(--bg-surface-2); border: 1px solid transparent; white-space: nowrap; }
.tab-btn.active { color: var(--text-on-accent); background: var(--accent-gold); }

/* ---- Personality / score rings ------------------------------------------------ */
.ring-wrap { position: relative; width: 96px; height: 96px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg-surface-2); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--accent-gold); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease-out); }
.ring-value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: var(--fs-lg); font-weight: 700; }

.personality-card { text-align: center; padding: var(--space-7) var(--space-5); }
.personality-emoji { font-size: 44px; margin-bottom: var(--space-3); }
.personality-name { font-family: var(--font-display); font-size: var(--fs-xl); color: var(--gold-t); }
.personality-desc { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: var(--space-3); max-width: 420px; margin-inline: auto; }

/* ---- Tables (Reports) ------------------------------------------------ */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.data-table th { text-align: left; padding: 10px 12px; color: var(--text-muted); border-bottom: 1px solid var(--border-glass-strong); font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.05em; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-glass); }
.data-table tr:last-child td { border-bottom: none; }

/* ---- Account type cards ------------------------------------------------ */
.account-card { padding: var(--space-5); position: relative; overflow: hidden; }
.account-type-tag { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.account-name { font-weight: 600; font-size: var(--fs-md); margin-top: 4px; }
.account-balance { font-size: var(--fs-xl); font-weight: 700; margin-top: var(--space-3); }

/* ---- Profile menu list ------------------------------------------------ */
.menu-list .menu-row { display: flex; align-items: center; gap: var(--space-3); padding: 13px var(--space-4); border-radius: var(--radius-md); cursor: pointer; }
.menu-list .menu-row:hover { background: var(--bg-surface-2); }
.menu-list .menu-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--bg-surface-2); display: flex; align-items: center; justify-content: center; }
.menu-list .menu-label { flex: 1; font-size: var(--fs-sm); font-weight: 500; }
.menu-list .menu-arrow { color: var(--text-muted); }

/* ---- Print (Reports page → window.print) ------------------------------------------------ */
@media print {
  .sidebar, .bottom-nav, .topbar, .toast-host, .overlay, .sheet, .no-print { display: none !important; }
  .app-shell { margin-left: 0 !important; }
  .app-main { padding: 0 !important; max-width: 100% !important; }
  .card { background: #fff !important; border: 1px solid #ddd !important; box-shadow: none !important; backdrop-filter: none !important; color: #111 !important; }
  body, .t-primary, .stat-value, .tx-merchant { color: #111 !important; }
  #printReportArea { display: block !important; }
}
