: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 28px; max-width: 60ch; }
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; gap: 16px; margin-bottom: 20px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.unit { position: relative; }
.full { grid-column: 1 / -1; }
.gst-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
label.check { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; color: var(--ink); cursor: pointer; flex: 1 1 280px; }
label.check small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
label.check input { width: 18px; height: 18px; padding: 0; margin: 0; flex: none; accent-color: var(--brand); }
.gst-rate { width: 110px; }
.gst-rate-field { display: flex; align-items: center; gap: 10px; }
.gst-rate-field label { margin: 0; }
.pair.rate-pair { grid-template-columns: minmax(0, 1fr) auto; }
.rate-pair select { width: auto; }
.sub-head { padding-top: 14px; border-top: 1px solid var(--line); font: 600 16px var(--serif); }
.sub-head span { display: block; font: 400 12.5px var(--sans); color: var(--muted); margin-top: 2px; }
.sched tr.up td { color: var(--muted); font-style: italic; }
.unit input { padding-right: 40px; }
.unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); pointer-events: none; }

.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); }
.split { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--bg-2); margin: 10px 0 4px; }
.split i { display: block; height: 100%; }

.section-note { color: var(--muted); font-size: 14px; margin: -6px 0 14px; max-width: 70ch; }
.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 16px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.seg.small { margin: 0; }
.seg.small button { font-size: 13px; padding: 6px 12px; }

.pp { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; margin-bottom: 12px; }
.pp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pp-head .kind { font-size: 12px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 3px 10px; border-radius: 99px; }
.pp-head .spacer { flex: 1; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.remove { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 6px 12px;
  cursor: pointer; font: inherit; font-size: 13px; }
.remove:hover { color: var(--err); border-color: var(--err); }
#csv:hover { color: var(--brand); border-color: var(--brand); }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.add { flex: 1; min-width: 180px; background: transparent; border: 1.5px dashed var(--line); color: var(--muted); border-radius: 14px;
  padding: 11px; font: inherit; cursor: pointer; }
.add:hover { border-color: var(--brand); color: var(--brand); }
.insight { color: var(--muted); margin: 14px 0 0; font-size: 15px; }
.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: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.c1 { background: var(--brand); } .c2 { background: var(--c-alt); }
.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 text { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .l-with { stroke: var(--brand); stroke-width: 2.5; fill: none; }
.chart .l-without { stroke: var(--c-alt); stroke-width: 2; fill: none; stroke-dasharray: 5 4; }
.chart .area { fill: var(--brand); opacity: .08; }
.chart .cursor { stroke: var(--ink-2); stroke-width: 1; }
.chart .dot { fill: var(--brand); stroke: var(--card); stroke-width: 2; }
.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; }
.sched-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
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.yr { cursor: pointer; }
.sched tr.yr:hover td { background: var(--bg-2); }
.sched tr.yr td:first-child { font-weight: 600; }
.sched tr.yr td:first-child::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .15s; }
.sched tbody.open tr.yr td:first-child::before { transform: rotate(90deg); }
.sched tr.mo { display: none; }
.sched tbody.open tr.mo { display: table-row; }
.sched tr.mo td { font-size: 13px; color: var(--muted); background: color-mix(in srgb, var(--bg-2) 45%, transparent); }
.sched tr.mo td:first-child { padding-left: 32px; }
.sched td.pp-cell { color: var(--gold); }
.sched td.pct { color: var(--muted); }
.sched tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--ink-2); }

.foot { color: var(--muted); font-size: 13px; margin-top: 32px; max-width: 70ch; }
@media (max-width: 560px) {
  .inputs { grid-template-columns: 1fr; }
  .sched th, .sched td { padding: 7px 10px; }
  .sched .hide-sm { display: none; }
}
@media print { .add-row, .seg, #csv, .pp .remove { display: none !important; } .sched tr.mo { display: table-row; } }
.foot a { color: var(--brand); }
