/* ============================================================================
   BORDERLESS SETTLEMENT CALCULATOR: the design system in use
   Built on tokens.css (the Borderless Design System), laid out like the
   Borderless calculators: a split editorial card on cream paper, an ink panel
   on the left with the headline and a step rail, the questions on the right.
   Woodland display serif, Manrope UI, Fragment Mono eyebrows and buttons,
   coral accent. The page's own pieces are in settlement/settlement.css.
   ============================================================================ */
@import url("/assets/tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }

/* RAG palette: tinted fills with dark text, per the design tokens */
:root {
  --rag-green: hsl(var(--success-subtle));  --rag-green-ink: hsl(var(--success-foreground));  --rag-green-dot: hsl(var(--success-strong));
  --rag-amber: hsl(var(--warning-subtle));  --rag-amber-ink: hsl(var(--warning-foreground));  --rag-amber-dot: #d98a1a;
  --rag-red:   hsl(var(--destructive-subtle)); --rag-red-ink: hsl(var(--destructive-strong)); --rag-red-dot: hsl(var(--destructive));
  --ink: hsl(var(--background-inverse));
  --paper: hsl(var(--card));
  --line: hsl(var(--border));
  --coral: hsl(var(--primary));
  --coral-ink: hsl(var(--primary-active));
  --coral-subtle: hsl(var(--primary-subtle));
  /* A figure the page filled in for the person to check */
  --doc-fill: hsl(48 100% 92%); --doc-edge: hsl(42 80% 58%);
}

/* Shared voice bits ------------------------------------------------------- */
.eyebrow {
  margin: 0;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: hsl(var(--foreground-muted));
}
.eyebrow-inv { color: hsl(var(--foreground-inverse) / 0.7); }
.muted { color: hsl(var(--foreground-muted)); }
.small { font-size: 13px; }
.print-only { display: none; }

/* Buttons ----------------------------------------------------------------- */
.btn-ink {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px;
  border: none; border-radius: var(--radius-lg);
  background: var(--ink); color: hsl(var(--foreground-inverse));
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.btn-ink:hover:not(:disabled) { background: var(--coral); color: hsl(var(--foreground)); }
.btn-ink:focus-visible { outline: 2px solid var(--coral-ink); outline-offset: 2px; }
.btn-ink:disabled { opacity: 0.45; cursor: default; }
.btn-ink.auto { width: auto; }
.btn-coral {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border-radius: var(--radius-lg); border: none;
  background: var(--coral); color: hsl(var(--foreground));
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--duration-fast);
}
.btn-coral:hover { background: hsl(var(--primary-hover)); }
.btn-coral:focus-visible { outline: 2px solid hsl(var(--foreground-inverse)); outline-offset: 2px; }
.btn-link {
  background: none; border: none; padding: 0;
  font-family: var(--font-sans); font-size: 14px; color: hsl(var(--foreground-muted));
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; white-space: nowrap;
}
.btn-link:hover { color: hsl(var(--foreground)); }
.btn-link:focus-visible { outline: 2px solid var(--coral-ink); outline-offset: 3px; border-radius: 4px; }
.btn-link:disabled { opacity: 0.4; cursor: default; text-decoration: none; }

/* ============================================================================
   SHELL — split editorial card (desktop) → stacked (mobile)
   ============================================================================ */
.calc-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px 24px; }
/* The card doesn't clip what's inside it, so a picker's list can open past
   its bottom edge; the ink panel rounds its own corners instead. */
.calc-shell {
  width: 100%; max-width: 1180px; display: flex;
  background: var(--paper); color: hsl(var(--foreground));
  border-radius: var(--radius-2xl); box-shadow: var(--shadow-xl);
  min-height: 640px;
}

