/* Brand: Pivomo brand guidelines v1.0 (Oct 2026). Core Ink #231F20 and White, accents Lime #DBE13F and
   Coral #F05050, support Slate #555861 and Mist #C8D1D9. Josefin Sans for display, Mulish for body.
   Coral is large text and graphics only; small coral-toned text uses --coral-ink. "Now" blue is a data
   colour (Andrew's v2 feedback), not a brand colour. */
:root {
  color-scheme: light;
  --ground: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #E9EDF1;
  --ink: #231F20;
  --muted: #555861;
  --line: #D5DCE2;
  --lime: #DBE13F;
  --lime-ink: #545A0C;
  --lime-soft: #F3F6CC;
  --coral: #F05050;
  --coral-ink: #A82C2B;
  --coral-soft: #FCE4E2;
  --now: #2F6FD1;
  --now-soft: #DFE9FA;
  --focus: #2F6FED;
  --logo: #231F20;
  --shadow: 0 1px 2px rgba(35,31,32,.06), 0 8px 24px rgba(35,31,32,.06);
  --display: "Josefin Sans", "Century Gothic", "Avenir Next", system-ui, sans-serif;
  --body: "Mulish", "Avenir Next", "Segoe UI", Arial, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #1B1819; --surface: #252122; --surface-2: #2E2A2B; --ink: #F3F5F7; --muted: #AEB6BF; --line: #3B3637;
    --lime: #DBE13F; --lime-ink: #E3E88A; --lime-soft: #34361A; --coral: #F05050; --coral-ink: #F47A72; --coral-soft: #3D2423;
    --now: #7AA6F2; --now-soft: #1F2C45; --focus: #DBE13F; --logo: #FFFFFF;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #1B1819; --surface: #252122; --surface-2: #2E2A2B; --ink: #F3F5F7; --muted: #AEB6BF; --line: #3B3637;
  --lime: #DBE13F; --lime-ink: #E3E88A; --lime-soft: #34361A; --coral: #F05050; --coral-ink: #F47A72; --coral-soft: #3D2423;
  --now: #7AA6F2; --now-soft: #1F2C45; --focus: #DBE13F; --logo: #FFFFFF;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* shell */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--ground); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 640px; margin: 0 auto; padding: 12px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.wordmark { display: block; position: relative; width: 96px; height: 24px; flex: none; }
.wordmark::before, .wordmark::after { content: ""; position: absolute; inset: 0; -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.wordmark::before { background: var(--logo); -webkit-mask-image: url("/icons/wordmark.png"); mask-image: url("/icons/wordmark.png"); }
.wordmark::after { background: var(--coral); -webkit-mask-image: url("/icons/wordmark-dot.png"); mask-image: url("/icons/wordmark-dot.png"); }
.step { font-family: var(--display); font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress { display: flex; gap: 4px; max-width: 640px; margin: 0 auto; padding: 0 16px 6px; }
.progress .seg { flex: 7; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress .seg-final { flex: 3; }
.progress .seg i { display: block; height: 100%; width: 0; background: var(--lime); transition: width .3s ease; }
.progress .seg i.done { background: var(--lime-ink); }
.progress-labels { display: flex; gap: 4px; max-width: 640px; margin: 0 auto; padding: 0 16px 8px; font-family: var(--display); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.progress-labels span { flex: 7; }
.progress-labels .seg-final { flex: 3; text-align: right; white-space: nowrap; }
@media (max-width: 420px) { .progress-labels { font-size: 10px; letter-spacing: .04em; } }
@media (prefers-reduced-motion: reduce) { .progress .seg i { transition: none; } }

main { max-width: 640px; margin: 0 auto; padding: 24px 16px 132px; }
.narrow { max-width: 520px; margin: 0 auto; }

.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--ground); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
.actions-inner { max-width: 520px; margin: 0 auto; display: flex; gap: 10px; }
.actions-inner > .btn { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 20px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: .03em; transition: transform .08s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn-lime { background: var(--lime); color: #231F20; border-color: var(--lime); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--coral-ink); }
.btn-sm { padding: 10px 15px 8px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }

.eyebrow { font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--coral-ink); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.note { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* status chip */
.status { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 6; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted); }
.status.ok { color: var(--lime-ink); }
.status.warn { color: var(--coral-ink); }
.status.report { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

/* welcome */
.hero h1 { font-size: 40px; font-weight: 300; letter-spacing: -.01em; }
.hero h1 b { font-weight: 600; color: var(--coral); }
.hero p { font-size: 17px; max-width: 34em; }
.stack { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.card h3 { font-size: 18px; margin-bottom: 6px; }
.flow { display: grid; grid-template-columns: 1fr; gap: 10px; }
.flow-step { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.flow-step .n { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 600; background: var(--lime-soft); color: var(--lime-ink); }
.flow-step .n.ai { background: var(--coral-soft); color: var(--coral-ink); }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field input[type="text"], textarea { font: inherit; color: inherit; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
textarea { min-height: 88px; resize: vertical; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--lime-ink); }
.banner { background: var(--lime-soft); color: var(--lime-ink); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.banner.coral { background: var(--coral-soft); color: var(--coral-ink); }

/* item */
.item h2 { font-size: 26px; margin: 6px 0 4px; }
.item .poles { font-family: var(--display); font-size: 15px; color: var(--muted); }
.item .question { font-size: 17px; margin-top: 14px; }
.scale { margin-top: 22px; display: grid; gap: 22px; }
.scale-row { display: grid; gap: 8px; }
.scale-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.scale-head .who { font-family: var(--display); font-weight: 600; font-size: 16px; }
.scale-head .val { font-family: var(--body); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); }
.scale-row.future .val { background: var(--lime-soft); color: var(--lime-ink); }
.scale-row.now .val { background: var(--now-soft); color: var(--now); }
.ends { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.ends span { max-width: 48%; }
.ends span:last-child { text-align: right; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--line) 0 49.5%, var(--muted) 49.5% 50.5%, var(--line) 50.5% 100%); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--line) 0 49.5%, var(--muted) 49.5% 50.5%, var(--line) 50.5% 100%); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; margin-top: -11px; background: var(--surface); border: 3px solid var(--now); box-shadow: var(--shadow); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 3px solid var(--now); box-shadow: var(--shadow); cursor: pointer; }
.scale-row.future input[type="range"]::-webkit-slider-thumb { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime-ink), var(--shadow); }
.scale-row.future input[type="range"]::-moz-range-thumb { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime-ink), var(--shadow); }
details.poles-detail { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
details.poles-detail summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.pole-defs { display: grid; gap: 12px; margin-top: 12px; font-size: 15px; }
.pole-defs b { font-family: var(--display); font-weight: 600; display: block; }
.comment { margin-top: 18px; }

/* probe */
.probe-shift { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--display); font-size: 15px; }
.chip { padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.chip-now { background: var(--now-soft); color: var(--now); }
.chip-future { background: var(--lime-soft); color: var(--lime-ink); }
.probe-q { font-size: 21px; font-family: var(--display); font-weight: 400; margin-top: 16px; min-height: 2.4em; }
.ai-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.ai-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); display: inline-block; }
.ai-tag i.static { background: var(--muted); }

/* report */
.report { display: grid; gap: 28px; }
.report-head h1 { font-size: 34px; font-weight: 300; }
.report-head h1 b { font-weight: 600; }
.profile-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-family: var(--display); font-size: 17px; }
.arrow { color: var(--muted); }
.chart-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.chart-box { position: relative; width: 100%; max-width: 100%; aspect-ratio: 1 / 1; }
.legend { display: flex; gap: 16px; justify-content: center; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.lens { font-size: 13px; color: var(--muted); text-align: center; margin-top: 8px; font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--display); font-weight: 600; color: var(--muted); font-size: 13px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.primary td { background: var(--lime-soft); }
.table-wrap { overflow-x: auto; }
.pole-bars { display: grid; gap: 8px; margin-top: 10px; }
.bar { display: grid; grid-template-columns: 96px 1fr 32px; align-items: center; gap: 8px; font-size: 14px; }
.bar .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--now); }
.bar.f .track i { background: var(--lime); }
.bar .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-title h2 { font-size: 22px; }
.strat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .strat { grid-template-columns: 1fr; } }
.strat h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.strat ul { margin: 0; padding-left: 18px; font-size: 15px; }
.callout { border-left: 3px solid var(--coral); padding: 4px 0 4px 14px; font-size: 15px; }
.ai-block { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.ai-block .ai-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-block .prose { font-size: 16px; white-space: pre-wrap; }
.ai-block .prose h3 { font-size: 16px; margin: 14px 0 4px; }
.ai-block .prose h3:first-child { margin-top: 0; }
.thinking { color: var(--muted); font-style: italic; }
.refl { display: grid; gap: 10px; }
.refl-item { font-size: 15px; }
.refl-item b { font-family: var(--display); font-weight: 600; }
.priorities td .why { color: var(--muted); font-size: 13px; }
.pri-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.pri-build { background: var(--lime-soft); color: var(--lime-ink); }
.pri-reduce { background: var(--coral-soft); color: var(--coral-ink); }
.pri-sustain { background: var(--surface-2); color: var(--muted); }
.foot { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.foot .row { margin-top: 10px; }
.share-box { display: grid; gap: 8px; }
.consent-list { margin: 0; padding-left: 18px; font-size: 15px; display: grid; gap: 6px; }
.share-box code { font-size: 13px; word-break: break-all; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; display: block; }

/* voice input under the comment and follow-up boxes */
.voice-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.voice-btn { gap: 8px; }
.voice-icon { flex: none; }
.voice-btn.recording { border-color: var(--coral); color: var(--coral-ink); }
.voice-btn.recording .voice-icon { animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .voice-btn.recording .voice-icon { animation: none; } }

/* Limen: Stance questions (Part A) */
.stance-field { margin-top: 18px; }
fieldset.choice { border: 0; padding: 0; margin: 22px 0 0; min-width: 0; }
fieldset.choice legend { font-size: 17px; font-weight: 600; padding: 0; margin-bottom: 10px; }
.opts { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 15px; }
.opt input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--lime-ink); }
.opt:has(input:checked) { border-color: var(--lime-ink); background: var(--lime-soft); }
#stance-note:empty { display: none; }
#stance-note { margin-top: 10px; }
#s-stance .banner { margin-top: 16px; }

