:root {
  color-scheme: dark;
  --bg: #07100b;
  --bg-deep: #040906;
  --panel: rgba(10, 22, 14, 0.94);
  --panel-soft: rgba(14, 29, 19, 0.84);
  --line: rgba(146, 205, 158, 0.18);
  --line-strong: rgba(146, 205, 158, 0.34);
  --text: #f0f6f1;
  --muted: #8fa398;
  --accent: #88ff56;
  --accent-soft: rgba(136, 255, 86, 0.12);
  --positive: #82f6a3;
  --negative: #ff7f85;
  --warning: #f7cf68;
  --investment-funding: #8ab8ff;
  --investment-recovery: #59d7c4;
  --radius: 18px;
  --mono: "SFMono-Regular", "Roboto Mono", "Cascadia Code", Menlo, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  width: 100%;
  min-height: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
  background: var(--bg-deep);
}

body {
  width: 100%;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(47, 105, 55, 0.2), transparent 36rem),
    linear-gradient(180deg, #07100b 0%, #050906 100%);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.13;
  pointer-events: none;
}

.ambient-one { top: -12rem; right: -10rem; background: var(--accent); }
.ambient-two { bottom: -14rem; left: -12rem; background: #1b8650; }

.app-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(94px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.login-view {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: calc(100dvh - 52px);
  align-content: center;
  gap: 22px;
  max-width: 430px;
  margin: 0 auto;
}

.login-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.18em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  letter-spacing: 0;
}

.login-card,
.status-card,
.metric-card,
.content-card,
.hero-metric,
.loading-card,
.error-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.22);
}

.login-card { min-width: 0; padding: 28px; border-radius: 24px; }
.eyebrow { margin: 0; color: var(--accent); font: 700 10px/1.4 var(--mono); letter-spacing: 0.16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(27px, 7vw, 42px); letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -0.025em; }
.login-card h1 { margin-top: 10px; }
.login-copy { margin: 14px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.75; }

form { display: grid; gap: 15px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; }
input[type="email"], input[type="password"], input[type="text"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(4, 10, 6, 0.84);
}
textarea { min-height: 72px; padding-block: 12px; resize: vertical; }
select { appearance: auto; }
input::placeholder { color: #53645a; }
.remember-row { display: flex; gap: 9px; align-items: center; }
.remember-row input { accent-color: var(--accent); }

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.tab,
.filter-chip {
  border: 0;
  cursor: pointer;
}

.primary-button {
  min-height: 49px;
  border-radius: 12px;
  color: #07100b;
  background: var(--accent);
  font-weight: 800;
}
.primary-button:disabled { cursor: wait; opacity: 0.58; }
.secondary-button { padding: 10px 15px; border: 1px solid var(--line-strong); border-radius: 10px; background: transparent; }
.text-button { padding: 5px 0; color: var(--accent); background: transparent; font-size: 12px; }
.form-status { min-height: 18px; margin: 0; color: var(--negative); font-size: 12px; line-height: 1.5; }
.security-note { margin: 0; overflow-wrap: anywhere; color: #607168; text-align: center; font: 10px/1.5 var(--mono); }

.dashboard-view { display: grid; gap: 18px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; padding: 10px 2px 0; }
.topbar h1 { margin-top: 7px; }
.topbar-actions { display: flex; gap: 8px; }
.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--panel-soft);
  font: 18px/1 var(--mono);
}
.icon-button.is-spinning { animation: spin 0.75s linear infinite; }

