/* Case shell styling (task 0096 on the Design System; originally task 0009,
 * recomposed by task 0081).
 *
 * Every color and font is a token from tokens.css -- there are no literal
 * colors in this file. One page, one column, in the order the UI/UX
 * Constitution requires:
 *
 *   hero      .case-headline + .outcome-surface (+ recognition state)
 *   focus     .next-action                      -- the one ask, or relief
 *   context   .living-case, .milestones
 *   why       .case-reasoning                   -- collapsed
 *             .timeline, .case-details          -- secondary / audit
 *
 * Exactly one surface carries [data-primary="true"]. Nothing here computes
 * state; it only frames the server-provided CaseView.
 */

* {
  box-sizing: border-box;
}

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

h1,
h2,
h3 {
  text-wrap: balance;
}

.app-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px var(--gutter);
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
}

.cockpit {
  max-width: var(--column);
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
}

/* The [hidden] attribute must always win over the display rules below. */
[hidden] {
  display: none !important;
}

/* -- Hero: headline + status pill + outcome ------------------------------- */

.case-headline {
  margin: 0 0 12px;
}

.case-headline-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
}

.case-headline-subtitle {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 15px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
}

.pill[data-tone="needs-you"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.pill[data-tone="needs-you"]::before {
  background: var(--accent);
}

.pill[data-tone="good"] {
  background: var(--good-soft);
}

.pill[data-tone="good"]::before {
  background: var(--good);
}

/* The stage LABEL is what distinguishes requested, offered, accepted and
   recovered money, so no stage is styled into another. */
.outcome-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--gutter);
}

.outcome-headline {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

.outcome-amount {
  margin: 4px 0 0;
  font-family: var(--font-serif);
  font-size: 56px;
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  /* Long money strings wrap instead of forcing horizontal overflow. */
  overflow-wrap: anywhere;
}

.outcome-note {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  max-width: var(--measure);
}

.outcome-context {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.outcome-context dt {
  color: var(--ink-2);
}

.outcome-context dd {
  margin: 0;
  font-weight: 600;
}

/* Worth Pursuing sits inside the outcome surface, supporting the hero. */
.pursuit-verdict {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.pursuit-label {
  font-weight: 600;
  color: var(--ink);
}

.pursuit-verdict[data-verdict="YES"] .pursuit-label {
  color: var(--good);
}

.pursuit-reason {
  display: block;
  margin-top: 2px;
  color: var(--ink-2);
}

/* -- Recognition list ------------------------------------------------------ */

.recognition-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.recognition-row {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.recognition-row:last-child {
  border-bottom: none;
}

.recognition-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.recognition-label {
  color: var(--ink-2);
}

.recognition-value {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-align: right;
  min-width: 0;
}

.recognition-text {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tag {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.recognition-row[data-status="FOUND"] .tag {
  color: var(--good);
}

.recognition-row[data-status="MISSING"] .tag,
.recognition-row[data-status="PROPOSED"] .tag {
  color: var(--accent-ink);
}

.recognition-source summary {
  cursor: pointer;
  list-style: none;
}

.recognition-source summary::-webkit-details-marker {
  display: none;
}

.quote {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
  color: var(--ink-2);
  font-style: italic;
  font-size: 15px;
}

.quote-mark {
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 4px;
  padding: 0 2px;
}

/* -- Focus zone ------------------------------------------------------------ */

.next-action {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px var(--gutter);
}

.next-action h2 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
}

.next-action-note {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 15px;
  max-width: var(--measure);
}

.offer-summary {
  margin-bottom: 12px;
  font-size: 15px;
}

.offer-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.offer-delta {
  margin-left: 8px;
  color: var(--ink-2);
}

.request-summary {
  margin-bottom: 12px;
  font-size: 15px;
}

.request-summary p {
  margin: 0 0 4px;
  color: var(--ink-2);
}

.decision-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* One primary button per screen: the first control is the primary action and
   carries the clay ground; every other control is secondary. This is display
   selection only -- the transport decides which controls exist. */
.decision-button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.decision-button:hover {
  background: var(--surface-2);
}

.decision-button:first-of-type {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.decision-button:first-of-type:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.decision-button:focus-visible,
.interaction-input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.decision-controls .interaction-input {
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  min-width: 200px;
}

.decision-button:disabled,
.interaction-input:disabled {
  opacity: 0.6;
  cursor: default;
}

/* No red anywhere: a failed submission uses the soft warning ground. */
.interaction-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
}

/* Task 0125: information, not an error -- the case moved on and is shown as it stands now. */
.case-notice {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
}

/* -- Context: waiting hinge, outlook, milestones --------------------------- */

.living-case,
.recovery-outlook {
  margin-top: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-card);
  padding: 16px var(--gutter);
}

.living-case h2,
.recovery-outlook h3 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

.living-case p,
.outlook-note {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
}

.living-case .hinge-awaited {
  color: var(--ink);
  font-weight: 600;
}

.living-case .hinge-date {
  margin-top: 4px;
}

.living-case .hinge-fallback {
  margin-top: 8px;
  padding-left: 8px;
  border-left: 3px solid var(--line);
}

.outlook-basis {
  margin: 8px 0 0;
  font-size: 14px;
}

.outlook-basis summary {
  cursor: pointer;
  color: var(--ink-2);
}

.recovery-outlook dl {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
}

.recovery-outlook dt {
  font-weight: 600;
}

.recovery-outlook dd {
  margin: 0;
}

.milestones {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  gap: 4px;
  align-items: flex-start;
  overflow-x: auto;
}

.milestone {
  flex: 1 1 0;
  min-width: 64px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-2);
}

.milestone-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--good);
}

.milestone[data-state="now"] .milestone-dot {
  background: var(--accent);
}

.milestone[data-state="future"] .milestone-dot {
  background: transparent;
  border: 1px solid var(--ink-3);
}

.milestone-label {
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.milestone-when {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* -- Why: collapsed disclosure with marked reasons ------------------------- */

.case-reasoning,
.case-details,
.timeline {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 12px var(--gutter);
}

.case-reasoning summary,
.case-details summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}

.case-reasoning .recovery-outlook {
  margin-top: 8px;
  padding: 0 0 8px;
  background: transparent;
  border-radius: 0;
}

.reasons-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.reason-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  max-width: var(--measure);
}

.reason-mark {
  flex: 0 0 1.2em;
  font-weight: 600;
  color: var(--good);
}

.reason-row[data-mark="unknown"] .reason-mark,
.reason-row[data-mark="failed"] .reason-mark {
  color: var(--accent-ink);
}

/* -- Timeline and audit ---------------------------------------------------- */

.timeline h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

.timeline-list,
#timeline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item time {
  font-size: 13px;
  color: var(--ink-3);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.case-details dl {
  margin: 8px 0 4px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
}

.case-details dt {
  font-weight: 600;
}

.case-details dd {
  margin: 0;
}

.case-reference {
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--ink-3);
}