/* Left — ink panel */
.persuade {
  flex: 0 0 320px;
  background: var(--ink); color: hsl(var(--foreground-inverse));
  padding: 40px 34px 30px;
  border-radius: var(--radius-2xl) 0 0 var(--radius-2xl);
}
.side { position: sticky; top: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; min-height: calc(100vh - 150px); }
.wordmark { height: 20px; width: auto; align-self: flex-start; }
.mstep { display: none; }
.persuade-top { display: flex; flex-direction: column; gap: 24px; }
.persuade-h { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 34px; line-height: 1.08; letter-spacing: -0.01em; }
.persuade-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.persuade-points li { display: flex; gap: 11px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: hsl(var(--foreground-inverse) / 0.88); }
.persuade-points li .dash { color: var(--coral); flex: none; line-height: 1.4; }
.persuade-foot { display: flex; flex-direction: column; gap: 12px; }
.side-note { margin: 0; font-size: 13px; line-height: 1.5; color: hsl(var(--foreground-inverse) / 0.72); display: flex; align-items: center; gap: 6px; }

/* Step rail: the headline and points on the first screen, the rail once the
   questions have started (.started on the shell). */
.rail { list-style: none; margin: 0; padding: 0; display: none; flex-direction: column; }
.started .rail { display: flex; }
.started .persuade-points { display: none; }
.started .persuade-h { font-size: 26px; }
.rail li { position: relative; display: flex; padding-bottom: 22px; }
.rail li:last-child { padding-bottom: 0; }
.rail li::before { content: ""; position: absolute; left: 11.5px; top: 30px; bottom: 4px; width: 1px; background: hsl(var(--foreground-inverse) / 0.16); }
.rail li:last-child::before { display: none; }
.rail-btn { display: flex; gap: 14px; align-items: flex-start; text-align: left; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; width: 100%; }
.rail-btn:disabled { cursor: default; }
.rail-btn:focus-visible { outline: 2px solid var(--coral); outline-offset: 4px; border-radius: 6px; }
.rail-dot {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid hsl(var(--foreground-inverse) / 0.35);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; line-height: 1;
  color: hsl(var(--foreground-inverse) / 0.75);
  transition: background var(--duration-normal), border-color var(--duration-normal), color var(--duration-normal);
}
.rail-dot svg { width: 12px; height: 12px; display: none; }
.rail-txt { display: flex; flex-direction: column; gap: 3px; padding-top: 2px; min-width: 0; }
.rail-txt b { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.rail-txt small { font-size: 12.5px; line-height: 1.45; color: hsl(var(--foreground-inverse) / 0.7); }
.rail li[data-state="todo"] .rail-txt b { color: hsl(var(--foreground-inverse) / 0.72); }
.rail li[data-state="todo"] .rail-txt small { color: hsl(var(--foreground-inverse) / 0.62); }
.rail li[data-state="current"] .rail-dot { background: var(--coral); border-color: var(--coral); color: hsl(var(--foreground)); }
.rail li[data-state="done"] .rail-dot { background: hsl(var(--foreground-inverse)); border-color: hsl(var(--foreground-inverse)); color: hsl(var(--foreground)); }
.rail li[data-state="done"] .rail-dot > span { display: none; }
.rail li[data-state="done"] .rail-dot svg { display: block; }
.rail li[data-state="done"]::before { background: hsl(var(--foreground-inverse) / 0.45); }
.rail-btn:hover:not(:disabled) .rail-txt b { text-decoration: underline; text-underline-offset: 3px; }

/* Right — the questions and the result */
.calc-main { flex: 1; min-width: 0; padding: 38px 38px 34px; display: flex; flex-direction: column; }
.view { display: flex; flex-direction: column; gap: 22px; }
.vhead { display: flex; flex-direction: column; gap: 8px; }
.vhead-row { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 24px; }
.vhead-row > div:not(.head-actions) { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 0; }
.vhead-row .head-actions { flex: none; padding-top: 28px; flex-wrap: nowrap; }
.vh { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 32px; line-height: 1.1; letter-spacing: -0.005em; }
.vh:focus { outline: none; }
.vsub { margin: 0; font-size: 14.5px; line-height: 1.55; color: hsl(var(--foreground-muted)); max-width: 62ch; }
.head-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* ============================================================================
   FORM CONTROLS (as on the calculators)
   ============================================================================ */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label:first-child, .field .flabel, .field > span:first-child { font-size: 14px; font-weight: 600; color: hsl(var(--foreground)); }
.field .help, .help { font-size: 13px; line-height: 1.45; color: hsl(var(--foreground-muted)); }
.help a { color: hsl(var(--info-text)); }
.field small { font-size: 13px; color: hsl(var(--foreground-muted)); }
.field em { font-style: normal; font-size: 13px; color: hsl(var(--destructive)); }
.field em:empty { display: none; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }

input[type="text"], input[type="number"], input[type="date"], input[type="email"], select {
  width: 100%; padding: 11px 13px;
  border-radius: var(--radius-md); border: 1px solid hsl(var(--input-border));
  background: hsl(var(--input)); font-family: var(--font-sans); font-size: 16px; /* 16px stops iOS zoom */
  color: hsl(var(--foreground)); outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
input:focus, select:focus { border-color: var(--coral-ink); box-shadow: 0 0 0 3px hsl(var(--primary) / 0.35); }
select {
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23202129' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.money { position: relative; }
.money::before { content: "£"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: hsl(var(--foreground-muted)); font-size: 15px; pointer-events: none; }
.money input { padding-left: 26px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--coral-ink); }

/* Segmented pills (yes/no and the like) */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-block; padding: 9px 16px; border-radius: var(--radius-full); cursor: pointer;
  border: 1px solid var(--line); background: var(--paper);
  font-family: var(--font-sans); font-size: 14.5px; font-weight: 600; color: hsl(var(--foreground));
  transition: border-color var(--duration-fast), background var(--duration-fast);
}
.seg span:hover { border-color: var(--coral); }
.seg input:checked + span { border-color: var(--coral-ink); background: var(--coral-subtle); }
.seg input:focus-visible + span { outline: 2px solid var(--coral-ink); outline-offset: 2px; }

/* Groups (titled sections) */
.group { display: flex; flex-direction: column; gap: 10px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.group-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: hsl(var(--foreground-muted)); }
.group-label span { text-transform: none; letter-spacing: 0; font-family: var(--font-sans); font-size: 13px; }

.runbar { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding-top: 6px; border-top: 1px solid var(--line); }
.runbar p { margin: 0; font-size: 14px; }
.spacer { flex: 1; }

/* The search picker (branded autocomplete, as on the calculators) */
.combo { position: relative; }
.combo-panel { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: 288px; overflow-y: auto; }
.combo-option { display: flex; align-items: baseline; gap: 10px; padding: 9px 11px; border-radius: var(--radius-md); cursor: pointer; font-size: 14px; line-height: 1.35; }
.combo-option:hover, .combo-option[aria-selected="true"] { background: var(--coral-subtle); }
.combo-name { flex: 1; }

/* ============================================================================
   RESULT
   ============================================================================ */
.pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--radius-full); font-size: 13px; font-weight: 600; line-height: 1.2; }
.pill-green { background: var(--rag-green); color: var(--rag-green-ink); }
.pill-amber { background: var(--rag-amber); color: var(--rag-amber-ink); }
.pill-red   { background: var(--rag-red);   color: var(--rag-red-ink); }
.pill-lg { font-size: 15px; padding: 7px 16px; }

