﻿/* ═══════════════════════════════════════════════════
   FinTrack — Polished Dashboard Stylesheet
   ═══════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --accent-mid: #bfdbfe;
  --accent-dark: #1d4ed8;
  --accent-rgb: 37,99,235;

  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface2: #f5f6f8;
  --surface3: #ebedf0;
  --border: #e3e5e8;
  --border2: #cdd1d6;
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;

  --green: #16a34a;
  --green-light: #ecfdf5;
  --red: #dc2626;
  --red-light: #fef2f2;
  --amber: #d97706;
  --amber-light: #fffbeb;

  --sidebar-w: 248px;
  --gap: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);
  --shadow-md: 0 4px 14px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.04);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="green"]  { --accent:#16a34a; --accent-light:#ecfdf5; --accent-mid:#bbf7d0; --accent-dark:#15803d; --accent-rgb:22,163,74; }
[data-theme="red"]    { --accent:#dc2626; --accent-light:#fef2f2; --accent-mid:#fecaca; --accent-dark:#b91c1c; --accent-rgb:220,38,38; }
[data-theme="purple"] { --accent:#7c3aed; --accent-light:#f5f3ff; --accent-mid:#ddd6fe; --accent-dark:#6d28d9; --accent-rgb:124,58,237; }
[data-theme="pink"]   { --accent:#db2777; --accent-light:#fdf2f8; --accent-mid:#fbcfe8; --accent-dark:#be185d; --accent-rgb:219,39,119; }
[data-theme="cyan"]   { --accent:#0891b2; --accent-light:#ecfeff; --accent-mid:#a5f3fc; --accent-dark:#0e7490; --accent-rgb:8,145,178; }
[data-theme="orange"] { --accent:#ea580c; --accent-light:#fff7ed; --accent-mid:#fed7aa; --accent-dark:#c2410c; --accent-rgb:234,88,12; }
[data-theme="teal"]   { --accent:#0d9488; --accent-light:#f0fdfa; --accent-mid:#99f6e4; --accent-dark:#0f766e; --accent-rgb:13,148,136; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }

/* scrollbar — hidden but functional */
* { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { width: 0; height: 0; }


/* ══════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════ */
#login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, rgba(var(--accent-rgb),.06) 0%, var(--bg) 50%, rgba(var(--accent-rgb),.03) 100%);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.login-box {
  width: 380px; padding: 2.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 2rem; }
.login-logo .dot { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(var(--accent-rgb),.3); }
.login-logo .dot span { color: #fff; font-size: 16px; font-weight: 700; }
.login-logo h1 em { color: var(--accent); font-style: normal; font-weight: 300; }
.login-box h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-box p { color: var(--text2); font-size: 13px; margin-bottom: 1.5rem; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.1); }
.btn-primary {
  width: 100%; height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: opacity .15s, transform .1s;
  box-shadow: 0 2px 10px rgba(var(--accent-rgb),.3);
}
.btn-primary:hover { opacity: .92; }
.btn-primary:active { transform: scale(.98); }
.login-hint { font-size: 12px; color: var(--text3); text-align: center; margin-top: 12px; }


/* ══════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════ */
#app { display: none; height: 100vh; flex-direction: row; overflow: hidden; }
#app.active { display: flex; }


/* ══════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  position: relative; z-index: 10;
}
.sidebar-logo {
  padding: 27px 20px 28px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb),.28);
}
.logo-icon span { color: #fff; font-size: 18px; font-weight: 700; }
.logo-name { font-size: 20px; font-weight: 600; letter-spacing: -.3px; line-height: 1.25; }
.logo-name em { color: var(--accent); font-style: normal; font-weight: 300; }

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-section { margin-bottom: 8px; }
.nav-section-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--text3); padding: 8px 12px 4px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 2px;
  cursor: pointer; color: var(--text2); font-size: 13.5px; font-weight: 500;
  transition: all .15s; position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(var(--accent-rgb),.08), rgba(var(--accent-rgb),.14));
  color: var(--accent); font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); position: relative; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); cursor: pointer; transition: background .12s;
}
.user-card:hover { background: var(--surface2); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: block; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(var(--accent-rgb),.25);
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text3); }


/* ══════════════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════════════ */
.main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
  background-image: radial-gradient(circle, rgba(0,0,0,.03) 1px, transparent 1px);
  background-size: 20px 20px;
}
.page {
  display: none; flex: 1; overflow-y: auto;
  padding: 28px 32px; flex-direction: column; gap: var(--gap);
}
.page.active { display: flex; }