.case-id {
  font-family: var(--font-mono);
  font-size: 13px;
}

.case-status {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  margin-left: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-2);
}

.case-title {
  margin: 4px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.fallback-note {
  max-width: var(--column);
  margin: 24px auto;
  padding: 12px var(--gutter);
  background: var(--surface-2);
  border-radius: var(--radius-control);
  color: var(--ink);
}

/* Exactly one surface carries data-primary at a time; it is the only one that
   gets dominant weight, so no two asks ever compete for first attention. */
[data-primary="true"] {
  border-color: var(--accent);
}

/* A relief/dead-end surface is quiet: still the single primary surface, but it
   must not shout like an open user ask. Relief is the oat "Nothing needed from
   you" soft card. */
[data-primary="true"][data-mode="relief"],
[data-primary="true"][data-mode="dead-end"] {
  border-color: var(--line);
  background: var(--surface-2);
}

/* -- Small screens ---------------------------------------------------------- */

@media (max-width: 480px) {
  .cockpit {
    padding: 16px 16px 40px;
  }

  .outcome-surface {
    padding: 16px;
  }

  .outcome-amount {
    font-size: 40px;
  }

  /* Stack the primary controls full width so nothing is clipped or pushed
     off-screen, and so each is comfortably tappable (44px minimum). */
  .decision-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .decision-controls .interaction-input {
    min-width: 0;
    width: 100%;
  }

  .timeline-item {
    flex-wrap: wrap;
    gap: 2px 12px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .cockpit > * {
    animation: rise 180ms ease-out;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* -- Capture entry (task 0097) -------------------------------------------- */

/* While the case awaits material, only the Capture surface is shown: no hero,
   no focus card, no history -- one entry, one button. */
body[data-mode="capture"] .cockpit > :not(#capture-surface) {
  display: none !important;
}

.capture-surface {
  display: grid;
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
}

.capture-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
}

.capture-prompt {
  margin: 0;
  color: var(--ink-2);
  max-width: var(--measure);
}

.capture-drop {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 16px;
  border: 1px dashed var(--ink-3);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--ink-2);
  text-align: center;
  cursor: pointer;
}

.capture-drop[data-over="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.capture-files {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 15px;
}

.capture-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

.capture-file-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.capture-file-remove {
  flex: none;
  font: inherit;
  font-size: 0.875rem;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink-2);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

.capture-text {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  resize: vertical;
}

.capture-submit {
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

.capture-submit:hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.capture-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.capture-fine-print {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  text-align: center;
}

.capture-drop:focus-visible,
.capture-text:focus-visible,
.capture-submit:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

/* -- Answer chips and per-row correction (task 0097) ------------------------ */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.chip {
  font: inherit;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--ink-3);
}

.recognition-correct {
  margin-top: 6px;
}

.recognition-correct summary {
  cursor: pointer;
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
}

.recognition-correct .interaction-input {
  margin-top: 6px;
  width: 100%;
}

.recognition-correct .decision-button {
  margin-top: 6px;
}

/* -- Discovery and Probably not (task 0098) -------------------------------- */

/* The Discovery hero: the fixed amount is the display figure, the basis label is
   the quiet line beneath it. */
.outcome-surface[data-stage="DISCOVERY"] .outcome-headline {
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
}

/* Probably not is a full, quiet screen: serif verdict, no figure. */
.outcome-surface[data-stage="RESTING"] .outcome-headline {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

.residual-rights {
  margin-top: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-card);
  padding: 16px var(--gutter);
}

.residual-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

.residual-items {
  margin: 0;
  padding-left: 18px;
  max-width: var(--measure);
}

.discovery-legal {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
  color: var(--ink-2);
  font-size: 14px;
  max-width: var(--measure);
}

/* -- Authorize and Relief (task 0099) ---------------------------------------- */

.prepared-action {
  margin: 0 0 12px;
}

.prepared-fields {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0 0 8px;
  font-size: 15px;
}

.prepared-fields dt {
  color: var(--ink-2);
}

.prepared-fields dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.prepared-body-disclosure summary {
  cursor: pointer;
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
}

.prepared-body {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 14px;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The fee bar sits directly above the primary button and shows the net amount. */
.prepared-fee {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
}

.prepared-fee-line {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.prepared-fee-terms {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.prepared-withdrawal {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 14px;
  text-align: center;
}

.relief-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
}

.relief-card-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

.relief-card-lines {
  margin: 0;
  padding-left: 18px;
  max-width: var(--measure);
}

.relief-action {
  margin-top: 10px;
  font: inherit;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

/* -- Living case: events, offer, receipt, recap (task 0100) -------------------- */

.event-block {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-card);
}

.event-when {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.event-what {
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
}

.event-consequence {
  margin: 4px 0 0;
  color: var(--ink-2);
}

.event-explanation {
  margin: 10px 0 0;
  max-width: var(--measure);
}

.event-next {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
  font-weight: 600;
}

.offer-review {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
}

.offer-review-recommendation {
  margin: 0 0 6px;
  font-weight: 600;
}

.receipt-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
}

.receipt-question {
  margin: 0 0 8px;
  font-weight: 600;
}

.receipt-confirm {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--good);
  border-radius: var(--radius-control);
  background: var(--good-soft);
  color: var(--ink);
  cursor: pointer;
}

.escalation-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
}

.escalation-why {
  margin: 0 0 4px;
  font-weight: 600;
}

.escalation-source {
  margin: 0 0 8px;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.escalation-letter {
  margin: 0 0 12px;
}

/* Task 0126: what the body does and what to do first; its channel, an ADR body, or the Commission's list. */
.escalation-note {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.9375rem;
}

.escalation-link {
  display: block;
  margin: 0 0 10px;
  color: var(--accent-ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.recap-card {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--good-soft);
  border-radius: var(--radius-card);
}

.recap-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.stop-action {
  margin-top: 12px;
  font: inherit;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  text-decoration: underline;
  cursor: pointer;
}

/* Task 0115: the offer to hear when a case we cannot handle yet becomes one we can. */
.waitlist {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.waitlist-note {
  margin: 0;
  color: var(--ink-2);
}

/* Task 0102: the Cases screen and the app-bar links. */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-bar-link,
.cases-link {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink-2);
  background: none;
  border: 0;
  padding: 8px 0;
  cursor: pointer;
  text-decoration: underline;
}

.sign-in {
  display: grid;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}

.sign-in-label {
  font-weight: 600;
}

/* Local Beta walk (D-40): what the product is, above the form; the form's own heading is quieter. */
.sign-in-welcome .capture-intro {
  margin-bottom: var(--space);
}
.sign-in-title {
  margin: var(--space) 0 0;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
}
.sign-in .interaction-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
}

.sign-in-notice {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-control);
}

.cases-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.case-group {
  margin-top: 24px;
}

.case-group-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--ink-2);
}

