/* Personal Investment Ledger · Navy / Graphite Glacier. Color-only theme layer. */
:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --canvas: #f0f4f8;
  --surface: #ffffff;
  --surface-soft: #edf2f8;
  --surface-warm: #fff7e6;
  --fg: #303133;
  --fg-subtle: #606266;
  --muted: #626b78;
  --muted-warm: #737b88;
  --border: #dce3ed;
  --border-strong: #7b8ba0;
  --accent: #1890ff;
  --accent-hover: #096dd9;
  --accent-soft: #e6f7ff;
  --accent-ink: #0960b5;
  --button-primary-bg: #096dd9;
  --button-primary-hover: #075bb6;
  --button-primary-fg: #ffffff;
  --sidebar: #001529;
  --sidebar-ink: #f1f5fa;
  --sidebar-secondary: #c7d3df;
  --sidebar-muted: #9cafc3;
  --sidebar-border: #25405b;
  --sidebar-hover: #102f4a;
  --sidebar-active: #096dd9;
  --sidebar-active-ink: #ffffff;
  --profit: #cf1322;
  --profit-soft: #fff1f0;
  --loss: #237804;
  --loss-soft: #f6ffed;
  --success: #237804;
  --success-soft: #f6ffed;
  --success-ink: #237804;
  --warning: #ad6800;
  --warning-soft: #fff7e6;
  --warning-ink: #874d00;
  --danger: #cf1322;
  --danger-soft: #fff1f0;
  --danger-ink: #a8071a;
  --color-cash: #7c8796;
  --color-stock: #1890ff;
  --color-gold: #ad6800;
  --color-forex: #087f8c;
  --color-insurance: #7155a5;
  --position-liquid: #1890ff;
  --position-total: #13a8a8;
  --shadow-card: 0 1px 2px #1020300a;
  --shadow-popover: 0 10px 30px #10203024;
  --shadow-modal: 0 24px 70px #10203038;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101419;
  --canvas: #131a22;
  --surface: #181f27;
  --surface-soft: #202a35;
  --surface-warm: #3a3020;
  --fg: #e7edf4;
  --fg-subtle: #b7c2d0;
  --muted: #a4b1c2;
  --muted-warm: #95a7b9;
  --border: #2b3643;
  --border-strong: #71869d;
  --accent: #6fd9e8;
  --accent-hover: #a2eaf3;
  --accent-soft: #173943;
  --accent-ink: #8ce4ee;
  --button-primary-bg: #6fd9e8;
  --button-primary-hover: #a2eaf3;
  --button-primary-fg: #07191d;
  --sidebar: #0b1016;
  --sidebar-ink: #e7edf4;
  --sidebar-secondary: #b7c2d0;
  --sidebar-muted: #a4b1c2;
  --sidebar-border: #2b3643;
  --sidebar-hover: #162630;
  --sidebar-active: #173943;
  --sidebar-active-ink: #8ce4ee;
  --profit: #f1a195;
  --profit-soft: #392724;
  --loss: #86c7aa;
  --loss-soft: #20352c;
  --success: #86c7aa;
  --success-soft: #20352c;
  --success-ink: #a4dbc2;
  --warning: #d9b56c;
  --warning-soft: #3a3020;
  --warning-ink: #e8c98e;
  --danger: #f1a195;
  --danger-soft: #392724;
  --danger-ink: #ffb7ad;
  --color-cash: #a4b1c2;
  --color-stock: #6fd9e8;
  --color-gold: #d9b56c;
  --color-forex: #86c7aa;
  --color-insurance: #b7a5d3;
  --position-liquid: #6fd9e8;
  --position-total: #86c7ca;
  --shadow-card: 0 1px 2px #00000033;
  --shadow-popover: 0 10px 30px #00000066;
  --shadow-modal: 0 24px 70px #00000088;
}
html[data-gaincolor="green-up"] { --profit: #237804; --profit-soft: #f6ffed; --loss: #cf1322; --loss-soft: #fff1f0; }
html[data-theme="dark"][data-gaincolor="green-up"] { --profit: #86c7aa; --profit-soft: #20352c; --loss: #f1a195; --loss-soft: #392724; }

.app, .workspace { background: var(--bg); }
.topbar { background: var(--surface); backdrop-filter: none; }
.btn.primary, .btn.accent, .cat-btn[aria-pressed="true"] { background: var(--button-primary-bg); border-color: var(--button-primary-bg); color: var(--button-primary-fg); }
.btn.primary:hover, .btn.accent:hover { background: var(--button-primary-hover); border-color: var(--button-primary-hover); color: var(--button-primary-fg); }
.step-btn[aria-current="step"] { color: var(--fg); background: var(--accent-soft); border-color: var(--accent); }
.step-btn[aria-current="step"] .step-num { color: var(--button-primary-fg); background: var(--button-primary-bg); border-color: var(--button-primary-bg); }
.step-btn[aria-current="step"] .step-sub { color: var(--fg-subtle); }
.bar-fill, .progress-fill { background: var(--accent); }
.bar-fill.soft { background: color-mix(in srgb, var(--accent) 42%, var(--fg-subtle)); }
.ico { width: 16px; height: 16px; flex: 0 0 16px; display: inline-block; vertical-align: middle; }

/* Supplied brand artwork: no redrawing, filters, borders or generated marks. */
.brand-mark::before, .brand-mark::after { content: none; }
.brand-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border: 0; border-radius: 0; overflow: visible; }
.brand-mark img { display: block; width: 24px; height: 24px; object-fit: contain; }
.logo-dark-surface { display: none !important; }
html[data-theme="dark"] .logo-light-surface { display: none !important; }
html[data-theme="dark"] .logo-dark-surface { display: block !important; }
.sidebar .brand { color: var(--sidebar-ink); flex: 0 0 44px; }
.sidebar .brand-sub { color: var(--sidebar-muted); }
.sidebar .brand-name { font-size: 13px; letter-spacing: 0; }
.sidebar { height: 100dvh; border-color: var(--sidebar-border); color: var(--sidebar-ink); }
.sidebar .nav-label { color: var(--sidebar-muted); }
.sidebar .nav-link { color: var(--sidebar-secondary); }
.sidebar .nav-link:hover { color: var(--sidebar-ink); background: var(--sidebar-hover); }
.sidebar .nav-link.active { color: var(--sidebar-active-ink); background: var(--sidebar-active); }
.sidebar :focus-visible { box-shadow: 0 0 0 2px var(--sidebar), 0 0 0 4px var(--accent); }
.nav-scroll { min-height: 0; flex: 1 1 auto; }

/* Footer stays in normal flex flow; only navigation scrolls. */
.sidebar-foot { flex: 0 0 auto; border-color: var(--sidebar-border); padding: 12px 6px 2px; display: grid; gap: 10px; }
.sidebar-context { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--sidebar-secondary); }
.sidebar-context b { font-family: var(--font-mono); color: var(--sidebar-ink); font-size: 11px; }
.sidebar-context .side-status { font-size: 11px; color: var(--sidebar-secondary); }
.sidebar-appearance { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 8px; align-items: center; }
.sidebar-appearance label { font-size: 11px; color: var(--sidebar-muted); }
.sidebar-appearance select { min-width: 0; width: 100%; height: 32px; border: 1px solid var(--sidebar-border); border-radius: 6px; padding: 0 8px; background: var(--sidebar); color: var(--sidebar-ink); font-size: 12px; color-scheme: dark; }
.sidebar-legal { display: grid; gap: 2px; font-size: 11px; color: var(--sidebar-muted); line-height: 1.5; }
.sidebar-legal .app-version { font-family: var(--font-mono); }
.sidebar-actions { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 8px; }
.sidebar .nav-collapse, .sidebar-about { height: 34px; margin: 0; width: 100%; min-width: 0; border: 1px solid var(--sidebar-border); border-radius: 6px; background: transparent; color: var(--sidebar-secondary); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; }
.sidebar .nav-collapse:hover, .sidebar-about:hover { color: var(--sidebar-ink); background: var(--sidebar-hover); }
.nav-collapse > .ico, .sidebar-about > .ico { width: 16px; height: 16px; flex: 0 0 16px; }
html[data-nav="collapsed"] .sidebar-context,
html[data-nav="collapsed"] .sidebar-appearance,
html[data-nav="collapsed"] .sidebar-legal { display: none; }
html[data-nav="collapsed"] .sidebar-foot { padding: 8px 0 2px; }
html[data-nav="collapsed"] .sidebar-actions { grid-template-columns: 1fr; }
.about-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.about-brand h3 { font-size: 18px; }
.about-kv { display: grid; gap: 12px; margin-bottom: 24px; }
.about-kv > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.about-kv dt { color: var(--muted); }
.about-theme { width: 100%; margin-top: 8px; }
.index-appearance { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.index-appearance select { max-width: 120px; }

@media (max-width:1023px) {
  .sidebar { height: 100dvh; width: min(280px,88vw); }
  html[data-nav="collapsed"] .sidebar-context { display: flex; }
  html[data-nav="collapsed"] .sidebar-appearance, html[data-nav="collapsed"] .sidebar-legal { display: grid; }
  html[data-nav="collapsed"] .sidebar-foot { padding: 12px 6px 2px; }
  html[data-nav="collapsed"] .sidebar-actions { grid-template-columns: 1fr; }
  .sidebar .nav-collapse { display: none; }
  .sidebar-about, .sidebar-appearance select { min-height: 44px; }
}
@media (max-width:520px) { .index-top { flex-wrap: wrap; gap: 16px; } }

/* Two original-style gauges retain their full size. */
.overview-gauges { scroll-margin-top: 72px; }
.position-gauge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 8px 24px 24px; }
.position-gauge { margin: 0; min-width: 0; text-align: center; }
.position-gauge > div { width: min(100%, 280px); margin: 0 auto; }
.position-gauge svg { width: 100%; height: auto; display: block; }
.position-gauge h3 { font-size: 14px; font-weight: 600; line-height: 1.5; }
.position-gauge p { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
@media (min-width:1024px) and (max-width:1279px) {
  .overview-grid > .overview-rail { grid-column: span 12; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width:600px) {
  .position-gauge-grid { grid-template-columns: 1fr; gap: 24px; padding: 8px 16px 24px; }
}

/* Revision 1.2: type, task hierarchy and restrained depth. */
:root { --ease-ui: cubic-bezier(.32,.72,0,1); --panel-highlight: #ffffffd9; --panel-depth: #1a36500a; }
html[data-theme="dark"] { --panel-highlight: #ffffff0c; --panel-depth: #00000020; }
.panel-title, .rail-title { font-size: 15px; letter-spacing: -.015em; }
.panel-sub, .rail-sub, .chart-note, .drawer-sub, .field-help, .summary-date, .todo small { font-size: 12px; line-height: 1.55; }
.todo, .summary-row, .alloc-row, .attr-row { font-size: 12.5px; }
.kpi-label, .kpi-foot, .field > label, .label, .form-section-title { font-size: 12px; }
.panel-head { padding: 18px 20px 0; }
.panel-body { padding: 16px 20px 20px; }
.rail-card { padding: 18px 20px; }
.chart-card, .overview-gauges { border-radius: 12px; border-color: color-mix(in srgb, var(--border) 75%, transparent); box-shadow: inset 0 1px 0 var(--panel-highlight), 0 6px 24px var(--panel-depth); }
.overview-gauges { padding-bottom: 4px; }
.overview-gauges .position-gauge-grid { padding-top: 16px; }
.overview-chart-tools { display: grid; grid-template-columns: minmax(0,1fr) 148px auto; gap: 8px; padding: 12px 20px 10px; width: 100%; }
.overview-chart-tools .seg { justify-self: start; height: 32px; align-items: center; }
.overview-chart-tools .seg button { height: 28px; font-size: 12px; }
.overview-chart-tools .select, .overview-chart-tools .btn { height: 32px; font-size: 12px; }
.chart-legend { padding: 0 20px 8px; gap: 12px; }
.legend-swatch:not(.dash):not(.dd) { background: var(--accent); }
.chart-note { padding: 4px 20px 16px; }
.defense-cash { display: grid; gap: 5px; padding: 18px 0 10px; }
.defense-cash > span { color: var(--muted); font-size: 12px; }
.defense-cash strong { font: 600 28px/1.15 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.baseline-disclosure { margin-left: auto; color: var(--muted); font-size: 12px; }
.baseline-disclosure summary { cursor: pointer; }
.baseline-disclosure p { max-width: 66ch; margin-top: 8px; padding: 12px 14px; background: var(--surface-soft); border-radius: 8px; line-height: 1.6; }
.baseline-note { margin: 12px 0 0; }
.asset-cash { background: var(--color-cash); }
.asset-stock { background: var(--color-stock); }
.asset-gold { background: var(--color-gold); }
.asset-forex { background: var(--color-forex); }
.asset-insurance { background: var(--color-insurance); }
.bar-fill { transition: transform 180ms var(--ease-ui); transform-origin: left center; }
.btn, .icon-btn, .cat-btn, .seg button { transition: background 160ms var(--ease-ui), border-color 160ms var(--ease-ui), transform 100ms var(--ease-ui); }
.btn:active, .icon-btn:active, .cat-btn:active { transform: scale(.98); }
.drawer-root.is-closing .drawer-panel { animation: none; transition: transform 160ms var(--ease-ui), opacity 160ms var(--ease-ui); transform: translateX(16px); opacity: 0; pointer-events: none; }
.drawer-root.is-closing .drawer-scrim { animation: none; transition: opacity 160ms var(--ease-ui); opacity: 0; }
@media (max-width:760px) {
  .panel-head { padding: 16px 16px 0; }
  .panel-body, .rail-card { padding: 16px; }
  .overview-chart-tools { grid-template-columns: minmax(0,1fr) auto; padding: 12px 16px; }
  .overview-chart-tools .seg { grid-column: 1 / -1; }
  .overview-chart-tools .select { width: 100%; }
  .chart-legend { padding-left: 16px; padding-right: 16px; }
  .chart-note { padding-left: 16px; padding-right: 16px; }
  .topbar #topbar-add, .topbar .nav-toggle { width: 44px; height: 44px; min-width: 44px; padding: 0; }
  .drawer-panel .icon-btn { width: 44px; height: 44px; }
  .drawer-panel .btn, .drawer-panel .cat-btn, .drawer-panel .seg button { min-height: 44px; height: auto; }
  .drawer-panel .input, .drawer-panel .select { min-height: 46px; }
  .drawer-panel .cat-btn { font-size: 12px; }
  .drawer-panel .form-grid { gap: 16px; }
  .baseline-disclosure { margin-left: 0; }
}

/* Revision 1.3: quiet navigation, header-only utilities. */
.sidebar-brand-row { display: flex; align-items: center; gap: 6px; flex: 0 0 44px; min-width: 0; }
.sidebar-brand-row .brand { flex: 1 1 auto; min-width: 0; padding: 0; gap: 8px; }
.sidebar-brand-row .brand-name { font-size: 12.5px; }
.sidebar-brand-row .brand-sub { font-size: 9px; letter-spacing: .035em; }
.sidebar-brand-row .nav-collapse { display: grid; place-items: center; width: 24px; height: 32px; flex: 0 0 24px; margin: 0; border: 0; background: transparent; color: var(--sidebar-muted); border-radius: 6px; padding: 0; }
.sidebar-brand-row .nav-collapse:hover { color: var(--sidebar-ink); background: var(--sidebar-hover); }
.sidebar-brand-row .nav-collapse .ico { width: 16px; height: 16px; }
html[data-nav="collapsed"] .sidebar-brand-row { flex-direction: column; flex-basis: 80px; gap: 0; }
html[data-nav="collapsed"] .sidebar-brand-row .brand { flex: 0 0 40px; width: 100%; }
html[data-nav="collapsed"] .sidebar-brand-row .nav-collapse { flex: 0 0 32px; }
.topbar .theme-toggle { border: 0; background: transparent; width: 32px; height: 32px; color: var(--fg-subtle); }
.topbar .theme-toggle:hover { background: var(--surface-soft); color: var(--fg); }
.theme-glyph { display: block; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--theme-glyph) center / contain no-repeat; mask: var(--theme-glyph) center / contain no-repeat; }
.glyph-moon { --theme-glyph: url("icons/phosphor/moon-light.svg"); }
.glyph-sun { --theme-glyph: url("icons/phosphor/sun-light.svg"); }
.profile-wrap { position: relative; }
.topbar .nav-toggle { display: none; }
.topbar .profile-avatar { display: grid; place-items: center; padding: 0; width: 32px; height: 32px; border: 0; background: transparent; cursor: pointer; }
.profile-avatar > span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-soft); color: var(--fg-subtle); font-size: 11px; }
.profile-avatar[aria-expanded="true"] > span { border-color: var(--accent); color: var(--accent-ink); }
.account-card { position: absolute; top: calc(100% + 10px); right: 0; width: 232px; max-width: calc(100vw - 24px); padding: 14px; display: grid; gap: 10px; z-index: 45; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-popover); color: var(--fg); }
.account-card[hidden] { display: none; }
.account-card strong { font-size: 13px; font-weight: 600; line-height: 1.45; }
.account-version { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.account-version > span:first-child { font-family: var(--font-mono); }
.account-tag { padding: 1px 5px; background: var(--surface-soft); border-radius: 4px; font-size: 10px; }
.account-card small { font-size: 11px; color: var(--muted); }
@media (max-width:1023px) {
  .topbar .nav-toggle { display: inline-grid; }
  html[data-nav="collapsed"] .sidebar-brand-row { flex-direction: row; flex-basis: 44px; gap: 6px; }
  html[data-nav="collapsed"] .sidebar-brand-row .brand { flex: 1 1 auto; width: auto; }
  .sidebar-brand-row .nav-collapse { width: 44px; height: 44px; flex: 0 0 44px; }
  html[data-nav="collapsed"] .sidebar-brand-row .nav-collapse { flex: 0 0 44px; }
}
@media (max-width:760px) {
  .topbar .theme-toggle, .topbar .profile-avatar { width: 44px; height: 44px; min-width: 44px; }
  .topbar-right { gap: 2px; }
}

/* Revision 1.4: actionable pending items in the header bell. */
.notification-wrap { position: relative; }
.topbar .notification-toggle { position: relative; width: 32px; height: 32px; border: 0; background: transparent; color: var(--fg-subtle); }
.topbar .notification-toggle:hover, .notification-toggle[aria-expanded="true"] { color: var(--accent-ink); background: var(--surface-soft); }
.notification-glyph { width: 18px; height: 18px; display: block; background: currentColor; -webkit-mask: url("icons/phosphor/bell-light.svg") center / contain no-repeat; mask: url("icons/phosphor/bell-light.svg") center / contain no-repeat; }
.notification-badge { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; display: grid; place-items: center; border-radius: 8px; background: var(--danger); color: var(--surface); font: 600 10px/1 var(--font-mono); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.notification-badge[hidden], .notification-panel[hidden] { display: none; }
.notification-panel { position: absolute; top: calc(100% + 10px); right: 0; width: 360px; max-width: calc(100vw - 24px); max-height: min(520px,calc(100dvh - 80px)); overflow-y: auto; z-index: 45; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-popover); }
.notification-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notification-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.notification-head > span { font-size: 12px; color: var(--muted); }
.notification-list { margin: 0; padding: 4px; list-style: none; }
.notification-item { display: grid; grid-template-columns: 6px minmax(0,1fr); gap: 10px; padding: 12px; border-radius: 6px; text-decoration: none; color: var(--fg); }
.notification-item:hover { background: var(--surface-soft); text-decoration: none; }
.notification-item strong { display: block; font-size: 13px; font-weight: 550; line-height: 1.5; }
.notification-item small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.notification-dot { width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: var(--warning); }
.notification-item.is-done .notification-dot { background: var(--success); }
.overview-grid > .overview-gauges { grid-column: span 12; }
.overview-gauges .position-gauge-grid { max-width: 820px; width: 100%; margin: 0 auto; }
@media (max-width:760px) {
  .topbar .notification-toggle { width: 44px; height: 44px; min-width: 44px; }
  .notification-badge { top: 4px; right: 3px; }
  .notification-panel { position: fixed; top: 62px; left: 12px; right: 12px; width: auto; max-width: none; max-height: calc(100dvh - 80px); }
  .notification-item { min-height: 44px; }
}