/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.4px; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text3); margin-top: 2px; }


/* ── PERIOD SELECT ── */
.period-select {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none; padding: 0;
}
.period-select .smooth-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 34px 0 12px; height: 38px;
  font-family: inherit; font-size: 13px; color: var(--text); cursor: pointer; outline: none;
  box-shadow: var(--shadow-sm); transition: border-color .15s;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
  min-width: 130px;
}
.period-select .smooth-select.year { min-width: 100px; }
.period-select .smooth-select:focus { border-color: var(--accent); }
.period-select .smooth-select:active { transform: none; }


/* ══════════════════════════════════════════
   CARDS — Base
   ══════════════════════════════════════════ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-head {
  padding: 18px 22px 0; display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 16px 22px 22px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gap); }


/* ══════════════════════════════════════════
   TOTAL ASSETS CARD (overview top)
   ══════════════════════════════════════════ */
/* #ov-total-asset spacing handled by page gap */
.total-asset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.total-asset-card .metric-header { display: flex; align-items: center; gap: 10px; }
.total-asset-card .metric-title { font-size: 14px; color: var(--text); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.total-asset-card .metric-value { font-size: 22px; font-weight: 400; font-family: 'DM Mono', monospace; color: var(--text); }
.total-asset-card .btn-sm { border-color: var(--border); background: var(--surface); color: var(--text); }
.total-asset-card .btn-sm:hover { background: var(--surface2); }
.total-icon {
  width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-light); color: var(--accent); font-size: 13px;
}
.total-left { display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.total-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }


/* ══════════════════════════════════════════
   METRIC CARDS (4 cards row)
   ══════════════════════════════════════════ */
.metrics-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.metric-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s;
  position: relative; overflow: hidden;
}
.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.metric-card::before { display: none; }

.metric-card::after { display: none; }