.overall {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 18px 22px; border-radius: var(--radius-xl);
  background: var(--rag-green); border: 1px solid var(--rag-green-dot);
}
.overall[data-rag="amber"] { background: var(--rag-amber); border-color: var(--rag-amber-dot); }
.overall[data-rag="red"] { background: var(--rag-red); border-color: var(--rag-red-dot); }
.overall .pill { background: var(--paper); }
.overall-main { display: flex; align-items: center; gap: 16px; }
.overall-line { margin: 0; font-size: 16px; font-weight: 600; }

/* The requirements: one row each, with its state */
.icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px; }
.icon svg { width: 14px; height: 14px; }
.rules { margin: 2px 0 14px; }
.rules-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 6px; }
.rules-count { font-size: 13px; font-weight: 600; }
.rules ul { list-style: none; margin: 0; padding: 0; }
.rule { display: grid; grid-template-columns: 26px 1fr minmax(130px, auto); gap: 4px 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.rule[data-rag="green"] .icon { background: var(--rag-green); color: var(--rag-green-ink); }
.rule[data-rag="amber"] .icon { background: var(--rag-amber); color: var(--rag-amber-ink); }
.rule[data-rag="red"]   .icon { background: var(--rag-red);   color: var(--rag-red-ink); }
.rule-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rule-label { font-size: 14.5px; font-weight: 600; }
.rule-line { font-size: 14px; line-height: 1.5; }
.rule .rule-status { font-size: 13px; font-weight: 600; }
.rule[data-rag="red"] .rule-status { color: var(--rag-red-ink); }
.rule[data-rag="amber"] .rule-status { color: var(--rag-amber-ink); }
.rule[data-rag="green"] .rule-status { color: var(--rag-green-ink); }

/* Ink next-step card (as the calculators' result-ink / CTA) */
.result-ink {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--ink); color: hsl(var(--foreground-inverse));
  border-radius: var(--radius-xl); padding: 24px 26px;
}
.next-h { margin: 6px 0 4px; font-family: var(--font-serif); font-weight: 400; font-size: 24px; line-height: 1.15; max-width: 30ch; }
.next-p { margin: 0; font-size: 14.5px; color: hsl(var(--foreground-inverse) / 0.75); }

