:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #566170;
  --line: #e5e7eb;
  --line-strong: #c9d1ce;
  --brand: #169c64;
  --brand-btn: #117a4e;
  --brand-btn-hover: #0e6842;
  --brand-ink: #0f6e47;
  --brand-wash: #e7f5ee;
  --warn-ink: #8a4b00;
  --warn-wash: #fdf2de;
  --danger: #b42318;
  --danger-wash: #fdecea;
  --radius: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  accent-color: var(--brand-btn);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

::selection { background: var(--brand-wash); color: var(--brand-ink); }
input, textarea { caret-color: var(--brand-btn); }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--brand-btn);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Header ───────────────────────────────────────────── */

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner {
  max-width: 680px; margin: 0 auto; padding: 0 16px; min-height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.mark { width: 22px; height: 22px; color: var(--brand); flex: none; }
.brand-name { font-weight: 800; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-weight: 500; }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); min-width: 0; }
.who strong { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand-ink); font-weight: 600; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link:hover { text-decoration-thickness: 2px; }
a.link { display: inline; }
.link.ext { white-space: nowrap; }
.link.ext svg { width: 13px; height: 13px; margin-left: 3px; vertical-align: -1px; }

/* ── Page ─────────────────────────────────────────────── */

.wrap { max-width: 680px; margin: 0 auto; padding: 40px 16px 96px; }
.view { animation: rise 0.45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 800; text-wrap: balance; }
h1:focus { outline: none; }
.lede { color: var(--muted); margin-top: 12px; max-width: 60ch; text-wrap: pretty; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; margin-top: 28px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 24px -12px rgba(17, 24, 39, 0.08);
}

/* ── Stepper ──────────────────────────────────────────── */

.steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 0 0 28px; padding: 0; list-style: none; }
.step { border-top: 3px solid var(--line-strong); padding-top: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.step.done { border-color: var(--brand); color: var(--ink); }
.step.current { border-color: var(--brand-btn); color: var(--ink); }
.step small { display: block; font-weight: 500; color: var(--muted); }

/* ── Forms ────────────────────────────────────────────── */

form { display: grid; gap: 24px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.hint { font-weight: 400; font-size: 14px; color: var(--muted); }

input[type='text'], input[type='password'], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; min-height: 84px; font-weight: 400; }
input::placeholder, textarea::placeholder { color: #6b7480; }
input:hover, textarea:hover { border-color: #9aa6a1; }
input:focus, textarea:focus { outline: 2px solid var(--brand-btn); outline-offset: 0; border-color: var(--brand-btn); }
input[aria-invalid='true'] { border-color: var(--danger); }

.q-prompt { font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; font-weight: 700; text-wrap: balance; }
.q-context { color: var(--muted); font-size: 15px; margin-top: 8px; }

/* Option rows (radio) */
.options { display: grid; gap: 10px; margin-top: 20px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 14px 16px; background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s;
}
.option:hover { border-color: #8d9b95; }
.option:has(input:checked) { border-color: var(--brand-btn); background: var(--brand-wash); }
.option:has(input:focus-visible) { outline: 2px solid var(--brand-btn); outline-offset: 2px; }
.option input { margin: 3px 0 0; width: 18px; height: 18px; flex: none; }
.option b { display: block; font-weight: 600; }
.option span small { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.reveal { margin-top: 4px; padding-left: 4px; }

/* Segmented approve / change */
.seg { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg label { position: relative; display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px;
  font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background-color 0.15s, color 0.15s;
}
.seg label + label span { border-left: 1px solid var(--line-strong); }
.seg input:hover + span { background: #f0f4f2; }
.seg input:checked + span { background: var(--brand-wash); color: var(--brand-ink); }
.seg input[value='change']:checked + span { background: var(--warn-wash); color: var(--warn-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--brand-btn); outline-offset: -2px; }

/* Slider */
.slider { padding: 4px 0 0; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.slider-head label { font-weight: 600; font-size: 15px; }
.slider-head output { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--brand-ink); }
.slider input[type='range'] {
  --fill: 50%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 4px 0 0; background: transparent; cursor: pointer;
}
.slider input[type='range']::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--brand-btn) var(--fill), var(--line-strong) var(--fill));
}
.slider input[type='range']::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line-strong); }
.slider input[type='range']::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand-btn); }
.slider input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand-btn); box-shadow: 0 1px 3px rgba(17, 24, 39, 0.25);
  transition: transform 0.15s var(--ease);
}
.slider input[type='range']::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-btn); box-shadow: 0 1px 3px rgba(17, 24, 39, 0.25);
}
.slider input[type='range']:active::-webkit-slider-thumb { transform: scale(1.12); }
.slider input[type='range']:focus-visible { outline: none; }
.slider input[type='range']:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--brand-btn); outline-offset: 3px; }
.slider input[type='range']:focus-visible::-moz-range-thumb { outline: 2px solid var(--brand-btn); outline-offset: 3px; }
.slider-scale { display: flex; justify-content: space-between; margin-top: -4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.slider .hint { margin-top: 8px; }

/* Pricing rows */
.plans { display: grid; margin-top: 20px; border-top: 1px solid var(--line); }
.plan { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.plan-name { font-weight: 700; }
.plan-price { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-price strong { color: var(--ink); font-size: 18px; font-weight: 700; margin-right: 6px; letter-spacing: -0.01em; }
.plan .reveal { grid-column: 1 / -1; padding: 0; }
.money { position: relative; }
.money > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money input { padding-left: 28px; }

/* Revenue */
.shares { display: grid; margin-top: 20px; gap: 12px; }
.share { display: grid; grid-template-columns: 1fr 150px; gap: 16px; align-items: center; }
.share .who-name { font-weight: 600; }
.pct { position: relative; }
.pct input { padding-right: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.pct > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.total { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; }
.total output { font-weight: 700; font-variant-numeric: tabular-nums; }
.total.ok output { color: var(--brand-ink); }
.total.off output { color: var(--warn-ink); }

/* Buttons */
.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: 6px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--brand-btn); color: #fff; transition: background-color 0.15s, transform 0.15s var(--ease);
}
.btn:hover { background: var(--brand-btn-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: #f0f4f2; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }

.error { color: var(--danger); background: var(--danger-wash); border-radius: 6px; padding: 10px 12px; font-size: 14px; font-weight: 500; }
.error:empty { display: none; }

/* ── Results ──────────────────────────────────────────── */

.banner { display: flex; gap: 14px; align-items: flex-start; border-radius: var(--radius); padding: 20px; margin-top: 28px; }
.banner svg { flex: none; width: 28px; height: 28px; margin-top: 2px; }
.banner h2 { font-size: 20px; letter-spacing: -0.015em; font-weight: 700; }
.banner p { margin-top: 4px; font-size: 15px; }
.banner.agreed { background: var(--brand-wash); color: var(--brand-ink); }
.banner.open { background: var(--warn-wash); color: var(--warn-ink); }
.banner.wait { background: #eef1f0; color: var(--ink); }

.decisions { margin-top: 28px; display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.decision { padding: 24px 28px; }
.decision + .decision { border-top: 1px solid var(--line); }
.decision-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.decision h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill svg { width: 14px; height: 14px; }
.pill.ok { background: var(--brand-wash); color: var(--brand-ink); }
.pill.no { background: var(--warn-wash); color: var(--warn-ink); }

.items { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.item-label { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.item-label b { font-weight: 600; }
.item-outcome { font-weight: 700; font-variant-numeric: tabular-nums; }
.item-label .mini { margin-left: auto; }
.item-big { font-size: 17px; }
.mini { font-size: 12px; font-weight: 600; }
.mini.ok { color: var(--brand-ink); }
.mini.no { color: var(--warn-ink); }
.positions { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 15px; }
.positions li { display: grid; grid-template-columns: minmax(90px, 160px) 1fr; gap: 12px; }
.positions .p-name { color: var(--muted); }
.positions .p-text { font-variant-numeric: tabular-nums; }
.notes { margin-top: 14px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.notes q { quotes: '“' '”'; color: var(--ink); }
.decision-foot { margin-top: 16px; }

.mine { margin-top: 28px; }
.mine h2 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

.board { margin-top: 16px; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.dots i.on { background: var(--brand); }

@media (max-width: 560px) {
  .wrap { padding-top: 28px; }
  h1 { font-size: 26px; }
  .panel, .decision { padding: 20px 16px; }
  .plan { grid-template-columns: 1fr; }
  .seg { display: grid; }
  .share { grid-template-columns: 1fr 120px; }
  .positions li { grid-template-columns: 1fr; gap: 0; }
  .actions .btn { flex: 1 1 auto; }
  .brand-sub { display: none; }
  .who .pre { display: none; }
  .who .link { white-space: nowrap; }
  .step { font-size: 13px; }
  .steps { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  * { transition: none !important; }
}