/* Limen: report legend swatches carry the diamond's edge */
.legend { flex-wrap: wrap; }
.legend i.edge { width: 22px; height: 0; border-radius: 0; border-top: 3px solid currentColor; background: none !important; vertical-align: 3px; }
.legend i.edge.dashed { border-top-style: dashed; }
.legend .legend-note { display: block; font-size: 12px; }

/* Limen: Stance panel */
.stance-rows { display: grid; gap: 16px; }
.stance-row { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; align-items: center; }
.stance-row .lbl { font-family: var(--display); font-weight: 600; font-size: 15px; }
.stance-row .extra { grid-column: 2; font-size: 14px; }
.track4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.track4 span { font-size: 12px; padding: 6px 2px; border-radius: 6px; background: var(--surface-2); color: var(--muted); text-align: center; }
.track4 span.on { background: var(--lime-soft); color: var(--lime-ink); font-weight: 700; outline: 1px solid var(--lime-ink); }
@media (max-width: 420px) { .stance-row { grid-template-columns: 1fr; } .stance-row .extra { grid-column: 1; } .track4 span { font-size: 11px; } }
.level-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Limen 1.2 review step */
.review-checks { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.review-checks b { color: var(--ink); font-weight: 600; }
.review-part { font-size: 18px; margin: 18px 0 8px; }
.review-row { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 8px; }
.review-q { font-weight: 600; font-size: 15px; }
.review-id { font-family: var(--display); color: var(--muted); margin-right: 8px; }
.review-poles { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.review-poles span:last-child { text-align: right; }
.review-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rv { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; font-size: 13px; }
.rv-who { font-weight: 600; }
.rv-now .rv-who { color: var(--now); }
.rv-future .rv-who { color: var(--lime-ink); }
.rv select { font: inherit; font-size: 16px; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; min-height: 40px; }
.rv-now select { border-color: var(--now); }
.rv-future select { border-color: var(--lime-ink); }
.rv-lean { grid-column: 1 / -1; color: var(--muted); }
.review-flag { font-size: 13px; color: var(--coral-ink); background: var(--coral-soft); border-radius: 8px; padding: 6px 10px; }

/* Limen 1.2 shared Primary */
.primary-roles { display: grid; gap: 10px; margin-top: 12px; }
.primary-roles p + p { margin-top: 6px; }
.strat-role { font-size: 16px; margin: 14px 0 8px; }
.strat-role:first-child { margin-top: 0; }
.derail p + p { margin-top: 8px; }