/* The bar at the end: a tick, a line, a button */
.done-bar {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--paper);
}
.done-bar .finished-tick { background: var(--ink); }
.done-bar .finished-p { color: hsl(var(--foreground-muted)); }
@media (max-width: 560px) { .done-bar { grid-template-columns: auto 1fr; } .done-bar .btn-ink { grid-column: 1 / -1; width: 100%; } }
.finished-tick { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--rag-green-ink); color: #fff; font-weight: 800; }
.finished-h { margin: 0; font-weight: 700; font-size: 15px; }
.finished-p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; }

.foot { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.disclaimer { margin: 0; font-size: 13px; line-height: 1.5; color: hsl(var(--foreground-muted)); }

/* Message boxes (as on the calculators) */
.msg { border-radius: var(--radius-lg); padding: 13px 15px; font-size: 14px; line-height: 1.5; }
.msg .mh { display: block; font-weight: 700; margin-bottom: 4px; }
.msg.warn { background: hsl(var(--warning-subtle)); color: hsl(var(--warning-foreground)); }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 30; padding: 10px 18px; border-radius: var(--radius-lg); background: var(--ink); color: hsl(var(--foreground-inverse)); font-size: 14px; }

/* Footer strip */
.ft { text-align: center; padding: 0 20px 30px; font-size: 13px; line-height: 1.6; color: hsl(var(--foreground-muted)); }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media screen and (max-width: 960px) {
  .calc-shell { flex-direction: column; min-height: 0; }
  .persuade { flex: none; padding: 26px 24px 22px; border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; }
  .side { position: static; min-height: 0; gap: 18px; }
  .persuade-points, .rail, .side-note:last-child { display: none !important; }
  .persuade-h, .started .persuade-h { font-size: 26px; }
  .started .persuade-top { display: none; }
  .started .side { flex-direction: row; align-items: center; justify-content: space-between; }
  .started .mstep { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: hsl(var(--foreground-inverse) / 0.75); white-space: nowrap; }
  .started .persuade-foot { flex-direction: row; align-items: center; gap: 14px; }
  .started .wordmark { height: 17px; }
  .started .persuade-foot .side-note { display: none !important; }
  .calc-main { padding: 26px 20px 30px; }
  .vh { font-size: 27px; }
  .runbar { flex-direction: column; align-items: stretch; text-align: center; }
  .runbar .btn-ink { width: 100%; }
  .vhead-row { flex-direction: column; align-items: stretch; }
  .vhead-row .head-actions { padding-top: 0; flex-wrap: wrap; }
}
@media screen and (max-width: 460px) {
  .calc-wrap { padding: 0; }
  .calc-shell, .persuade { border-radius: 0; box-shadow: none; }
  .field-row { flex-direction: column; }
  .ft { padding-top: 16px; }
}
