:root { --muted: var(--ink-2); --c-alt: #8a9a92; }
.wrap { max-width: 860px; margin: 0 auto; padding: 40px 20px 72px; }
h1 { font: 600 clamp(30px, 5vw, 42px)/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font: 600 24px var(--serif); letter-spacing: -.01em; margin: 36px 0 14px; }
.subtitle { color: var(--muted); margin: 0 0 24px; max-width: 62ch; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select { width: 100%; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; height: 42px; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); margin: 5px 0 0; min-height: 1em; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.unit { position: relative; }
.unit input { padding-right: 76px; }
.unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); pointer-events: none; }
[hidden] { display: none !important; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.seg button { font: inherit; font-size: 14px; background: var(--field); color: var(--muted); border: 0; padding: 8px 18px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }

.totals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.total { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.total.hl { border-color: var(--brand); background: var(--brand-soft); }
.total .n { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.total .v { font: 600 28px var(--serif); margin: 0; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.total .s { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.total .s b { color: var(--ink); }
.insight { color: var(--muted); margin: 14px 0 0; font-size: 15px; max-width: 72ch; }
.insight b { color: var(--ink); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.legend b { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-panel { padding: 16px 16px 10px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); }
.chart .mark { stroke: var(--gold); stroke-dasharray: 4 4; }
.chart text { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .fill { stroke: none; }
.chart .line { fill: none; }
.chart .s0.fill { fill: var(--brand); fill-opacity: .16; }
.chart .s1.fill { fill: var(--c-alt); fill-opacity: .22; }
.chart .s0.line { stroke: var(--brand); stroke-width: 2.5; }
.chart .s1.line { stroke: var(--c-alt); stroke-width: 1.5; }
.chart .cursor { stroke: var(--ink-2); stroke-width: 1; }
.c0 { background: var(--brand); } .c1 { background: var(--c-alt); }
.tip { position: absolute; top: 0; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tip b { display: block; font-size: 13px; margin-bottom: 2px; }
.tip span { color: var(--muted); }

.sched-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 36px 0 14px; }
.sched-head h2 { margin: 0; }
.ghost { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.ghost:hover { color: var(--brand); border-color: var(--brand); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; max-height: 560px; overflow-y: auto; }
table.sched { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.sched th, .sched td { padding: 8px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.sched th:first-child, .sched td:first-child { text-align: left; }
.sched thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg-2); position: sticky; top: 0; }
.sched tr.ret td { border-top: 2px solid var(--gold); }
.sched td[data-c="neg"] { color: var(--err); }
.sched td[data-c="txt"] { text-align: left; color: var(--muted); }

.foot { color: var(--muted); font-size: 13px; margin-top: 32px; max-width: 70ch; }
@media (max-width: 760px) { .inputs { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .inputs { grid-template-columns: 1fr; }
  .seg button { padding: 8px 12px; }
  .sched th, .sched td { padding: 7px 8px; font-size: 13px; }
  .sched .hide-sm { display: none; }
}
@media print { .seg, #csv { display: none !important; } .table-wrap { max-height: none; } }
