/* ============================================================
   main.css — SEA Dashboard
   Design tokens (CSS variables), base styles, layout (header,
   tabs, bottom nav, panels/cards/forms/buttons), settings rows,
   animations, toast notifications, and shared components used
   across every zone (dashboard/overview, progress bars, etc).
   ============================================================ */
:root {
  --paper: #F8F4EA;
  --paper-line: #E7DECC;
  --ink: #1F2430;
  --ink-soft: #6E7685;
  --card: #FFFFFF;
  --surface-soft: #F7F3EA;
  --input-bg: #FCFAF5;
  --chip-bg: #EEE8DC;

  --header: #163447;
  --work: #2D8C72;
  --life: #C96A4A;
  --health: #5A9B6C;
  --finance: #B58A2E;
  --overview: #465FCF;
  --dashboard: #163447;
  --danger: #C0463A;

  --radius: 18px;
  --shadow: 0 10px 26px rgba(22,52,71,0.08), 0 2px 8px rgba(0,0,0,0.04);

  --success: #2D8C72;
  --warning: #B58A2E;
  --info: #465FCF;
  --error: #C0463A;
  --success-bg: #E8F5EF;
  --warning-bg: #FAF1DE;
  --info-bg: #E9EEFF;
  --error-bg: #FBEAEA;
}

  /* Status tokens are declared in the root block above. */

html[data-theme="dark"] {
  --paper: #151A20;
  --paper-line: #2A323D;
  --ink: #EDF1F7;
  --ink-soft: #9AA6B5;
  --card: #1D242D;
  --surface-soft: #242C36;
  --input-bg: #232B35;
  --chip-bg: #2A3440;
  --shadow: 0 8px 24px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.28);

  --success-bg: rgba(45,140,114,0.18);
  --warning-bg: rgba(181,138,46,0.20);
  --info-bg: rgba(70,95,207,0.20);
  --error-bg: rgba(192,70,58,0.20);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(31,59,77,0.08), transparent 45%),
    radial-gradient(circle at 100% 15%, rgba(217,80,59,0.06), transparent 40%),
    radial-gradient(circle at 15% 90%, rgba(47,143,91,0.06), transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(180,146,46,0.07), transparent 45%),
    var(--paper);
  color: var(--ink);
  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
  min-height: 100vh;
  padding-bottom: 40px;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, .display { font-family: 'Kanit', 'Noto Sans Thai', sans-serif; margin: 0; }
h3 { font-size: clamp(15px, 4vw, 18px); }
.mono { font-family: 'JetBrains Mono', monospace; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===== Header ===== */
.header {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.10), transparent 28%),
    linear-gradient(135deg, #163447, #102735 58%, #0C1F2B);
  color: #fff;
  padding: 20px 20px 28px;
  border-radius: 0 0 28px 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.header::after {
  content: "";
  position: absolute; right: -40px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1;}
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand { font-size: 14px; opacity: 0.85; letter-spacing: 0.08em; text-transform: uppercase; }
.theme-toggle {
  border: none; background: rgba(255,255,255,0.16); color: #fff; width: 30px; height: 30px;
  border-radius: 50%; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.clock { font-size: clamp(28px, 8vw, 44px); font-weight: 600; line-height: 1.05; margin-top: 2px;}
.datestr { font-size: 15px; opacity: 0.9; margin-top: 4px;}
.weather-box {
  background: rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 12px 16px;
  min-width: 200px;
  backdrop-filter: blur(4px);
}
.weather-top { display: flex; align-items: center; gap: 10px;}
.weather-temp { font-size: clamp(22px, 6vw, 30px); font-weight: 600;}
.weather-desc { font-size: 13px; opacity: 0.9;}
.weather-city-row { display: flex; gap: 6px; margin-top: 10px;}
.weather-city-row input {
  flex: 1; border: none; border-radius: 8px; padding: 6px 10px; font-size: 13px;
  background: rgba(255,255,255,0.85); color: #23262B;
}
.weather-city-row button {
  border: none; background: rgba(255,255,255,0.9); border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--header);
}
.weather-note { font-size: 11px; opacity: 0.75; margin-top: 6px;}

/* ===== Tabs (notebook dividers) ===== */
.tabs {
  display: flex; gap: 6px; padding: 20px 16px 0; overflow-x: auto;
}
.tab-btn {
  border: none; padding: 12px 18px 10px; font-family: 'Kanit', sans-serif; font-weight: 600; font-size: 14px;
  color: #fff; white-space: nowrap;
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%);
  opacity: 0.55; transform: translateY(6px);
  transition: all .18s ease;
}
.tab-btn.active { opacity: 1; transform: translateY(0); box-shadow: var(--shadow);}
.tab-btn[data-zone="dashboard"] { background: var(--dashboard); }
.tab-btn[data-zone="work"] { background: var(--work); }
.tab-btn[data-zone="life"] { background: var(--life); }
.tab-btn[data-zone="health"] { background: var(--health); }
.tab-btn[data-zone="finance"] { background: var(--finance); }
.tab-btn[data-zone="overview"] { background: var(--overview); }
.tab-btn[data-zone="admin"] { background: #555; }

/* ===== Bottom nav (mobile) ===== */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card); border-top: 1px solid var(--paper-line);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav-row { display: flex; }
.bn-btn {
  flex: 1; border: none; background: transparent; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; padding: 4px 2px; border-radius: 10px;
  min-width: 60px;
}
.bn-btn .ic { font-size: 18px; }
.bn-btn.active { color: var(--ink); font-weight: 600; background: var(--surface-soft); }