.metric-card .metric-header { display: flex; align-items: center; gap: 8px; }
.metric-card .metric-icon {
  width: 20px; height: 20px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.metric-card .metric-title {
  font-size: 12px; color: var(--text3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.metric-card .metric-value {
  font-size: 20px; font-weight: 400; font-family: 'DM Mono', monospace;
  margin-top: 10px; letter-spacing: -.3px;
}
.metric-card .metric-change { margin-top: 6px; font-size: 12px; color: var(--text3); }

/* legacy compat */
.metric-label { font-size: 12px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.metric-label svg { width: 14px; height: 14px; }
.metric-value { font-size: 24px; font-weight: 400; letter-spacing: -.5px; font-family: 'DM Mono', monospace; }
.metric-change { font-size: 12px; color: var(--text3); margin-top: 4px; }
.metric-change.up { color: var(--green); }
.metric-change.dn { color: var(--red); }
.metric-header { min-height: 20px; }


/* ══════════════════════════════════════════
   TOTAL ASSET CARD V2
   ══════════════════════════════════════════ */
.total-asset-card-v2 {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  position: relative; overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.total-asset-card-v2:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tac-deco {
  position: absolute; top: -30px; right: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: var(--accent-light); opacity: .35; pointer-events: none;
}
.tac-left { min-width: 0; flex: 1; }
.tac-label-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tac-icon-badge {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tac-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; }
.tac-value {
  font-size: 28px; font-weight: 400; font-family: 'DM Mono', monospace;
  color: var(--accent); letter-spacing: -.5px; margin-bottom: 10px;
}
.tac-avatar {
  position: absolute; top: 16px; right: 18px;
  width: 100px; height: 100px; border-radius: 50%;
}
.tac-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.asset-pill {
  font-size: 11px; color: var(--text2); background: var(--surface2);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
}
.tac-progress-wrap { width: 100%; }
.tac-progress-bar {
  height: 5px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 5px;
}
.tac-progress-fill {
  height: 100%; background: var(--accent); border-radius: 999px;
  transition: width 1.4s cubic-bezier(0.4,0,0.2,1);
}
.tac-progress-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text3); }
.tac-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.tac-change-badge {
  font-size: 11px; font-weight: 500;
  background: var(--green-light); color: var(--green);
  padding: 4px 10px; border-radius: 999px;
}
.tac-btn {
  font-size: 12px; font-weight: 500; color: var(--accent);
  background: var(--accent-light); border: none;
  padding: 6px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: opacity .15s;
}
.tac-btn:hover { opacity: .8; }
.tac-no-assets {
  font-size: 11px; color: var(--text2); font-weight: 500;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px;
  display: inline-block;
}
.tac-mobile-count { display: none; }

/* ══════════════════════════════════════════
   METRIC CARD V2 (4 cards)
   ══════════════════════════════════════════ */
.metric-card-v2 {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s;
  display: flex; flex-direction: column; gap: 4px;
}
.metric-card-v2:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mcv2-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mcv2-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mcv2-label {
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
}
.mcv2-value {
  font-size: 20px; font-weight: 400; font-family: 'DM Mono', monospace;
  color: var(--text); letter-spacing: -.3px; margin: 4px 0 2px;
}
.mcv2-badge {
  font-size: 11px; font-weight: 500; padding: 3px 8px;
  border-radius: 999px; display: inline-block; width: fit-content;
}
.mcv2-badge.up { background: var(--green-light); color: var(--green); }
.mcv2-badge.dn { background: var(--red-light); color: var(--red); }
.mcv2-badge.neutral { background: var(--surface2); color: var(--text3); }

/* ══════════════════════════════════════════
   CHARTS
   ══════════════════════════════════════════ */
.chart-wrap { position: relative; height: 240px; cursor: default; }
.chart-wrap.chart-grab { cursor: grab; }
.chart-wrap.chart-grabbing { cursor: grabbing; }

.chart-zoom-controls { display: flex; gap: 4px; align-items: center; }
.chart-zoom-btn {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 18px; font-weight: 400; line-height: 1;
  color: var(--text2); display: flex; align-items: center; justify-content: center;
  transition: all .12s; padding: 0; font-family: inherit;
}
.chart-zoom-btn:hover:not(:disabled) { background: var(--accent-light); color: var(--accent); border-color: var(--accent-mid); }
.chart-zoom-btn:disabled { opacity: .35; cursor: default; }


/* ══════════════════════════════════════════
   BADGES / PILLS
   ══════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600;
}
.badge-in { background: var(--green-light); color: var(--green); }
.badge-out { background: var(--red-light); color: var(--red); }
.badge-neutral { background: var(--surface2); color: var(--text2); }
.badge-transfer { background: var(--accent-light); color: var(--accent); }


/* ══════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text3); padding: 10px 14px; text-align: left;
  border-bottom: 2px solid var(--surface3); background: var(--surface2);
}
.tbl th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.tbl th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.tbl td {
  padding: 12px 14px; border-bottom: 1px solid var(--surface2);
  font-size: 13px; vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover td { background: rgba(var(--accent-rgb),.03); }
.tbl .num { font-family: 'DM Mono', monospace; font-size: 13px; }
.tbl .num.g { color: var(--green); }
.tbl .num.r { color: var(--red); }

/* ── COLUMN FILTERS ── */
.tbl th.filterable { cursor: pointer; user-select: none; white-space: nowrap; position: relative; padding-right: 28px; }
.tbl th.filterable:hover { background: var(--surface3); color: var(--text); }
.tbl th.filterable.col-active { color: var(--accent); background: var(--accent-light); }
.th-arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .4; transition: opacity .15s; }
.tbl th.filterable:hover .th-arrow,
.tbl th.filterable.col-active .th-arrow { opacity: 1; }
.col-filter-panel {
  position: fixed; z-index: 600;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 14px; min-width: 230px; display: none;
}
.col-filter-panel.open { display: block; }
.col-filter-panel .fp-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text3); margin-bottom: 5px; }
.col-filter-panel input,
.col-filter-panel select {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--surface); outline: none; margin-bottom: 10px;
  transition: border-color .15s;
}
.col-filter-panel input:last-of-type,
.col-filter-panel select:last-of-type { margin-bottom: 0; }
.col-filter-panel input:focus,
.col-filter-panel select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.08); }
.col-filter-footer { display: flex; gap: 8px; padding-top: 12px; }
.col-filter-footer button {
  flex: 1; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--text); cursor: pointer; transition: background .12s;
}
.col-filter-footer button:hover { background: var(--surface2); }
.col-filter-footer button.primary { background: var(--accent); color: #fff; border-color: transparent; }
.col-filter-footer button.primary:hover { opacity: .9; }


/* ══════════════════════════════════════════
   CATEGORY BARS
   ══════════════════════════════════════════ */
.cat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cat-row:last-child { margin-bottom: 0; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.cat-name { flex: 1; font-size: 13px; color: var(--text); font-weight: 500; }
.cat-bar-wrap { width: 110px; height: 6px; background: var(--surface2); border-radius: 99px; overflow: hidden; flex-shrink: 0; }
.cat-bar { height: 100%; border-radius: 99px; transition: width .4s ease; }
.cat-bar.g { background: var(--green); }
.cat-bar.r { background: var(--red); }
.cat-amt { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text2); min-width: 90px; text-align: right; }
.cat-pct { display: none; }


/* ══════════════════════════════════════════
   ASSETS
   ══════════════════════════════════════════ */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--gap); }
