/* ==================== 3 Flagship Themes ==================== */
/* Theme 1: 暖纸黑卡 (Obsidian × Warm Editorial Paper — Default) */
:root,
:root[data-theme="obsidian"] {
  --bg: #F3F0E8;
  --bg-grad: linear-gradient(180deg, #F7F4ED 0%, #F2EFE7 42%, #ECE8DE 100%);
  --surface: #FCFBF8;
  --surface-sub: #E8E3D8;
  --surface-tint: #F4F1E9;
  --text-main: #1A1917;
  --text-sub: #78736A;
  --text-muted: #A39D93;
  --accent: #181A20;
  --accent-grad: linear-gradient(135deg, #1E2028 0%, #121318 100%);
  --accent-text: #FFFFFF;
  --accent-soft: rgba(24, 26, 32, 0.07);
  --gold: #C28E3B;
  --green: #15803D;
  --green-soft: rgba(21, 128, 61, 0.11);
  --red: #C83E3B;
  --red-soft: rgba(200, 62, 59, 0.10);
  --orange: #D97706;
  --border: rgba(28, 25, 23, 0.08);
  --card-shadow: 0 6px 22px rgba(28, 25, 23, 0.05), 0 1px 2px rgba(28, 25, 23, 0.03);
  --hero-bg: linear-gradient(145deg, #1D2028 0%, #12141A 100%);
  --hero-border: rgba(255, 255, 255, 0.09);
  --hero-text: #FAF9F6;
  --hero-sub: rgba(250, 249, 246, 0.58);
  --hero-exp: #FB7185;
  --hero-inc: #34D399;
  --dock-bg: rgba(252, 251, 248, 0.86);
  --dock-border: rgba(28, 25, 23, 0.09);
  --dock-active-bg: #181A20;
  --dock-active-text: #FAF9F6;
  --motto-bg: rgba(252, 251, 248, 0.85);
  --motto-border: rgba(194, 142, 59, 0.24);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 2: 暗夜高定 (Midnight OLED — Copilot Money × Apple Stocks) */
:root[data-theme="midnight"] {
  --bg: #090A0D;
  --bg-grad: linear-gradient(180deg, #0E1016 0%, #090A0D 45%, #060709 100%);
  --surface: #14161D;
  --surface-sub: #1E212B;
  --surface-tint: #1A1D26;
  --text-main: #F4F5F7;
  --text-sub: #8E93A2;
  --text-muted: #5C6170;
  --accent: #F4F5F7;
  --accent-grad: linear-gradient(135deg, #FFFFFF 0%, #E2E5EC 100%);
  --accent-text: #0B0C0F;
  --accent-soft: rgba(244, 245, 247, 0.10);
  --gold: #E5B96B;
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --red: #FB7185;
  --red-soft: rgba(251, 113, 133, 0.14);
  --orange: #FBBF24;
  --border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --hero-bg: linear-gradient(145deg, #1E222E 0%, #13151D 100%);
  --hero-border: rgba(229, 185, 107, 0.22);
  --hero-text: #FFFFFF;
  --hero-sub: rgba(244, 245, 247, 0.56);
  --hero-exp: #FB7185;
  --hero-inc: #34D399;
  --dock-bg: rgba(20, 22, 29, 0.88);
  --dock-border: rgba(255, 255, 255, 0.10);
  --dock-active-bg: #F4F5F7;
  --dock-active-text: #0B0C0F;
  --motto-bg: rgba(20, 22, 29, 0.85);
  --motto-border: rgba(229, 185, 107, 0.24);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 3: 现代留白 (Swiss Editorial × Monochrome iOS 18) */
:root[data-theme="editorial"] {
  --bg: #F4F5F7;
  --bg-grad: linear-gradient(180deg, #F8F9FB 0%, #F2F4F7 50%, #ECEEF2 100%);
  --surface: #FFFFFF;
  --surface-sub: #E5E7EB;
  --surface-tint: #F7F8FA;
  --text-main: #111318;
  --text-sub: #6B7280;
  --text-muted: #9CA3AF;
  --accent: #18181B;
  --accent-grad: linear-gradient(135deg, #27272A 0%, #111113 100%);
  --accent-text: #FFFFFF;
  --accent-soft: rgba(24, 24, 27, 0.07);
  --gold: #18181B;
  --green: #16A34A;
  --green-soft: rgba(22, 163, 74, 0.11);
  --red: #DC2626;
  --red-soft: rgba(220, 38, 38, 0.10);
  --orange: #D97706;
  --border: rgba(15, 23, 42, 0.06);
  --card-shadow: 0 4px 16px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --hero-bg: #FFFFFF;
  --hero-border: rgba(15, 23, 42, 0.08);
  --hero-text: #111318;
  --hero-sub: #6B7280;
  --hero-exp: #DC2626;
  --hero-inc: #16A34A;
  --dock-bg: rgba(255, 255, 255, 0.88);
  --dock-border: rgba(15, 23, 42, 0.08);
  --dock-active-bg: #18181B;
  --dock-active-text: #FFFFFF;
  --motto-bg: rgba(255, 255, 255, 0.88);
  --motto-border: rgba(15, 23, 42, 0.09);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 4: 江南竹影 (Celadon Bamboo Paper × Deep Pine) */
:root[data-theme="bamboo"] {
  --bg: #EEF3EE;
  --bg-grad: linear-gradient(180deg, #F3F7F2 0%, #ECF2EC 48%, #E4ECE5 100%);
  --surface: #FAFDF9;
  --surface-sub: #DDE7DE;
  --surface-tint: #F0F5F0;
  --text-main: #18261F;
  --text-sub: #5E7166;
  --text-muted: #8FA197;
  --accent: #1F4D3A;
  --accent-grad: linear-gradient(135deg, #275E47 0%, #173C2D 100%);
  --accent-text: #FFFFFF;
  --accent-soft: rgba(31, 77, 58, 0.09);
  --gold: #A9823B;
  --green: #16804A;
  --green-soft: rgba(22, 128, 74, 0.12);
  --red: #C64844;
  --red-soft: rgba(198, 72, 68, 0.11);
  --orange: #C97A2B;
  --border: rgba(24, 38, 31, 0.08);
  --card-shadow: 0 6px 22px rgba(24, 38, 31, 0.05), 0 1px 2px rgba(24, 38, 31, 0.03);
  --hero-bg: linear-gradient(145deg, #1E3E31 0%, #122820 100%);
  --hero-border: rgba(255, 255, 255, 0.10);
  --hero-text: #F7FAF8;
  --hero-sub: rgba(247, 250, 248, 0.62);
  --hero-exp: #FDA4AF;
  --hero-inc: #6EE7B7;
  --dock-bg: rgba(250, 253, 249, 0.88);
  --dock-border: rgba(24, 38, 31, 0.09);
  --dock-active-bg: #1F4D3A;
  --dock-active-text: #F7FAF8;
  --motto-bg: rgba(250, 253, 249, 0.88);
  --motto-border: rgba(31, 77, 58, 0.20);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 5: 海盐晴空 (Sea Salt Glacier × Deep Navy) */
:root[data-theme="ocean"] {
  --bg: #EEF3F8;
  --bg-grad: linear-gradient(180deg, #F4F8FC 0%, #ECF2F8 50%, #E3ECF5 100%);
  --surface: #FBFCFE;
  --surface-sub: #DCE6F1;
  --surface-tint: #F1F5FA;
  --text-main: #132030;
  --text-sub: #5B6E84;
  --text-muted: #8C9EB2;
  --accent: #1B4B82;
  --accent-grad: linear-gradient(135deg, #255D9D 0%, #153B68 100%);
  --accent-text: #FFFFFF;
  --accent-soft: rgba(27, 75, 130, 0.09);
  --gold: #2A6AB3;
  --green: #148256;
  --green-soft: rgba(20, 130, 86, 0.11);
  --red: #C9454A;
  --red-soft: rgba(201, 69, 74, 0.10);
  --orange: #D97706;
  --border: rgba(19, 32, 48, 0.08);
  --card-shadow: 0 6px 22px rgba(19, 32, 48, 0.05), 0 1px 2px rgba(19, 32, 48, 0.03);
  --hero-bg: linear-gradient(145deg, #173458 0%, #0E223B 100%);
  --hero-border: rgba(255, 255, 255, 0.10);
  --hero-text: #F7FAFF;
  --hero-sub: rgba(247, 250, 255, 0.62);
  --hero-exp: #FDA4AF;
  --hero-inc: #5EEAD4;
  --dock-bg: rgba(251, 252, 254, 0.88);
  --dock-border: rgba(19, 32, 48, 0.09);
  --dock-active-bg: #1B4B82;
  --dock-active-text: #FFFFFF;
  --motto-bg: rgba(251, 252, 254, 0.88);
  --motto-border: rgba(27, 75, 130, 0.20);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 6: 晚霞蜜桃 (Warm Sakura Cream × Berry Espresso) */
:root[data-theme="sakura"] {
  --bg: #F8F0EE;
  --bg-grad: linear-gradient(180deg, #FCF6F4 0%, #F7EEEB 50%, #F2E5E1 100%);
  --surface: #FFFDFC;
  --surface-sub: #EEDCD8;
  --surface-tint: #FAF2F0;
  --text-main: #2C1D1B;
  --text-sub: #826A66;
  --text-muted: #B09995;
  --accent: #9E4757;
  --accent-grad: linear-gradient(135deg, #B55768 0%, #863847 100%);
  --accent-text: #FFFFFF;
  --accent-soft: rgba(158, 71, 87, 0.09);
  --gold: #B5625A;
  --green: #1D8254;
  --green-soft: rgba(29, 130, 84, 0.11);
  --red: #C83E4D;
  --red-soft: rgba(200, 62, 77, 0.11);
  --orange: #D4783A;
  --border: rgba(44, 29, 27, 0.08);
  --card-shadow: 0 6px 22px rgba(96, 46, 42, 0.06), 0 1px 2px rgba(44, 29, 27, 0.03);
  --hero-bg: linear-gradient(145deg, #4B252B 0%, #2D1519 100%);
  --hero-border: rgba(255, 214, 214, 0.14);
  --hero-text: #FFF8F7;
  --hero-sub: rgba(255, 248, 247, 0.64);
  --hero-exp: #FDA4AF;
  --hero-inc: #6EE7B7;
  --dock-bg: rgba(255, 253, 252, 0.88);
  --dock-border: rgba(44, 29, 27, 0.09);
  --dock-active-bg: #9E4757;
  --dock-active-text: #FFFFFF;
  --motto-bg: rgba(255, 253, 252, 0.88);
  --motto-border: rgba(158, 71, 87, 0.22);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 7: 拿铁焦糖 (Oat Latte × Roasted Espresso) */
:root[data-theme="mocha"] {
  --bg: #F2EAE1;
  --bg-grad: linear-gradient(180deg, #F7F0E8 0%, #EFE6DC 50%, #E7DCD0 100%);
  --surface: #FCF9F5;
  --surface-sub: #E4D7C8;
  --surface-tint: #F4ECE3;
  --text-main: #2A2018;
  --text-sub: #7D6B5B;
  --text-muted: #AA9887;
  --accent: #5C3D28;
  --accent-grad: linear-gradient(135deg, #734E34 0%, #482F1E 100%);
  --accent-text: #FFFBF7;
  --accent-soft: rgba(92, 61, 40, 0.09);
  --gold: #B87B3B;
  --green: #1E7E4C;
  --green-soft: rgba(30, 126, 76, 0.11);
  --red: #C1473B;
  --red-soft: rgba(193, 71, 59, 0.11);
  --orange: #C97428;
  --border: rgba(42, 32, 24, 0.09);
  --card-shadow: 0 6px 22px rgba(42, 32, 24, 0.06), 0 1px 2px rgba(42, 32, 24, 0.03);
  --hero-bg: linear-gradient(145deg, #3B271B 0%, #241710 100%);
  --hero-border: rgba(230, 185, 130, 0.18);
  --hero-text: #FDF8F2;
  --hero-sub: rgba(253, 248, 242, 0.62);
  --hero-exp: #FCA5A5;
  --hero-inc: #6EE7B7;
  --dock-bg: rgba(252, 249, 245, 0.88);
  --dock-border: rgba(42, 32, 24, 0.10);
  --dock-active-bg: #5C3D28;
  --dock-active-text: #FFFBF7;
  --motto-bg: rgba(252, 249, 245, 0.88);
  --motto-border: rgba(184, 123, 59, 0.24);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 8: 松烟墨夜 (Deep Emerald Forest OLED × Champagne) */
:root[data-theme="forest"] {
  --bg: #08110E;
  --bg-grad: linear-gradient(180deg, #0D1915 0%, #08110E 48%, #050B09 100%);
  --surface: #111E1A;
  --surface-sub: #192B25;
  --surface-tint: #152520;
  --text-main: #EFF6F2;
  --text-sub: #8CA69B;
  --text-muted: #5A7368;
  --accent: #34D399;
  --accent-grad: linear-gradient(135deg, #4ADEA8 0%, #1EA876 100%);
  --accent-text: #06140F;
  --accent-soft: rgba(52, 211, 153, 0.13);
  --gold: #DFBA6F;
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.15);
  --red: #FB7185;
  --red-soft: rgba(251, 113, 133, 0.15);
  --orange: #FBBF24;
  --border: rgba(210, 245, 228, 0.09);
  --card-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(210, 245, 228, 0.05);
  --hero-bg: linear-gradient(145deg, #162E26 0%, #0D1C17 100%);
  --hero-border: rgba(223, 186, 111, 0.24);
  --hero-text: #F5FBF8;
  --hero-sub: rgba(239, 246, 242, 0.58);
  --hero-exp: #FB7185;
  --hero-inc: #34D399;
  --dock-bg: rgba(17, 30, 26, 0.90);
  --dock-border: rgba(210, 245, 228, 0.11);
  --dock-active-bg: #34D399;
  --dock-active-text: #06140F;
  --motto-bg: rgba(17, 30, 26, 0.88);
  --motto-border: rgba(223, 186, 111, 0.26);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Theme 9: 暮紫星云 (Velvet Nebula OLED × Soft Lavender Gold) */
:root[data-theme="nebula"] {
  --bg: #0C0A15;
  --bg-grad: linear-gradient(180deg, #131022 0%, #0C0A15 48%, #08060F 100%);
  --surface: #171426;
  --surface-sub: #221E36;
  --surface-tint: #1C182E;
  --text-main: #F4F2FA;
  --text-sub: #9A93B5;
  --text-muted: #686182;
  --accent: #A78BFA;
  --accent-grad: linear-gradient(135deg, #BCA6FF 0%, #8B6CE8 100%);
  --accent-text: #0D0A18;
  --accent-soft: rgba(167, 139, 250, 0.14);
  --gold: #E5B97A;
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.15);
  --red: #FB7185;
  --red-soft: rgba(251, 113, 133, 0.15);
  --orange: #FBBF24;
  --border: rgba(220, 210, 255, 0.09);
  --card-shadow: 0 10px 28px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(220, 210, 255, 0.05);
  --hero-bg: linear-gradient(145deg, #241E3E 0%, #151126 100%);
  --hero-border: rgba(167, 139, 250, 0.26);
  --hero-text: #FAF9FF;
  --hero-sub: rgba(244, 242, 250, 0.58);
  --hero-exp: #FB7185;
  --hero-inc: #34D399;
  --dock-bg: rgba(23, 20, 38, 0.90);
  --dock-border: rgba(220, 210, 255, 0.11);
  --dock-active-bg: #A78BFA;
  --dock-active-text: #0D0A18;
  --motto-bg: rgba(23, 20, 38, 0.88);
  --motto-border: rgba(167, 139, 250, 0.28);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "MiSans", sans-serif;
  background: var(--bg-grad);
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px 96px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 1. Apple Minimalist Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
}

.period-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.period-mode-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}

.period-mode-select option {
  background: var(--surface);
  color: var(--text-main);
}

.month-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  white-space: nowrap;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-select option {
  background: var(--surface);
  color: var(--text-main);
}

.custom-range-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 12px;
}

.custom-date-input {
  width: 100%;
  border: none;
  background: var(--bg);
  color: var(--text-main);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.custom-range-sep {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
}

.settings-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px 2px;
  font-family: inherit;
}

.api-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.api-dot.off {
  background: var(--orange);
}

/* 2. Clean Financial Summary Card */
.summary-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sum-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.sum-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sum-col.right {
  text-align: right;
  align-items: flex-end;
}

.sum-main-label {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 5px;
  white-space: nowrap;
}

.sum-giant-num {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sum-giant-num.exp {
  color: var(--text-main);
}

.sum-giant-num.inc {
  color: var(--green);
}

.sum-sub-detail {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.mom-tag {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.mom-tag.worse {
  color: var(--red);
}

.sum-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
}

.sum-item {
  min-width: 0;
}

.sum-item-label {
  font-size: 11.5px;
  color: var(--text-sub);
  white-space: nowrap;
}

.sum-item-val {
  font-size: 15px;
  font-weight: 600;
  margin-top: 3px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.budget-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.budget-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-sub);
  white-space: nowrap;
}

.budget-track {
  height: 4px;
  background: var(--surface-sub);
  border-radius: 999px;
  overflow: hidden;
}

.budget-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
}

.budget-fill.danger {
  background: var(--red);
}

/* Smart Mode Toggle & Prediction Chips */
.smart-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}

.smart-mode-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.smart-mode-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
}

.smart-mode-hint {
  font-size: 11.5px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ios-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-sub);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.ios-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.ios-switch input:checked + .ios-slider {
  background: var(--green);
}

.ios-switch input:checked + .ios-slider::before {
  transform: translateX(16px);
}

.smart-chips-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-top: 2px;
}

.smart-chips-row::-webkit-scrollbar {
  display: none;
}

.smart-chip {
  border: none;
  background: var(--bg);
  color: var(--text-main);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.smart-chip:active {
  opacity: 0.65;
}

.smart-chip span {
  color: var(--text-sub);
  margin-left: 3px;
  font-variant-numeric: tabular-nums;
}

.smart-forecast-list {
  display: flex;
  flex-direction: column;
}

.smart-forecast-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
}

.smart-forecast-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sf-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sf-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-sub {
  font-size: 11.5px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-amt {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sf-amt.warn {
  color: var(--red);
}

/* Simplified Single-Line Summary Footer */
.sum-mini-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}

.sum-mini-metrics {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sum-mini-metrics strong {
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.mini-dot {
  opacity: 0.5;
}

.sum-mini-smart {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Worth/Regret Micro Tag on Transactions */
.worth-btn {
  border: none;
  background: var(--bg);
  color: var(--text-sub);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}

.worth-btn.worth {
  background: rgba(52, 199, 89, 0.14);
  color: var(--green);
}

.worth-btn.regret {
  background: rgba(255, 59, 48, 0.12);
  color: var(--red);
}

/* Financial Goals & Gap */
.goals-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.goal-item {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.goal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.goal-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.goal-nums {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.goal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-sub);
}

.goal-gap-line {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.45;
}

/* Pre-purchase Sandbox */
.sim-result-box {
  background: var(--bg);
  border-radius: 11px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-main);
}

/* Multi-turn Financial Agent Chat */
/* Always-Visible Pinned Live Daily Briefing Box (Distinct Champagne-Gold Executive Card) */
.agent-briefing-box {
  background: linear-gradient(145deg, rgba(194, 142, 59, 0.13) 0%, rgba(194, 142, 59, 0.05) 100%);
  border: 1px solid rgba(194, 142, 59, 0.30);
  border-radius: 15px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(28, 25, 23, 0.05);
}

:root[data-theme="midnight"] .agent-briefing-box,
:root[data-theme="forest"] .agent-briefing-box,
:root[data-theme="nebula"] .agent-briefing-box {
  background: linear-gradient(145deg, rgba(229, 185, 107, 0.14) 0%, rgba(229, 185, 107, 0.04) 100%);
  border-color: rgba(229, 185, 107, 0.28);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

:root[data-theme="editorial"] .agent-briefing-box {
  background: linear-gradient(145deg, rgba(24, 24, 27, 0.05) 0%, rgba(24, 24, 27, 0.015) 100%);
  border-color: rgba(24, 24, 27, 0.14);
}

/* Recessed Dialogue Viewport with Smooth Top/Bottom Scroll Fade */
.agent-chat-wrap {
  position: relative;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
}

.agent-chat-wrap::before,
.agent-chat-wrap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 6px;
  height: 18px;
  pointer-events: none;
  z-index: 2;
}

.agent-chat-wrap::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
}

.agent-chat-wrap::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
}

.agent-chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
  max-height: 330px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 115, 106, 0.42) transparent;
}

.agent-chat-box::-webkit-scrollbar {
  width: 4px;
}

.agent-chat-box::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}

.agent-chat-box::-webkit-scrollbar-thumb {
  background: rgba(120, 115, 106, 0.38);
  border-radius: 99px;
}

:root[data-theme="midnight"] .agent-chat-box::-webkit-scrollbar-thumb {
  background: rgba(244, 245, 247, 0.25);
}

/* Top Bar Right Action Group & Income Privacy Toggle */
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.settings-icon-btn.privacy-active {
  color: var(--gold);
  border-color: var(--motto-border);
  background: rgba(194, 142, 59, 0.14);
}

.chat-bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.memory-suggest-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(194, 142, 59, 0.11);
  border: 1px solid rgba(194, 142, 59, 0.28);
  border-radius: 14px;
  padding: 9px 12px;
}

.ms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ms-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ms-action-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
}

.ms-action-btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.ms-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--gold);
}

.ms-val {
  width: 100%;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  max-height: 115px;
  overflow-y: auto;
}

/* Editable MEMORY.md Sheet */
.memory-editor {
  width: 100%;
  min-height: 220px;
  max-height: 45vh;
  background: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 12px;
  color: var(--text-main);
  font-size: 12.5px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
  resize: vertical;
}

.fact-details {
  font-size: 12px;
  color: var(--text-sub);
  border-top: 0.5px solid var(--border);
  padding-top: 8px;
}

.fact-details summary {
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}

.fact-pre {
  margin: 8px 0 0;
  padding: 10px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* v12.1 Asset Baseline, Decision Logs & Pattern Feedback */
.asset-baseline-bar {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--bg);
  border-radius: 9px;
  padding: 7px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sim-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.decision-stats-line {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  padding-top: 2px;
}

.sf-right-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pat-btn {
  border: none;
  background: var(--bg);
  color: var(--text-sub);
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.pat-btn.confirmed {
  background: rgba(52, 199, 89, 0.16);
  color: var(--green);
}

/* v13.0 Proactive Alert Strip & Global History Search */
.agent-alert-strip {
  background: rgba(255, 59, 48, 0.09);
  color: var(--red);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ledger-search-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.search-summary-bar {
  font-size: 12px;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.07);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 500;
}

/* v14.0 Seamless Marquee Pill, Obsidian Hero, Floating Bottom Dock & 3-Theme Picker */
.header-motto-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  user-select: none;
  contain: layout paint;
  background: var(--surface);
  border: 1px solid var(--motto-border);
  border-radius: 999px;
  padding: 6.5px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 94%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 94%, transparent 100%);
}

.header-motto-track {
  display: inline-flex;
  align-items: center;
  width: max-content;
  white-space: nowrap;
  will-change: transform;
  animation: mottoTickerLoop var(--motto-dur, 14s) linear infinite;
}

.header-motto-wrap:active .header-motto-track {
  animation-play-state: paused;
}

.motto-copy {
  display: inline-block;
  padding-right: 48px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.1px;
}

@keyframes mottoTickerLoop {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

/* Layered Card Depth & Obsidian Focal Points */
.card,
.stats-period-bar {
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

.summary-card {
  background: var(--hero-bg);
  border: 1px solid var(--hero-border);
  box-shadow: 0 12px 30px rgba(15, 20, 30, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: var(--hero-text);
}

.summary-card .sum-main-label,
.summary-card .sum-sub-detail,
.summary-card .sum-mini-metrics,
.summary-card .sum-mini-smart {
  color: var(--hero-sub);
}

.summary-card .sum-giant-num.exp {
  color: var(--hero-exp);
}

.summary-card .sum-giant-num.inc {
  color: var(--hero-inc);
}

.summary-card .sum-mini-footer {
  border-top-color: var(--hero-border);
}

.summary-card .sum-mini-metrics strong {
  color: var(--hero-text);
}

.summary-card .smart-chip {
  background: rgba(255, 255, 255, 0.10);
  color: var(--hero-text);
}

:root[data-theme="editorial"] .summary-card {
  box-shadow: var(--card-shadow);
}

:root[data-theme="editorial"] .summary-card .smart-chip {
  background: var(--accent-soft);
  color: var(--text-main);
}

/* Agent Hero Card with Flagship Dark Banner */
.agent-hero-card {
  padding-top: 0;
  overflow: hidden;
}

.agent-hero-banner {
  margin: 0 -16px 2px;
  padding: 14px 16px;
  background: var(--hero-bg);
  border-bottom: 1px solid var(--hero-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agent-hero-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-hero-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--hero-text);
  letter-spacing: -0.2px;
}

.agent-hero-sub {
  font-size: 11.5px;
  color: var(--gold);
  font-weight: 500;
}

.agent-banner-link {
  border: none;
  background: rgba(255, 255, 255, 0.11);
  color: var(--hero-text);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.agent-banner-link.muted {
  background: transparent;
  color: var(--hero-sub);
  padding: 4px 2px;
}

:root[data-theme="editorial"] .agent-banner-link {
  background: var(--accent-soft);
}

/* Buttons & Chat Bubbles */
.btn-primary {
  background: var(--accent-grad);
  color: var(--accent-text);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.smart-chip {
  background: var(--accent-soft);
  color: var(--text-main);
}

.chat-bubble.user {
  background: var(--accent-grad);
  color: var(--accent-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.chat-bubble.assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.cmp-box,
.goal-item,
.sim-result-box,
.asset-baseline-bar {
  background: var(--surface-tint);
  border: 1px solid var(--border);
}

/* Floating Bottom Navigation Dock (120Hz GPU-Smooth, No Heavy Blur Repaint) */
.bottom-dock {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translate3d(-50%, 0, 0);
  width: calc(100% - 28px);
  max-width: 448px;
  background: var(--surface);
  border: 1px solid var(--dock-border);
  border-radius: 22px;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 80;
}

.dock-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  padding: 6px 2px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  opacity: 0.78;
  transition: all 0.18s ease;
}

body.kbd-open .bottom-dock {
  display: none !important;
}

body.kbd-open .app-container {
  padding-bottom: 24px;
}

.bottom-dock .dock-btn.active {
  background: var(--dock-active-bg);
  color: var(--dock-active-text);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

/* 3-Theme Visual Picker in Settings */
.theme-picker-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-card-btn {
  border: 1.5px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-main);
  border-radius: 12px;
  padding: 9px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.theme-card-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.theme-swatch {
  width: 34px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.sw-obsidian {
  background: linear-gradient(135deg, #F5F2EA 50%, #15171C 50%);
}

.sw-midnight {
  background: linear-gradient(135deg, #090A0D 50%, #1E222E 50%);
}

.sw-editorial {
  background: linear-gradient(135deg, #F8F9FB 50%, #18181B 50%);
}

.sw-bamboo {
  background: linear-gradient(135deg, #EEF3EE 50%, #1F4D3A 50%);
}

.sw-ocean {
  background: linear-gradient(135deg, #EEF3F8 50%, #1B4B82 50%);
}

.sw-sakura {
  background: linear-gradient(135deg, #F8F0EE 50%, #9E4757 50%);
}

.sw-mocha {
  background: linear-gradient(135deg, #F2EAE1 50%, #5C3D28 50%);
}

.sw-forest {
  background: linear-gradient(135deg, #08110E 50%, #34D399 50%);
}

.sw-nebula {
  background: linear-gradient(135deg, #0C0A15 50%, #A78BFA 50%);
}

/* v14.2 Circular Settings Icon Button (Matching Marquee Pill) */
.settings-icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--motto-border);
  background: var(--surface);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease;
}

.settings-icon-btn:active {
  transform: scale(0.92);
}

.corner-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border: 1.5px solid var(--surface);
}

/* v14.2 7-Day Interactive Spend Radar & Trajectory Runway */
.forecast-status-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  white-space: nowrap;
}

.forecast-status-pill.danger {
  background: var(--red-soft);
  color: var(--red);
}

.forecast-week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 6px 0 2px;
}

.fw-day {
  border: 1px solid transparent;
  background: var(--surface-tint);
  border-radius: 12px;
  padding: 7px 2px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.fw-day.active {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.fw-dow {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.72;
  white-space: nowrap;
}

.fw-bar-track {
  width: 6px;
  height: 30px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.14);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.fw-bar-fill {
  width: 100%;
  border-radius: 999px;
  background: var(--gold);
  min-height: 4px;
  transition: height 0.25s ease;
}

.fw-day.active .fw-bar-fill {
  background: var(--accent-text);
}

.fw-amt {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fw-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
}

.runway-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.runway-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-sub);
  white-space: nowrap;
}

.runway-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-sub);
  display: flex;
  overflow: hidden;
}

.runway-actual {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.runway-pred {
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--gold),
    var(--gold) 4px,
    rgba(212, 163, 89, 0.35) 4px,
    rgba(212, 163, 89, 0.35) 8px
  );
  transition: width 0.3s ease;
}

.pat-btn.quick-add {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* v14.3 Rich Markdown Rendering inside Agent Bubbles & Live Briefing */
.chat-bubble.assistant.rich {
  white-space: normal;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.md-h {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.1px;
  margin-top: 2px;
}

.md-p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-main);
}

.md-li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.8px;
  line-height: 1.5;
  color: var(--text-main);
}

.md-bullet {
  color: var(--gold);
  font-weight: 700;
  flex-shrink: 0;
}

.md-code {
  background: var(--accent-soft);
  color: var(--text-main);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.md-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.md-num.pos {
  color: var(--green);
}

.md-num.neg {
  color: var(--red);
}

.brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 0.5px solid var(--border);
}

.brief-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.brief-tag {
  border: none;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(194, 142, 59, 0.14);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.brief-tag:active {
  opacity: 0.65;
}

.brief-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 2px 0;
}

.brief-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brief-kpi-lbl {
  font-size: 10.5px;
  color: var(--text-sub);
  white-space: nowrap;
}

.brief-kpi-val {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.brief-kpi-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* v15.0 Clickable Category Subtitle & Mixed Basket Pills */
.tx-cat-sub.editable {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tx-cat-sub.editable:active {
  opacity: 0.6;
}

.tx-basket-line {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.evo-suggest-card {
  background: var(--surface-tint);
  border: 1px solid var(--motto-border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* v17.0 Native Grouped Drill-Down List & Smooth Panel/Sheet Transitions */
.grouped-nav-card {
  padding: 4px 16px;
  gap: 0;
}

.grouped-nav-row {
  width: 100%;
  border: none;
  background: transparent;
  padding: 13px 0;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.14s ease;
}

.grouped-nav-row:last-child {
  border-bottom: none;
}

.grouped-nav-row:active {
  opacity: 0.6;
}

.gn-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.gn-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
}

.gn-sub {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gn-chevron {
  font-size: 19px;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
}

.view-panel.active {
  animation: panelEnter 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.modal-mask.open .modal-sheet {
  animation: sheetSlideUp 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetSlideUp {
  from {
    opacity: 0.7;
    transform: translate3d(0, 26px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.mini-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.step-arrow {
  border: none;
  background: var(--bg);
  color: var(--text-main);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}

.step-arrow.lg {
  width: 32px;
  height: 32px;
  background: transparent;
  font-size: 20px;
  color: var(--accent);
}

.stats-period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: 12px;
  padding: 5px 8px;
}

.stats-period-trigger {
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.period-mode-badge {
  background: var(--bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}

.period-caret {
  font-size: 12px;
  color: var(--text-sub);
}

.period-seg-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface-sub);
  padding: 2.5px;
  border-radius: 9px;
  gap: 2px;
}

.period-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-main);
  opacity: 0.65;
  padding: 6px 2px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.period-seg-btn.active {
  background: var(--surface);
  opacity: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 3. iOS Segmented Control (4 Tabs, Pure Text) */
.tab-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface-sub);
  padding: 2.5px;
  border-radius: 10px;
  gap: 2px;
}

/* Views */
.view-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.view-panel.active {
  display: flex;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.card-header > div:first-child {
  min-width: 0;
  flex: 1;
}

.card {
  max-width: 100%;
  overflow: hidden;
}

.card-sub {
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.card-sub {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
}

.text-link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}

/* Smart Input Bar */
.smart-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.smart-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: none;
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.smart-input::placeholder {
  color: var(--text-muted);
}

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.72;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.btn-secondary {
  background: var(--bg);
  color: var(--accent);
}

.btn-ghost {
  background: var(--bg);
  color: var(--text-main);
}

.btn-ghost.rec {
  background: var(--red);
  color: #FFFFFF;
}

/* Collapsible Form Area */
.collapsible-box {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}

.collapsible-box.open {
  display: flex;
  animation: collapseSlideIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes collapseSlideIn {
  from { opacity: 0; transform: translate3d(0, -10px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field label {
  font-size: 11.5px;
  color: var(--text-sub);
  white-space: nowrap;
}

.field input,
.field select {
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: none;
  background: var(--bg);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  width: 100%;
  font-family: inherit;
}

/* Sub-Switch (日历 / 列表) */
.sub-switch {
  display: inline-flex;
  background: var(--surface-sub);
  padding: 2px;
  border-radius: 8px;
  gap: 2px;
}

.sub-switch-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}

.sub-switch-btn.active {
  background: var(--surface);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Calendar Grid */
.calendar-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-sub);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding-bottom: 6px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-cell {
  min-height: 56px;
  border-radius: 13px;
  padding: 6px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.cal-cell:active:not(.empty) {
  transform: scale(0.95);
}

.cal-cell.empty {
  cursor: default;
}

.cal-cell.weekend:not(.selected) {
  background: var(--surface-tint);
}

.cal-cell.today:not(.selected) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.cal-cell.selected {
  background: var(--dock-active-bg);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(24, 24, 27, 0.16);
}

.cal-day-num {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.cal-cell.today .cal-day-num {
  color: var(--gold);
  font-weight: 700;
}

.cal-cell.selected .cal-day-num {
  color: var(--dock-active-text);
  font-weight: 700;
}

.cal-day-badge {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1;
  color: var(--gold);
  opacity: 0.85;
}

.cal-cell.selected .cal-day-badge {
  color: #E8C67A;
}

.cal-exp {
  font-size: 9px;
  font-weight: 650;
  color: var(--red);
  background: var(--red-soft);
  padding: 1.5px 4.5px;
  border-radius: 5px;
  white-space: nowrap;
  margin-top: 3px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  max-width: 96%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-exp.high {
  color: #FFFFFF;
  background: var(--red);
  box-shadow: 0 2px 6px rgba(200, 62, 59, 0.22);
}

.cal-cell.selected .cal-exp,
.cal-cell.selected .cal-exp.high {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.cal-inc {
  font-size: 9px;
  font-weight: 650;
  color: var(--green);
  background: var(--green-soft);
  padding: 1.5px 4.5px;
  border-radius: 5px;
  white-space: nowrap;
  margin-top: 2px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  max-width: 96%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-cell.selected .cal-inc {
  color: #A7F3D0;
  background: rgba(110, 231, 183, 0.20);
}

.cal-fixed-dot {
  font-size: 8.5px;
  color: var(--gold);
  white-space: nowrap;
  line-height: 1.1;
  margin-top: 1px;
}

.cal-cell.selected .cal-fixed-dot {
  color: #F3D18A;
}

.cal-selected-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sub);
  padding: 10px 2px 2px;
  border-top: 0.5px solid var(--border);
  white-space: nowrap;
}

/* iOS Inset Grouped List Items */
.day-group {
  display: flex;
  flex-direction: column;
}

.day-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  padding: 8px 2px 6px;
  white-space: nowrap;
}

.tx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 0.5px solid var(--border);
}

.tx-item:last-child {
  border-bottom: none;
}

.tx-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tx-info {
  min-width: 0;
}

.tx-note {
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-cat-sub {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 1px;
  white-space: nowrap;
}

.tx-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tx-amt {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tx-amt.inc {
  color: var(--green);
}

.tx-del-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
}

/* Fixed & Subscription Clean Rows */
.fixed-item,
.sub-card {
  padding: 11px 2px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.fixed-item:last-child,
.sub-card:last-child {
  border-bottom: none;
}

.fixed-top,
.sub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fixed-badge {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-sub);
  white-space: nowrap;
}

.fixed-badge.done {
  color: var(--green);
}

.sub-status-pill {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.sub-status-pill.ok {
  color: var(--green);
}

.sub-status-pill.warn {
  color: var(--orange);
}

.sub-status-pill.danger {
  color: var(--red);
}

.sub-progress-track {
  height: 3.5px;
  background: var(--surface-sub);
  border-radius: 999px;
  overflow: hidden;
}

.sub-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
}

.sub-progress-fill.warn {
  background: var(--orange);
}

.sub-progress-fill.danger {
  background: var(--red);
}

/* Analytics */
.cmp-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cmp-box {
  background: var(--bg);
  border-radius: 11px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cmp-label {
  font-size: 11px;
  color: var(--text-sub);
  white-space: nowrap;
}

.cmp-val {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cmp-diff {
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
}

.cat-bar-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.cat-bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cat-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.cat-bar-track {
  height: 5px;
  background: var(--surface-sub);
  border-radius: 999px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.canvas-box {
  width: 100%;
  height: 155px;
  position: relative;
}

canvas.chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.ai-report {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-main);
}

/* Flagship Spring Bottom Sheet Overlay (True Open + Close 120Hz Transitions) */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.44);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
}

.modal-mask.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 14px 16px max(26px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translate3d(0, 102%, 0);
  will-change: transform;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.22);
}

.modal-mask.open .modal-sheet {
  transform: translate3d(0, 0, 0);
}

.modal-sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-muted);
  opacity: 0.34;
  margin: 0 auto 6px;
  flex-shrink: 0;
}

.modal-sheet.is-pulling {
  transition: none !important;
}

.preset-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.preset-chip {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 999px;
  border: none;
  background: var(--bg);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.preset-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  pointer-events: none;
}

.toast-msg {
  background: rgba(28, 28, 30, 0.92);
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ==================== Underlying Database Inspector Sheet (v17.3) ==================== */
.db-sheet {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-tabs-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  flex-shrink: 0;
}

.db-tabs-row::-webkit-scrollbar {
  display: none;
}

.db-tab-pill {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-sub);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.db-tab-pill.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.db-tab-count {
  font-size: 10px;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

.db-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.db-search-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-main);
  padding: 0 10px;
  font-size: 12.5px;
  outline: none;
}

.db-editor-box {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.db-json-textarea {
  width: 100%;
  min-height: 150px;
  max-height: 240px;
  background: var(--bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
}

.db-table-wrap {
  flex: 1;
  min-height: 180px;
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.db-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  color: var(--text-sub);
  font-weight: 600;
  padding: 8px 9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.db-table td {
  padding: 7px 9px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-main);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-table tr.db-row {
  cursor: pointer;
}

.db-table tr.db-row:active,
.db-table tr.db-row.selected {
  background: var(--accent-soft);
}

/* ==================== Habit Profile & Scoped Memory UI (v18.0) ==================== */
.habit-stage-banner {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-sub);
  flex-shrink: 0;
}

.habit-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex-shrink: 0;
}

.habit-kpi-card {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.habit-kpi-lbl {
  font-size: 10.5px;
  color: var(--text-sub);
}

.habit-kpi-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.habit-kpi-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.habit-ai-box {
  background: linear-gradient(145deg, rgba(194, 142, 59, 0.12) 0%, rgba(194, 142, 59, 0.04) 100%);
  border: 1px solid rgba(194, 142, 59, 0.28);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-main);
  flex-shrink: 0;
  max-height: 180px;
  overflow-y: auto;
}

.mem-scope-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mem-scope-tabs::-webkit-scrollbar {
  display: none;
}

.mem-scope-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-sub);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.mem-scope-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* ==================== v19.0 Flagship Home: Single-Axis Viewport, Collapsing Briefing & Receipt Cards ==================== */
body.home-agent-mode {
  height: 100dvh;
  overflow: hidden;
}

body.home-agent-mode .app-container {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
  gap: 0;
}

body.home-agent-mode .top-bar {
  flex-shrink: 0;
  margin-bottom: 10px;
}

.home-agent-stage.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}

/* Dynamic Collapsing Sticky Briefing Stage (120Hz Zero-Jank Grid 1fr->0fr + Liquid Glass) */
.home-only-btn {
  display: none;
}

body.home-agent-mode .home-only-btn {
  display: inline-flex;
}

/* Subtle Ambient Light Veil for Liquid Glass Refraction */
body.home-agent-mode .app-container {
  position: relative;
}

body.home-agent-mode .app-container::before {
  content: '';
  position: fixed;
  top: -60px;
  right: -40px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 162, 76, 0.14) 0%, rgba(212, 162, 76, 0.03) 50%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}

:root[data-theme="midnight"] body.home-agent-mode .app-container::before {
  background: radial-gradient(circle, rgba(229, 185, 107, 0.16) 0%, rgba(99, 102, 241, 0.06) 48%, transparent 72%);
}

.briefing-stage {
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  margin-bottom: 6px;
}

.briefing-collapse-grid {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.briefing-stage.collapsed .briefing-collapse-grid {
  grid-template-rows: 0fr;
}

.briefing-collapse-inner {
  overflow: hidden;
  min-height: 0;
}

.briefing-expanded-card {
  --be-text: #FAF9F6;
  --be-sub: rgba(250, 249, 246, 0.72);
  background: var(--hero-bg);
  color: var(--be-text);
  border: 1px solid var(--hero-border);
  border-radius: 22px;
  padding: 15px 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow:
    0 12px 28px rgba(18, 20, 26, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform-origin: top center;
  will-change: transform, opacity;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease;
}

:root[data-theme="editorial"] .briefing-expanded-card {
  --be-text: #FAFAFA;
  --be-sub: rgba(250, 250, 250, 0.74);
  background:
    radial-gradient(circle at 86% 14%, rgba(255, 255, 255, 0.12) 0%, transparent 52%),
    linear-gradient(145deg, rgba(28, 28, 32, 0.96) 0%, rgba(15, 15, 18, 0.98) 100%);
  color: var(--be-text);
  border-color: rgba(255, 255, 255, 0.14);
}

.briefing-stage.collapsed .briefing-expanded-card {
  opacity: 0;
  transform: translate3d(0, -10px, 0) scale(0.97);
  pointer-events: none;
}

.be-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.be-date-tag {
  font-size: 11.5px;
  color: var(--be-sub);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.be-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.be-pill-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.10);
  color: var(--be-text);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.be-pill-btn.gold {
  border-color: rgba(229, 185, 107, 0.42);
  background: rgba(229, 185, 107, 0.18);
  color: #F6D794;
}

.be-main-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.be-hero-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.be-hero-lbl {
  font-size: 11.5px;
  color: var(--be-sub);
}

.be-hero-num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
  color: var(--be-text);
}

.be-hero-sub {
  font-size: 11.5px;
  color: var(--be-sub);
  margin-top: 2px;
}

.be-budget-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 120px;
  flex-shrink: 0;
  cursor: pointer;
}

.be-budget-val {
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.be-budget-track {
  width: 116px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.be-budget-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #E5B96B 0%, #34D399 100%);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.be-budget-fill.over {
  background: linear-gradient(90deg, #FB7185 0%, #EF4444 100%);
}

.be-budget-lbl {
  font-size: 10.5px;
  color: #F3D08B;
}

.be-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 9px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px;
  color: var(--be-sub);
}

.be-footer-row strong {
  color: var(--be-text) !important;
}

.be-ai-snippet {
  font-size: 12.5px;
  line-height: 1.6;
  color: #F7F5F0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  max-height: 150px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  cursor: pointer;
  transition: max-height 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.be-ai-snippet.expanded {
  max-height: 44vh;
}

.be-ai-snippet *,
.be-ai-snippet .md-p,
.be-ai-snippet .md-li,
.be-ai-snippet .md-ul {
  color: rgba(250, 248, 243, 0.94) !important;
}

.be-ai-snippet strong {
  color: #F5D28B !important;
  font-weight: 650;
}

.be-ai-snippet code {
  background: rgba(229, 185, 107, 0.22) !important;
  color: #FCE3A8 !important;
  padding: 1px 5px;
  border-radius: 5px;
}

.be-ai-snippet-hint {
  margin-top: 6px;
  text-align: right;
  font-size: 10.5px;
  color: rgba(245, 210, 139, 0.85) !important;
}

/* Collapsed 38px Frosted Liquid-Glass Dewdrop Pill Bar */
.briefing-collapsed-pill {
  width: 100%;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--motto-border);
  background: var(--motto-bg);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  color: var(--text-main);
  padding: 0 14px;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow:
    0 6px 18px rgba(28, 25, 23, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
  animation: pillDropIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

:root[data-theme="midnight"] .briefing-collapsed-pill,
:root[data-theme="forest"] .briefing-collapsed-pill,
:root[data-theme="nebula"] .briefing-collapsed-pill {
  background: var(--motto-bg);
  border-color: var(--motto-border);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.briefing-stage.collapsed .briefing-collapsed-pill {
  display: flex;
}

@keyframes pillDropIn {
  from { opacity: 0; transform: translate3d(0, -6px, 0) scale(0.98); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.bcp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF3D1 0%, var(--gold) 65%, #9B6E22 100%);
  box-shadow: 0 0 8px rgba(194, 142, 59, 0.55);
  flex-shrink: 0;
}

.bcp-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.bcp-expand {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
}

/* Single-Axis Full-Bleed Chat Viewport (ONLY vertical scrollbar on Home!) */
.home-chat-viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-chat-viewport::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 6px;
  height: 16px;
  background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

.home-chat-viewport::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 6px;
  height: 14px;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

.home-chat-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 14px 2px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 115, 106, 0.35) transparent;
}

.home-chat-stream::-webkit-scrollbar {
  width: 3.5px;
}

.home-chat-stream::-webkit-scrollbar-thumb {
  background: rgba(120, 115, 106, 0.35);
  border-radius: 99px;
}

/* Message Pop-In GPU Micro-Animation */
.home-chat-stream .chat-bubble,
.home-chat-stream .receipt-stack {
  animation: msgPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes msgPopIn {
  from { opacity: 0; transform: translate3d(0, 10px, 0) scale(0.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* Calm Centered Empty State (Replaces Permanent Clutter Chips) */
.home-empty-state {
  margin: auto 0;
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.hes-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.hes-sub {
  font-size: 12.5px;
  color: var(--text-sub);
  max-width: 270px;
  line-height: 1.5;
}

.hes-prompts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  max-width: 310px;
  margin-top: 4px;
}

.hes-prompt-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  border-radius: 13px;
  padding: 9px 13px;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.14s ease, background 0.14s ease;
}

.hes-prompt-btn:active {
  transform: scale(0.98);
  background: var(--surface-tint);
}

/* Native Receipt Confirmation Cards inside Chat Stream */
.receipt-stack {
  align-self: flex-start;
  width: 90%;
  max-width: 330px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.receipt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 11px 13px;
  box-shadow: 0 4px 14px rgba(28, 25, 23, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rc-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rc-name {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rc-amt {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
  flex-shrink: 0;
}

.rc-amt.inc {
  color: var(--green);
}

.rc-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 7px;
  border-top: 0.5px dashed var(--border);
}

.rc-meta {
  font-size: 11px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rc-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.rc-btn {
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-sub);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 550;
  cursor: pointer;
}

.rc-btn.worth {
  color: var(--green);
  border-color: rgba(21, 128, 61, 0.25);
  background: var(--green-soft);
}

.rc-btn.regret {
  color: var(--red);
  border-color: rgba(200, 62, 59, 0.25);
  background: var(--red-soft);
}

.rc-btn.del {
  color: var(--red);
}

/* Sub-Agent Thinking Shimmer Pill */
.agent-thinking-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--motto-border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12px;
  color: var(--text-sub);
}

.thinking-orb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: agentPulse 1.1s ease-in-out infinite;
}

@keyframes agentPulse {
  0%, 100% { transform: scale(0.75); opacity: 0.45; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Bottom Floating Input Capsule & Quick Action Popover */
.home-input-dock {
  flex-shrink: 0;
  position: relative;
  padding: 6px 0 calc(82px + env(safe-area-inset-bottom));
  transition: padding-bottom 0.2s ease;
}

body.kbd-open .home-input-dock {
  padding-bottom: 10px;
}

.home-input-capsule {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--dock-bg);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid var(--dock-border);
  border-radius: 26px;
  padding: 5px 6px;
  box-shadow:
    0 8px 24px rgba(28, 25, 23, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

:root[data-theme="midnight"] .home-input-capsule,
:root[data-theme="forest"] .home-input-capsule,
:root[data-theme="nebula"] .home-input-capsule {
  background: var(--dock-bg);
  border-color: var(--dock-border);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Liquid Glass Chrome Polish on Top Buttons, Motto Pill, Popover & Bottom Dock */
body.home-agent-mode .settings-icon-btn,
body.home-agent-mode .header-motto-wrap {
  background: rgba(252, 251, 248, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(165%);
  backdrop-filter: blur(16px) saturate(165%);
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 12px rgba(28, 25, 23, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

:root[data-theme="midnight"] body.home-agent-mode .settings-icon-btn,
:root[data-theme="midnight"] body.home-agent-mode .header-motto-wrap {
  background: rgba(24, 27, 36, 0.72);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.bottom-dock {
  background: var(--dock-bg);
  -webkit-backdrop-filter: blur(18px) saturate(175%);
  backdrop-filter: blur(18px) saturate(175%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

:root[data-theme="midnight"] .bottom-dock {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.capsule-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--surface-tint);
  color: var(--text-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease;
}

.capsule-icon-btn:active {
  transform: scale(0.92);
}

.capsule-icon-btn.open {
  background: var(--accent);
  color: var(--accent-text);
  transform: rotate(45deg);
}

.capsule-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  padding: 0 4px;
  outline: none;
}

.capsule-input::placeholder {
  color: var(--text-muted);
}

.capsule-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent-grad);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
  transition: transform 0.14s ease;
}

.capsule-send-btn:active {
  transform: scale(0.9);
}

/* Floating Quick Action Popover above Input Capsule (High-Contrast Frosted Elevation) */
.home-quick-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: rgba(255, 254, 250, 0.95);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(194, 142, 59, 0.34);
  border-radius: 20px;
  padding: 13px;
  box-shadow:
    0 18px 42px rgba(20, 18, 15, 0.22),
    0 4px 12px rgba(20, 18, 15, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
  animation: msgPopIn 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

:root[data-theme="midnight"] .home-quick-popover,
:root[data-theme="forest"] .home-quick-popover,
:root[data-theme="nebula"] .home-quick-popover {
  background: var(--surface);
  border-color: var(--motto-border);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.65),
    0 4px 14px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.home-quick-popover.open {
  display: flex;
}

.hqp-section-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.hqp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.hqp-item {
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-main);
  border-radius: 11px;
  padding: 8px 4px;
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  text-align: center;
}

.hqp-item.danger {
  color: var(--red);
}

.hqp-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hqp-prompt {
  border: none;
  background: var(--surface-tint);
  color: var(--text-main);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

/* ==================== v20.0 Full-Width Mijiao Mascot Bar, Morphing Quote & 5-Tab Dock ==================== */
.mijiao-companion-bar {
  width: 100%;
  min-height: 44px;
  border-radius: 22px;
  padding: 5px 12px 5px 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  background: var(--motto-bg);
  -webkit-backdrop-filter: blur(18px) saturate(175%);
  backdrop-filter: blur(18px) saturate(175%);
  border: 1px solid var(--motto-border);
  box-shadow:
    0 6px 18px rgba(28, 25, 23, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: transform 0.16s ease, box-shadow 0.18s ease, background 0.22s ease, border-color 0.22s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mijiao-companion-bar:active {
  transform: scale(0.985);
}

:root[data-theme="midnight"] .mijiao-companion-bar,
:root[data-theme="forest"] .mijiao-companion-bar,
:root[data-theme="nebula"] .mijiao-companion-bar {
  background: var(--motto-bg);
  border-color: var(--motto-border);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Cute Animated 皖南米饺 Crescent Dumpling Mascot */
.mijiao-mascot {
  position: relative;
  width: 44px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mijiaoFloat 3.4s ease-in-out infinite;
  will-change: transform;
}

.mijiao-mascot .mj-steam {
  animation: steamRise 2.8s ease-in-out infinite;
}

@keyframes steamRise {
  0%, 100% { transform: translateY(1px); opacity: 0.45; }
  50% { transform: translateY(-2px); opacity: 0.92; }
}

@keyframes mijiaoFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -2.5px, 0); }
}

.mijiao-mascot .mj-eyes-normal {
  transform-origin: 22px 21px;
  animation: mijiaoBlink 4.6s ease-in-out infinite;
}

@keyframes mijiaoBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%, 97% { transform: scaleY(0.12); }
}

/* Cool Shades when Income Privacy Mode is ON */
.mijiao-mascot .mj-shades {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

body.income-hidden-mode .mijiao-mascot .mj-shades {
  opacity: 1;
  transform: translateY(0);
}

body.income-hidden-mode .mijiao-mascot .mj-eyes-normal {
  opacity: 0;
}

/* Jelly Squish + Sparkle Pop on Poke! */
.mijiao-mascot.poked {
  animation: mijiaoSquish 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes mijiaoSquish {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.18, 0.80) translateY(2px); }
  55% { transform: scale(0.92, 1.12) translateY(-4px); }
  80% { transform: scale(1.04, 0.96); }
  100% { transform: scale(1, 1); }
}

.mj-spark {
  position: absolute;
  font-size: 9px;
  color: var(--gold);
  opacity: 0;
  pointer-events: none;
}

.mj-spark.s2 { color: #FB7185; font-size: 8px; }

.mijiao-mascot.poked .mj-spark.s1 {
  animation: sparkFly1 0.55s ease-out forwards;
}
.mijiao-mascot.poked .mj-spark.s2 {
  animation: sparkFly2 0.55s ease-out forwards;
}
.mijiao-mascot.poked .mj-spark.s3 {
  animation: sparkFly3 0.55s ease-out forwards;
}

@keyframes sparkFly1 {
  0% { opacity: 1; transform: translate(0, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(-14px, -16px) scale(1.2); }
}
@keyframes sparkFly2 {
  0% { opacity: 1; transform: translate(0, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(2px, -20px) scale(1.25); }
}
@keyframes sparkFly3 {
  0% { opacity: 1; transform: translate(0, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(15px, -14px) scale(1.15); }
}

/* Non-Scrolling Editorial Morphing Quote Text */
.mijiao-quote-box {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.mijiao-quote-text {
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.38;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.mijiao-quote-text.morph-out {
  opacity: 0;
  transform: translate3d(0, -6px, 0);
}

.mijiao-quote-text.morph-in {
  animation: quoteMorphIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes quoteMorphIn {
  from { opacity: 0; transform: translate3d(0, 7px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.mijiao-tap-hint {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.7;
}

/* Collapsed Dewdrop Pill + Companion New Session Compose Button */
.briefing-collapsed-bar {
  display: none;
  align-items: center;
  gap: 7px;
  width: 100%;
}

.briefing-stage.collapsed .briefing-collapsed-bar {
  display: flex;
}

.briefing-stage.collapsed .briefing-collapsed-pill {
  flex: 1;
  min-width: 0;
}

.bcp-compose-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--motto-border);
  background: var(--motto-bg);
  -webkit-backdrop-filter: blur(18px) saturate(175%);
  backdrop-filter: blur(18px) saturate(175%);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(28, 25, 23, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* Unified Theme-Aware Top Action Pill Button (v31.4) */
.nav-action-pill {
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background 0.16s ease;
}

.nav-action-pill.sm {
  padding: 5px 10px;
  font-size: 11.5px;
}

.nav-action-pill:active {
  transform: scale(0.95);
}

:root[data-theme="midnight"] .bcp-compose-btn,
:root[data-theme="forest"] .bcp-compose-btn,
:root[data-theme="nebula"] .bcp-compose-btn {
  background: var(--motto-bg);
  border-color: var(--motto-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* 5-Tab Floating Dock & TAB 5 (我的) Switch Row */
.bottom-dock.dock-5 {
  grid-template-columns: repeat(5, 1fr);
}

.mine-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

/* ==================== v21.0 Generative UI Inline Charts & Full Markdown Engine ==================== */
.chat-chart-card {
  margin: 8px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ccc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ccc-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-main);
}

.ccc-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Donut Chart Layout */
.ccc-donut-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ccc-donut-svg {
  width: 112px;
  height: 112px;
  flex-shrink: 0;
}

.ccc-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ccc-leg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
}

.ccc-leg-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ccc-leg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ccc-leg-name {
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ccc-leg-val {
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Horizontal Ranked Bar Chart */
.ccc-hbar-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ccc-hbar-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ccc-hbar-top {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-main);
}

.ccc-hbar-track {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-sub);
  overflow: hidden;
}

.ccc-hbar-fill {
  height: 100%;
  border-radius: 99px;
}

/* Full Markdown Table, Code Block, Blockquote, Divider */
.md-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 7px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.md-table th {
  background: var(--surface-tint);
  color: var(--text-sub);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.md-table td {
  padding: 6px 8px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-main);
  white-space: nowrap;
}

.md-table tr:last-child td {
  border-bottom: none;
}

.md-pre {
  margin: 7px 0;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.48;
  color: var(--text-main);
  white-space: pre;
}

.md-quote {
  margin: 6px 0;
  padding: 5px 10px;
  border-left: 3px solid var(--gold);
  background: var(--surface-tint);
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  color: var(--text-sub);
}

.md-hr {
  border: none;
  border-top: 0.5px solid var(--border);
  margin: 8px 0;
}

/* ==================== v21.4 Chat Timeline Date Divider ==================== */
.chat-date-divider {
  align-self: center;
  margin: 6px 0 2px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-tint);
  border: 0.5px solid var(--border);
  font-size: 10.5px;
  font-weight: 550;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ==================== v23.0 Calendar Date Context Micro-Badges ==================== */
.cal-cell {
  position: relative;
}

.cal-day-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
  padding: 1px 2.5px;
  border-radius: 3px;
  pointer-events: none;
}

.cal-day-badge.hol {
  color: var(--green);
  background: var(--green-soft);
}

.cal-day-badge.work {
  color: var(--red);
  background: var(--red-soft);
}

.cal-day-badge.pay {
  color: var(--gold);
  background: rgba(194, 142, 59, 0.14);
}

.cal-day-badge.evt {
  color: #3B82F6;
  background: rgba(59, 130, 246, 0.12);
}

/* ==================== v24.0 Stats First-Screen Segmented Breakdown ==================== */
.stats-sub-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.stats-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  border-radius: 9px;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.stats-seg-btn.active {
  background: var(--surface);
  color: var(--text-main);
  font-weight: 650;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.stats-pane {
  display: none;
}

.stats-pane.active {
  display: block;
}

/* ==================== v27.1 Interactive 3-Option Category Proposal Card in Chat ==================== */
.cat-proposal-card {
  align-self: flex-start;
  width: 92%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid rgba(194, 142, 59, 0.34);
  border-radius: 16px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.07);
  animation: msgPopIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cpc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cpc-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--gold);
}

.cpc-sub {
  font-size: 11.5px;
  color: var(--text-sub);
  line-height: 1.45;
}

.cpc-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cpc-opt-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-main);
  border-radius: 12px;
  padding: 9px 11px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.cpc-opt-btn:active {
  transform: scale(0.985);
}

.cpc-opt-btn.rec {
  border-color: rgba(194, 142, 59, 0.42);
  background: rgba(194, 142, 59, 0.08);
}

.cpc-opt-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cpc-opt-lbl {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.cpc-opt-desc {
  font-size: 11px;
  color: var(--text-sub);
}

.cpc-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(194, 142, 59, 0.16);
  color: var(--gold);
  flex-shrink: 0;
}

.cpc-resolved {
  font-size: 11.5px;
  color: var(--green);
  font-weight: 550;
  padding: 2px 2px;
}

/* ==================== v27.3 Grouped Recurring Income / Expense UI ==================== */
.fx-summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.fx-sum-pill {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fx-sum-lbl {
  font-size: 10.5px;
  color: var(--text-sub);
}

.fx-sum-val {
  font-size: 13.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-group-block {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
}

.fx-group-block + .fx-group-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.fx-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 9px;
  background: var(--surface-tint);
}

.fx-group-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-main);
}

.fx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fx-dot.inc {
  background: var(--green);
}

.fx-dot.exp {
  background: var(--red, #C85A4B);
}

.fx-group-sub {
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.fx-day-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-tint);
  color: var(--text-sub);
  border: 1px solid var(--border);
  margin-right: 5px;
}

/* ==================== v27.5 Proactive AI Data Anomaly Alert Card ==================== */
.audit-alert-card {
  background: linear-gradient(135deg, rgba(194, 142, 59, 0.11), rgba(194, 142, 59, 0.04));
  border: 1px solid rgba(194, 142, 59, 0.36);
  border-radius: 16px;
  padding: 12px 13px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--gold);
}

.audit-alert-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.audit-alert-msg {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.45;
}

.audit-alert-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==================== v27.6 Native Sticky Page Bars (All 4 Non-Home Tabs) ==================== */
.page-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 35;
  margin: -6px -16px 2px;
  padding: 10px 16px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-sticky-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.page-sticky-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-sub);
  opacity: 0.85;
}

.stats-period-bar.page-sticky-bar {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  box-shadow: none;
}

/* ==================== v27.6 Native 120Hz Left-Swipe Action Drawer ==================== */
.swipe-row {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.swipe-row + .swipe-row {
  margin-top: 8px;
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  z-index: 1;
}

.swipe-act {
  border: none;
  min-width: 58px;
  padding: 0 11px;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: filter 0.14s ease;
}

.swipe-act:active {
  filter: brightness(0.9);
}

.swipe-act.edit {
  background: #C28E3B;
}

.swipe-act.primary {
  background: #2D8A68;
}

.swipe-act.del {
  background: #D15446;
}

.swipe-content {
  position: relative;
  z-index: 2;
  background: var(--surface);
  will-change: transform;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.swipe-row.is-dragging .swipe-content {
  transition: none;
}

.swipe-row .fixed-item,
.swipe-row .sub-card,
.swipe-row .tx-item {
  margin: 0 !important;
  border-radius: 14px;
}

.swipe-row .tx-item {
  padding: 10px 6px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  border-radius: 0;
}

.swipe-row.tx-swipe-row {
  border-radius: 10px;
}

.swipe-row.tx-swipe-row + .swipe-row.tx-swipe-row {
  margin-top: 0;
}

/* ==================== v29.0 Merged Bills Top Switch & Assets Net Worth Module ==================== */
.bills-mode-seg {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.bills-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.bills-mode-btn.active {
  background: var(--dock-active-bg);
  color: var(--dock-active-text);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.bills-subpane {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.bills-subpane.active {
  display: flex;
}

/* Theme-Aware Metallic Flagship Net Worth Hero Card (v30.0) */
.asset-hero-card {
  position: relative;
  overflow: hidden;
  background: var(--hero-bg);
  color: var(--hero-text);
  border-radius: 22px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 14px 32px rgba(24, 21, 18, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  border: 1px solid var(--hero-border);
}

.asset-hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0.04) 100%);
  pointer-events: none;
}

.asset-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.asset-hero-lbl {
  font-size: 12px;
  color: var(--hero-sub);
  letter-spacing: 0.03em;
}

.asset-hero-net {
  font-size: 31px;
  font-weight: 750;
  letter-spacing: -0.025em;
  color: var(--hero-text);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.num-dec {
  font-size: 0.62em;
  font-weight: 600;
  opacity: 0.68;
  margin-left: 1px;
}

.asset-ai-btn {
  border: 1px solid rgba(213, 168, 86, 0.45);
  background: rgba(213, 168, 86, 0.16);
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 650;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.14s ease;
}

.asset-ai-btn:active {
  transform: scale(0.95);
}

.asset-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 0.5px solid var(--hero-border);
}

.asset-metric-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.asset-metric-lbl {
  font-size: 11px;
  color: var(--hero-sub);
}

.asset-metric-val {
  font-size: 14.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--hero-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-metric-val.inc {
  color: var(--hero-inc);
}

.asset-metric-val.debt {
  color: var(--hero-exp);
}

.asset-alloc-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.18);
  overflow: hidden;
  display: flex;
  gap: 2px;
}

.asset-alloc-seg {
  height: 100%;
  transition: width 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.asset-alloc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--hero-sub);
}

.asset-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.asset-leg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.asset-acc-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-acc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.asset-acc-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.asset-acc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.asset-acc-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-acc-sub {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-acc-amt {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.asset-acc-pct {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.asset-bar-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-tint);
  overflow: hidden;
}

.asset-bar-fill {
  height: 100%;
  border-radius: 999px;
}

/* ==================== v30.0 Flagship Motion, Elastic Frosted Dock & Pull-to-Dismiss ==================== */
.bottom-dock {
  background: var(--dock-bg) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.65);
  backdrop-filter: blur(22px) saturate(1.65);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), inset 0 0.5px 0 rgba(255, 255, 255, 0.22);
}

.dock-slider-pill {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  border-radius: 17px;
  background: var(--dock-active-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  z-index: 0;
  pointer-events: none;
  will-change: transform, width;
  transition: transform 0.34s cubic-bezier(0.28, 1.14, 0.48, 1), width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-dock .dock-btn {
  position: relative;
  z-index: 1;
  transition: color 0.22s ease, transform 0.14s ease;
}

.bottom-dock .dock-btn:active {
  transform: scale(0.93);
}

.bottom-dock .dock-btn.active {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--dock-active-text);
}

/* Direction-Aware 120Hz Spatial Panel Transitions */
.view-panel.panel-slide-from-right,
.bills-subpane.panel-slide-from-right,
.stats-pane.panel-slide-from-right,
.sal-pane.panel-slide-from-right {
  animation: panelSlideRight 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.view-panel.panel-slide-from-left,
.bills-subpane.panel-slide-from-left,
.stats-pane.panel-slide-from-left,
.sal-pane.panel-slide-from-left {
  animation: panelSlideLeft 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panelSlideRight {
  from { opacity: 0; transform: translate3d(42px, 0, 0) scale(0.986); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes panelSlideLeft {
  from { opacity: 0; transform: translate3d(-42px, 0, 0) scale(0.986); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

.cal-grid {
  will-change: transform, opacity;
}

/* Bottom Sheet Top Grabber Handle & Smooth Pull-to-Dismiss */
.sheet-card::before {
  content: '';
  display: block;
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-muted);
  opacity: 0.34;
  margin: -4px auto 10px;
}

.sheet-card.is-pulling {
  transition: none !important;
}

/* Unified Tactile Spring Press */
.grouped-nav-row,
.theme-card-btn,
.bills-mode-btn,
.stats-seg-btn,
.mini-pill,
.btn {
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.grouped-nav-row:active,
.theme-card-btn:active,
.bills-mode-btn:active,
.stats-seg-btn:active,
.mini-pill:active,
.btn:active {
  transform: scale(0.975);
}

/* ==================== v31.1 Flagship Salary & Cumulative IIT Studio Styles ==================== */
.sal-entry-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--gold);
  font-size: 13px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sal-sheet-card {
  max-height: 90dvh;
  overflow-y: auto;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
}

.sal-pane {
  display: none;
  flex-direction: column;
}

.sal-pane.active {
  display: flex;
  animation: panelSlideRight 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sal-group-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-sub);
  margin: 12px 4px 6px;
  letter-spacing: 0.02em;
}

.sal-group-label:first-child {
  margin-top: 2px;
}

.sal-inset-group {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sal-inset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  min-height: 46px;
}

.sal-inset-row + .sal-inset-row {
  border-top: 0.5px solid var(--border);
}

.sal-row-lbl {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-main);
  white-space: nowrap;
}

.sal-row-input-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.sal-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.sal-clean-input {
  width: 112px;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 2px 0 !important;
  text-align: right;
  font-size: 15px;
  font-weight: 650;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.sal-clean-input::placeholder {
  color: var(--text-muted);
  font-weight: 450;
}

.sal-sched-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sal-sched-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  border-radius: 10px;
  padding: 7px 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sal-sched-pill.active {
  background: var(--dock-active-bg);
  color: var(--dock-active-text);
  border-color: transparent;
}

/* Results-First Theme-Aware Hero Banner */
.sal-hero-card {
  position: relative;
  overflow: hidden;
  background: var(--hero-bg);
  color: var(--hero-text);
  border: 1px solid var(--hero-border);
  border-radius: 20px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sal-hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0) 45%);
  pointer-events: none;
}

.sal-hero-num {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--hero-text);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.sal-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 0.5px solid var(--hero-border);
}

/* 12-Month Visual Bar Chart */
.sal-chart-card {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 10px 10px;
}

.sal-bar-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  align-items: end;
  height: 82px;
  margin-top: 10px;
}

.sal-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.sal-bar-pill {
  width: 100%;
  max-width: 14px;
  border-radius: 6px 6px 3px 3px;
  background: var(--green);
  opacity: 0.85;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sal-bar-pill.bonus {
  background: var(--gold);
  opacity: 1;
}

.sal-bar-pill.jump {
  background: var(--orange);
  opacity: 0.95;
}

.sal-bar-m {
  font-size: 9.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Clean Timeline Rows */
.sal-month-list {
  display: flex;
  flex-direction: column;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.sal-month-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
}

.sal-month-row + .sal-month-row {
  border-top: 0.5px solid var(--border);
}

.sal-m-badge {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.sal-month-row.jumped .sal-m-badge {
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.4);
  color: var(--orange);
}

.sal-tag {
  display: inline-block;
  padding: 1.5px 5.5px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 650;
  margin-left: 4px;
}

.sal-tag.jump {
  background: rgba(217, 119, 6, 0.16);
  color: var(--orange);
}

.sal-tag.q1 {
  background: var(--green-soft);
  color: var(--green);
}

.sal-tag.merged {
  background: rgba(59, 130, 246, 0.14);
  color: #3B82F6;
}







