:root {
  color-scheme: dark;
  --background: #0c1018;
  --panel: #101620;
  --surface: #18202e;
  --border: #273244;
  --text: #eef2fa;
  --muted: #a0adc1;
  --blue: #82aaff;
  --teal: #7ed9c4;
  --lavender: #c1a3f5;
  --warning: #ecc592;
  --target: #f0a6ca;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
button, input { font: inherit; color: inherit; }
button, input[type="range"] { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, canvas:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
button { transition: background .18s, color .18s, border-color .18s; }
button:active { filter: brightness(.9); }
button:disabled, input:disabled { cursor: default; }
svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.app-header { height: 76px; display: flex; align-items: center; padding: 0 32px; gap: 28px; border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; gap: 12px; align-items: center; color: var(--text); text-decoration: none; font-size: 23px; font-weight: 650; letter-spacing: -.8px; }
.brand-mark { width: 29px; height: 29px; color: var(--blue); }
.brand-dot { color: var(--blue); }
.header-description { color: var(--muted); font-size: 13px; padding-left: 28px; border-left: 1px solid var(--border); }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 10px 0; min-height: 44px; }
.text-button:hover { color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.signed-in { color: var(--muted); font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.about-button { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.about-button svg { width: 17px; }
.github-link { color: var(--muted); text-decoration: none; transition: background .18s, color .18s; }
.github-link:hover { color: var(--text); background: #1a2434; }
.github-link svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: var(--surface); border-radius: 8px; }
.workspace { display: grid; grid-template-columns: 350px minmax(0, 1fr); height: calc(100dvh - 76px); min-height: 570px; }
.controls-panel { background: var(--panel); border-right: 1px solid var(--border); padding: 26px 26px 18px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #354056 transparent; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
h1, h2, p { margin: 0; }
h1 { font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.panel-heading p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.control-section { border-bottom: 1px solid var(--border); padding: 18px 0; }
.control-section h2 { font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 8px; margin-bottom: 15px; }
.section-dot { width: 6px; height: 6px; border-radius: 50%; }
.start-dot { background: var(--blue); }
.horizon-dot { background: var(--lavender); }
.entry-dot { background: var(--teal); }
.target-dot { background: var(--target); }
.section-count { margin-left: auto; color: var(--muted); font-weight: 500; }
.entry-section { border-bottom: 0; }
.control { margin-bottom: 8px; }
.control-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.control-top label, .field > span { color: var(--muted); font-size: 12px; }
.value-field { display: flex; align-items: center; border: 1px solid var(--border); background: #0c121d; border-radius: 6px; padding: 0 8px; width: 133px; min-width: 0; }
.value-field.full { width: 100%; }
.value-field:focus-within { border-color: var(--blue); }
.value-field input { background: transparent; border: 0; color: var(--text); text-align: right; min-width: 0; width: 100%; padding: 8px 0; font-size: 13px; font-weight: 550; outline: none; font-variant-numeric: tabular-nums; }
.value-field .unit { color: var(--muted); font-size: 10px; padding-left: 7px; }
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.control input[type="range"] { appearance: none; width: 100%; height: 26px; margin: 1px 0 0; background: transparent; --fill: 0%; }
.control input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, var(--blue) var(--fill), #303b4d var(--fill)); }
.control input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, var(--blue) var(--fill), #303b4d var(--fill)); }
.control input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border: 2px solid #d5e2ff; border-radius: 50%; background: var(--blue); margin-top: -4.5px; box-shadow: 0 0 0 4px #82aaff0c; }
.control input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #d5e2ff; border-radius: 50%; background: var(--blue); }
.control input[type="range"]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 6px #82aaff20; }
.range-bounds { display: flex; justify-content: space-between; gap: 12px; }
.range-bounds label { display: flex; gap: 5px; align-items: baseline; color: var(--muted); font-size: 10px; }
.range-bounds input { min-width: 0; width: 64px; color: #b7c4d9; background: transparent; border: 0; border-bottom: 1px solid #344055; padding: 3px 0; border-radius: 0; font-size: 10px; font-variant-numeric: tabular-nums; }
.range-bounds label:last-child input { text-align: right; }
.control-help { font-size: 11px; color: var(--muted); margin-top: 8px; }
.control-error { color: var(--warning); font-size: 11px; margin-top: 8px; }
.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field input[type="date"], .form-stack input {
  width: 100%;
  min-height: 38px;
  background: #0c121d;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
}
.field input[type="date"]:focus, .form-stack input:focus { border-color: var(--blue); outline: none; }
.panel-button { width: 100%; margin-top: 12px; }
.entry-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.entry-row { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; background: #0c121d; border: 1px solid var(--border); border-radius: 8px; }
.entry-date { color: var(--muted); font-size: 12px; }
.entry-weight { margin-left: auto; font-weight: 550; font-variant-numeric: tabular-nums; }
.entry-remove { border: 0; background: transparent; color: var(--muted); width: 44px; height: 44px; font-size: 18px; }
.entry-remove:hover { color: var(--text); }
.panel-footnote { font-size: 11px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--border); line-height: 1.6; }
.projection-panel { min-width: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 38px 44px 22px; background: radial-gradient(ellipse at 75% 0, #17223840, transparent 52%); }
.projection-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.projection-caption { display: flex; gap: 9px; align-items: center; color: #bcc7d9; font-size: 13px; }
.live-dot { width: 6px; height: 6px; background: var(--blue); border-radius: 50%; box-shadow: 0 0 0 4px #82aaff0b; }
.balance-heading { display: flex; gap: 12px; align-items: baseline; margin-top: 14px; flex-wrap: wrap; }
.hero-value { font-size: clamp(32px, 3.5vw, 58px); font-weight: 550; line-height: 1.1; letter-spacing: -2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.balance-currency { color: var(--muted); font-size: 18px; font-weight: 400; }
.projection-subtitle { color: var(--muted); font-size: 12px; margin-top: 12px; }
.expand-button { display: flex; gap: 8px; align-items: center; padding: 9px 12px; min-height: 40px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); font-size: 11px; background: #111823; }
.expand-button:hover { color: var(--text); border-color: #4b6084; }
.expand-button svg { width: 15px; height: 15px; }
.metrics { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 29px; padding-bottom: 26px; border-bottom: 1px solid var(--border); gap: 16px; }
.metric { display: flex; flex-direction: column; gap: 6px; }
.metric > span { color: var(--muted); font-size: 11px; }
.metric strong { font-size: clamp(13px, 1.35vw, 19px); font-weight: 550; letter-spacing: -.3px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric .gain-value { color: var(--teal); }
.metric .negative { color: var(--warning); }
.return-metric { text-align: right; }
.chart-container { position: relative; flex: 1; min-height: 240px; margin-top: 20px; }
#weight-chart { width: 100%; height: 100%; position: absolute; display: block; touch-action: pan-y; border-radius: 4px; }
.chart-tooltip { position: absolute; pointer-events: none; z-index: 2; width: 210px; padding: 15px 16px; border: 1px solid #3d4c65; border-radius: 10px; background: #182130f5; box-shadow: 0 12px 32px #0006; backdrop-filter: blur(12px); font-size: 11px; }
.tooltip-date { color: #c4cede; margin-bottom: 12px; }
.tooltip-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); }
.tooltip-row strong { color: var(--blue); font-weight: 550; font-variant-numeric: tabular-nums; }
.chart-empty { position: absolute; inset: 20% 15% auto; text-align: center; pointer-events: none; background: #101620dd; border: 1px solid var(--border); border-radius: 10px; padding: 22px; }
.chart-empty span { font-size: 16px; }
.chart-empty p { color: var(--muted); font-size: 12px; margin-top: 6px; }
.chart-legend { display: flex; justify-content: center; gap: 22px; padding: 15px 0 19px; flex-wrap: wrap; }
.chart-legend > span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.legend-mark { display: inline-block; width: 16px; height: 2px; background: var(--blue); }
.forecast-mark { height: 0; background: transparent; border-top: 2px dashed var(--teal); }
.weigh-in-mark { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.target-mark { height: 0; background: transparent; border-top: 2px dotted var(--target); }
.projection-message { background: #251f18; border: 1px solid #665238; color: var(--warning); border-radius: 6px; padding: 10px 14px; margin-bottom: 15px; font-size: 12px; }
.login-screen { min-height: calc(100dvh - 76px); display: grid; place-items: center; padding: 32px 16px; }
.boot-status { color: var(--muted); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack input { min-height: 44px; }
.form-stack .primary-button { width: 100%; margin-top: 4px; }
.form-stack .control-error, .form-stack .control-help { margin-top: 0; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid #3b4b64; border-radius: 14px; padding: 28px; box-shadow: 0 30px 90px #0008; }
.login-card h1 { font-size: 22px; letter-spacing: -.5px; }
.login-card p { color: #b7c4d9; font-size: 13px; line-height: 1.65; }
#password-dialog { width: min(440px, calc(100% - 32px)); }
body.chart-expanded { overflow: hidden; }
.chart-expanded .app-header { visibility: hidden; }
dialog { background: var(--panel); color: var(--text); border: 1px solid #3b4b64; border-radius: 14px; padding: 26px; width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 40px); box-shadow: 0 30px 90px #0008; }
dialog::backdrop { background: #04080eb8; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.dialog-heading h2 { font-size: 22px; letter-spacing: -.5px; }
dialog p, dialog li { color: #b7c4d9; font-size: 13px; line-height: 1.65; }
dialog ul { padding-left: 18px; }
dialog li { margin-bottom: 8px; }
.dialog-note { padding-top: 15px; border-top: 1px solid var(--border); }
.primary-button { border: 0; background: var(--blue); color: #101a2b; font-weight: 600; border-radius: 7px; padding: 11px 22px; min-height: 44px; }
.primary-button:disabled { opacity: .45; }
.noscript { position: fixed; inset: auto 0 0; background: var(--warning); color: #151b25; padding: 20px; text-align: center; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (min-width: 1700px) {
  .workspace { grid-template-columns: 380px minmax(0, 1fr); }
  .controls-panel { padding-inline: 32px; }
  .projection-panel { padding: 50px 64px 30px; }
}
@media (max-width: 1150px) {
  .workspace { grid-template-columns: 320px minmax(0, 1fr); }
  .controls-panel { padding-inline: 20px; }
  .projection-panel { padding: 30px 26px 20px; }
  .expand-button span { display: none; }
  .metrics { gap: 10px; }
  .signed-in { display: none; }
}
@media (min-width: 851px) {
  .workspace.is-expanded { position: fixed; inset: 0; z-index: 5; grid-template-columns: minmax(0, 1fr); height: 100dvh; min-height: 0; background: var(--background); }
  .workspace.is-expanded .controls-panel { display: none; }
  .workspace.is-expanded .projection-panel { min-height: 0; padding: 16px 20px 0; overflow: hidden; }
  .workspace.is-expanded .projection-heading { position: absolute; top: 16px; right: 20px; z-index: 3; }
  .workspace.is-expanded .projection-heading > div, .workspace.is-expanded .metrics { display: none; }
  .workspace.is-expanded .expand-button span { display: inline; }
  .workspace.is-expanded .chart-container { min-height: 0; margin-top: 12px; }
  .workspace.is-expanded .chart-legend { padding: 12px 0 16px; }
}
@media (max-width: 850px) {
  .app-header { height: 68px; padding-inline: 24px; }
  .header-description, .expand-button { display: none; }
  .workspace, .workspace.is-expanded { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .controls-panel, .workspace.is-expanded .controls-panel { visibility: visible; padding: 25px; overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
  .projection-panel, .workspace.is-expanded .projection-panel { padding: 30px 25px 25px; overflow: visible; }
  .hero-value { font-size: 48px; }
  .chart-container { flex: none; height: 380px; }
  .metric strong { font-size: 18px; }
  .value-field input, .field input[type="date"], .range-bounds input { min-height: 44px; font-size: 16px; }
  .control input[type="range"] { height: 44px; }
}
@media (max-width: 540px) {
  .app-header { padding-inline: 20px; gap: 10px; }
  .brand { font-size: 21px; gap: 9px; }
  .about-button { font-size: 0; }
  .controls-panel, .workspace.is-expanded .controls-panel { padding: 23px 20px; }
  .split-fields { grid-template-columns: 1fr; }
  .projection-panel, .workspace.is-expanded .projection-panel { padding: 28px 16px 22px; }
  .hero-value { font-size: 40px; letter-spacing: -1.5px; }
  .metrics { grid-auto-flow: row; grid-template-columns: 1fr 1fr; gap: 20px; }
  .return-metric { text-align: left; }
  .chart-container { height: 340px; }
  .chart-empty { inset-inline: 8%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