/* ===== Panels ===== */
.panel { display: none; padding: 18px 16px 8px; max-width: 1100px; margin: 0 auto; }
.panel.active { display: block; }
.zone-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px;}
.zone-dot { width: 12px; height: 12px; border-radius: 50%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }

.card {
  background: rgba(255,255,255,0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.35);
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .card {
  background: rgba(29,36,45,0.92);
  border: 1px solid rgba(255,255,255,0.04);
}

.card h3 { font-size: clamp(14px, 3.6vw, 16px); margin-bottom: 12px; }

/* form bits */
.form-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.form-row input, .form-row select {
  padding: 8px 10px; border: 1px solid var(--paper-line); border-radius: 8px; font-size: 13px; background: var(--input-bg); color: var(--ink);
}
.time-picker { width: 110px; }
.time-label { font-size: 12px; color: var(--ink-soft); align-self: center; }
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--overview), #314BB9);
  box-shadow: 0 6px 16px rgba(70,95,207,0.20);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--paper-line);
  color: var(--ink-soft);
}
.btn-del { background: transparent; color: var(--danger); border: none; font-size: 13px; padding: 4px 8px;}
.small { font-size: 12px; color: var(--ink-soft); }

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--ink-soft);
}

.sync-dot.online {
  background: var(--work);
}

.sync-dot.pending {
  background: var(--warning);
}

.sync-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.field-error { color: var(--danger); font-size: 12px; margin: -4px 0 8px; display: none; }
.field-error.show { display: block; }
.search-row { margin-bottom: 10px; }
.search-row input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--paper-line); border-radius: 8px; font-size: 13px; background: var(--input-bg); color: var(--ink);
}

/* Progress Bar */
.progress-wrap { width: 100%; background: var(--surface-soft); border-radius: 20px; overflow: hidden; height: 12px; margin: 8px 0; }
.progress-bar { height: 100%; border-radius: 20px; transition: width 0.4s ease; }

.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-header button { border: none; background: var(--chip-bg); color: var(--ink); border-radius: 8px; padding: 6px 10px; font-size: 13px;}
.cal-title { font-weight: 600; font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--ink-soft); font-weight: 600; padding-bottom: 4px;}
.cal-cell { aspect-ratio: 1; background: var(--surface-soft); border-radius: 8px; font-size: 12px; padding: 4px; position: relative; }
.cal-cell.empty { background: transparent; }
.cal-cell.today { outline: 2px solid var(--work); }
.cal-cell.active-filter { outline: 2px solid var(--life); background: var(--warning-bg); }
.cal-dot { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; border-radius: 50%; background: var(--life);}

.chart-wrap { position: relative; height: 200px; margin-top: 12px; }
.chart-wrap canvas { max-width: 100%; }