.status-card { padding: 17px; border-radius: var(--radius); }
.status-heading { display: flex; gap: 9px; align-items: center; }
.status-heading strong { font-size: 15px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px rgba(136, 255, 86, 0.8); }
.status-meta, .status-actions { display: flex; gap: 12px; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.status-meta { margin-top: 10px; }
.status-actions { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.status-actions span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabbar {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 7px max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgba(4, 9, 6, 0.96);
  backdrop-filter: blur(15px);
}
.tab { min-height: 50px; border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.tab.is-active { color: var(--accent); background: transparent; box-shadow: none; }
.tab-create { display: grid; place-items: center; color: var(--accent); }
.tab-create span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #07100b; background: var(--accent); font: 800 25px/1 var(--sans); }
.tab-create small { margin-top: 2px; font-size: 9px; }

.loading-card, .error-card { padding: 30px 18px; border-radius: var(--radius); text-align: center; }
.loading-card { display: flex; gap: 12px; justify-content: center; align-items: center; color: var(--muted); font-size: 13px; }
.spinner { width: 17px; height: 17px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.75s linear infinite; }
.error-card strong { color: var(--negative); }
.error-card p { margin: 10px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
@keyframes spin { to { transform: rotate(360deg); } }

.tab-panel { display: grid; min-width: 0; gap: 16px; }
.content-card { min-width: 0; }
.hero-metric { padding: 24px; border-color: var(--line-strong); border-radius: 22px; background: linear-gradient(145deg, rgba(19, 43, 25, 0.95), rgba(8, 19, 12, 0.96)); }
.hero-metric > span, .metric-card > span { color: var(--muted); font-size: 11px; }
.hero-metric strong { display: block; margin-top: 10px; font: 750 clamp(31px, 9vw, 51px)/1.08 var(--mono); letter-spacing: -0.055em; }
.hero-metric small { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric-card { min-width: 0; padding: 17px; border-radius: 15px; }
.metric-card strong { display: block; margin-top: 9px; overflow-wrap: anywhere; font: 700 clamp(15px, 4.5vw, 21px)/1.25 var(--mono); }
.metric-card small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.overview-metric-grid .metric-card:not(.metric-card-wide) > strong { overflow: hidden; font-size: clamp(12px, 3.45vw, 15px); letter-spacing: -0.035em; text-overflow: clip; white-space: nowrap; }
.overview-metric-grid .metric-card:not(.metric-card-wide) > small { font-size: 8.5px; }
.metric-detail-button { min-height: 26px; margin-top: 10px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--accent); background: transparent; font-size: 9px; font-weight: 750; cursor: pointer; }
.metric-detail-button:active { background: var(--accent-soft); }
.metric-card-wide { grid-column: 1 / -1; }
.fx-metric-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: end; }
.fx-metric-card > span { grid-column: 1 / -1; }
.fx-metric-card > strong { font-size: clamp(17px, 5vw, 23px); }
.fx-metric-card > small { text-align: right; }
.fx-metric-card > small:last-child { grid-column: 1 / -1; text-align: left; }
.is-positive { color: var(--positive) !important; }
.is-negative { color: var(--negative) !important; }

.content-card { padding: 18px; border-radius: var(--radius); }
.section-head { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.section-head h2 { margin-top: 5px; }
.section-head > small { color: var(--muted); font-size: 10px; }
.sticky-head { padding-top: 2px; }
.count-badge { display: grid; min-width: 30px; height: 30px; padding: 0 8px; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font: 11px/1 var(--mono); }

.asset-groups { display: grid; gap: 14px; margin-top: 20px; }
.asset-group { display: grid; gap: 8px; }
.asset-group-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.asset-group-name { display: flex; gap: 8px; align-items: center; min-width: 0; }
.asset-group-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.asset-group-name small { color: var(--muted); font: 10px/1 var(--mono); }
.asset-group-value { text-align: right; font: 700 12px/1 var(--mono); }
.funding-attribution { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.allocation-track { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(143, 163, 152, 0.12); }
.allocation-bar { height: 100%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 12px rgba(136, 255, 86, 0.3); }
.cost-value-card { display: grid; gap: 16px; }
.cost-value-chart { display: grid; gap: 12px; }
.cost-value-row { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.cost-value-row.is-total { border-color: var(--line-strong); background: rgba(20, 43, 27, 0.72); }
.cost-value-row-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cost-value-row-head strong { font-size: 12px; }
.cost-value-row-head span { text-align: right; font: 700 10px/1.3 var(--mono); }
.cost-value-pair { display: grid; gap: 7px; }
.cost-value-line { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.cost-value-line > span { color: var(--muted); font-size: 9px; }
.cost-value-line > b { min-width: 72px; text-align: right; font: 700 10px/1.2 var(--mono); }
.cost-value-track { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(143, 163, 152, 0.12); }
.cost-value-bar { display: block; height: 100%; border-radius: inherit; }
.cost-value-bar.is-cost { background: #7390a4; }
.cost-value-bar.is-value { background: var(--accent); }
.overview-treemap-card { display: grid; gap: 12px; }
.overview-treemap-card .section-head { flex-wrap: wrap; }
.overview-treemap-card .segmented-control { margin-left: auto; }
.overview-treemap-legend { display: flex; flex-wrap: wrap; gap: 5px 10px; }
.overview-treemap-legend span { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-size: 9px; }
.overview-treemap-legend span[hidden] { display: none; }
.overview-treemap-legend span::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--legend-color); }
.overview-treemap-legend span:nth-child(1) { --legend-color: #246547; }
.overview-treemap-legend span:nth-child(2) { --legend-color: #285775; }
.overview-treemap-legend span:nth-child(3) { --legend-color: #584476; }
.overview-treemap-legend span:nth-child(4) { --legend-color: #6b6039; }
.overview-treemap-legend span:nth-child(5) { --legend-color: #276763; }
.overview-treemap-legend span:nth-child(6) { --legend-color: #64513d; }
.overview-treemap-markets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.overview-treemap-markets[hidden] { display: none; }
.overview-treemap-markets button { display: grid; gap: 4px; min-width: 0; padding: 9px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); color: var(--muted); text-align: center; }
.overview-treemap-markets button.is-active { border-color: var(--accent); background: rgba(136, 255, 86, .13); color: var(--text); }
.overview-treemap-markets button strong { font-size: 10px; }
.overview-treemap-markets button small { font: 700 10px/1.1 var(--mono); }
.overview-treemap-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.overview-treemap-scroll-hint { margin: 0; color: var(--muted); font-size: 9px; }
.overview-treemap-zoom { display: flex; gap: 4px; align-items: center; }
.overview-treemap-zoom button { min-width: 29px; min-height: 29px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-soft); color: var(--text); font: 700 10px/1 var(--mono); }
.overview-treemap-zoom button:disabled { opacity: .4; }
.overview-treemap-zoom button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.overview-treemap-scroll { max-width: 100%; overflow-x: auto; overflow-y: hidden; border-radius: 12px; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; touch-action: pan-x pan-y; }
.overview-treemap-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.overview-treemap-canvas { position: relative; width: max(100%, 860px); height: 410px; overflow: hidden; border-radius: 12px; background: #151c19; }
.overview-treemap-canvas.is-empty { display: grid; place-items: center; padding: 20px; color: var(--muted); font-size: 11px; text-align: center; }
.overview-treemap-tile { position: absolute; display: block; min-width: 0; min-height: 0; margin: 0; padding: 2px; overflow: hidden; border: 0; background: #222b26; text-align: center; cursor: pointer; }
.overview-treemap-tile-inner { display: flex; width: 100%; height: 100%; min-width: 0; flex-direction: column; justify-content: center; align-items: center; gap: 4px; overflow: hidden; border-radius: 7px; padding: 3px; background: var(--overview-tile-bg); }
.overview-treemap-tile.is-tw_equity { --overview-tile-bg: #246547; }
.overview-treemap-tile.is-us_equity { --overview-tile-bg: #285775; }
.overview-treemap-tile.is-crypto { --overview-tile-bg: #584476; }
.overview-treemap-tile.is-cash { --overview-tile-bg: #6b6039; }
.overview-treemap-tile.is-grid { --overview-tile-bg: #276763; }
.overview-treemap-tile.is-property { --overview-tile-bg: #64513d; }
.overview-treemap-tile.is-selected .overview-treemap-tile-inner { box-shadow: inset 0 0 0 2px #fff; }
.overview-treemap-tile strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 750 clamp(10px, 3.4vw, 17px)/1.1 var(--sans); }
.overview-treemap-tile small { font: 650 clamp(9px, 2.8vw, 13px)/1.1 var(--mono); }
.overview-treemap-tile.is-small small, .overview-treemap-tile.is-micro .overview-treemap-tile-inner > * { display: none; }
.overview-treemap-small-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.overview-treemap-small-list button { display: grid; flex: 0 0 auto; gap: 3px; min-width: 64px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-soft); text-align: left; }
.overview-treemap-small-list button strong { font: 700 10px/1 var(--mono); }
.overview-treemap-small-list button small { color: var(--muted); font: 9px/1.2 var(--mono); }
.overview-treemap-small-list button.is-selected { border-color: var(--accent); color: var(--accent); }
.overview-treemap-detail { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; min-height: 42px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--muted); font-size: 10px; line-height: 1.5; }
.overview-treemap-detail strong { color: var(--text); }
.exposure-card { display: grid; gap: 14px; }
.exposure-head { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.segmented-control { display: grid; grid-template-columns: repeat(2, auto); gap: 3px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-deep); }
.exposure-head .segmented-control { justify-self: start; }
.segmented-control button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 750; }
.segmented-control button.is-active { color: #07100b; background: var(--accent); }
.exposure-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.exposure-summary { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.exposure-summary span { display: grid; min-width: 0; gap: 4px; }
.exposure-summary small { color: var(--muted); font-size: 9px; }
.exposure-summary strong { overflow: hidden; font-size: 13px; line-height: 1.4; }
.exposure-summary b { color: var(--accent); font: 750 22px/1 var(--mono); }
.exposure-list { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; }
.exposure-row { display: grid; width: 100%; min-width: 0; grid-template-columns: 5px minmax(0, 1fr) auto; gap: 11px; min-height: 58px; padding: 11px 13px; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: rgba(4, 9, 6, 0.5); text-align: left; }
.exposure-row:last-child { border-bottom: 0; }
.exposure-row.is-active { background: var(--accent-soft); }
.exposure-row > i { width: 5px; height: 30px; border-radius: 999px; background: var(--exposure-color); }
.exposure-row > span { display: grid; min-width: 0; gap: 4px; }
.exposure-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.exposure-row small { color: var(--muted); font: 9px/1.2 var(--mono); }
.exposure-row > b { color: var(--accent); font: 750 11px/1 var(--mono); }
.exposure-detail { overflow: hidden; border-top: 1px solid var(--line); }
.exposure-detail-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 14px 0 10px; }
.exposure-detail-head strong { font-size: 13px; }
.exposure-detail-head span { color: var(--muted); font-size: 9px; text-align: right; }
.exposure-members { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.exposure-member { display: grid; min-width: 0; min-height: 68px; padding: 12px; align-content: center; grid-template-columns: minmax(0, 1fr); gap: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.exposure-member:nth-child(even) { border-right: 0; }
.exposure-member > span { display: grid; min-width: 0; gap: 3px; }
.exposure-member > span:last-child { text-align: right; }
.exposure-member strong, .exposure-member b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.exposure-member small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 8.5px; }
.exposure-warning { margin: 0; color: var(--warning); font-size: 10px; line-height: 1.5; }
.overview-operations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--line); }
.overview-operation { min-width: 0; padding: 14px; background: var(--panel-soft); }
.overview-operation > span { display: block; color: var(--muted); font-size: 10px; }
.overview-operation > strong { display: block; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 750 14px/1.25 var(--mono); }
.overview-operation > small { display: block; min-height: 13px; margin-top: 7px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 9px/1.3 var(--mono); }
.overview-operation > small.is-positive { color: var(--positive); }
.overview-operation > small.is-negative { color: var(--negative); }

.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font-size: 11px; }
.filter-chip.is-active { border-color: rgba(136, 255, 86, 0.32); color: var(--accent); background: var(--accent-soft); }
.heatmap-card { display: grid; gap: 13px; margin-top: 16px; }
.heatmap-head { align-items: start; flex-wrap: wrap; }
.heatmap-head h3 { margin: 5px 0 0; font-size: 16px; }
.heatmap-head .segmented-control { margin-left: auto; }
.heatmap-market-shares { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.heatmap-market-shares > span { display: flex; min-width: 0; justify-content: space-between; gap: 4px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.heatmap-market-shares small { color: var(--muted); font-size: 10px; }
.heatmap-market-shares b { font: 700 10px/1.2 var(--mono); }
.heatmap-canvas { position: relative; height: 300px; min-width: 0; overflow: hidden; border-radius: 12px; background: #151c19; }
.heatmap-canvas.is-empty { display: grid; place-items: center; padding: 20px; color: var(--muted); font-size: 11px; text-align: center; }
.heatmap-tile { position: absolute; display: block; min-width: 0; min-height: 0; margin: 0; padding: 2px; overflow: hidden; border: 0; background: #393f3c; text-align: center; cursor: pointer; }
.heatmap-tile-inner { display: flex; width: 100%; height: 100%; min-width: 0; flex-direction: column; justify-content: center; align-items: center; gap: 4px; overflow: hidden; border-radius: 7px; padding: 3px; background: var(--tile-bg); }
.heatmap-tile.is-up { --tile-bg: #246547; }
.heatmap-tile.is-down { --tile-bg: #793d43; }
.heatmap-tile.is-flat { --tile-bg: #3a4140; }
.heatmap-tile.is-unavailable { --tile-bg: #333735; }
.heatmap-tile.is-selected .heatmap-tile-inner { box-shadow: inset 0 0 0 2px #fff; }
.heatmap-tile strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 750 clamp(10px, 3.5vw, 16px)/1.1 var(--sans); }
.heatmap-tile small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 650 clamp(8px, 2.8vw, 12px)/1.1 var(--mono); }
.heatmap-tile.is-small small, .heatmap-tile.is-micro .heatmap-tile-inner > * { display: none; }
.heatmap-small-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.heatmap-small-list button { display: grid; flex: 0 0 auto; gap: 3px; min-width: 64px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-soft); text-align: left; }
.heatmap-small-list button strong { font: 700 10px/1 var(--mono); }
.heatmap-small-list button small { color: var(--muted); font: 9px/1.2 var(--mono); }
.heatmap-small-list button.is-selected { border-color: var(--accent); color: var(--accent); }
.heatmap-detail { min-height: 42px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--muted); font-size: 10px; line-height: 1.5; }
.heatmap-detail-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--text); }
.heatmap-detail-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.heatmap-detail-title small { color: var(--muted); text-align: right; }
.heatmap-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.heatmap-detail-grid > span { display: grid; gap: 4px; min-width: 0; }
.heatmap-detail-grid small { color: var(--muted); }
.heatmap-detail-grid b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font: 700 11px/1.2 var(--mono); }
.heatmap-detail p { margin: 12px 0 0; color: var(--muted); }
.heatmap-sectors { display: grid; gap: 9px; border-top: 1px solid var(--line); padding-top: 13px; }
.heatmap-sectors .section-head strong { font-size: 12px; }
.heatmap-sectors .section-head small { color: var(--muted); font-size: 9px; }
#heatmap-sector-list { display: grid; gap: 8px; }
.heatmap-sector-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(55px, 0.8fr) 44px; align-items: center; gap: 8px; font-size: 10px; }
.heatmap-sector-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heatmap-sector-row i { height: 4px; overflow: hidden; border-radius: 999px; background: rgba(143, 163, 152, 0.18); }
.heatmap-sector-row i span { display: block; height: 100%; background: var(--accent); }
.heatmap-sector-row b { text-align: right; font: 700 10px/1 var(--mono); }
.position-status-toggle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 14px 0 10px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.position-status-button { padding: 10px 8px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font: 700 11px/1 var(--sans); }
.position-status-button.is-active { color: var(--accent); background: rgba(136, 255, 86, 0.1); box-shadow: inset 0 0 0 1px rgba(136, 255, 86, 0.2); }
.position-currency-toggle { display: flex; justify-content: flex-end; gap: 6px; margin: 12px 0 2px; }
.position-currency-button { min-width: 54px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font: 700 10px/1 var(--mono); }
.position-currency-button.is-active { border-color: rgba(136, 255, 86, 0.32); color: var(--accent); background: var(--accent-soft); }
.position-currency-hint { margin: 0 0 10px; color: var(--muted); font-size: 10px; }

.position-list { display: grid; gap: 9px; }
.position-list.compact { margin-top: 15px; }
.position-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 23, 15, 0.72);
}
.position-card summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 15px; cursor: pointer; list-style: none; }
.position-card summary::-webkit-details-marker { display: none; }
.position-identity { min-width: 0; }
.symbol-row { display: flex; gap: 7px; align-items: center; }
.symbol-row strong { font: 800 14px/1 var(--mono); }
.market-pill { padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font: 8px/1 var(--mono); }
.position-name { display: block; margin-top: 7px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.position-value { display: grid; gap: 9px; min-width: 118px; text-align: right; }
.position-summary-metric { display: grid; gap: 4px; }
.position-summary-metric small { display: block; color: var(--muted); font-size: 9px; line-height: 1; }
.position-summary-metric strong { display: block; font: 700 13px/1.2 var(--mono); white-space: nowrap; }
.position-summary-metric.position-total-pnl strong { font-weight: 800; }
.position-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.position-detail { min-width: 0; padding: 12px 14px; background: var(--panel); }
.position-detail span { display: block; color: var(--muted); font-size: 9px; }
.position-detail strong { display: block; margin-top: 6px; overflow-wrap: anywhere; font: 650 11px/1.35 var(--mono); }
.position-detail-note { display: block; margin-top: 4px; color: var(--muted); font: 600 8px/1.35 var(--mono); }
.position-detail .price-status { margin-top: 3px; font: 700 9px/1.2 var(--sans); }
.position-detail .price-status.is-stale { color: var(--negative); }
.position-ledger-actions { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; border-top: 1px solid var(--line); }
.position-ledger-button { min-width: 0; padding: 13px 8px; border: 0; border-right: 1px solid var(--line); color: var(--accent); background: rgba(136, 255, 86, 0.035); text-align: center; font: 700 10px/1.3 var(--mono); }
.position-ledger-button:last-child { border-right: 0; }
.position-ledger-button:active { background: rgba(136, 255, 86, 0.14); }
.position-news { border-top: 1px solid var(--line); }
.position-news-toggle { width: 100%; min-height: 46px; padding: 11px 15px; border: 0; color: var(--accent); background: var(--panel-soft); text-align: left; font-size: 12px; font-weight: 700; cursor: pointer; }
.position-news-toggle:focus-visible, .position-news-list a:focus-visible, .position-report a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.position-news-toggle[aria-expanded="true"] { border-bottom: 1px solid var(--line); }
.position-news-content { padding: 15px; }
.position-news-content > p, .position-news-empty { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.position-report { color: var(--text) !important; }
.position-report a, .position-news-list a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.position-news-list { display: grid; gap: 13px; margin: 0; padding-left: 20px; }
.position-news-list li { padding-left: 2px; font-size: 12px; line-height: 1.5; }
.position-news-list small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.position-news-topic { display: block; margin-bottom: 3px; color: var(--accent); font-size: 10px; font-weight: 700; }
.buy-bubble { padding: 17px 0 14px; border-top: 1px solid var(--line); background: #0c1911; }
.buy-bubble-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 15px; color: var(--text); font-size: 13px; font-weight: 700; }
.buy-bubble-heading small { color: var(--muted); font-size: 10px; font-weight: 500; white-space: nowrap; }
.buy-bubble-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding: 0 15px; }
.buy-bubble-stats span { display: grid; min-width: 0; gap: 6px; }
.buy-bubble-stats small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.buy-bubble-stats strong { overflow-wrap: anywhere; color: var(--text); font: 700 14px/1.25 var(--mono); }
.buy-bubble-stats strong.is-negative { color: var(--negative); }
.buy-bubble-stats strong.is-positive { color: var(--positive); }
.buy-bubble-scroll { max-width: 100%; margin-top: 12px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.buy-bubble-scroll::-webkit-scrollbar { display: none; }
.buy-bubble-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.buy-bubble-svg { display: block; max-width: none; font-family: var(--mono); }
.buy-bubble-dot { cursor: pointer; touch-action: manipulation; }
.buy-bubble-dot:focus-visible, .buy-bubble-dot.is-selected { stroke: var(--text); stroke-width: 3; }
.buy-bubble-dot:active { opacity: .7; }
.buy-bubble-selected { min-height: 16px; margin: -2px 0 7px; padding: 0 15px; color: #c6dda9; font-size: 10px; line-height: 1.5; }
.buy-bubble-caption { margin: 0; padding: 0 15px; color: var(--muted); font-size: 10px; line-height: 1.5; }
body.numbers-hidden .buy-bubble-plot { pointer-events: none; }
.empty-state { padding: 32px 15px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; font-size: 12px; }

.ledger-tools { display: flex; gap: 8px; }
.ledger-search { flex: 1; min-width: 0; }
.ledger-search input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--panel-soft); font-size: 13px; outline: none; }
.ledger-search input:focus { border-color: rgba(136, 255, 86, 0.5); box-shadow: 0 0 0 3px rgba(136, 255, 86, 0.08); }
.ledger-search input::placeholder { color: var(--muted); }
.clear-search { flex: 0 0 auto; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: transparent; font-size: 11px; }
#transaction-filters { margin-top: 10px; }
.filter-note { min-height: 16px; margin: 9px 2px 0; color: var(--muted); font-size: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.transaction-list { display: grid; gap: 9px; }
.transaction-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-soft); }
.transaction-type { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; color: var(--positive); background: rgba(130, 246, 163, 0.09); font: 800 10px/1 var(--mono); }
.transaction-type.is-sell { color: var(--negative); background: rgba(255, 127, 133, 0.09); }
.transaction-type.is-income { color: var(--warning); background: rgba(247, 207, 104, 0.09); }
.transaction-copy { min-width: 0; }
.transaction-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.transaction-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.transaction-copy .transaction-costs { color: #718078; }
.transaction-copy .transaction-holding-average { color: #aebdb4; }
.transaction-amount { text-align: right; }
.transaction-amount strong { display: block; font: 650 11px/1.25 var(--mono); }
.transaction-amount small { display: block; margin-top: 5px; color: var(--muted); font: 9px/1.25 var(--mono); }
.transaction-amount .transaction-gross { color: var(--text); }
.transaction-amount .transaction-charge-total { color: #cbbd85; }
.transaction-amount .transaction-cashflow { margin-top: 6px; color: var(--text); font-weight: 700; }
.income-head { margin-top: 12px; }

.compact-button { min-height: 40px; padding: 0 15px; white-space: nowrap; font-size: 12px; }
.cashbook-title-row { align-items: flex-end; }
.cashbook-view-switch { display: grid; grid-template-columns: repeat(3, 1fr); width: min(100%, 330px); margin: 0 auto; padding: 3px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-deep); }
.cashbook-view-switch button { min-height: 38px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
.cashbook-view-switch button.is-active { color: #07100b; background: var(--text); }
.cashbook-ledger-view { display: grid; gap: 0; margin-inline: -16px; }
.cashbook-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; border-block: 1px solid var(--line); background: var(--line); }
.cashbook-summary-grid article { min-width: 0; padding: 12px 10px; background: var(--panel-soft); }
.cashbook-summary-grid span, .cashbook-summary-grid small { display: block; color: var(--muted); font-size: 9px; }
.cashbook-summary-grid strong { display: block; margin: 7px 0 5px; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; font: 720 13px/1.2 var(--mono); }
.cashbook-summary-grid small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; }
.cashbook-calendar-card { min-width: 0; padding: 12px 12px 7px; border-block: 1px solid var(--line); background: rgba(2, 7, 4, 0.6); }
.cashbook-month-toolbar { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: center; }
.cashbook-month-toolbar > div { min-width: 0; }
.cashbook-month-toolbar strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; font-weight: 650; line-height: 1.2; }
.cashbook-month-toolbar small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.calendar-nav-button, .sheet-close-button, .danger-button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.calendar-nav-button { min-width: 42px; border-color: transparent; font-size: 30px; font-weight: 300; }
.cashbook-weekdays, .cashbook-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; }
.cashbook-weekdays { margin: 18px -12px 0; padding-bottom: 9px; border-bottom: 1px solid var(--line); color: #708078; text-align: center; font-size: 10px; line-height: 1; }
.cashbook-calendar-grid { margin-inline: -12px; }
.calendar-spacer { min-height: 54px; background: rgba(255, 255, 255, 0.018); }
.cashbook-day-button { display: grid; min-width: 0; min-height: 54px; padding: 7px 2px 6px; place-items: center; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--text); background: transparent; cursor: pointer; }
.cashbook-day-button.is-today { border-color: var(--line-strong); color: var(--text); }
.cashbook-day-button.is-selected { color: #07100b; background: var(--accent); }
.cashbook-day-button > span { font: 650 14px/1 var(--sans); }
.cashbook-day-button > b { display: flex; min-height: 5px; gap: 2px; margin-top: 6px; }
.cashbook-day-button i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.cashbook-day-button i.is-expense { background: var(--negative); }
.cashbook-day-button i.is-income { background: var(--positive); }
.cashbook-day-button i.is-transfer, .cashbook-day-button i.is-exchange, .cashbook-day-button i.is-credit_card_payment { background: var(--warning); }
.cashbook-day-button i.is-investment_funding_transfer { background: var(--investment-funding); }
.cashbook-day-button i.is-investment_recovery_transfer { background: var(--investment-recovery); }
.cashbook-day-button i.is-usd { background: #84b7ff; }
.cashbook-day-button.is-selected i { box-shadow: 0 0 0 1px rgba(7, 16, 11, 0.4); }
.cashbook-day-card { padding: 17px 16px 0; background: rgba(8, 17, 11, 0.85); }
.cashbook-day-heading { display: flex; justify-content: space-between; align-items: center; }
.cashbook-day-heading h2 { font-size: 15px; }
.cashbook-entry-list { display: grid; margin: 10px -16px 0; }
.cashbook-entry-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; min-height: 76px; padding: 13px 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; color: var(--text); background: rgba(255, 255, 255, 0.025); text-align: left; cursor: pointer; }
.cashbook-entry-copy { min-width: 0; }
.cashbook-entry-heading { display: flex; min-width: 0; gap: 7px; align-items: center; }
.cashbook-entry-copy strong, .cashbook-entry-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cashbook-entry-copy strong { font-size: 15px; font-weight: 620; }
.cashbook-entry-copy small { margin-top: 7px; color: var(--muted); font-size: 11px; }
.cashbook-entry-type { flex: 0 0 auto; padding: 3px 5px; border: 1px solid currentColor; border-radius: 999px; font: 700 8px/1 var(--sans); }
.cashbook-entry-type.is-expense { color: var(--negative); background: rgba(255, 118, 139, 0.08); }
.cashbook-entry-type.is-income { color: var(--positive); background: rgba(109, 239, 156, 0.08); }
.cashbook-entry-type.is-transfer { color: var(--warning); background: rgba(255, 202, 103, 0.08); }
.cashbook-entry-type.is-funding { color: var(--investment-funding); background: rgba(138, 184, 255, 0.08); }
.cashbook-entry-type.is-recovery { color: var(--investment-recovery); background: rgba(89, 215, 196, 0.08); }
.cashbook-entry-value { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font: 700 14px/1.25 var(--mono); }
.cashbook-entry-value small { display: block; margin-top: 5px; color: var(--muted); font: 9px/1 var(--sans); }
.cashbook-entry-row.is-expense .cashbook-entry-value { color: var(--negative); }
.cashbook-entry-row.is-income .cashbook-entry-value { color: var(--positive); }
.cashbook-entry-row.is-transfer .cashbook-entry-value { color: var(--warning); }
.cashbook-entry-row.is-funding .cashbook-entry-value { color: var(--investment-funding); }
.cashbook-entry-row.is-recovery .cashbook-entry-value { color: var(--investment-recovery); }
.cashbook-entry-row[data-cashbook-event-type="investment_funding_transfer"] .cashbook-entry-type,
.cashbook-entry-row[data-cashbook-event-type="investment_funding_transfer"] .cashbook-entry-value { color: var(--investment-funding) !important; }
.cashbook-entry-row[data-cashbook-event-type="investment_funding_transfer"] .cashbook-entry-copy > small { color: var(--investment-funding); }
.cashbook-entry-row[data-cashbook-event-type="investment_recovery_transfer"] .cashbook-entry-type,
.cashbook-entry-row[data-cashbook-event-type="investment_recovery_transfer"] .cashbook-entry-value { color: var(--investment-recovery) !important; }
.cashbook-entry-row[data-cashbook-event-type="investment_recovery_transfer"] .cashbook-entry-copy > small { color: var(--investment-recovery); }
.cashbook-accounts-view { margin-inline: -16px; border-block: 1px solid var(--line); background: rgba(8, 17, 11, 0.85); }
.cashbook-account-group + .cashbook-account-group { margin-top: 18px; }
.cashbook-account-group-title { display: flex; justify-content: space-between; padding: 12px 16px 8px; color: var(--muted); font-size: 12px; }
.cashbook-account-group-title strong { color: var(--muted); font: 500 12px/1 var(--mono); }
.cashbook-account-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 74px; padding: 12px 16px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); }
.cashbook-account-copy { min-width: 0; }
.cashbook-account-copy strong, .cashbook-account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cashbook-account-copy strong { font-size: 16px; font-weight: 620; }
.cashbook-account-copy small { margin-top: 6px; color: var(--muted); font: 12px/1 var(--mono); }
.cashbook-account-balance-wrap { display: grid; justify-items: end; gap: 5px; min-width: 0; }
.cashbook-account-balance { color: var(--positive); text-align: right; font: 650 16px/1.2 var(--mono); }
.cashbook-account-row.is-negative .cashbook-account-balance { color: var(--negative); }
.cashbook-account-projection { color: var(--muted); text-align: right; font: 10px/1.1 var(--mono); white-space: nowrap; }
.cashbook-account-projection.is-negative { color: var(--negative); }
.cashbook-account-row { width: 100%; border-inline: 0; text-align: left; }
button.cashbook-account-row { cursor: pointer; }
.cashbook-account-row.is-property-account { grid-template-columns: minmax(0, 1fr) auto auto; }
.cashbook-account-row.is-availability-account { grid-template-columns: minmax(0, 1fr) auto auto; }
.property-details-button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--accent); background: transparent; font-size: 10px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.property-cost-details { display: grid; gap: 14px; padding: 16px; }
.property-cost-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); }
.property-cost-summary > div { min-width: 0; padding: 11px; background: var(--panel-soft); }
.property-cost-summary > .property-cost-total { grid-column: 1 / -1; padding: 14px 11px; }
.property-cost-summary span, .property-cost-summary small { display: block; color: var(--muted); font-size: 10px; }
.property-cost-summary strong { display: block; margin-top: 5px; color: var(--text); font: 700 13px/1.2 var(--mono); }
.property-cost-summary .property-cost-total strong { font-size: 22px; }
.property-cost-detail-list { display: grid; border-top: 1px solid var(--line); }
.property-cost-detail-heading { margin: 0; padding: 14px 0 8px; color: var(--text); font-size: 13px; }
.property-cost-detail-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.property-cost-detail-row strong, .property-cost-detail-row small { display: block; }
.property-cost-detail-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.property-cost-detail-amount { align-self: center; color: var(--text); text-align: right; font: 650 12px/1.2 var(--mono); white-space: nowrap; }
.property-cost-scheduled { margin-top: 16px; padding-top: 2px; border-top: 1px solid var(--line-strong); }
.property-cost-scheduled > p { margin: 0 0 2px; color: var(--muted); font-size: 10px; }
.property-cost-detail-row.is-scheduled .property-cost-detail-amount { color: var(--warning); }
.property-valuation-form { display: grid; gap: 11px; padding: 0 0 15px; border-bottom: 1px solid var(--line-strong); }
.property-valuation-form label { display: grid; gap: 5px; }
.property-valuation-form label > span { color: var(--text); font-size: 12px; font-weight: 750; }
.property-valuation-form input { min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--panel-soft); font: 700 15px/1 var(--mono); }
.property-valuation-form label > small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.property-valuation-preview { display: block; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); background: var(--accent-soft); font: 700 11px/1.5 var(--mono); }
.property-valuation-form .primary-button { justify-self: start; }
.capital-recovery-status { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 9px; align-items: baseline; padding: 10px 14px; border-top: 1px solid var(--line); background: rgba(136, 255, 86, 0.025); }
.capital-recovery-status span { color: var(--muted); font: 650 9px/1 var(--mono); letter-spacing: 0.08em; }
.capital-recovery-status strong { color: var(--text); font-size: 12px; }
.capital-recovery-status b { color: var(--accent); font: 650 11px/1 var(--mono); white-space: nowrap; }
.capital-recovery-details { display: grid; gap: 16px; padding: 16px; }
.capital-recovery-current { display: grid; gap: 5px; padding: 14px; border: 1px solid rgba(136, 255, 86, 0.32); border-radius: 13px; background: rgba(136, 255, 86, 0.06); }
.capital-recovery-current > span, .capital-recovery-current small { color: var(--muted); font-size: 10px; line-height: 1.55; }
.capital-recovery-current strong { color: var(--accent); font-size: 17px; }
.capital-recovery-timeline { display: grid; border-top: 1px solid var(--line); }
.capital-recovery-cycle { display: grid; gap: 7px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.capital-recovery-cycle.is-active { border-left: 2px solid var(--accent); padding-left: 11px; }
.capital-recovery-cycle header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.capital-recovery-cycle header span { display: grid; gap: 4px; }
.capital-recovery-cycle header strong { font-size: 13px; }
.capital-recovery-cycle header small, .capital-recovery-cycle p, .capital-recovery-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.capital-recovery-cycle header > b { display: grid; gap: 4px; color: var(--text); text-align: right; white-space: nowrap; }
.capital-recovery-cycle header > b strong { font: 650 11px/1.2 var(--mono); }
.capital-recovery-cycle header > b small { color: var(--muted); font: 600 9px/1 var(--mono); }
.capital-recovery-cycle.is-recovered header > b strong, .capital-recovery-cycle.is-recovered header > b small { color: var(--accent); }
.capital-recovery-cycle p b { color: var(--text); font-family: var(--mono); font-weight: 650; }
.capital-recovery-note { padding-top: 14px; }
.cashbook-inline-action { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cashbook-inline-action small { color: var(--muted); font-size: 10px; text-align: right; }
.cashbook-card-obligations { border-bottom: 1px solid var(--line-strong); background: rgba(255, 185, 89, 0.035); }
.cashbook-obligation-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 12px 16px 8px; color: var(--warning); font: 700 11px/1 var(--mono); letter-spacing: 0.04em; }
.cashbook-obligation-heading small { color: var(--muted); font: 10px/1.35 var(--sans); text-align: right; letter-spacing: 0; }
.cashbook-card-obligation { width: 100%; min-height: 70px; background: transparent; text-align: left; }
.cashbook-card-obligation .cashbook-account-balance { color: var(--muted); }
.cashbook-card-obligation.is-outstanding .cashbook-account-balance { color: var(--warning); }
.cashbook-schedule-row .cashbook-account-balance { color: var(--warning); }
.cashbook-schedule-row.is-overdue .cashbook-account-balance { color: var(--negative); }
.cashbook-schedule-row small.schedule-date { color: var(--accent); }

@media (max-width: 679px) {
  .app-shell { max-width: 100%; overflow-x: clip; }
  .dashboard-view[data-active-tab="cashbook"] .status-card,
  .dashboard-view[data-active-tab="cashbook"] .cashbook-title-row { display: none; }
  .dashboard-view[data-active-tab="cashbook"] { gap: 14px; }
  .sheet-backdrop { padding-top: 0; }
  .bottom-sheet { width: 100%; height: 100dvh; max-height: 100dvh; padding: 0 16px max(18px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; box-shadow: none; }
  .sheet-header { top: 0; margin: 0 -16px 14px; padding: max(14px, env(safe-area-inset-top)) 16px 12px; }
  .sheet-header .eyebrow { font-size: 8px; }
  .sheet-header h2 { margin-top: 3px; font-size: 22px; }
  .sheet-close-button { min-height: 38px; padding-inline: 13px; }
  .cashbook-form { gap: 11px; }
  .cashbook-form-grid { gap: 11px; }
  .cashbook-form-grid label { gap: 6px; font-size: 12px; }
  .cashbook-form-grid input[type="text"],
  .cashbook-form-grid input[type="date"],
  .cashbook-form-grid input[type="number"],
  .cashbook-form-grid select { min-height: 48px; border-radius: 11px; font-size: 16px; }
  .cashbook-amount-field { order: -1; }
  .cashbook-amount-field input { min-height: 62px !important; padding-inline: 15px; font-size: 26px !important; }
  .cashbook-amount-field select { min-height: 62px !important; }
  .cashbook-check-field { min-height: 58px; padding: 9px 12px; }
  .cashbook-check-row { min-height: 24px; }
  .cashbook-note-field textarea { min-height: 68px; font-size: 16px; }
  .cashbook-calculation { gap: 4px; padding: 12px 14px; border-radius: 12px; }
  .cashbook-calculation strong { font-size: 12px; }
  .cashbook-calculation small { font-size: 9px; }
  .sheet-actions { bottom: calc(-1 * max(18px, env(safe-area-inset-bottom))); margin: 0 -16px calc(-1 * max(18px, env(safe-area-inset-bottom))); padding: 11px 16px max(18px, env(safe-area-inset-bottom)); }
  .sheet-actions .primary-button { min-height: 52px; }
}

body.sheet-open { position: fixed; width: 100%; overflow: hidden; }
.sheet-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; align-items: end; min-width: 0; overflow: hidden; overscroll-behavior: none; padding-top: max(20px, env(safe-area-inset-top)); background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(8px); touch-action: none; }
.bottom-sheet { width: min(100%, 680px); max-height: calc(100dvh - max(20px, env(safe-area-inset-top))); margin: 0 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px max(16px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 24px 24px 0 0; background: #09130d; box-shadow: 0 -24px 80px rgba(0, 0, 0, 0.45); touch-action: pan-y; }
.sheet-header { position: sticky; z-index: 2; top: -20px; display: flex; justify-content: space-between; align-items: center; margin: -20px -16px 18px; padding: 20px 16px 14px; border-bottom: 1px solid var(--line); background: rgba(9, 19, 13, 0.96); backdrop-filter: blur(14px); }
.sheet-header h2 { margin-top: 6px; }
.cashbook-form { gap: 14px; }
.cashbook-form-grid { display: grid; gap: 13px; }
.cashbook-form-grid label[hidden] { display: none; }
.cashbook-account-balance-hint { display: block; min-height: 12px; margin-top: -1px; color: var(--muted); font: 9px/1.25 var(--mono); }
.cashbook-account-balance-hint.is-negative { color: var(--negative); }
.cashbook-amount-field { display: grid; gap: 8px; min-width: 0; }
.cashbook-amount-field label { display: block; }
.cashbook-amount-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: stretch; }
.cashbook-amount-controls.with-currency { grid-template-columns: minmax(0, 1fr) 94px; }
.cashbook-amount-controls input { min-width: 0; font: 750 24px/1 var(--mono); letter-spacing: -0.04em; }
.cashbook-amount-controls select { width: 100%; height: 100%; padding-inline: 9px; font: 750 13px/1 var(--mono); }
.cashbook-amount-controls #cashbook-currency-field[hidden] { display: none; }
.cashbook-amount-field small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.cashbook-check-field { min-height: 72px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 10, 6, 0.84); }
.cashbook-check-row { display: flex; gap: 9px; align-items: center; min-height: 28px; color: var(--text); }
.cashbook-check-row input { accent-color: var(--accent); }
.cashbook-note-field { grid-column: 1 / -1; }
.cashbook-calculation { display: grid; gap: 7px; padding: 15px; border: 1px solid rgba(136, 255, 86, 0.3); border-radius: 13px; background: rgba(136, 255, 86, 0.055); }
.cashbook-calculation > span { color: var(--accent); font: 700 9px/1 var(--mono); letter-spacing: 0.15em; }
.cashbook-calculation strong { font-size: 13px; line-height: 1.45; }
.cashbook-calculation small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.sheet-actions { position: sticky; bottom: calc(-1 * max(22px, env(safe-area-inset-bottom))); display: grid; grid-template-columns: auto minmax(150px, 1fr); gap: 10px; margin: 3px -16px calc(-1 * max(22px, env(safe-area-inset-bottom))); padding: 14px 16px max(22px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(9, 19, 13, 0.97); backdrop-filter: blur(14px); }
.danger-button[hidden] + .primary-button { grid-column: 1 / -1; }
.danger-button { color: var(--negative); border-color: rgba(255, 127, 133, 0.28); }
.app-toast { position: fixed; z-index: 150; right: 16px; bottom: max(24px, env(safe-area-inset-bottom)); left: 16px; width: fit-content; max-width: calc(100% - 32px); margin: auto; padding: 12px 16px; border: 1px solid rgba(136, 255, 86, 0.35); border-radius: 12px; color: var(--text); background: #13251a; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4); font-size: 12px; text-align: center; }
.app-footer { display: flex; justify-content: space-between; padding: 18px 2px 6px; color: #526259; font: 9px/1.4 var(--mono); }

body.numbers-hidden .private-value,
body.numbers-hidden .private-number { filter: blur(8px); user-select: none; }

@media (min-width: 680px) {
  .app-shell { padding: max(22px, env(safe-area-inset-top)) 28px max(30px, env(safe-area-inset-bottom)); }
  .dashboard-view { grid-template-columns: 230px minmax(0, 1fr); align-items: start; }
  .topbar, .tabbar, .loading-card, .error-card, .tab-panel, .app-footer { grid-column: 2; }
  .status-card { position: sticky; top: 28px; grid-column: 1; grid-row: 1 / span 5; }
  .topbar { grid-row: 1; }
  .tabbar { position: sticky; top: 28px; right: auto; bottom: auto; left: auto; grid-row: 2; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(6, 14, 9, 0.9); }
  .tab { min-height: 40px; font-size: 13px; }
  .tab.is-active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(136, 255, 86, 0.16); }
  .tab-create { display: none; }
  .loading-card, .error-card, .tab-panel { grid-row: 3; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric-card { padding: 16px 13px; }
  .overview-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cashbook-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cashbook-ledger-view, .cashbook-accounts-view { margin-inline: 0; }
  .cashbook-calendar-card, .cashbook-day-card, .cashbook-accounts-view { border: 1px solid var(--line); border-radius: var(--radius); }
  .cashbook-day-card { margin-top: 14px; }
}

@media (max-width: 380px) {
  .login-card { padding: 22px; }
  .metric-grid { grid-template-columns: 1fr; }
  .hero-metric strong { font-size: 28px; }
  .transaction-row { grid-template-columns: 38px minmax(0, 1fr); }
  .transaction-type { width: 38px; height: 38px; }
  .transaction-amount { grid-column: 2; text-align: left; }
  .cashbook-entry-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tab { font-size: 12px; }
  .cashbook-month-toolbar { gap: 7px; }
  .calendar-nav-button { padding-inline: 9px; }
}

/* Mobile reading hierarchy: quieter surfaces, clearer figures, fewer repeated boxes. */
@media (max-width: 679px) {
  :root {
    --bg: #101714;
    --bg-deep: #101714;
    --panel: #18211c;
    --panel-soft: #1c2720;
    --line: rgba(214, 225, 211, 0.11);
    --line-strong: rgba(214, 225, 211, 0.22);
    --text: #f0f1e9;
    --muted: #a9b5a7;
    --accent: #c8dc9d;
    --accent-soft: rgba(200, 220, 157, 0.11);
    --sans: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Segoe UI", sans-serif;
  }
  body { background: var(--bg); }
  .ambient { display: none; }
  .app-shell { padding-top: max(28px, env(safe-area-inset-top)); }
  .dashboard-view { gap: 22px; }
  .topbar { align-items: center; padding: 0 2px 2px; }
  .topbar h1 { font-size: 30px; line-height: 1.1; letter-spacing: -0.045em; }
  .eyebrow { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; }
  .status-card, .metric-card, .content-card, .hero-metric, .loading-card, .error-card {
    box-shadow: none;
  }
  .status-card { padding: 13px 2px 15px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
  .live-dot { background: #96bb88; box-shadow: none; }
  .hero-metric { padding: 24px 21px 26px; border: 0; border-radius: 16px; background: #25372b; }
  .hero-metric > span, .metric-card > span { font-size: 12px; }
  .hero-metric strong { margin-top: 13px; font-size: clamp(29px, 8vw, 42px); font-variant-numeric: tabular-nums; }
  .metric-grid { gap: 0 18px; }
  .metric-card { padding: 18px 2px 17px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
  .metric-card strong { font-variant-numeric: tabular-nums; }
  .overview-metric-grid .metric-card:not(.metric-card-wide) > small { font-size: 10px; line-height: 1.45; }
  .content-card { padding: 21px 18px; border-color: var(--line); border-radius: 14px; }
  .section-head h2 { font-size: 18px; }
  .tabbar { border-top-color: var(--line-strong); background: rgba(16, 23, 20, 0.96); }
  .tab.is-active { color: var(--text); }
  .tab.is-active::after { content: ""; display: block; width: 16px; height: 2px; margin: 5px auto 0; border-radius: 2px; background: var(--accent); }
  .tab-create span { color: #172019; }
  .primary-button { color: #172019; }
  .login-view { gap: 12px; align-content: center; }
  .login-brand { padding-inline: 4px; color: var(--muted); letter-spacing: 0.11em; }
  .brand-mark { width: 31px; height: 31px; border-radius: 7px; background: transparent; }
  .login-card { padding: 18px 4px 14px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .login-card .eyebrow { display: none; }
  .login-card h1 { margin-top: 0; font-size: 34px; }
  .login-copy { margin: 11px 0 29px; font-size: 14px; line-height: 1.65; }
  input::placeholder { color: #8a9b8c; }
  .security-note { color: var(--muted); font: 11px/1.5 var(--sans); }
  .section-head .eyebrow { display: none; }
  .section-head h2 { margin-top: 0; }
  .topbar .eyebrow { margin-bottom: 7px; }
  .tab-create small, .metric-detail-button, .segmented-control button,
  .overview-treemap-markets button, .overview-treemap-zoom button { font-size: 11px; }
  .status-meta, .status-actions, .metric-card small { font-size: 11px; }
  .primary-button, .secondary-button, .icon-button, .tab,
  .filter-chip, .segmented-control button, .overview-treemap-markets button,
  .overview-treemap-zoom button, .position-status-button,
  .position-currency-button, .calendar-nav-button, .sheet-close-button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1),
      background-color 160ms ease, border-color 160ms ease;
  }
  :is(.primary-button, .secondary-button, .icon-button, .tab,
    .filter-chip, .segmented-control button, .overview-treemap-markets button,
    .overview-treemap-zoom button, .position-status-button,
    .position-currency-button, .calendar-nav-button, .sheet-close-button):active:not(:disabled):not(:focus-visible) {
    transform: scale(0.97);
  }
  .tab-create:active:not(:disabled):not(:focus-visible) span { transform: scale(0.92); }
  .tab-create span { transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
  .primary-button:active:not(:disabled) { background-color: #dbe8bb; }
  .secondary-button:active:not(:disabled), .icon-button:active:not(:disabled),
  .filter-chip:active:not(:disabled) { background-color: var(--accent-soft); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  button:active { transform: none !important; }
  .tab-create:active span { transform: none !important; }
}

/* Screenshot presentation: all trades fit horizontally; zoom changes only price spacing. */
.buy-bubble-expand { border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--accent); padding: 7px 9px; white-space: nowrap; font-size: 11px; }
.buy-presentation { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; margin: 0; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); border: 0; background: #08110c; color: var(--text); box-sizing: border-box; overflow: hidden; }
.buy-presentation[open] { display: flex; flex-direction: column; }
.buy-presentation::backdrop { background: #08110c; }
.buy-presentation-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; flex-shrink: 0; }
.buy-presentation-tools[hidden], .buy-presentation-restore[hidden] { display: none; }
.buy-presentation-tools button, .buy-presentation-tools select, .buy-presentation-restore { padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: #17281d; color: var(--text); }
.buy-presentation-tools label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.buy-presentation-tools small { width: 100%; color: var(--muted); font-size: 11px; }
.buy-presentation-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.buy-presentation-image { flex-shrink: 0; box-sizing: border-box; overflow: hidden; background: #0c1911; touch-action: none; user-select: none; }
.buy-presentation-title { padding: 12px 15px 0; color: var(--accent); font: 700 14px/1.4 var(--mono); }
.buy-presentation-image .buy-bubble { border: 0; padding-top: 12px; }
.buy-presentation-image .buy-bubble-heading { font-size: 12px; gap: 6px; }
.buy-presentation-image .buy-bubble-stats { margin-top: 10px; gap: 5px; }
.buy-presentation-image .buy-bubble-stats strong { font-size: 12px; }
.buy-presentation-image .buy-bubble-scroll { overflow: hidden; }
.buy-presentation-image .buy-bubble-svg { width: 100%; height: auto; }
.buy-presentation-image .buy-bubble-selected { display: none; }
.buy-presentation-image .buy-bubble-caption { margin-top: 6px; font-size: 9px; }
.buy-presentation-restore { position: absolute; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); font-size: 10px; opacity: .65; }