.case-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.case-card {
  background: var(--surface-2);
  border-radius: var(--radius-card);
  padding: 4px 4px 8px;
}

.case-open {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 12px 14px 4px;
  cursor: pointer;
}

.case-card-title {
  font-weight: 600;
}

.case-card-amount,
.case-card-status {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.case-delete,
.case-delete-no {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink-2);
  background: none;
  border: 0;
  padding: 4px 14px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: underline;
}

.case-delete-confirm {
  padding: 4px 14px;
}

.case-delete-note {
  margin: 0 0 8px;
}

.case-delete-yes {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--accent-ink);
  border-radius: var(--radius-control);
  background: var(--accent-soft);
  color: var(--ink);
  cursor: pointer;
}

/* Task 0103: the desktop grammar (design-system.md section 7).
 *   < 760px     the phone: one column, nothing else.
 *   760-1023px  two columns: an icon rail for the case list + the case page; the
 *               context stays folded inside the centre column.
 *   >= 1024px   three columns: case list 220px · centre (max 640px, the phone's
 *               words) · context 260px (Why, Documents, Timeline, no buttons).
 *   >= 1440px   no fourth column: extra width is whitespace.
 * The rail and the context are absent below 760px / 1024px; they hold only fields
 * the page already renders. */
.shell {
  display: block;
}

