/* Caretta Global: app pages (sponsor compliance check).
   Shares tokens with styles.css, with its own working layout. */
:root { --ok: #2C7A6B; --app-head: 76px; }

body.app { background: var(--paper); }

/* App header */
.app-header { background: var(--sea); color: var(--on-sea); border-bottom: 1px solid var(--sea-line); position: sticky; top: 0; z-index: 40; }
.app-header-inner { display: flex; align-items: center; gap: 24px; min-height: var(--app-head); flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.app-header .brand svg { width: 44px; height: 44px; }
.app-header .brand-name { font-size: 26px; }
.app-title { font-family: var(--font-display); font-size: 20px; color: var(--on-sea-muted); padding-left: 24px; border-left: 1px solid var(--sea-line); }
.app-header-actions { margin-left: auto; display: flex; align-items: center; gap: 24px; }
.back-link { color: var(--on-sea-muted); text-decoration: none; font-size: 15px; transition: color 0.2s var(--ease); }
.back-link:hover { color: var(--on-sea); text-decoration: underline; text-underline-offset: 5px; }
.app-header .btn { min-height: 44px; padding: 0 20px; font-size: 15px; white-space: nowrap; }
@media (max-width: 760px) {
  .app-title { display: none; }
  .app-header-inner { flex-wrap: nowrap; gap: 12px; }
  .app-header .brand { gap: 10px; }
  .app-header .brand svg { width: 38px; height: 38px; }
  .app-header .brand-name { font-size: 20px; }
  .app-header-actions { gap: 10px; }
  .app-header .btn { padding: 0 14px; font-size: 14px; min-height: 40px; }
  .back-link { display: none; }
}

/* Intro */
.intro { padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 5vw, 64px); }
.intro-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(40px, 6vw, 96px); align-items: start; }
@media (max-width: 960px) { .intro-grid { grid-template-columns: 1fr; } }
.intro h1 { font-size: clamp(38px, 5vw, 68px); line-height: 1.06; color: var(--sea); max-width: 16ch; margin-bottom: 24px; }
.intro-lede { font-family: var(--font-display); font-weight: 300; font-size: clamp(21px, 2vw, 26px); line-height: 1.4; color: var(--muted); max-width: 40ch; }
.intro-actions { margin: 36px 0 56px; display: flex; align-items: center; gap: 20px 28px; flex-wrap: wrap; }
.btn-lg { min-height: 58px; padding: 0 34px; font-size: 17px; }
.intro-meta { font-size: 15px; color: var(--muted); max-width: 34ch; }
.intro-answers h2 { font-size: clamp(22px, 2vw, 26px); font-weight: 400; margin-bottom: 8px; color: var(--sea); }
.intro-answers ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.intro-answers li { display: grid; gap: 2px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.intro-answers strong { font-weight: 500; color: var(--sea); }
.intro-answers span { color: var(--muted); font-size: 16px; }
.dial-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px 20px; text-align: center; }
.dial-empty { margin-top: -6px; color: var(--muted); font-size: 15px; }
.stat { margin-top: 20px; padding: 24px; background: var(--sea); color: var(--on-sea-muted); border-radius: var(--radius); display: grid; gap: 8px; }
.stat-num { font-family: var(--font-display); font-size: clamp(44px, 5vw, 64px); line-height: 1; color: var(--on-sea); font-weight: 300; }
.stat p:last-child { font-size: 15px; max-width: 38ch; }
.intro-foot { margin-top: clamp(40px, 6vw, 72px); padding-top: 24px; border-top: 1px solid var(--line); }
.intro-foot p { font-size: 14px; color: var(--muted); max-width: 90ch; }