.asset-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  background: var(--surface); position: relative;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s;
}
.asset-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.asset-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb),.08), rgba(var(--accent-rgb),.16));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.asset-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.asset-type { font-size: 11px; color: var(--text3); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.asset-bal { font-size: 18px; font-weight: 400; font-family: 'DM Mono', monospace; letter-spacing: -.3px; }
.asset-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.asset-card:hover .asset-actions { opacity: 1; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text3); transition: all .12s;
}
.icon-btn:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }
.add-asset-btn {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; background: transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  color: var(--text3); font-size: 13px; font-family: inherit; font-weight: 500;
  transition: all .15s; min-height: 140px;
}
.add-asset-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb),.03); }
.add-asset-btn svg { width: 28px; height: 28px; }

/* ══════════════════════════════════════════
   BUDGET
   ══════════════════════════════════════════ */
.budget-row { margin-bottom: 14px; }
.budget-row:last-child { margin-bottom: 0; }
.budget-info { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.budget-cat { font-size: 13px; font-weight: 600; }
.budget-nums { font-size: 12px; font-family: 'DM Mono', monospace; color: var(--text2); }
.budget-bar-wrap { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.budget-bar { height: 100%; border-radius: 99px; background: var(--green); transition: width .5s ease; }
.budget-bar.warn { background: var(--amber); }
.budget-bar.over { background: var(--red); }


/* ══════════════════════════════════════════
   SETTINGS
   ══════════════════════════════════════════ */
.settings-section {
  background: var(--surface); border-radius: var(--radius);
  margin-bottom: var(--gap); box-shadow: var(--shadow-md);
  padding: 22px 26px;
}
.settings-section-head {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 20px; padding-bottom: 0;
}
.settings-row {
  padding: 10px 0; display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.settings-row:last-child { padding-bottom: 0; }
.settings-label { font-size: 13px; font-weight: 600; }
.settings-desc { font-size: 12px; color: var(--text3); margin-top: 2px; }
.settings-field { width: 220px; }
.settings-field input, .settings-field select {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.settings-field input:focus, .settings-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.08);
}
.theme-options { display: flex; gap: 10px; }
.theme-dot {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2.5px solid transparent; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.theme-dot.selected { border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.theme-dot.blue   { background: #2563eb; }
.theme-dot.green  { background: #16a34a; }
.theme-dot.red    { background: #dc2626; }
.theme-dot.purple { background: #7c3aed; }
.theme-dot.pink   { background: #db2777; }
.theme-dot.cyan   { background: #0891b2; }
.theme-dot.orange { background: #ea580c; }
.theme-dot.teal   { background: #0d9488; }

/* ── PROFILE CARD ── */
.pf-head { display:flex; align-items:center; justify-content:space-between; }
.pf-head-btns { display:flex; gap:8px; }
.pf-footer-mob { display:none; }
.pf-card-body {
  display: flex; align-items: center; gap: 36px;
  padding: 20px 0 16px;
}
.pf-pic-wrap {
  position: relative; flex-shrink: 0;
  width: 200px; height: 200px; border-radius: 50%;
  cursor: pointer; user-select: none;
}
.pf-pic-canvas { width: 200px; height: 200px; border-radius: 50%; display: block; }
.pf-pic-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: #fff; font-size: 12px; font-weight: 600;
  opacity: 0; transition: opacity .2s, background .2s;
  pointer-events: none;
}
.pf-pic-wrap:hover .pf-pic-overlay { opacity: 1; background: rgba(0,0,0,.48); }
.pf-fields { flex: 1; min-width: 0; }
.pf-field-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 14px 0;
  border-bottom: 1px solid var(--surface2);
}
.pf-field-row:last-child { border-bottom: none; padding-bottom: 4px; }
.pf-field-left { flex-shrink: 0; width: 224px; }
.pf-field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.pf-field-desc { font-size: 12px; color: var(--text3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-input {
  flex: 1; min-width: 0; height: 50px; padding: 0 14px;
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.pf-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.1); }

/* ── PP MODAL ── */
.pp-modal-box {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); width: 380px; max-width: 95vw;
  max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease; display: flex; flex-direction: column;
}
.pp-modal-head {
  padding: 18px 20px 0; display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.pp-tabs { display: flex; gap: 0; padding: 0 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pp-tab {
  padding: 9px 16px; font-size: 13px; font-weight: 500; font-family: inherit;
  background: none; border: none; cursor: pointer; color: var(--text2);
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; transition: color .15s;
}
.pp-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pp-modal-body { padding: 16px; overflow-y: auto; }
.pp-modal-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-shrink: 0;
}
.pp-dropzone {
  border: 2px dashed var(--border2); border-radius: var(--radius-sm);
  padding: 28px 20px; text-align: center; cursor: pointer;
  color: var(--text2); font-size: 13px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; transition: border-color .15s, color .15s;
}
.pp-dropzone:hover { border-color: var(--accent); color: var(--accent); }
.pp-drop-sub { font-size: 11px; color: var(--text3); }
.pp-crop-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 4px; }
.pp-crop-container { border-radius: 12px; overflow: hidden; cursor: grab; display: inline-block; touch-action: none; }
.pp-crop-container:active { cursor: grabbing; }
#pp-crop-canvas { display: block; width: 280px; height: 280px; }
.pp-zoom-row { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--text3); }
.pp-zoom-row input[type=range] { flex: 1; accent-color: var(--accent); }
.pp-emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px; max-height: 210px; overflow-y: auto; padding: 2px;
}
.pp-emoji-btn {
  width: 44px; height: 44px; font-size: 24px; border-radius: var(--radius-sm);
  border: 2px solid transparent; background: var(--surface2); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .12s;
  padding: 0;
}
.pp-emoji-btn:hover { background: var(--accent-light); }
.pp-emoji-btn.selected { border-color: var(--accent); background: var(--accent-light); }
.pp-section-label {
  font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase;
  letter-spacing: .06em; margin: 14px 0 8px;
}
.pp-frame-row { display: flex; gap: 12px; flex-wrap: wrap; padding-bottom: 4px; }
.pp-frame-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; font-size: 10px; color: var(--text3); font-weight: 500;
  background: none; border: none; padding: 4px; border-radius: 8px;
  transition: color .12s;
}
.pp-frame-btn canvas { border-radius: 50%; transition: outline .12s; outline: 2px solid transparent; outline-offset: 2px; }
.pp-frame-btn.selected { color: var(--accent); }
.pp-frame-btn.selected canvas { outline-color: var(--accent); }


/* ══════════════════════════════════════════
   USER SWITCHER
   ══════════════════════════════════════════ */
.user-switcher {
  position: fixed; bottom: 72px; left: 12px; width: 224px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  z-index: 200; padding: 6px; overflow: hidden;
  animation: modalIn .15s ease;
}
.switcher-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background .1s;
}
.switcher-item:hover { background: var(--surface2); }
.switcher-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.switcher-name { flex: 1; font-size: 13px; font-weight: 500; }
.switcher-active { font-size: 12px; }


/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn-sm {
  height: 36px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--text); transition: all .12s; box-shadow: var(--shadow-sm);
}
.btn-sm:hover { background: var(--surface2); }
.btn-sm.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb),.3);
}
.btn-sm.primary:hover { opacity: .92; box-shadow: 0 4px 14px rgba(var(--accent-rgb),.35); }
.btn-sm.danger { color: var(--red); border-color: var(--red); }
.btn-sm.danger:hover { background: var(--red-light); }


/* ══════════════════════════════════════════
   MISC
   ══════════════════════════════════════════ */
.empty-state { text-align: center; padding: 48px; color: var(--text3); font-size: 13px; }
.empty-state svg { width: 44px; height: 44px; margin: 0 auto 12px; display: block; color: var(--border); }

/* Recent / TX mobile list — hidden on desktop */
.recent-mobile-list { display: none; }

/* TX header layout (desktop) */
.tx-header-right { display: flex; align-items: center; gap: 8px; }
.tx-top-row { display: none; }
.tx-filter-btn { display: none; }
.tx-add-mobile { display: none; }

/* Desktop: card-head tools */
.tx-card-tools { display: flex; align-items: center; gap: 8px; }
.tx-filter-ch-mob { display: none; }  /* mobile-only filter btn, hidden on desktop */

/* TX Filter popup — centered modal */
.tx-filter-sheet {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 401;
  pointer-events: none; opacity: 0;
  transition: opacity .2s ease;
}
.tx-filter-sheet.open { opacity: 1; pointer-events: auto; }
.tx-filter-sheet-inner {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 440px; max-width: 95vw;
  max-height: 85vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
.tx-filter-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 0;
  margin-bottom: 4px;
}
.tx-filter-sheet-title { font-size: 17px; font-weight: 700; }
.tx-filter-content { padding: 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.tx-filter-sheet-footer {
  padding: 16px 24px 24px;
  display: flex; gap: 10px;
  border-top: 1px solid var(--surface2);
}
.tx-filter-sheet-footer .btn-sm { flex: 1; justify-content: center; }
.mf-group { display: flex; flex-direction: column; gap: 6px; }
.mf-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text3); }
.mf-row { display: flex; align-items: center; gap: 8px; }
.mf-row input { flex: 1; height: 36px; padding: 0 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); font-family: inherit; font-size: 12px; color: var(--text); background: var(--surface); outline: none; }
.mf-col { display: flex; flex-direction: column; gap: 6px; }
.mf-col input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); font-family: inherit; font-size: 12px; color: var(--text); background: var(--surface); outline: none; }
.mf-sep { color: var(--text3); font-size: 12px; flex-shrink: 0; }
.mf-group select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border2); border-radius: var(--radius-sm); font-family: inherit; font-size: 13px; color: var(--text); background: var(--surface); outline: none; }
.mf-type-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mf-type-btn { padding: 6px 14px; border-radius: 99px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); background: var(--surface); color: var(--text2); cursor: pointer; font-family: inherit; }
.mf-type-btn.active { background: rgba(var(--accent-rgb),.1); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }


/* ══════════════════════════════════════════
   MOBILE HEADER
   ══════════════════════════════════════════ */
.mobile-header {
  display: none;
  position: sticky; top: 0; z-index: 20;
  height: 56px; flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}
.mobile-header-logo { display: flex; align-items: center; gap: 8px; }
.mobile-header-right { display: flex; align-items: center; gap: 8px; }
.mobile-logout-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.mobile-logout-btn:active { background: var(--surface2); color: var(--danger,#ef4444); }
.mobile-avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; overflow: hidden;
  box-shadow: 0 2px 6px rgba(var(--accent-rgb),.25);
  flex-shrink: 0;
  background: transparent;
}

/* ══════════════════════════════════════════
   MOBILE BOTTOM NAV
   ══════════════════════════════════════════ */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 62px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom);
}
.mob-nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; padding: 4px 8px;
  cursor: pointer; color: var(--text3);
  font-size: 10px; font-weight: 500;
  transition: color .15s;
  flex: 1; border-radius: 8px; min-width: 0;
}
.mob-nav-item.active { color: var(--accent); }
.mob-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.mob-nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ══════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page.active { animation: fadeIn .25s ease; }


/* ══════════════════════════════════════════
   RESPONSIVE — TABLET
   ══════════════════════════════════════════ */