/* Overview */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; }
.stat-card .label { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.stat-card .value { font-size: clamp(18px, 5vw, 24px); font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.stat-card, .dash-card {
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover, .dash-card:hover, .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(22,52,71,0.10), 0 4px 10px rgba(0,0,0,0.04);
}

html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .dash-card {
  border: 1px solid rgba(255,255,255,0.04);
}

.empty { color: var(--ink-soft); font-size: 13px; padding: 10px 0; }

/* Filter row for transaction list */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row input, .filter-row select {
  padding: 7px 10px; border: 1px solid var(--paper-line); border-radius: 8px; font-size: 13px; background: var(--input-bg); color: var(--ink);
}
.filter-row input[type="text"] { flex: 1; min-width: 140px; }

/* Dashboard (unified) */
.summary-banner {
  background: linear-gradient(135deg, var(--header), #0F2029); color: #fff;
  border-radius: 18px; padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
  font-family: 'Kanit', 'Noto Sans Thai', sans-serif; font-size: 15px; line-height: 1.7;
}
.summary-banner .copy-btn { margin-top: 10px; border: none; background: rgba(255,255,255,0.16); color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.dash-card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; }
.dash-card .dh { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.dash-card .dh .em { font-size: 20px; }
.dash-card .dv { font-size: clamp(17px, 5vw, 22px); font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-bottom: 4px; }
.dash-card .dsub { font-size: 12px; color: var(--ink-soft); }
.dash-card ul { margin: 0; padding-left: 18px; font-size: 13px; }
.dash-card ul li { margin-bottom: 4px; }

@media(max-width: 800px) {
  body { padding-bottom: 76px; }
  .tabs { display: none; }
  .bottom-nav { display: block; }
  .card { padding: 13px 14px; }
}

@media(max-width: 480px) {
  .header { padding: 14px 14px 20px; border-radius: 0 0 18px 18px; }
  .weather-box {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 12px 16px;
  min-width: 220px;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
  .card { padding: 12px 12px; border-radius: 12px; margin-bottom: 12px; }
  .zone-title { margin-bottom: 10px; }
  .zone-title h3 { font-size: 15px; }
  .form-row { gap: 6px; margin-bottom: 8px; }
  .form-row input, .form-row select,
  .filter-row input, .filter-row select {
    width: 100% !important; flex: 1 1 100%; min-width: 0 !important;
  }
  .time-picker { width: auto !important; }
  .btn { width: 100%; }
  .form-row .type-toggle { width: 100%; justify-content: center; }
  .form-row .type-toggle + input, .form-row .type-toggle + select { margin-top: 6px; }
  .stat-grid, .dash-grid { grid-template-columns: 1fr; }
  .bucket-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .chart-wrap { height: 170px; }
  .summary-banner { padding: 14px 16px; font-size: 13.5px; }
  .summary-banner div#dashSummaryText { line-height: 1.9; }
  .wallet-card { padding: 16px 18px; }
  .meal-table { font-size: 11px; }
  .weather-city-row input { min-width: 0; }
}

/* ===== Settings rows (Backup / Animation) ===== */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--paper-line); }
.setting-row:last-child { border-bottom: none; }
.setting-row .label-txt { font-size: 13.5px; font-weight: 600; }
.setting-row .desc { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; inset: 0; background: var(--chip-bg); border-radius: 24px; cursor: pointer; transition: background-color .2s ease; }
.toggle-slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform .2s ease; }
.toggle-switch input:checked + .toggle-slider { background: var(--overview); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

#backupStatus { margin-bottom: 10px; }

/* ===== Panel entrance animation (Fade / Slide) ===== */
@keyframes seaFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes seaSlideIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.panel.anim-fade { animation: seaFadeIn .32s ease; }
.panel.anim-slide { animation: seaSlideIn .35s ease; }

/* ===== Ripple button effect ===== */
.btn, .tab-btn, .bn-btn, .checkin-btn { position: relative; overflow: hidden; }
.sea-ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.55); transform: scale(0); opacity: 0.65; pointer-events: none; animation: seaRippleAnim .55s ease-out forwards; }
@keyframes seaRippleAnim { to { transform: scale(2.6); opacity: 0; } }

/* ===== Smooth Animation master switch ===== */
body.sea-no-smooth * { transition: none !important; }

/* ===== Toast notifications ===== */
.sea-toast-wrap { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 380px); }
.sea-toast { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transform: translateY(-12px); transition: opacity .22s ease, transform .22s ease; text-align: center; width: 100%; }
.sea-toast.show { opacity: 1; transform: translateY(0); }
.sea-toast.success { background: var(--work); color: #fff; }
.sea-toast.error { background: var(--danger); color: #fff; }
.sea-toast.info { background: var(--overview); color: #fff; }

/* ===== Reduced motion (accessibility) ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .panel.anim-fade, .panel.anim-slide { animation: none !important; }
  .sea-ripple { display: none !important; }
}

/* ============================================================
   SEA visual refresh
   ============================================================ */
:root {
  --font-display: 'Kanit', sans-serif;
  --font-body: 'Sarabun', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --paper: #f5f1e8;
  --paper-line: #e5ddcf;
  --ink: #18222b;
  --ink-soft: #71808b;
  --card: #fffdf9;
  --surface-soft: #f3eee5;
  --input-bg: #fffdfa;
  --chip-bg: #ece5d8;
}

html[data-theme="dark"] {
  --paper: #10151b;
  --paper-line: #2d3944;
  --ink: #edf4f5;
  --ink-soft: #9aaab3;
  --card: #19232b;
  --surface-soft: #202d36;
  --input-bg: #172129;
  --chip-bg: #293944;
  --header: #0c1b25;
  --shadow: 0 14px 30px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.18);
}

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at 0 0, rgba(70,95,207,.08), transparent 34%), var(--paper);
  color: var(--ink);
}
h1, h2, h3, .display, .brand, .tab-btn, .btn, .life-filter { font-family: var(--font-display); }
button, input, select, textarea { font-family: var(--font-body); }
.mono, .wallet-balance, .stat-card .value, .dash-card .dv, #bmiValue { font-family: var(--font-mono); }
.zone-title h3 { letter-spacing: -.02em; }
.zone-subtitle { margin: 2px 0 0; color: var(--ink-soft); font: 400 12px var(--font-body); }
.card, .stat-card, .dash-card { background: var(--card); border-color: var(--paper-line); }
.card:hover, .stat-card:hover, .dash-card:hover { transform: translateY(-3px); }
.form-row input, .form-row select, .text-input { background: var(--input-bg); border-color: var(--paper-line); }
.btn { background: linear-gradient(135deg, #2d9a70, #207c5c); box-shadow: 0 7px 16px rgba(45,154,112,.2); }
.btn-ghost { color: var(--ink); }
#panel-work .btn:not(.btn-ghost) { background: linear-gradient(135deg, #2d9a70, #167653); box-shadow: 0 7px 16px rgba(45,154,112,.25); }
#panel-life .btn:not(.btn-ghost) { background: linear-gradient(135deg, #e8637a, #c94e63); box-shadow: 0 7px 16px rgba(232,99,122,.25); }
#panel-health .btn:not(.btn-ghost) { background: linear-gradient(135deg, #5a9b6c, #39804e); box-shadow: 0 7px 16px rgba(90,155,108,.25); }
#panel-finance .btn:not(.btn-ghost) { background: linear-gradient(135deg, #c98a2c, #a56b17); box-shadow: 0 7px 16px rgba(201,138,44,.25); }
#panel-overview .btn:not(.btn-ghost) { background: linear-gradient(135deg, #596be0, #4052c2); }
#panel-admin .btn:not(.btn-ghost) { background: linear-gradient(135deg, #5f6d78, #3b4852); }
.tabs { background: transparent; }
.tab-btn { opacity: .7; }
.tab-btn.active { opacity: 1; }

/* Each area has its own typographic voice while keeping Thai text readable. */
#panel-dashboard h3, #panel-overview h3 { font-family: var(--font-display); letter-spacing: -.035em; }
#panel-work h3, #panel-work .board-caption { font-family: var(--font-display); letter-spacing: -.025em; }
#panel-work .task-item, #panel-work .cal-cell { font-family: var(--font-body); }
#panel-life h3 { font-family: var(--font-display); letter-spacing: -.04em; }
#panel-life .deadline-name, #panel-life .wish-name { font-family: var(--font-body); font-weight: 600; }
#panel-health h3 { font-family: var(--font-display); }
#panel-health .small, #panel-health label { font-family: var(--font-body); }
#panel-finance h3 { font-family: var(--font-display); letter-spacing: .01em; }
#panel-finance .mono, #panel-finance .tx-amt { font-family: var(--font-mono); }
#panel-admin h3 { font-family: var(--font-display); }

/* Work / schedule: a clean planner toolbar and roomy two-column workspace. */
#panel-work .card { border-radius: 18px; }
#panel-work > .card:first-of-type { background: linear-gradient(120deg, var(--card), #f1faf4); border-top: 3px solid var(--work); }
html[data-theme="dark"] #panel-work > .card:first-of-type { background: linear-gradient(120deg, var(--card), #1d3732); }
#panel-work .week-grid { gap: 9px; }
#panel-work .day-col { background: var(--surface-soft); border: 1px solid var(--paper-line); min-height: 130px; }
#panel-work .day-col h4 { color: var(--work); font-family: var(--font-display); font-size: 14px; }
#panel-work .sched-chip { box-shadow: 0 4px 9px rgba(0,0,0,.1); border-radius: 10px; }
#panel-work .grid2 { align-items: start; }
#panel-work .grid2 > .card:first-child { border-top: 3px solid var(--work); }
#panel-work .grid2 > .card:last-child { border-top: 3px solid var(--overview); }
#panel-work .cal-cell { background: var(--surface-soft); transition: transform .16s ease, background .16s ease; }
#panel-work .cal-cell:not(.empty):hover { transform: scale(1.04); background: var(--info-bg); }

/* Life categories and editorial cards. */
.life-category-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.life-filter { border: 1px solid var(--paper-line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 7px 16px; cursor: pointer; transition: .18s ease; }
.life-filter:hover { border-color: var(--life); color: var(--life); }
.life-filter.active { background: var(--life); border-color: var(--life); color: #fff; box-shadow: 0 7px 16px rgba(201,106,74,.22); }
.life-grid { align-items: start; }
.life-card { position: relative; overflow: hidden; border-top: 3px solid var(--life); }
.life-card[data-life-category="goals"] { border-top-color: var(--overview); }
.life-card[data-life-category="wishlist"] { border-top-color: var(--finance); }
.life-card-wide { grid-column: 1 / -1; }
.life-card-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.life-card-heading h3 { margin: 0; }
.life-card-heading span:not(.life-icon) { color: var(--ink-soft); font-size: 12px; }
.life-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--surface-soft); font-size: 20px; }
.life-card .deadline-item, .life-card .wish-item { border-color: var(--paper-line); }

/* BMI: playful body-check card with a clear scale. */
.bmi-card { background: linear-gradient(145deg, var(--card), var(--surface-soft)); border-top: 3px solid var(--finance); }
.bmi-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.eyebrow { color: var(--finance); font: 600 10px var(--font-mono); letter-spacing: .15em; }
.bmi-card h3 { margin-top: 3px; font-size: 21px; }
.bmi-form { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto; align-items: end; gap: 10px; margin-top: 18px; }
.bmi-form label { font-size: 14px; color: var(--ink-soft); padding-bottom: 10px; }
.bmi-form label span { font-size: 11px; }
.bmi-form input { width: 100%; padding: 11px; }
.bmi-result { display: flex; align-items: center; gap: 14px; margin-top: 18px; min-height: 58px; }
#bmiValue { font-size: 40px; font-weight: 600; color: var(--finance); line-height: 1; }
#bmiAdvice { margin-top: 4px; }
.bmi-scale-wrap { margin-top: 20px; }
.bmi-scale { height: 13px; border-radius: 99px; position: relative; background: linear-gradient(90deg, #5664d8 0 18.5%, #2d9a70 18.5% 55%, #c08b35 55% 75%, #c54d42 75%); }
.bmi-scale #bmiMarker { position: absolute; top: -5px; left: 0; width: 4px; height: 23px; border-radius: 4px; background: var(--ink); box-shadow: 0 0 0 3px var(--card); transition: left .35s ease; }
.bmi-scale-labels { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 10px; margin-top: 6px; }
.bmi-avatar { width: 55px; min-height: 70px; justify-content: flex-end; }

html[data-theme="dark"] body { background: radial-gradient(circle at 90% 0, rgba(45,154,112,.12), transparent 32%), var(--paper); }
html[data-theme="dark"] .header { background: linear-gradient(135deg, #102a36, #0b1821); }
html[data-theme="dark"] .summary-banner { background: linear-gradient(135deg, #163544, #10262f); }
html[data-theme="dark"] .life-icon, html[data-theme="dark"] #panel-work .day-col { background: #24343d; }
html[data-theme="dark"] .tab-btn.active, html[data-theme="dark"] .bn-btn.active { box-shadow: 0 5px 15px rgba(0,0,0,.3); }

@media (max-width: 600px) {
  .bmi-form { grid-template-columns: 1fr 1fr; }
  .bmi-form label { grid-column: 1 / -1; padding: 0; }
  .bmi-form .btn { grid-column: 1 / -1; }
  .life-card-wide { grid-column: auto; }
}

/* Planner controls and responsive layout polish. */
.schedule-editor { background: linear-gradient(135deg, var(--card), color-mix(in srgb, var(--work) 8%, var(--card))); border-top: 3px solid var(--work); }
.editor-heading, .board-caption, .calendar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-heading h3, .calendar-heading h3 { margin: 0; }
.editor-heading span:not(.editor-mark), .board-caption small, .calendar-heading span { color: var(--ink-soft); font-size: 12px; }
.editor-mark { color: var(--finance); font-size: 25px; }
.schedule-editor > .form-row:first-of-type { margin-top: 16px; align-items: center; }
.schedule-editor #schedColor { width: 48px; height: 38px; padding: 4px; cursor: pointer; }
.color-choice-label { color: var(--ink-soft); font-size: 12px; margin: 3px 0 6px; }
.color-palette { gap: 9px; margin: 0; }
.color-preset { width: 32px; height: 32px; border: 0; padding: 4px; border-radius: 50%; background: var(--chip-bg); box-shadow: 0 2px 7px rgba(0,0,0,.12); }
.color-preset span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--preset-color, var(--overview)); }
.color-preset:nth-child(1) span { background: #4c5fd5; }
.color-preset:nth-child(2) span { background: #2fa35e; }
.color-preset:nth-child(3) span { background: #e8637a; }
.color-preset:nth-child(4) span { background: #c98a2c; }
.color-preset:nth-child(5) span { background: #168c91; }
.color-preset:hover, .color-preset:focus-visible { transform: translateY(-2px) scale(1.08); outline: 2px solid var(--work); outline-offset: 2px; }
.schedule-board { background: var(--card); }
.board-caption { margin-bottom: 12px; font: 600 15px var(--font-display); }
.board-caption small { font-family: var(--font-body); font-weight: 400; }
.schedule-board .day-col { background: color-mix(in srgb, var(--work) 5%, var(--card)); }
.task-card { border-top: 3px solid var(--work); }
.calendar-card { border-top: 3px solid var(--overview); }
.calendar-heading input { width: 145px; padding: 8px 10px; }
.calendar-actions { margin-top: 14px; }
.calendar-actions .btn { width: auto; }
.calendar-card .cal-cell { min-height: 58px; }
.calendar-card .cal-cell.today { outline: 2px solid var(--work); background: color-mix(in srgb, var(--work) 12%, var(--surface-soft)); font-weight: 700; }
.calendar-card .cal-cell.active-filter { outline: 2px solid var(--life); }

/* Birthday-inspired accent: warm June gold balanced with the user's green planner theme. */
#panel-life::before { content: '21 · 06'; float: right; color: var(--finance); font: 600 11px var(--font-mono); letter-spacing: .08em; opacity: .8; }

@media (max-width: 800px) {
  .schedule-editor > .form-row:first-of-type { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-editor > .form-row:first-of-type #schedSubject,
  .schedule-editor > .form-row:first-of-type #schedCode,
  .schedule-editor > .form-row:first-of-type #schedLocation { grid-column: span 2; }
  .schedule-editor > .form-row:first-of-type #schedAddBtn { grid-column: span 2; }
  .calendar-heading { align-items: flex-start; flex-direction: column; }
  .calendar-heading input { width: 100%; }
  .calendar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .calendar-actions .btn:last-child { grid-column: span 2; }
  .calendar-card .cal-cell { min-height: 47px; }
}

@media (min-width: 801px) and (max-width: 1100px) {
  .panel { padding-left: 24px; padding-right: 24px; }
  .schedule-editor > .form-row:first-of-type { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .schedule-editor > .form-row:first-of-type #schedSubject { grid-column: span 2; }
  .schedule-editor > .form-row:first-of-type #schedCode,
  .schedule-editor > .form-row:first-of-type #schedLocation { grid-column: span 1; }
}

@media (max-width: 480px) {
  .editor-heading span:not(.editor-mark), .board-caption small { display: none; }
  .calendar-card .cal-cell { min-height: 40px; padding: 5px 3px; font-size: 11px; }
  .calendar-card .cal-dow { font-size: 10px; }
  .life-category-nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
  .life-filter { white-space: nowrap; }
}

/* Finance and habit controls. */
.habit-grid.habit-header { color: var(--ink-soft); font-size: 11px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.habit-grid.habit-header div:first-child { text-align: left; }
.habit-grid:not(.habit-header) { padding: 5px 0; border-bottom: 1px solid var(--paper-line); }
.bank-panel { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 10px 12px; margin-bottom: 14px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--finance) 12%, var(--card)), var(--card)); border: 1px solid color-mix(in srgb, var(--finance) 28%, var(--paper-line)); }
.bank-panel-title { grid-column: 1 / -1; color: var(--finance); font: 600 13px var(--font-display); }
.bank-panel label { display: grid; gap: 4px; color: var(--ink-soft); font-size: 11px; }
.bank-panel input { width: 100%; min-width: 0; font-family: var(--font-mono); font-size: 12px; }
.bank-panel input[readonly] { cursor: not-allowed; background: var(--surface-soft); color: var(--ink-soft); }
.bank-chart-card { margin: 10px 0 16px; padding: 12px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--paper-line); }
.bank-chart-title { color: var(--finance); font: 600 13px var(--font-display); }
.bank-chart-card .chart-wrap { height: 190px; }
.bank-breakdown { display: grid; gap: 6px; margin-top: 8px; }
.bank-breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.bank-breakdown-row > span { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.bank-breakdown-row i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.bank-breakdown-row strong { font-family: var(--font-mono); font-size: 11px; }
.bank-breakdown-row small { color: var(--ink-soft); font-family: var(--font-body); font-weight: 400; }
.bank-negative { color: var(--danger); font-family: var(--font-body); font-weight: 600; }
.finance-bank-filter { margin-left: 8px; max-width: 170px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; background: rgba(255,255,255,.16); color: #fff; }
.finance-bank-filter option { color: var(--ink); background: var(--card); }
.backup-clear-btn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--paper-line)); }
.wallet-top > div:first-child { min-width: 0; flex: 1 1 auto; }
.wallet-balance { white-space: nowrap; word-break: normal; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.04em; }
.btn-danger { background: linear-gradient(135deg, #d45349, #a8322b) !important; color: #fff !important; border: 0; box-shadow: 0 7px 16px rgba(192,70,58,.22); }
.btn-delete-category { color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--paper-line)); background: var(--error-bg); border-radius: 9px; padding: 8px 10px; }
.danger-zone-card { border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--paper-line)); background: color-mix(in srgb, var(--danger) 5%, var(--card)); }
.danger-zone-card h3 { color: var(--danger); }
#panel-finance .tx-item { transition: background .16s ease, transform .16s ease; }
#panel-finance .tx-item:hover { background: var(--surface-soft); transform: translateX(2px); }
#panel-finance #txDetail { min-width: 180px; }
#panel-finance #txBank, #panel-finance #recurBank { min-width: 145px; }
.recur-edit-btn { padding: 4px 8px; font-size: 11px; white-space: nowrap; }
#saveBank { margin: 8px 0; }
#saveCurrentAmount:disabled { opacity: .72; cursor: not-allowed; background: var(--surface-soft); }

@media (max-width: 700px) {
  .bank-panel { grid-template-columns: 1fr; }
  .bank-panel-title { grid-column: auto; }
  .finance-bank-filter { margin: 8px 0 0; max-width: none; width: 100%; }
  .btn-delete-category { width: 100%; }
}

/* Reduce expensive chart motion on desktop while preserving panel transitions. */
@media (min-width: 801px) {
  .chart-wrap canvas { contain: strict; }
  .card:hover, .stat-card:hover, .dash-card:hover { transform: none; }
}

/* ===== PIN Lock screen ===== */
.lock-screen {
  position: fixed; inset: 0; z-index: 10000;
  background: linear-gradient(135deg, var(--header), #0F2029);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.lock-card {
  background: var(--card); color: var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 26px; max-width: 320px; width: 100%; text-align: center;
}
.lock-icon { font-size: 34px; margin-bottom: 6px; }
.lock-card h3 { margin-bottom: 6px; }
.lock-card input {
  width: 100%; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--paper-line);
  border-radius: 8px; font-size: 16px; text-align: center; background: var(--input-bg); color: var(--ink);
  letter-spacing: 4px;
}
.lock-card input.text-input { letter-spacing: normal; text-align: left; font-size: 14px; }

/* ===== Badge component ===== */
.sea-badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; margin-right: 6px; }
.sea-badge.success { background: var(--success-bg); color: var(--success); }
.sea-badge.warning { background: var(--warning-bg); color: var(--warning); }
.sea-badge.info { background: var(--info-bg); color: var(--info); }
.sea-badge.error { background: var(--error-bg); color: var(--error); }

/* ============================================================
   work.css — Work & Study zone
   ============================================================ */
/* Work: weekly schedule grid */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-col { background: var(--surface-soft); border-radius: 10px; padding: 8px; min-height: 100px; }
.day-col h4 { font-size: 12px; text-align: center; margin: 0 0 6px; color: var(--ink-soft); font-weight: 600;}
.sched-chip { border-radius: 8px; padding: 6px 8px; font-size: 11px; color: #fff; margin-bottom: 6px; position: relative; }
.sched-chip .del { position: absolute; top: 2px; right: 5px; cursor: pointer; opacity: 0.8; font-size: 11px;}

.color-preset { border-radius: 50%; width: 24px; height: 24px; border: 2px solid transparent; cursor: pointer; transition: transform 0.2s; }
.color-preset:hover { transform: scale(1.1); }

@media(max-width: 800px) { .week-grid { grid-template-columns: repeat(7, minmax(90px, 1fr)); overflow-x: auto; } }

.task-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--paper-line); }
.task-item:last-child { border-bottom: none; }
.task-item.done span.txt { text-decoration: line-through; color: var(--ink-soft); }
.task-item span.txt { flex: 1; font-size: 14px; }
.task-item-time { font-size: 11px; color: var(--ink-soft); margin-right: 8px; background: var(--chip-bg); padding: 2px 6px; border-radius: 4px; }

/* Deadlines & Calendar */
.deadline-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--paper-line); font-size: 13px; gap: 10px;}
.deadline-item:last-child { border-bottom: none; }
.deadline-name { font-weight: 600; flex: 1; }

/* Pomodoro */
.pomo-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 0; }
.pomo-time { font-size: clamp(36px, 12vw, 52px); font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.pomo-mode { font-size: 13px; font-weight: 600; padding: 4px 14px; border-radius: 20px; background: var(--chip-bg); }
.pomo-mode.work { background: var(--success-bg); color: var(--work); }
.pomo-mode.break { background: var(--info-bg); color: var(--overview); }
.pomo-btns { display: flex; gap: 10px; }

/* ============================================================
   life.css — Lifestyle & Goals zone
   ============================================================ */
/* Lifestyle */
.bucket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.bucket-card { background: var(--surface-soft); border-radius: 12px; overflow: hidden; }
.bucket-img { height: 90px; background-size: cover; background-position: center; background-color: #eee; }
.bucket-body { padding: 8px 10px; }
.bucket-body .name { font-size: 13px; font-weight: 600; }
.checkin-btn { margin-top: 6px; width: 100%; border: none; border-radius: 8px; padding: 6px; font-size: 12px; font-weight: 600; }
.checkin-btn.off { background: var(--chip-bg); color: var(--ink-soft); }
.checkin-btn.on { background: var(--life); color: #fff; }

.wish-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--paper-line); font-size: 14px;}
.wish-item:last-child { border-bottom: none; }
.wish-item a { color: var(--life); text-decoration: none; font-weight: 600; }
.wish-price { font-family: 'JetBrains Mono', monospace; font-weight: 600;}

/* ===== Wishlist purchased state ===== */
.wish-item.bought { opacity: 0.6; }
.wish-item.bought .wish-name { text-decoration: line-through; }
.wish-buy-btn { border: none; border-radius: 8px; padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer; }
.wish-buy-btn.off { background: var(--chip-bg); color: var(--ink-soft); }
.wish-buy-btn.on { background: var(--work); color: #fff; }

/* ============================================================
   health.css — Health & Fitness zone
   ============================================================ */
/* Habit Tracker Grid */
.habit-grid { display: grid; grid-template-columns: 2fr repeat(7, 1fr) auto; gap: 4px; align-items: center; margin-bottom: 8px; font-size: 13px;}
.habit-day-header { text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.habit-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-checkbox { width: 18px; height: 18px; justify-self: center; accent-color: var(--health); cursor: pointer;}

/* Health */
.meal-table { width: 100%; border-collapse: collapse; font-size: 13px;}
.meal-table th, .meal-table td { border: 1px solid var(--paper-line); padding: 6px; text-align: left; }
.meal-table th { background: var(--surface-soft); font-size: 12px;}
.meal-table input { width: 100%; border: none; background: transparent; font-size: 12px; padding: 2px; color: var(--ink);}
.meal-table input:focus { outline: 1px solid var(--health); border-radius: 4px; }
.exercise-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--paper-line); font-size: 13px;}

/* BMI */
.bmi-result { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.bmi-value { font-size: clamp(26px, 8vw, 36px); font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.bmi-badge { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; white-space: nowrap; }
.bmi-badge.under { background: var(--info-bg); color: var(--overview); }
.bmi-badge.normal { background: var(--success-bg); color: var(--work); }
.bmi-badge.over { background: var(--warning-bg); color: #B98A3E; }
.bmi-badge.obese { background: var(--error-bg); color: var(--danger); }
.bmi-scale { width: 100%; height: 8px; border-radius: 20px; margin-top: 14px; background: linear-gradient(90deg, #5059C9 0 18.5%, #2F8F5B 18.5% 55%, #B98A3E 55% 75%, #C0463A 75% 100%); position: relative; }
.bmi-scale-marker { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--ink); border-radius: 2px; transition: left .3s ease; }

/* ===== BMI Character Avatar ===== */
.bmi-avatar-box { flex-shrink: 0; width: 60px; height: 100px; display: flex; align-items: flex-end; justify-content: center; margin-left: auto; }
.bmi-avatar { display: flex; flex-direction: column; align-items: center; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.bmi-avatar .head { width: 22px; height: 22px; background: var(--health); border-radius: 50%; transition: all 0.4s; }
.bmi-avatar .body { height: 35px; background: var(--health); border-radius: 12px; margin-top: 2px; transition: all 0.4s; }
.bmi-avatar .legs { width: 22px; height: 25px; display: flex; justify-content: space-between; margin-top: 2px; transition: all 0.4s; }
.bmi-avatar .legs::before, .bmi-avatar .legs::after { content: ''; width: 8px; height: 100%; background: var(--health); border-radius: 4px; }

.bmi-avatar.under .body { width: 14px; }
.bmi-avatar.under .legs { width: 14px; }

.bmi-avatar.normal .body { width: 26px; }
.bmi-avatar.normal .legs { width: 20px; }

.bmi-avatar.over .body { width: 42px; border-radius: 16px 16px 12px 12px; }
.bmi-avatar.over .legs { width: 28px; }

.bmi-avatar.obese .head { width: 26px; height: 26px; }
.bmi-avatar.obese .body { width: 56px; border-radius: 24px 24px 14px 14px; }
.bmi-avatar.obese .legs { width: 34px; }

/* Keep the refreshed BMI scale above the legacy health styles. */
.bmi-card .bmi-scale { height: 13px; margin-top: 0; background: linear-gradient(90deg, #5664d8 0 18.5%, #2d9a70 18.5% 55%, #c08b35 55% 75%, #c54d42 75%); }
.bmi-card .bmi-scale #bmiMarker { position: absolute; top: -5px; left: 0; width: 4px; height: 23px; border-radius: 4px; background: var(--ink); box-shadow: 0 0 0 3px var(--card); }

/* ============================================================
   finance.css — Finance zone
   ============================================================ */
/* Finance */
.wallet-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #E9CD7A 0%, #B4922E 45%, #8A6B1E 100%);
  border-radius: 20px; padding: 20px 22px; color: #fff; margin-bottom: 16px;
  box-shadow: 0 10px 24px rgba(180,146,46,0.3);
}
.wallet-card::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.25) 45%, transparent 60%);
  pointer-events: none;
}
.wallet-top { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1;}
.wallet-balance { font-size: clamp(20px, 6vw, 38px); font-weight: 600; margin-top: 8px; position: relative; z-index: 1; word-break: normal; white-space: nowrap; }
.wallet-chips { display: flex; gap: 10px; margin-top: 14px; position: relative; z-index: 1; flex-wrap: wrap;}
.wallet-chip { background: rgba(255,255,255,0.18); border-radius: 20px; padding: 6px 14px; font-size: 13px; display: flex; align-items: center; gap: 6px;}
.wallet-chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block;}
.wallet-chip.in .dot { background: #B6F2C9;}
.wallet-chip.out .dot { background: #F7B4B4;}
.wallet-chip b { font-weight: 600;}

.type-toggle { display: flex; background: var(--chip-bg); border-radius: 8px; padding: 3px; }
.type-opt { border: none; background: transparent; padding: 6px 14px; font-size: 13px; font-weight: 600; border-radius: 6px; color: var(--ink-soft); }
.type-opt.active[data-val="income"] { background: var(--health); color: #fff; }
.type-opt.active[data-val="expense"] { background: var(--danger); color: #fff; }

.tx-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--paper-line); font-size: 13px;}
.tx-icon { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;}
.tx-icon.income { background: var(--success-bg); }
.tx-icon.expense { background: var(--error-bg); }
.tx-amt.income { color: var(--success); font-family: 'JetBrains Mono', monospace; font-weight: 600;}
.tx-amt.expense { color: var(--danger); font-family: 'JetBrains Mono', monospace; font-weight: 600;}

/* Debt / Investment / Recurring */
.debt-item, .invest-item, .recur-item { padding: 10px 0; border-bottom: 1px solid var(--paper-line); }
.debt-item:last-child, .invest-item:last-child, .recur-item:last-child { border-bottom: none; }
.debt-item-top, .invest-item-top, .recur-item-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.debt-item-top .nm, .invest-item-top .nm, .recur-item-top .nm { font-weight: 600; flex: 1; }
.debt-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.gain { color: var(--work); font-weight: 600; }
.loss { color: var(--danger); font-weight: 600; }

/* ===== Budget warning ===== */
.budget-warn { margin-top: 10px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600; background: var(--error-bg); color: var(--danger); display: none; }
.budget-warn.show { display: block; }

/* Finance overrides must come after the legacy wallet rules. */
.wallet-card .wallet-balance { white-space: nowrap; word-break: normal; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.04em; }
.finance-bank-filter { display: none !important; }
#panel-finance .type-opt { background: var(--surface-soft); color: var(--ink-soft); border: 1px solid var(--paper-line); }
#panel-finance .type-opt.active[data-val="income"] { background: var(--success-bg); color: var(--success); border-color: var(--success); }
#panel-finance .type-opt.active[data-val="expense"] { background: var(--error-bg); color: var(--danger); border-color: var(--danger); }
.recur-remove-month { display: block; margin: 7px 0 0 auto; padding: 5px 9px; font-size: 11px; }
.recur-insights { margin: 14px 0; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--finance) 10%, var(--card)), var(--surface-soft)); border: 1px solid color-mix(in srgb, var(--finance) 22%, var(--paper-line)); }
.recur-insight-head { display: flex; justify-content: space-between; align-items: center; color: var(--finance); font-family: var(--font-display); }
.recur-insight-head span { color: var(--ink-soft); font: 11px var(--font-body); }
.recur-stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 10px 0 13px; }
.recur-stat-grid div { padding: 8px; border-radius: 10px; background: var(--card); }
.recur-stat-grid small { display: block; color: var(--ink-soft); font-size: 10px; }
.recur-stat-grid strong { display: block; margin-top: 3px; font: 600 14px var(--font-mono); }
.recur-expense { color: var(--danger); }
.recur-income { color: var(--success); }
.recur-bars { display: grid; gap: 7px; }
.recur-bar-row { display: grid; grid-template-columns: minmax(70px,1fr) 2fr auto; gap: 8px; align-items: center; font-size: 11px; }
.recur-bar-row > div { height: 7px; background: var(--paper-line); border-radius: 99px; overflow: hidden; }
.recur-bar-row i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--finance), #e0b34d); }
.recur-bar-row strong { font: 11px var(--font-mono); }
.save-insight { margin-top: 18px; padding: 15px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--finance) 13%, var(--card)), var(--surface-soft)); border: 1px solid color-mix(in srgb, var(--finance) 25%, var(--paper-line)); }
.save-insight-top { display: flex; align-items: center; gap: 10px; }
.save-insight-top div { flex: 1; }
.save-insight-top strong, .save-insight-top small { display: block; }
.save-insight-top strong { font: 600 15px var(--font-display); }
.save-insight-top small { color: var(--ink-soft); font-size: 11px; margin-top: 2px; }
.save-insight-top > b { color: var(--finance); font: 600 20px var(--font-mono); }
.save-insight-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--finance); color: #fff; }
.save-milestones { display: flex; justify-content: space-between; gap: 6px; margin-top: 14px; }
.save-milestone { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--paper-line); color: var(--ink-soft); font: 10px var(--font-mono); }
.save-milestone.done { background: var(--finance); color: #fff; }
.save-remaining { color: var(--ink-soft); font-size: 11px; margin-top: 9px; }
