:root {
  --bg: #f6f7f9; --card: #fff; --text: #1b1f24; --muted: #667085; --border: #e1e4e8;
  --accent: #0072B2; --pos: #0a7a4b; --neg: #b42318; --warn-bg: #fff4e5;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171a; --card: #1d2125; --text: #e8eaed; --muted: #98a2b3; --border: #30363d;
          --accent: #56B4E9; --pos: #3ccf91; --neg: #f97066; --warn-bg: #3a2c12; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--text); }
header { padding: 1rem 1.5rem 0; max-width: 1000px; margin: auto; }
h1 { margin: 0 0 .5rem; font-size: 1.4rem; }
h2 { margin: 0 0 .75rem; font-size: 1.1rem; }
h3 { margin: 0; font-size: 1rem; }
main { max-width: 1000px; margin: auto; padding: 1rem 1.5rem 3rem; }
.summary { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: .75rem; }
.summary strong { font-size: 1.15rem; display: block; }
.warn { background: var(--warn-bg); padding: .4rem .75rem; border-radius: 6px; flex-basis: 100%; }
nav { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
nav a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
nav a[aria-current] { color: var(--text); border-color: var(--accent); font-weight: 600; }
a { color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.row { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin-bottom: .5rem; }
.row.between { justify-content: space-between; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; align-items: end; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .4rem; }
label.row { flex-direction: row; align-items: center; color: var(--text); }
input, select, button { font: inherit; padding: .4rem .55rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
input:focus-visible, select:focus-visible, button:focus-visible, nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
button.danger { background: var(--neg); border-color: var(--neg); }
button.link { background: none; border: none; color: var(--muted); padding: .1rem .4rem; }
button.link:hover { color: var(--neg); }
.file input { display: none; }
.file { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .7rem; cursor: pointer; color: var(--text); font-size: 1rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.n { text-align: right; font-variant-numeric: tabular-nums; }
input.price { width: 6.5rem; text-align: right; }
tr.total td { font-weight: 600; border-bottom: none; }
.split { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; }
.split table { flex: 1; min-width: 280px; }
.donut { width: 220px; height: 220px; }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; margin-right: .5rem; }
.goal { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .75rem; }
.line { width: 100%; max-width: 560px; height: auto; }
.line .gridline { stroke: var(--border); }
.line .axis { fill: var(--muted); font-size: 11px; }
.line .series { stroke: var(--accent); stroke-width: 2.5; }
.line .target { stroke: var(--muted); stroke-dasharray: 5 4; }
.hint { font-size: .8rem; }
.attention { border-color: var(--accent); }
.roll { margin: .5rem 0; background: var(--bg); }
.roll .row { margin: .5rem 0 0; }
button.secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.preview { align-self: center; font-size: .85rem; }
.stats { display: flex; gap: 2rem; flex-wrap: wrap; }
.stats > div { display: flex; flex-direction: column; }
.stats strong { font-size: 1.15rem; }
details.project { border-top: 1px solid var(--border); padding: .6rem 0; }
details.project summary { cursor: pointer; display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
details.project .sum { margin-left: auto; font-variant-numeric: tabular-nums; }
.badge { font-size: .75rem; padding: .05rem .5rem; border: 1px solid var(--border); border-radius: 999px; }
.badge.neg { border-color: var(--neg); }
details.project h3 { margin: .75rem 0 .4rem; }
/* Hint sits below its field without making the label taller, so inputs stay aligned. */
.has-hint { position: relative; }
.has-hint .hint { position: absolute; top: 100%; left: 0; white-space: nowrap; }
.hint-grid { row-gap: 1.5rem; }
.syncstat { font-size: .75rem; font-weight: 400; margin-left: .5rem; padding: .1rem .55rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); text-decoration: none; vertical-align: middle; }
.syncstat.attn { color: var(--neg); border-color: var(--neg); }
