﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #f0f2f8;
      --bg2: #e8ebf4;
      --card: #ffffff;
      --card2: #f7f8fc;
      --border: #e2e6f0;
      --border2: #d0d6e8;
      --text: #0d1117;
      --text2: #3d4560;
      --muted: #7b85a0;
      --muted2: #a0a8bf;
      --navy: #0d1117;
      --accent: #4f6ef7;
      --accent2: #3d5ce8;
      --accent-bg: rgba(79,110,247,0.08);
      --accent-border: rgba(79,110,247,0.2);
      --green: #10b77f;
      --green-bg: rgba(16,183,127,0.1);
      --red: #f04c65;
      --red-bg: rgba(240,76,101,0.1);
      --amber: #f59e0b;
      --amber-bg: rgba(245,158,11,0.1);
      --purple: #8b5cf6;
      --purple-bg: rgba(139,92,246,0.1);
      --shadow-sm: 0 1px 3px rgba(13,17,23,0.06), 0 1px 2px rgba(13,17,23,0.04);
      --shadow: 0 4px 16px rgba(13,17,23,0.08), 0 2px 4px rgba(13,17,23,0.04);
      --shadow-lg: 0 12px 40px rgba(13,17,23,0.12), 0 4px 12px rgba(13,17,23,0.06);
      --radius-sm: 10px;
      --radius: 16px;
      --radius-lg: 22px;
      --sidebar-w: 260px;
      --font: 'Plus Jakarta Sans', sans-serif;
      --mono: 'JetBrains Mono', monospace;
    }

    body.dark {
      --bg: #080c14;
      --bg2: #0d1220;
      --card: #111827;
      --card2: #161f30;
      --border: #1e2d45;
      --border2: #243550;
      --text: #e8edf8;
      --text2: #b0bdd8;
      --muted: #6b7899;
      --muted2: #4a5570;
      --accent-bg: rgba(79,110,247,0.12);
      --accent-border: rgba(79,110,247,0.3);
      --green-bg: rgba(16,183,127,0.12);
      --red-bg: rgba(240,76,101,0.12);
      --amber-bg: rgba(245,158,11,0.12);
      --purple-bg: rgba(139,92,246,0.12);
      --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
      --shadow: 0 4px 16px rgba(0,0,0,0.4);
      --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
    }

    body {
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      transition: background 0.3s, color 0.3s;
      font-size: 14px;
      line-height: 1.5;
    }

    /* ─── LAYOUT ─── */
    .app { display: flex; min-height: 100vh; }

    /* ─── SIDEBAR ─── */
    .sidebar {
      width: var(--sidebar-w);
      background: var(--navy);
      position: fixed;
      top: 0; left: 0; bottom: 0;
      display: flex; flex-direction: column;
      z-index: 50;
      transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
      overflow-y: auto;
      overflow-x: hidden;
    }
    body.dark .sidebar { background: #060a10; border-right: 1px solid var(--border); }

    .sidebar-logo {
      padding: 22px 20px 18px;
      border-bottom: 1px solid rgba(255,255,255,0.06);
      display: flex; align-items: center; gap: 10px;
    }
    .logo-icon {
      width: 36px; height: 36px; border-radius: 10px;
      background: linear-gradient(135deg, #4f6ef7, #8b5cf6);
      display: flex; align-items: center; justify-content: center;
      font-size: 18px; flex-shrink: 0;
    }
    .logo-text { font-size: 18px; font-weight: 800; color: white; letter-spacing: -0.3px; }
    .logo-text span { color: #7c9dff; }

    .sidebar-section { padding: 16px 14px 8px; }
    .sidebar-section-title {
      font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
      text-transform: uppercase; color: rgba(255,255,255,0.3);
      padding: 0 6px; margin-bottom: 8px;
    }

    .user-chip {
      display: flex; align-items: center; gap: 10px;
      padding: 9px 10px; border-radius: var(--radius-sm);
      cursor: pointer; transition: background 0.15s;
      border: 1px solid transparent;
    }
    .user-chip:hover { background: rgba(255,255,255,0.06); }
    .user-chip.active {
      background: rgba(79,110,247,0.15);
      border-color: rgba(79,110,247,0.3);
    }
    .avatar {
      width: 32px; height: 32px; border-radius: 9px;
      display: flex; align-items: center; justify-content: center;
      font-weight: 700; font-size: 13px; color: white; flex-shrink: 0;
    }
    .user-info { min-width: 0; }
    .user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-badge { font-size: 10px; color: rgba(255,255,255,0.35); font-weight: 500; }
    .user-chip.active .user-badge { color: #7c9dff; }

    .sidebar-input {
      width: 100%;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: var(--radius-sm);
      padding: 9px 12px;
      font-size: 13px; color: white;
      font-family: var(--font);
      outline: none;
      transition: border-color 0.2s;
      margin-bottom: 8px;
    }
    .sidebar-input::placeholder { color: rgba(255,255,255,0.25); }
    .sidebar-input:focus { border-color: rgba(79,110,247,0.5); }

    .sb-btn {
      width: 100%; padding: 9px 12px;
      border-radius: var(--radius-sm); border: none;
      font-family: var(--font); font-size: 13px; font-weight: 600;
      cursor: pointer; transition: all 0.15s;
    }
    .sb-btn-primary { background: #4f6ef7; color: white; }
    .sb-btn-primary:hover { background: #3d5ce8; }
    .sb-btn-ghost { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
    .sb-btn-ghost:hover { background: rgba(255,255,255,0.1); color: white; }
    .sb-btn-danger { background: rgba(240,76,101,0.15); color: #f04c65; }
    .sb-btn-danger:hover { background: rgba(240,76,101,0.25); }
    .sb-btns { display: grid; gap: 6px; margin-top: 6px; }

    .sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 14px; }

    .sidebar-close-btn {
      display: none; position: absolute; top: 14px; right: 14px;
      background: rgba(255,255,255,0.1); border: none; color: white;
      width: 30px; height: 30px; border-radius: 8px;
      cursor: pointer; font-size: 16px; align-items: center; justify-content: center;
    }

    /* ─── MOBILE TOPBAR ─── */
    .mobile-topbar {
      display: none; position: sticky; top: 0; z-index: 40;
      background: var(--card); border-bottom: 1px solid var(--border);
      padding: 12px 16px; align-items: center; justify-content: space-between;
      box-shadow: var(--shadow-sm);
    }
    .mobile-logo { font-size: 17px; font-weight: 800; color: var(--text); }
    .mobile-logo span { color: var(--accent); }
    .mobile-menu-btn {
      background: var(--card2); border: 1px solid var(--border);
      color: var(--text); padding: 8px 12px;
      border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; cursor: pointer;
    }
    .sidebar-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.5); z-index: 49;
      backdrop-filter: blur(2px);
    }
    .sidebar-overlay.show { display: block; }

    /* ─── MAIN ─── */
    .main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; padding: 24px; }
    .shell { max-width: 1360px; margin: 0 auto; }

    /* ─── TOPBAR ─── */
    .topbar {
      display: flex; justify-content: space-between; align-items: flex-start;
      gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
    }
    .page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; }
    .page-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }

    .topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

    .month-nav {
      display: flex; align-items: center; gap: 2px;
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 4px;
      box-shadow: var(--shadow-sm);
    }
    .month-nav button {
      background: none; border: none; color: var(--muted);
      width: 30px; height: 30px; border-radius: 7px;
      cursor: pointer; font-size: 16px; transition: all 0.15s;
      display: flex; align-items: center; justify-content: center;
    }
    .month-nav button:hover { background: var(--bg2); color: var(--text); }
    .month-label { font-size: 13px; font-weight: 700; padding: 0 10px; white-space: nowrap; }

    .icon-btn {
      background: var(--card); border: 1px solid var(--border);
      color: var(--text2); padding: 8px 14px;
      border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
      cursor: pointer; transition: all 0.15s; white-space: nowrap;
      box-shadow: var(--shadow-sm);
    }
    .icon-btn:hover { background: var(--bg2); border-color: var(--border2); }
    .icon-btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
    .icon-btn.primary:hover { background: var(--accent2); }

    /* ─── STATS GRID ─── */
    .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }

    .stat-card {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 18px 20px;
      box-shadow: var(--shadow-sm); transition: transform 0.2s, box-shadow 0.2s;
      position: relative; overflow: hidden;
    }
    .stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
    .stat-card.hero {
      background: linear-gradient(135deg, #0d1117 0%, #1a2235 100%);
      border: none; color: white;
    }
    body.dark .stat-card.hero { background: linear-gradient(135deg, #0a1628 0%, #0d1f3c 100%); }

    .stat-card-bg {
      position: absolute; right: -10px; top: -10px;
      width: 80px; height: 80px; border-radius: 50%;
      opacity: 0.07;
    }
    .stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
    .hero .stat-label { color: rgba(255,255,255,0.45); }
    .stat-value { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; font-family: var(--mono); }
    .hero .stat-value { color: white; }
    .stat-change { margin-top: 8px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
    .stat-change.up { color: var(--red); }
    .stat-change.down { color: var(--green); }
    .stat-change.neutral { color: var(--muted); }

    .stat-pill {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
    }
    .pill-green { background: var(--green-bg); color: var(--green); }
    .pill-red { background: var(--red-bg); color: var(--red); }
    .pill-amber { background: var(--amber-bg); color: var(--amber); }
    .pill-blue { background: var(--accent-bg); color: var(--accent); }
    .pill-purple { background: var(--purple-bg); color: var(--purple); }

    /* ─── INSIGHT STATS ─── */
    .insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }

    /* ─── BUDGET GOAL CARD ─── */
    .budget-goal-card {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 18px 20px;
      box-shadow: var(--shadow-sm); margin-bottom: 20px;
    }
    .budget-goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
    .budget-goal-title { font-size: 15px; font-weight: 700; }
    .budget-goal-edit { display: flex; gap: 8px; align-items: center; }
    .goal-input-inline {
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 7px 12px;
      font-size: 13px; color: var(--text); font-family: var(--font);
      outline: none; width: 160px;
      transition: border-color 0.2s;
    }
    .goal-input-inline:focus { border-color: var(--accent); }

    .goal-progress-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
    .goal-bar { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
    .goal-bar-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
    .goal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
    .goal-stat { text-align: center; }
    .goal-stat-val { font-size: 16px; font-weight: 800; font-family: var(--mono); }
    .goal-stat-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }

    /* ─── MAIN LAYOUT ─── */
    .content-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }

    /* ─── CARD ─── */
    .card {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 20px;
      box-shadow: var(--shadow-sm);
    }
    .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; }
    .card-title { font-size: 15px; font-weight: 700; }
    .card-badge {
      background: var(--card2); border: 1px solid var(--border);
      font-size: 11px; font-weight: 600; color: var(--muted);
      padding: 4px 10px; border-radius: 999px;
    }

    /* ─── TYPE TOGGLE ─── */
    .type-toggle {
      display: grid; grid-template-columns: 1fr 1fr;
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 3px; gap: 3px;
      margin-bottom: 16px;
    }
    .type-toggle button {
      border: none; padding: 9px; border-radius: 7px;
      cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 700;
      color: var(--muted); background: transparent; transition: all 0.15s;
    }
    .type-toggle button.active {
      background: var(--card); color: var(--text);
      box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    }
    .type-toggle button.active.income { color: var(--green); }
    .type-toggle button.active.expense { color: var(--red); }

    /* ─── FORM ─── */
    .form-grid { display: grid; gap: 12px; }
    .form-group { display: grid; gap: 5px; }
    .form-label { font-size: 12px; font-weight: 700; color: var(--text2); }
    .form-input {
      width: 100%; background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 10px 13px;
      font-size: 14px; color: var(--text); font-family: var(--font);
      outline: none; transition: border-color 0.2s, box-shadow 0.2s;
    }
    .form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
    .form-input.error { border-color: var(--red); }
    .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .form-hint { font-size: 11px; color: var(--muted); }

    .edit-banner {
      background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
      border-radius: var(--radius-sm); padding: 10px 13px;
      font-size: 13px; font-weight: 600; color: var(--amber);
      display: none; margin-bottom: 12px;
    }

    .cat-manager {
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 12px;
    }
    .cat-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
    .cat-add-row .form-input { flex: 1; }
    .color-pick { width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; padding: 2px; background: var(--card2); }
    .cat-list-mini { display: flex; flex-wrap: wrap; gap: 6px; }
    .cat-chip {
      display: inline-flex; align-items: center; gap: 5px;
      background: var(--card); border: 1px solid var(--border);
      border-radius: 7px; padding: 4px 8px; font-size: 12px; font-weight: 600;
    }
    .cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .cat-chip-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; transition: color 0.15s; }
    .cat-chip-del:hover { color: var(--red); }

    .installment-box {
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 12px;
    }
    .checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
    .checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
    .checkbox-row span { font-size: 13px; font-weight: 600; }

    .recurring-box {
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 12px; margin-top: 12px;
    }

    .btn {
      border: none; border-radius: var(--radius-sm); padding: 11px 16px;
      font-family: var(--font); font-size: 14px; font-weight: 700;
      cursor: pointer; transition: all 0.15s; width: 100%;
      display: flex; align-items: center; justify-content: center; gap: 6px;
    }
    .btn-primary { background: var(--navy); color: white; }
    body.dark .btn-primary { background: var(--accent); }
    .btn-primary:hover { opacity: 0.88; }
    .btn-success { background: var(--green); color: white; }
    .btn-success:hover { opacity: 0.88; }
    .btn-danger { background: var(--red); color: white; }
    .btn-secondary { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
    .btn-secondary:hover { background: var(--bg2); }
    .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

    /* ─── RIGHT COL ─── */
    .right-col { display: grid; gap: 18px; }

    /* ─── CHARTS ─── */
    .charts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
    .chart-wrap { height: 220px; position: relative; }

    /* ─── COMPARISON CHART ─── */
    .comparison-card { grid-column: span 2; }

    /* ─── CATEGORY ANALYSIS ─── */
    .analysis-layout { display: grid; grid-template-columns: 1fr 220px; gap: 20px; align-items: start; }
    .cat-analysis-list { display: grid; gap: 10px; }
    .cat-analysis-row { display: grid; gap: 5px; }
    .cat-row-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
    .cat-row-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
    .progress-bar { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
    .progress-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }

    .donut-wrap { display: flex; flex-direction: column; align-items: center; }
    .donut {
      width: 180px; height: 180px; border-radius: 50%;
      position: relative; background: var(--bg2);
    }
    .donut::after {
      content: ""; position: absolute; inset: 38px;
      background: var(--card); border-radius: 50%;
    }
    .donut-center {
      position: absolute; inset: 0; display: flex; flex-direction: column;
      align-items: center; justify-content: center; z-index: 2;
      text-align: center; padding: 0 16px;
    }
    .donut-center-val { font-size: 13px; font-weight: 700; }
    .donut-center-lbl { font-size: 10px; color: var(--muted); margin-top: 2px; }
    .donut-legend { margin-top: 12px; display: grid; gap: 6px; width: 100%; }
    .legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
    .legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

    /* ─── TRANSACTION LIST ─── */
    .list-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
    .list-filters .form-input { flex: 1; min-width: 140px; }

    .tx-list { display: grid; gap: 8px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
    .tx-list::-webkit-scrollbar { width: 4px; }
    .tx-list::-webkit-scrollbar-track { background: transparent; }
    .tx-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

    .tx-item {
      display: flex; justify-content: space-between; align-items: center;
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 12px 14px; gap: 12px;
      transition: border-color 0.15s, transform 0.15s;
      cursor: default;
    }
    .tx-item:hover { border-color: var(--accent-border); transform: translateX(2px); }
    .tx-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
    .tx-icon {
      width: 38px; height: 38px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      font-size: 15px; font-weight: 700; flex-shrink: 0;
      background: var(--bg2); color: var(--text2);
    }
    .tx-icon.income { background: var(--green-bg); color: var(--green); }
    .tx-icon.recurring { background: var(--purple-bg); color: var(--purple); }
    .tx-body { min-width: 0; }
    .tx-desc { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tx-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
    .tx-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
    .tag-pill {
      background: var(--accent-bg); color: var(--accent);
      border: 1px solid var(--accent-border);
      font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 6px;
    }
    .tx-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
    .tx-amount { font-family: var(--mono); font-size: 14px; font-weight: 700; }
    .tx-amount.income { color: var(--green); }
    .tx-amount.expense { color: var(--red); }
    .tx-action-btn {
      border: none; padding: 6px 10px; border-radius: 7px;
      font-family: var(--font); font-size: 11px; font-weight: 700; cursor: pointer;
      transition: all 0.15s;
    }
    .edit-tx { background: var(--accent-bg); color: var(--accent); }
    .del-tx { background: var(--card); color: var(--muted); border: 1px solid var(--border); }
    .del-tx:hover { background: var(--red-bg); color: var(--red); border-color: transparent; }

    .empty-state {
      text-align: center; color: var(--muted); padding: 32px 16px;
      border: 1px dashed var(--border); border-radius: var(--radius-sm);
    }
    .empty-state-icon { font-size: 32px; margin-bottom: 8px; }
    .empty-state-text { font-size: 13px; }

    /* ─── MODAL ─── */
    .modal-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.55); z-index: 200;
      align-items: center; justify-content: center;
      backdrop-filter: blur(4px);
    }
    .modal-overlay.open { display: flex; }
    .modal {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius-lg); width: 90%; max-width: 480px;
      padding: 24px; box-shadow: var(--shadow-lg);
      position: relative; max-height: 90vh; overflow-y: auto;
    }
    .modal-title { font-size: 18px; font-weight: 800; margin-bottom: 20px; }
    .modal-close {
      position: absolute; top: 18px; right: 18px;
      background: var(--card2); border: 1px solid var(--border);
      color: var(--muted); width: 30px; height: 30px;
      border-radius: 8px; cursor: pointer; font-size: 16px;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.15s;
    }
    .modal-close:hover { background: var(--red-bg); color: var(--red); border-color: transparent; }

    .settings-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
    .settings-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
    .settings-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 12px; }
    .settings-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
    .settings-row:last-child { margin-bottom: 0; }

    .export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
    .export-btn {
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 10px 8px;
      font-family: var(--font); font-size: 12px; font-weight: 700;
      cursor: pointer; transition: all 0.15s; color: var(--text);
      text-align: center;
    }
    .export-btn:hover { background: var(--bg2); border-color: var(--accent); color: var(--accent); }

    /* ─── TOAST ─── */
    .toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
    .toast {
      background: var(--card); color: var(--text);
      padding: 12px 18px; border-radius: var(--radius-sm);
      box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600;
      border-left: 3px solid var(--accent);
      display: flex; align-items: center; gap: 8px;
      transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
      pointer-events: auto; min-width: 240px;
    }
    .toast.show { transform: translateX(0); }
    .toast.success { border-left-color: var(--green); }
    .toast.error { border-left-color: var(--red); }
    .toast.warning { border-left-color: var(--amber); }

    /* ─── BOTTOM NAV (mobile only) ─── */
    .bottom-nav {
      display: none;
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
      background: var(--card);
      border-top: 1px solid var(--border);
      padding: 8px 0 max(8px, env(safe-area-inset-bottom));
      box-shadow: 0 -4px 20px rgba(13,17,23,0.1);
    }
    .bottom-nav-inner { display: flex; justify-content: space-around; align-items: center; }
    .bnav-item {
      display: flex; flex-direction: column; align-items: center; gap: 3px;
      padding: 6px 14px; border-radius: 12px; cursor: pointer;
      transition: all 0.18s; border: none; background: none; color: var(--muted);
      font-family: var(--font); min-width: 56px;
      -webkit-tap-highlight-color: transparent;
    }
    .bnav-item.active { color: var(--accent); }
    .bnav-item.active .bnav-icon { background: var(--accent-bg); }
    .bnav-icon {
      width: 40px; height: 28px; border-radius: 8px;
      display: flex; align-items: center; justify-content: center;
      font-size: 18px; transition: background 0.18s;
    }
    .bnav-label { font-size: 10px; font-weight: 700; letter-spacing: 0.01em; }

    /* ─── FAB ─── */
    .fab {
      display: none;
      position: fixed; bottom: calc(72px + max(8px, env(safe-area-inset-bottom))); right: 18px;
      z-index: 55;
      width: 54px; height: 54px; border-radius: 999px;
      background: linear-gradient(135deg, var(--accent), #7c5ef7);
      color: white; border: none;
      font-size: 26px; font-weight: 300;
      cursor: pointer; box-shadow: 0 6px 20px rgba(79,110,247,0.45);
      display: none; align-items: center; justify-content: center;
      transition: transform 0.2s, box-shadow 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    .fab:active { transform: scale(0.92); box-shadow: 0 3px 12px rgba(79,110,247,0.35); }

    /* ─── MOBILE SECTION TABS ─── */
    .mobile-section {
      display: none;
    }
    .mobile-section.active { display: block; }

    /* ─── SWIPE HINT ─── */
    .swipe-hint {
      display: none;
      text-align: center; font-size: 11px; color: var(--muted2);
      padding: 6px; margin-top: -8px; margin-bottom: 8px;
    }

    /* ─── PULL TO REFRESH indicator ─── */
    .ptr-indicator {
      position: fixed; top: 0; left: 0; right: 0; z-index: 200;
      background: var(--accent); color: white;
      height: 3px; transform: scaleX(0); transform-origin: left;
      transition: transform 0.3s ease;
    }

    /* ─── MOBILE SHEET (bottom sheet modal) ─── */
    .bottom-sheet-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.45); z-index: 150;
      backdrop-filter: blur(3px);
    }
    .bottom-sheet-overlay.open { display: block; }
    .bottom-sheet {
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 151;
      background: var(--card); border-radius: 22px 22px 0 0;
      padding: 0 18px max(20px, env(safe-area-inset-bottom));
      box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
      transform: translateY(100%);
      transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
      max-height: 92vh; overflow-y: auto;
    }
    .bottom-sheet.open { transform: translateY(0); }
    .sheet-handle {
      width: 36px; height: 4px; background: var(--border2);
      border-radius: 999px; margin: 12px auto 16px;
    }
    .sheet-title { font-size: 17px; font-weight: 800; margin-bottom: 16px; }

    /* ─── TOUCH IMPROVEMENTS ─── */
    .tx-item { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
    .tx-item.swiping-left { transform: translateX(-60px) !important; }
    .tx-item.swiped { position: relative; overflow: hidden; }
    .tx-swipe-action {
      position: absolute; right: 0; top: 0; bottom: 0;
      background: var(--red); color: white;
      display: flex; align-items: center; justify-content: center;
      width: 60px; font-size: 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      transform: translateX(60px); transition: transform 0.2s;
    }

    /* ─── IMPROVED TOUCH TARGETS ─── */
    @media (hover: none) and (pointer: coarse) {
      .btn { min-height: 48px; font-size: 15px; }
      .form-input { min-height: 48px; font-size: 16px; } /* prevents zoom on iOS */
      select.form-input { font-size: 16px; }
      .bnav-item { min-height: 44px; }
      .tx-action-btn { min-height: 36px; min-width: 48px; font-size: 13px; }
      .icon-btn { min-height: 44px; }
      .type-toggle button { min-height: 44px; }
    }

    /* ─── RESPONSIVE ─── */
    @media (max-width: 1280px) {
      .stats-grid { grid-template-columns: repeat(2, 1fr); }
      .charts-grid { grid-template-columns: 1fr 1fr; }
      .comparison-card { grid-column: span 1; }
    }
    @media (max-width: 1024px) {
      .content-layout { grid-template-columns: 1fr; }
    }
    @media (max-width: 900px) {
      .sidebar { transform: translateX(-100%); }
      .sidebar.open { transform: translateX(0); }
      .sidebar-close-btn { display: flex; }
      .mobile-topbar { display: flex; }
      .main { margin-left: 0; }
    }
    @media (max-width: 768px) {
      .main { padding: 12px 12px calc(80px + max(8px, env(safe-area-inset-bottom))); }
      .stats-grid { grid-template-columns: 1fr 1fr; }
      .insight-grid { grid-template-columns: 1fr 1fr; }
      .charts-grid { grid-template-columns: 1fr; }
      .analysis-layout { grid-template-columns: 1fr; }
      .goal-stats { grid-template-columns: 1fr 1fr 1fr; }
      .bottom-nav { display: block; }
      .fab { display: flex; }
      .swipe-hint { display: block; }
      /* hide desktop topbar actions, use bottom nav */
      .topbar-actions .icon-btn[onclick="openModal('settingsModal')"] { display: none; }
      /* scrollable horizontal stats on mobile */
      .stats-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
      .stats-grid::-webkit-scrollbar { height: 3px; }
      .stats-grid::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
    }
    @media (max-width: 480px) {
      .main { padding: 10px 10px calc(80px + max(8px, env(safe-area-inset-bottom))); }
      .stats-grid { grid-template-columns: repeat(4, 150px); }
      .row-2 { grid-template-columns: 1fr; }
      .tx-item { flex-direction: row; align-items: center; }
      .tx-right { flex-direction: column; align-items: flex-end; gap: 4px; }
      .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
      .month-nav { width: 100%; justify-content: space-between; }
      .insight-grid { grid-template-columns: 1fr; }
      .card { padding: 14px; }
      .budget-goal-header { flex-direction: column; align-items: flex-start; }
      .budget-goal-edit { width: 100%; }
      .goal-input-inline { flex: 1; width: 100%; }
      .chart-wrap { height: 180px; }
      .page-title { font-size: 22px; }
      /* Mobile section visibility */
      .desktop-only { display: none !important; }
    }

    /* ─── MOBILE PAGE SECTIONS ─── */
    /* Visibility is controlled 100% by JS applyMobPageVisibility() via inline display style */
    /* No CSS rule here — avoids race condition between CSS media query and JS */

    /* ─── PWA INSTALL BANNER ─── */
    .pwa-banner {
      display: none;
      position: fixed; bottom: calc(72px + max(8px, env(safe-area-inset-bottom)) + 8px);
      left: 12px; right: 12px; z-index: 70;
      background: linear-gradient(135deg, #0d1117, #1a2235);
      border: 1px solid rgba(79,110,247,0.3);
      border-radius: var(--radius); padding: 14px 16px;
      box-shadow: var(--shadow-lg);
      color: white;
      animation: slideUpBanner 0.4s cubic-bezier(0.4,0,0.2,1);
    }
    @keyframes slideUpBanner {
      from { transform: translateY(20px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }
    .pwa-banner-row { display: flex; align-items: center; gap: 12px; }
    .pwa-banner-icon { font-size: 28px; flex-shrink: 0; }
    .pwa-banner-text { flex: 1; min-width: 0; }
    .pwa-banner-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
    .pwa-banner-sub { font-size: 12px; color: rgba(255,255,255,0.55); }
    .pwa-banner-btns { display: flex; gap: 8px; margin-top: 10px; }
    .pwa-install-btn {
      flex: 1; padding: 10px; border-radius: 10px; border: none;
      background: var(--accent); color: white; font-family: var(--font);
      font-size: 13px; font-weight: 700; cursor: pointer;
    }
    .pwa-dismiss-btn {
      padding: 10px 14px; border-radius: 10px;
      border: 1px solid rgba(255,255,255,0.15); background: transparent;
      color: rgba(255,255,255,0.6); font-family: var(--font);
      font-size: 13px; font-weight: 600; cursor: pointer;
    }

    /* ─── NOTIFICATION BELL ─── */
    .notif-badge {
      position: absolute; top: -4px; right: -4px;
      width: 16px; height: 16px; border-radius: 50%;
      background: var(--red); color: white;
      font-size: 9px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      border: 2px solid var(--card);
    }

    /* ─── CURRENCY SELECTOR ─── */
    .currency-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px;
    }
    .currency-opt {
      padding: 8px 6px; border-radius: var(--radius-sm);
      border: 1px solid var(--border); background: var(--card2);
      text-align: center; cursor: pointer; transition: all 0.15s;
      font-size: 12px; font-weight: 700; color: var(--text2);
    }
    .currency-opt:hover { border-color: var(--accent); color: var(--accent); }
    .currency-opt.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

    /* ─── NOTE FIELD ─── */
    .note-textarea {
      width: 100%; background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 10px 13px;
      font-size: 13px; color: var(--text); font-family: var(--font);
      outline: none; resize: none; transition: border-color 0.2s;
      min-height: 68px; line-height: 1.5;
    }
    .note-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
    .tx-note {
      font-size: 11px; color: var(--muted); margin-top: 4px;
      padding: 5px 8px; background: var(--card2); border-radius: 6px;
      border-left: 2px solid var(--border2); line-height: 1.4;
    }

    /* ─── REMINDER MODAL ─── */
    .reminder-list { display: grid; gap: 8px; margin-top: 10px; max-height: 260px; overflow-y: auto; }
    .reminder-item {
      display: flex; align-items: center; gap: 10px;
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 10px 12px;
    }
    .reminder-icon { font-size: 18px; flex-shrink: 0; }
    .reminder-body { flex: 1; min-width: 0; }
    .reminder-title { font-size: 13px; font-weight: 600; }
    .reminder-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
    .reminder-del {
      border: none; background: none; color: var(--muted);
      cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px;
      transition: all 0.15s;
    }
    .reminder-del:hover { background: var(--red-bg); color: var(--red); }

    /* ─── REPORT PAGE ─── */
    .report-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 18px; }
    .report-kpi {
      background: var(--card); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
      position: relative; overflow: hidden;
    }
    .report-kpi-icon { font-size: 26px; margin-bottom: 8px; }
    .report-kpi-val { font-size: 22px; font-weight: 800; font-family: var(--mono); letter-spacing:-0.5px; }
    .report-kpi-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
    .report-kpi-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; }
    .report-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
    .report-section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
    .report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
    .report-table th { text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--border); }
    .report-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
    .report-table tr:last-child td { border-bottom: none; }
    .report-table tr:hover td { background: var(--card2); }
    .trend-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }

    /* ─── BUDGET PLANNING ─── */
    .plan-summary {
      background: linear-gradient(135deg, #0d1117, #1a2235); color: white;
      border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px;
      display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
    }
    body.dark .plan-summary { background: linear-gradient(135deg, #060a12, #0d1628); }
    .plan-sum-val { font-size: 18px; font-weight: 800; font-family: var(--mono); text-align: center; }
    .plan-sum-lbl { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 3px; text-align: center; }
    .plan-grid { display: grid; gap: 8px; }
    .plan-row {
      display: grid; grid-template-columns: 1fr 110px 70px; gap: 10px; align-items: center;
      background: var(--card2); border: 1px solid var(--border);
      border-radius: var(--radius-sm); padding: 10px 14px;
    }
    .plan-row-name { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
    .plan-row-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
    .plan-input {
      background: var(--card); border: 1px solid var(--border);
      border-radius: 8px; padding: 7px 10px; font-size: 13px;
      color: var(--text); font-family: var(--mono); outline: none;
      transition: border-color 0.2s; text-align: right; width: 100%;
    }
    .plan-input:focus { border-color: var(--accent); }
    .plan-diff { font-size: 12px; font-weight: 700; font-family: var(--mono); text-align: right; }

    /* ─── PIN LOCK ─── */
    .pin-overlay {
      display: none; position: fixed; inset: 0; z-index: 9999;
      background: var(--bg);
      flex-direction: column; align-items: center; justify-content: center; gap: 20px;
    }
    .pin-overlay.show { display: flex; }
    .pin-logo { font-size: 52px; }
    .pin-title { font-size: 22px; font-weight: 800; color: var(--text); margin: 0; }
    .pin-subtitle { font-size: 13px; color: var(--muted); margin: -12px 0 0; }
    .pin-dots { display: flex; gap: 14px; }
    .pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border2); background: transparent; transition: all 0.15s; }
    .pin-dot.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
    .pin-dot.error { background: var(--red); border-color: var(--red); animation: pinshake 0.35s ease; }
    @keyframes pinshake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 75%{transform:translateX(7px)} }
    .pin-pad { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; width: 248px; }
    .pin-btn {
      height: 64px; border-radius: var(--radius-sm); border: 1px solid var(--border);
      background: var(--card); color: var(--text); font-family: var(--font);
      font-size: 22px; font-weight: 700; cursor: pointer; transition: all 0.1s;
      box-shadow: var(--shadow-sm); -webkit-tap-highlight-color: transparent;
      display: flex; align-items: center; justify-content: center;
    }
    .pin-btn:active { transform: scale(0.91); background: var(--accent); color: white; border-color: transparent; }
    .pin-btn.del { font-size: 17px; color: var(--muted); }
    .pin-error-msg { font-size: 13px; color: var(--red); font-weight: 600; min-height: 18px; text-align: center; }
    .pin-forgot { font-size: 12px; color: var(--muted); cursor: pointer; text-decoration: underline; }

    @media (max-width: 768px) {
      .report-grid { grid-template-columns: 1fr 1fr; }
      .plan-row { grid-template-columns: 1fr 90px 60px; }
    }
    @media (max-width: 480px) {
      .report-grid { grid-template-columns: 1fr; }
      .plan-row { grid-template-columns: 1fr; }
      .plan-diff { text-align: left; }
    }

    /* ─── ANOMALY DETECTION ─── */
    .anomaly-banner {
      background: rgba(240,76,101,0.08); border: 1px solid rgba(240,76,101,0.25);
      border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px;
      display: none;
    }
    .anomaly-banner.show { display: block; }
    .anomaly-banner-title { font-size: 14px; font-weight: 700; color: var(--red); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
    .anomaly-list { display: grid; gap: 6px; }
    .anomaly-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 6px 10px; background: var(--card); border-radius: 8px; border: 1px solid var(--border); }
    .anomaly-item-left { display: flex; align-items: center; gap: 8px; }
    .anomaly-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
    .anomaly-pct { font-size: 11px; font-weight: 700; color: var(--red); background: var(--red-bg); padding: 2px 7px; border-radius: 6px; }

    /* ─── TX CURRENCY BADGE ─── */
    .tx-currency-badge { font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-bg); border: 1px solid var(--accent-border); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }

    /* ─── SHARE MODAL ─── */
    .share-code-box {
      background: var(--card2); border: 1px solid var(--border); border-radius: var(--radius-sm);
      padding: 12px 14px; font-family: var(--mono); font-size: 12px;
      word-break: break-all; line-height: 1.6; color: var(--muted); max-height: 120px; overflow-y: auto;
      margin: 10px 0;
    }
    .share-qr { display: flex; justify-content: center; margin: 14px 0; }
    .share-qr canvas { border-radius: 10px; }
    .import-drop {
      border: 2px dashed var(--border2); border-radius: var(--radius);
      padding: 28px; text-align: center; cursor: pointer; transition: all 0.2s;
      color: var(--muted); font-size: 13px;
    }
    .import-drop:hover, .import-drop.drag-over { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
    .import-drop-icon { font-size: 32px; margin-bottom: 8px; }