/* Dial */
.dial { width: 100%; max-width: 420px; height: auto; margin: 0 auto; overflow: visible; }
.dial-track, .dial-fill { fill: none; stroke-width: 14; stroke-linecap: butt; }
.dial-track { stroke: var(--line); }
.dial-fill { stroke: var(--ok); stroke-dasharray: 0 100; }
.dial .tick { stroke: #9FB0AA; stroke-width: 1; }
.dial .tick.major { stroke: var(--muted); stroke-width: 1.5; }
.dial-mark { fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
.dial-needle { transform-origin: 190px 200px; transform-box: view-box; }
.dial-needle line { stroke: var(--sea-deep); stroke-width: 2.5; stroke-linecap: round; }
.dial-hub { fill: var(--amber-soft); stroke: var(--sea-deep); stroke-width: 2; }

/* Flow layout */
.flow { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100svh - var(--app-head)); }
.flow[hidden] { display: none; }
.rail { background: var(--sea-deep); color: var(--on-sea); padding: 32px 28px; position: sticky; top: var(--app-head); align-self: start; height: calc(100svh - var(--app-head)); overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.rail-title { font-family: var(--font-display); font-size: 22px; color: var(--on-sea); }
.rail-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rail-step { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 10px; border-radius: var(--radius); cursor: pointer; color: var(--on-sea-muted); font-size: 15px; transition: background-color 0.2s var(--ease), color 0.2s var(--ease); }
.rail-step:hover:not(:disabled) { background: rgba(238, 241, 236, 0.07); color: var(--on-sea); }
.rail-step:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.rail-step:disabled { cursor: default; opacity: 0.5; }
.rail-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(201, 220, 213, 0.4); display: grid; place-items: center; font-size: 13px; }
.rail-step.is-current { color: var(--on-sea); background: rgba(238, 241, 236, 0.1); }
.rail-step.is-current .rail-mark { background: var(--amber-soft); border-color: var(--amber-soft); color: var(--sea-deep); font-weight: 500; }
.rail-step.is-done .rail-mark { border-color: var(--amber-soft); color: var(--amber-soft); }
.rail-progress { font-size: 14px; color: var(--on-sea-muted); display: grid; gap: 8px; }
.rail-progress strong { color: var(--on-sea); font-weight: 500; }
.bar { height: 4px; background: rgba(201, 220, 213, 0.2); position: relative; overflow: hidden; border-radius: 2px; }
.bar span { position: absolute; inset: 0 auto 0 0; background: var(--amber-soft); transition: width 0.3s var(--ease); }
.rail-note { margin-top: auto; font-size: 13px; color: var(--on-sea-muted); max-width: 30ch; }

@media (max-width: 960px) {
  .flow { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: column; padding: 16px var(--gutter); gap: 12px; }
  .rail-title, .rail-note { display: none; }
  .rail-steps { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .rail-step { width: auto; flex: none; padding: 8px 12px 8px 8px; }
  .rail-name { white-space: nowrap; }
}

/* Panel */
.panel { padding: clamp(32px, 5vw, 64px) var(--gutter) 96px; max-width: 980px; width: 100%; }
.panel.is-results { max-width: 1120px; }
.panel-head h1 { font-size: clamp(32px, 3.6vw, 48px); color: var(--sea); margin-bottom: 14px; }
.panel-head h1:focus { outline: none; }
.panel-head p { color: var(--muted); max-width: 62ch; font-size: 18px; }
.panel-body { margin-top: 36px; display: grid; gap: 16px; }
.panel-foot { margin-top: 40px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }

/* Questions */
.q { margin: 0; padding: 26px clamp(20px, 3vw, 32px); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; transition: border-color 0.2s var(--ease); }
.q.has-error { border-color: var(--danger); }
.q legend { float: left; width: 100%; padding: 0; margin: 0 0 18px; font-size: 18px; font-weight: 500; line-height: 1.45; color: var(--ink); max-width: 70ch; }
.q legend + * { clear: both; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts-stack { flex-direction: column; align-items: stretch; }
.opt { position: relative; display: inline-flex; align-items: center; min-height: 46px; padding: 8px 18px; border: 1px solid #C9D1CD; border-radius: var(--radius); background: var(--paper); cursor: pointer; font-size: 16px; line-height: 1.35; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), color 0.15s var(--ease); }
.opt:hover { border-color: var(--sea); }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opt:focus-within { outline: 2px solid var(--amber); outline-offset: 2px; }
.opt.is-checked { background: var(--sea); border-color: var(--sea); color: var(--on-sea); }
.why { margin-top: 16px; font-size: 15px; }
.why summary { cursor: pointer; color: var(--sea); font-weight: 500; width: fit-content; list-style: none; display: inline-flex; align-items: center; gap: 8px; text-decoration: underline; text-decoration-color: var(--amber); text-underline-offset: 5px; text-decoration-thickness: 1px; }
.why summary::-webkit-details-marker { display: none; }
.why summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin-top: -3px; transition: transform 0.2s var(--ease); }
.why[open] summary::after { transform: rotate(225deg); margin-top: 3px; }
.why p { color: var(--muted); margin-top: 10px; max-width: 66ch; }
.ref { font-size: 13px; color: var(--amber-text); }
.why .ref { margin-top: 6px; }
.q-error { color: var(--danger); font-size: 14px; margin-top: 12px; }
.q-error:empty { display: none; }

/* Results */
.results { display: grid; gap: clamp(36px, 5vw, 64px); }
.results:focus { outline: none; }
.res-hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 64px); align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 4vw, 48px); }
@media (max-width: 860px) { .res-hero { grid-template-columns: 1fr; } }
.res-dial { text-align: center; }
.res-score { display: flex; justify-content: center; align-items: baseline; gap: 2px; margin-top: 4px; }
.res-num { font-family: var(--font-display); font-size: clamp(64px, 8vw, 96px); font-weight: 300; line-height: 1; color: var(--sea); font-variant-numeric: tabular-nums; }
.res-pct { font-family: var(--font-display); font-size: clamp(24px, 3vw, 34px); color: var(--muted); }
.res-copy h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.15; margin-bottom: 14px; color: var(--ink); }
.res-copy h1:focus { outline: none; }
.band { color: var(--ok); }
.band-risk { color: var(--amber-text); }
.band-high { color: var(--danger); }
.res-copy p { color: var(--muted); font-size: 18px; max-width: 52ch; }
.res-copy .cap-note { margin-top: 14px; font-size: 16px; padding-left: 14px; border-left: 2px solid var(--amber); }
.res-copy .fine { margin-top: 20px; font-size: 14px; }
.res-block h2 { font-size: clamp(24px, 2.4vw, 32px); margin-bottom: 20px; color: var(--sea); font-weight: 400; }
.verdicts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) { .verdicts { grid-template-columns: 1fr; } }
.verdict { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--ok); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.verdict.tone-warn { border-top-color: var(--amber); }
.verdict.tone-bad { border-top-color: var(--danger); }
.verdict h3 { font-family: var(--font-body); font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.verdict-head { font-family: var(--font-display); font-size: 24px; line-height: 1.25; color: var(--ink); }
.verdict p { color: var(--muted); font-size: 16px; }
.verdict .verdict-head { color: var(--ink); }
.verdict .ref { margin-top: auto; padding-top: 6px; }
.res-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
@media (max-width: 960px) { .res-split { grid-template-columns: 1fr; } }
.dbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.dbar-top { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; font-size: 16px; }
.dbar-top strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.dbars .bar { height: 8px; background: var(--line); border-radius: 4px; }
.dbars .bar span { background: var(--ok); transition: none; }
.dbars .bar-risk span { background: var(--amber); }
.dbars .bar-high span { background: var(--danger); }
.findings { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.finding { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; padding: 18px 0 18px 18px; border-bottom: 1px solid var(--line); position: relative; }
.finding::before { content: ""; position: absolute; left: 0; top: 24px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.finding.is-red::before { background: var(--danger); }
.finding strong { font-weight: 500; font-size: 17px; }
.finding p { color: var(--muted); font-size: 15px; margin-top: 4px; max-width: 60ch; }
.finding .ref { white-space: nowrap; }
@media (max-width: 600px) { .finding { grid-template-columns: 1fr; } .finding .ref { white-space: normal; } }
.locked { margin-top: 20px; padding: 20px 22px; background: var(--white); border: 1px dashed var(--amber); border-radius: var(--radius); }
.locked p { color: var(--muted); font-size: 16px; }
.locked strong { color: var(--ink); font-weight: 500; }
.muted { color: var(--muted); }
.context p { color: var(--muted); max-width: 72ch; }
.context p + p { margin-top: 12px; }
.res-cta { display: flex; justify-content: space-between; align-items: center; gap: 28px 48px; flex-wrap: wrap; background: var(--sea); color: var(--on-sea); border-radius: var(--radius); padding: clamp(28px, 4vw, 52px); }
.res-cta h2 { font-size: clamp(26px, 2.8vw, 36px); color: var(--on-sea); margin-bottom: 12px; font-weight: 300; }
.res-cta p { color: var(--on-sea-muted); max-width: 56ch; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.res-tools { display: flex; gap: 28px; flex-wrap: wrap; }
.link-btn { all: unset; cursor: pointer; color: var(--sea); font-weight: 500; text-decoration: underline; text-decoration-color: var(--amber); text-underline-offset: 5px; text-decoration-thickness: 1px; }
.link-btn:hover { text-decoration-thickness: 2px; }
.link-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; }
.sources h2 { font-size: 22px; }
.sources ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 15px; }
.sources a { color: var(--sea); text-underline-offset: 4px; }

.noscript { padding: 48px var(--gutter); }

/* Footer */
.app-footer { background: var(--sea-deep); color: var(--on-sea-muted); padding: 28px 0; font-size: 14px; }
.app-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 32px; }
.app-footer p:last-child { display: flex; gap: 24px; }
.app-footer a { text-decoration: none; }
.app-footer a:hover { color: var(--on-sea); }
body.in-flow .app-footer { display: none; }