.case-rail,
.context-panel {
  display: none;
}

@media (min-width: 760px) {
  .shell {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: start;
  }

  .case-rail:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    padding: 12px 6px;
    border-right: 1px solid var(--line);
    background: var(--surface);
  }

  /* The icon rail: a monogram per case; the full words live in title/aria-label. */
  .rail-group-title,
  .rail-title,
  .rail-amount,
  .rail-status {
    display: none;
  }

  .rail-group + .rail-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .rail-row {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    cursor: pointer;
  }

  .rail-row[aria-current="true"] {
    border-color: var(--ink);
  }

  .rail-new {
    margin-top: auto;
    width: 44px;
    height: 44px;
    padding: 0;
    overflow: hidden;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    cursor: pointer;
    /* The icon rail shows only the plus of "+ New case". */
    text-indent: 0;
    white-space: nowrap;
    max-width: 44px;
  }
}

@media (min-width: 1024px) {
  .shell {
    grid-template-columns: 220px minmax(0, 640px) 260px;
    justify-content: center;
  }

  .case-rail:not([hidden]) {
    padding: 12px;
    gap: 4px;
  }

  .rail-group-title {
    display: block;
    margin: 8px 0 2px;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
  }

  .rail-group + .rail-group {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .rail-mark {
    display: none;
  }

  .rail-row {
    display: grid;
    grid-template-columns: 1fr auto;
    place-items: stretch;
    gap: 2px 8px;
    width: 100%;
    height: auto;
    padding: 8px 10px;
    margin-bottom: 4px;
    font-weight: 400;
    text-align: left;
    background: none;
    border: 1px solid var(--line);
  }

  .rail-title {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rail-amount {
    display: block;
    color: var(--ink-2);
    font-size: 0.875rem;
  }

  .rail-status {
    display: block;
    grid-column: 1 / -1;
    color: var(--ink-2);
    font-size: 0.8125rem;
  }

  .rail-new {
    width: 100%;
    max-width: none;
    padding: 8px;
    text-align: center;
  }

  .context-panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    padding: 24px 16px;
    border-left: 1px solid var(--line);
    background: var(--surface);
    font-size: 0.8125rem;
  }

  .ctx-title {
    margin: 0 0 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
  }

  .ctx-documents,
  .ctx-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .ctx-doc {
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink-2);
  }

  .ctx-doc-line {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    cursor: default;
  }

  summary.ctx-doc-line {
    cursor: pointer;
  }

  .ctx-doc-text {
    margin: 6px 0 0;
    padding: 6px 8px;
    background: var(--surface-2);
    border-radius: var(--radius-control);
    white-space: pre-wrap;
  }

  .ctx-tl {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 6px;
    padding: 4px 0;
    color: var(--ink-2);
  }

  .ctx-tl-when {
    color: var(--ink-3);
  }

  /* The reasons, the history and the folded context now live in the right column;
   * the centre keeps the case page the phone has. */
  body:has(.context-panel:not([hidden])) #case-reasoning {
    display: none;
  }

  /* Capture on desktop: a centred single column with a larger drop zone; the
   * recognition expands in place. */
  body[data-mode="capture"] .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-mode="capture"] .case-rail,
  body[data-mode="capture"] .context-panel {
    display: none !important;
  }

  .capture-drop {
    min-height: 200px;
  }
}