@media (max-width: 1100px) {
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Login */
  #login-screen { padding: 0 20px; }
  .login-box { width: 100%; }
  .login-logo h1 { font-size: 18px; white-space: nowrap; }

  /* Layout */
  .sidebar { display: none; }
  .mobile-header { display: flex; }

  /* Mobile header logo size */
  .mobile-header-logo .logo-icon { width: 28px; height: 28px; border-radius: 8px; }
  .mobile-header-logo .logo-icon span { font-size: 13px; }
  .mobile-header-logo .logo-name { font-size: 14px; line-height: 1; }
  .mobile-avatar-btn { width: 28px; height: 28px; font-size: 11px; }
  .mobile-logout-btn { width: 28px; height: 28px; }
  .mobile-header-right { gap: 6px; }
  .mobile-nav { display: flex; }
  .page { padding: 16px 16px 80px; gap: 8px; }

  /* Grids */
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .two-col, .three-col { grid-template-columns: 1fr; gap: 8px; }
  .asset-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Metric cards: icon kiri, label+nilai kanan */
  .metric-card-v2 {
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    padding: 12px 12px;
  }
  .mcv2-header { display: contents; }
  .mcv2-icon { grid-column: 1; grid-row: 1 / 3; width: 32px; height: 32px; border-radius: 9px; align-self: center; }
  .mcv2-label { grid-column: 2; grid-row: 1; align-self: end; font-size: 9px; }
  .mcv2-value { grid-column: 2; grid-row: 2; font-size: 12px; margin: 0; align-self: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mcv2-badge { display: none; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header > :last-child { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }

  /* Total aset card: hide pills, show count pill instead */
  .tac-pills { display: none; }
  .tac-mobile-count {
    display: inline-block;
    font-size: 11px; color: var(--text2); font-weight: 500;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 999px; padding: 3px 10px;
  }

  /* Transactions mobile layout */
  #page-transactions .page-header > div:first-child { display: none; } /* hide title/sub */
  .tx-header-right { flex-direction: column; width: 100%; gap: 8px; }
  .tx-top-row { display: none; }  /* search+filter moved into card-head */
  .tx-add-btn { display: none; }
  .tx-add-mobile { display: flex; align-items: center; justify-content: center; width: 100%; height: 40px; order: -1; }
  .tx-table-wrap { display: none; }
  #tx-mobile-list { display: block; }
  /* Card-head: 2-row layout — title+filter-btn on row 1, search on row 2 */
  .tx-card-head { flex-wrap: wrap; align-items: center; row-gap: 12px; padding-bottom: 12px !important; }
  .tx-card-head .card-title { flex: 1; }
  .tx-filter-ch-mob { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
  .tx-card-tools { display: flex !important; width: 100%; order: 10; }
  .tx-card-tools #tx-search-card { flex: 1; width: auto !important; }
  .tx-filter-ch-desk { display: none; }
  #page-transactions .card-body { padding-top: 10px; padding-bottom: 12px; }

  /* Overview: hide title+sub on mobile */
  #page-overview .page-header > div:first-child { display: none; }

  /* Budget: hide title+sub, make button full-width centered */
  #page-budget .page-header > div:first-child { display: none; }
  #page-budget .page-header > button { width: 100%; display: flex; align-items: center; justify-content: center; }

  /* Assets: hide title+sub, make button full-width centered */
  #page-assets .page-header > div:first-child { display: none; }
  #page-assets .page-header > button { width: 100%; display: flex; align-items: center; justify-content: center; }

  /* Settings: hide entire page-header (empty on mobile) */
  #page-settings .page-header { display: none; }

  /* Period selects */
  .period-select { flex-wrap: wrap; }
  .period-select .smooth-select { min-width: 0; flex: 1; }

  /* Cards */
  .card-head { flex-wrap: wrap; gap: 8px; }

  /* Tables — horizontal scroll */
  .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 560px; }

  /* Settings */
  .settings-section { margin-bottom: 0; padding: 16px; }
  .settings-section-head { font-size: 14px; margin-bottom: 12px; }
  .settings-row { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 0; }
  .settings-row > button.btn-sm { width: 100%; }
  .settings-field { width: 100%; }
  /* Profile card mobile */
  .pf-card-body { flex-direction: column; align-items: center; gap: 18px; padding: 12px 0 8px; }
  .pf-pic-wrap { width: 120px; height: 120px; }
  .pf-pic-canvas { width: 120px; height: 120px; }
  .pf-fields { width: 100%; }
  .pf-field-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .pf-field-left { width: 100%; }
  .pf-field-desc { white-space: normal; }
  .pf-input { width: 100%; flex: none; }
  .pf-head { flex-direction: row; }
  .pf-head-btns { display: none; }
  .pf-footer-mob {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 16px; margin-top: 4px;
    border-top: 1px solid var(--surface2);
  }
  /* PP modal mobile */
  .pp-modal-box { width: 96vw; max-height: 90vh; }
  #pp-crop-canvas { width: 240px !important; height: 240px !important; }

  /* Recent transactions — hide table, show mobile list */
  .recent-table-wrap { display: none; }
  .recent-mobile-list { display: block; }

  /* Mobile recent list layout */
  .rmob-group { margin-bottom: 0px; }
  .rmob-date {
    font-size: 11px; font-weight: 700; color: var(--text3);
    letter-spacing: .06em; text-transform: uppercase;
    padding: 6px 0 4px;
  }
  .rmob-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--surface2);
    cursor: pointer;
  }
  .rmob-row:last-child { border-bottom: none; }
  .rmob-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
  }
  .rmob-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .rmob-cat { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rmob-asset { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rmob-desc { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rmob-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
  .rmob-amt { font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 400; white-space: nowrap; }
  .rmob-amt.g { color: var(--green); }
  .rmob-amt.r { color: var(--red); }
  .rmob-type { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
  .rmob-type.g { background: var(--green-light); color: var(--green); }
  .rmob-type.r { background: var(--red-light); color: var(--red); }
  .rmob-type.neutral { background: var(--surface2); color: var(--text2); }

  /* User switcher — drop below top mobile header */
  .user-switcher { bottom: auto; top: 60px; left: auto; right: 12px; width: 240px; }

  /* Category rows mobile — Pengeluaran Terbesar / Pemasukan Terbanyak */
  .cat-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 8px;
    row-gap: 5px;
    align-items: center;
    margin-bottom: 14px;
  }
  .cat-row .cat-dot { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .cat-row .cat-icon { grid-column: 1; grid-row: 1 / 3; align-self: center; width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
  .cat-row .cat-name { grid-column: 2; grid-row: 1; flex: unset; }
  .cat-row .cat-pct-label { display: none; }
  .cat-row .cat-amt { grid-column: 3; grid-row: 1; min-width: 0; font-size: 11px; text-align: right; }
  .cat-row .cat-bar-wrap { grid-column: 2 / 4; grid-row: 2; width: 100%; height: 20px; position: relative; }
  .cat-pct { display: block; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; color: #fff; font-weight: 700; line-height: 1; z-index: 1; pointer-events: none; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — SMALL PHONES
   ══════════════════════════════════════════ */
@media (max-width: 480px) {
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .asset-grid { grid-template-columns: 1fr; }
  .page { padding: 16px 12px 80px; }
  .metric-card .metric-value { font-size: 18px; }
  .total-asset-card-v2 { flex-direction: column; }
  .tac-right { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .tac-value { font-size: 22px; }
  .tac-avatar { width: 90px; height: 90px; top: 12px; right: 12px; }
}