/* Task 0107: evidence is quiet -- a closed disclosure, never a competing action. */
.evidence,
.milestone-evidence,
.fee-statement {
  margin-top: calc(var(--space) * 1.5);
  font-size: 0.875rem;
  color: var(--ink);
}
.evidence-meta,
.fee-label,
.fee-note {
  color: var(--ink-2);
  margin: var(--space) 0 0;
}
.fee-rows {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: calc(var(--space) / 2) calc(var(--space) * 2);
  margin: calc(var(--space) * 1.5) 0 0;
}
.fee-rows dd {
  margin: 0;
  text-align: right;
}
.fee-evidence {
  margin: var(--space) 0 0;
  padding-left: calc(var(--space) * 2);
}
.fee-evidence li[data-found="no"] {
  color: var(--ink-2);
}
.fee-bundle {
  display: inline-block;
  margin-top: calc(var(--space) * 1.5);
  color: var(--accent-ink);
}

/* Task 0108: the questions beside the readings are part of the same card. */
.recognition-questions {
  margin-top: calc(var(--space) * 2);
  display: grid;
  gap: calc(var(--space) * 2);
}
.recognition-question-label {
  display: block;
  font-weight: 600;
  color: var(--ink);
}
.recognition-question-help,
.recognition-question-reading {
  margin: calc(var(--space) / 2) 0 0;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.recognition-question-reading:not(:empty) {
  color: var(--ink);
}

/* Held mail: shown plainly, quieter than the next action, never believed by default. */
.held-mail-item {
  margin-top: calc(var(--space) * 2);
  padding: calc(var(--space) * 1.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-2);
  color: var(--ink);
}
.held-mail-label {
  margin: 0;
  font-weight: 600;
}

/* Task 0109: self-send. Actions are quiet; the one dominant action stays the permission. */
.self-send,
.prepared-letter {
  margin-top: calc(var(--space) * 2);
  padding: calc(var(--space) * 1.5);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-2);
  color: var(--ink);
}
.self-send-note,
.address-note {
  margin: 0 0 var(--space);
  color: var(--ink-2);
  font-size: 0.875rem;
}
/* Task 0127: how to send it yourself, one step per line. */
.self-send-steps {
  margin: 0 0 calc(var(--space) * 1.5);
  padding-left: 1.25rem;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.self-send-actions {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space) * 1.5);
  align-items: center;
}
.self-send-link {
  color: var(--accent-ink);
  font-weight: 600;
}
.self-send-copy {
  background: none;
  border: 0;
  padding: 0;
  min-height: 2.75rem; /* a tap target on a phone: found by the report-link screen check (task 0130) */
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.prepared-letter-label {
  margin: 0;
  font-weight: 600;
}

/* A quiet way back before anything is sent. */
.start-over {
  margin: 8px 0 0;
}

.start-over-open {
  font: inherit;
  font-size: 0.9375rem;
  min-height: 44px;
  padding: 0 4px;
  color: var(--ink-2);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

.start-over-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.start-over-note {
  flex-grow: 1;
  flex-shrink: 0;
  flex-basis: 100%;
  margin: 0;
  color: var(--ink-2);
}

/* Inputs that sit outside the decision controls look and size like the ones inside them. */
.recognition-correct .interaction-input,
.recognition-question .interaction-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.recognition-correct-error {
  margin: 6px 0 0;
  color: var(--ink);
}

/* Every disclosure heading is a comfortable tap target; it is the only way to open or close it. */
details > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
}

/* Task 0128: the notice and terms pages, the links to them, the consent step and the account footer. */
.notice-page h2 {
  margin: calc(var(--space) * 3) 0 var(--space);
  font-size: 1.125rem;
}
.notice-page p,
.notice-page li {
  max-width: var(--measure);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.notice-version {
  color: var(--ink-2);
  font-size: 0.875rem;
}
.notice-links {
  margin: calc(var(--space) * 2) 0;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.notice-links a {
  color: var(--ink-2);
}
.case-footer {
  text-align: center;
  padding: 0 var(--gutter) calc(var(--space) * 3);
}
/* Task 0130: "Something went wrong?" reads as a link in the footer and opens a short form. */
.report-link {
  background: none;
  border: 0;
  padding: 0 calc(var(--space) / 2);
  min-height: 2.75rem; /* a tap target on a phone */
  display: inline-flex;
  align-items: center;
  font: inherit;
  color: var(--ink-2);
  text-decoration: underline;
  cursor: pointer;
}
.report-panel {
  max-width: var(--measure);
  margin: 0 auto calc(var(--space) * 3);
  padding: 0 var(--gutter);
  display: grid;
  gap: var(--space);
  text-align: left;
}
.report-label {
  font-weight: 600;
}
.report-text {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: var(--space);
}
/* Task 0131: the start lines, what happens now, the survey, the plain-word buttons. */
.capture-intro {
  margin: 0 0 calc(var(--space) * 2);
  padding-left: 1.25rem;
  max-width: var(--measure);
  line-height: 1.5;
}
.capture-intro li + li {
  margin-top: calc(var(--space) / 2);
}
.capture-language {
  margin: var(--space) 0 0;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.capture-links {
  margin: var(--space) 0 0;
}
.relief-what-now {
  margin-top: calc(var(--space) * 2);
}
.relief-what-now-label {
  margin: 0 0 var(--space);
  font-weight: 600;
}
.relief-what-now-lines {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.5;
}
.survey-card {
  display: grid;
  gap: var(--space);
  margin-top: calc(var(--space) * 3);
  padding: calc(var(--space) * 2);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.survey-title,
.survey-ease-label,
.survey-comment-label {
  margin: 0;
  font-weight: 600;
}
.survey-ease {
  display: flex;
  gap: var(--space);
  flex-wrap: wrap;
}
.survey-ease-button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: none;
  color: inherit;
  cursor: pointer;
}
.survey-ease-button.is-picked {
  background: var(--accent);
  color: var(--on-accent);
}
.survey-actions {
  display: flex;
  gap: var(--space);
  flex-wrap: wrap;
  align-items: center;
}
.glossary-term {
  display: inline-block;
  /* A tap target of at least 32px without changing the line it sits in. */
  margin: -6px 0;
  padding: 6px 0;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.glossary-note {
  display: block;
  margin: var(--space) 0;
  padding: var(--space) calc(var(--space) * 1.5);
  border-left: 3px solid var(--accent-ink);
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.report-hint,
.report-result {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.consent-lines {
  margin: 0 0 calc(var(--space) * 2);
  padding-left: 1.25rem;
  line-height: 1.55;
}
/* 2026-10-20: the notice and the terms on the consent screen, collapsed, each scrolling inside its own box. */
.consent-notices {
  margin: 0 0 calc(var(--space) * 2);
  display: grid;
  gap: calc(var(--space) / 2);
}
.consent-notice {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.consent-notice summary {
  cursor: pointer;
  padding: 10px 12px;
  min-height: 44px;
  box-sizing: border-box;
  font-weight: 600;
  color: var(--accent-ink);
}
.consent-notice-body {
  max-height: 50vh;
  overflow-y: auto;
  padding: 0 12px 12px;
  font-size: 0.9375rem;
}
.consent-notice-body h2 {
  margin: var(--space) 0 calc(var(--space) / 2);
  font-size: 1rem;
}
.consent-notice-body p,
.consent-notice-body li {
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.consent-check {
  display: flex;
  gap: var(--space);
  align-items: flex-start;
  margin: 0 0 calc(var(--space) * 2);
  line-height: 1.45;
}
.consent-check input {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}
.account-footer {
  margin-top: calc(var(--space) * 4);
  border-top: 1px solid var(--line);
  padding-top: calc(var(--space) * 2);
}

/* D-55 (local Beta walk): an airline's claim-form address is one long word; on a phone it pushed the page sideways. */
.prepared-letter,
.prepared-letter .evidence-meta,
.offer-letter-to,
.prepared-fields dd,
.self-send-link {
  overflow-wrap: anywhere;
  min-width: 0;
}
