/* Matters. One stylesheet: tokens, base, components, layouts, pages, motion. */

/* ---------- Fonts ---------- */

@font-face {
  font-family: 'Public Sans';
  src: url('/fonts/public-sans.woff2?v=1') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/newsreader.woff2?v=1') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
/* Fallbacks sized to match, so the swap does not shift the layout. */
@font-face {
  font-family: 'Public Sans Fallback';
  src: local('Arial'), local('ArialMT');
  size-adjust: 104.87%;
  ascent-override: 90.59%;
  descent-override: 21.46%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Public Sans Fallback Android';
  src: local('Roboto'), local('Roboto-Regular');
  size-adjust: 105.1%;
  ascent-override: 90.39%;
  descent-override: 21.41%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Newsreader Fallback';
  src: local('Times New Roman'), local('TimesNewRomanPSMT');
  size-adjust: 105.48%;
  ascent-override: 69.68%;
  descent-override: 25.12%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Newsreader Fallback Android';
  src: local('Noto Serif'), local('NotoSerif');
  size-adjust: 89.09%;
  ascent-override: 82.51%;
  descent-override: 29.75%;
  line-gap-override: 0%;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --font-sans: 'Public Sans', 'Public Sans Fallback', 'Public Sans Fallback Android', system-ui, sans-serif;
  --font-serif: 'Newsreader', 'Newsreader Fallback', 'Newsreader Fallback Android', Georgia, serif;

  /* Type scale (px): 12, 14, 16, 18, 21, 24, 30, 36, 48, 60 */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.3125rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;
  --text-5xl: 3.75rem;

  --lh-tight: 1.12;
  --lh-snug: 1.3;
  --lh-body: 1.55;
  --lh-prose: 1.65;

  /* Spacing on a 4px scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-20: 5rem;
  --s-24: 6rem;

  /* Radii by role: controls, buttons, surfaces, pills */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-full: 999px;

  /* Motion */
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 240ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in: cubic-bezier(0.55, 0, 0.75, 0.2);

  /* Colour: light */
  --paper: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --ink: #16231e;
  --ink-2: #3f4f48;
  --ink-3: #5a6a63;
  --line: #d5ddd8;
  --line-strong: #b4c2bb;
  --green: #0e5a43;
  --green-hover: #0b4b38;
  --green-press: #083d2d;
  --on-green: #ffffff;
  --green-tint: #e2efe8;
  --green-ink: #0b4a37;
  --tape: #b8456b;
  --warn-bg: #fff3d6;
  --warn-ink: #6e4600;
  --warn-line: #ecc978;
  --danger: #a3262b;
  --danger-hover: #8a1f24;
  --danger-bg: #fbeaea;
  --danger-line: #ebbdbd;
  --info-bg: #e7eff5;
  --info-ink: #1e4a69;
  --info-line: #b9d0e2;

  --shadow-1: 0 1px 2px rgb(22 35 30 / 0.06), 0 1px 1px rgb(22 35 30 / 0.04);
  --shadow-pop: 0 16px 40px -12px rgb(22 35 30 / 0.28), 0 2px 6px rgb(22 35 30 / 0.08);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--green);

  --measure: 68ch;
  --content: 72rem;
  --tabbar-h: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1613;
    --surface: #15201b;
    --surface-2: #1a2621;
    --ink: #e8efeb;
    --ink-2: #bccac3;
    --ink-3: #9aaba3;
    --line: #2a3a33;
    --line-strong: #3d5047;
    --green: #5ec497;
    --green-hover: #74d0a7;
    --green-press: #4fb388;
    --on-green: #082018;
    --green-tint: #173a2d;
    --green-ink: #94e0bd;
    --tape: #e586a6;
    --warn-bg: #3a2c0c;
    --warn-ink: #f6cd6f;
    --warn-line: #6c5420;
    --danger: #f19393;
    --danger-hover: #f5aaaa;
    --danger-bg: #3a1818;
    --danger-line: #6e2f2f;
    --info-bg: #142a3a;
    --info-ink: #a5cdea;
    --info-line: #2c4c66;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-pop: 0 18px 44px -12px rgb(0 0 0 / 0.7), 0 2px 6px rgb(0 0 0 / 0.4);
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation-duration: var(--dur-fast);
  animation-timing-function: var(--ease-in);
}
::view-transition-new(root) {
  animation-duration: var(--dur-base);
  animation-timing-function: var(--ease-out);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  font-feature-settings: 'kern' 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

svg.icon {
  display: inline-block;
  flex: none;
  vertical-align: middle;
}

a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--green-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--s-6) 0;
}

.num,
time,
.badge,
table {
  font-variant-numeric: tabular-nums lining-nums;
}

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

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: var(--s-2);
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--surface);
  color: var(--green);
  border-radius: var(--r-md);
  transform: translateY(calc(-100% - var(--s-4)));
}
.skip-link:focus {
  transform: none;
  box-shadow: var(--shadow-pop);
}

.muted {
  color: var(--ink-3);
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.truncate.is-open {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------- Typography ---------- */

.page-title,
.section-title,
.hero-title,
.closing-title,
.dialog-title,
.r-chambers,
.stat-number,
.prose h2,
.message-code {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.page-title {
  font-size: var(--text-2xl);
  line-height: var(--lh-tight);
}

.section-title {
  font-size: var(--text-lg);
  line-height: var(--lh-snug);
}

.lede {
  font-size: var(--text-md);
  color: var(--ink-2);
  max-width: var(--measure);
  text-wrap: pretty;
}

.meta-line {
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.help {
  font-size: var(--text-sm);
  color: var(--ink-3);
  line-height: var(--lh-snug);
  text-wrap: pretty;
}

@media (min-width: 60rem) {
  .page-title {
    font-size: var(--text-3xl);
  }
  .section-title {
    font-size: var(--text-xl);
  }
}

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-line: var(--line-strong);
  --btn-bg-hover: var(--surface-2);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 var(--s-4);
  border: 1px solid var(--btn-line);
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn:hover {
  background: var(--btn-bg-hover);
  color: var(--btn-ink);
  text-decoration: none;
}
.btn:active {
  transform: scale(0.98);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.btn:disabled,
.btn[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-label {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  transition: opacity var(--dur-fast) var(--ease-out);
}

.btn-primary {
  --btn-bg: var(--green);
  --btn-ink: var(--on-green);
  --btn-line: var(--green);
  --btn-bg-hover: var(--green-hover);
}
.btn-primary:active {
  --btn-bg: var(--green-press);
}
.btn-secondary {
  --btn-bg: var(--surface);
  --btn-ink: var(--green-ink);
  --btn-line: var(--line-strong);
  --btn-bg-hover: var(--green-tint);
}
.btn-quiet {
  --btn-bg: transparent;
  --btn-ink: var(--green-ink);
  --btn-line: transparent;
  --btn-bg-hover: var(--green-tint);
}
.btn-danger {
  --btn-bg: var(--surface);
  --btn-ink: var(--danger);
  --btn-line: var(--danger-line);
  --btn-bg-hover: var(--danger-bg);
}
.btn-sm {
  min-height: 2.25rem;
  padding: 0 var(--s-3);
  font-size: var(--text-sm);
}
.btn-lg {
  min-height: 3.25rem;
  padding: 0 var(--s-6);
  font-size: var(--text-md);
}
.btn-block {
  display: flex;
  width: 100%;
}

/* Spinner inside the button while its request runs. The label keeps the width. */
.spinner {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 1.125rem;
  height: 1.125rem;
  margin: -0.5625rem 0 0 -0.5625rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.btn.is-busy,
.btn.htmx-request {
  pointer-events: none;
}
.btn.is-busy .btn-label,
.btn.htmx-request .btn-label {
  opacity: 0;
}
.btn.is-busy .spinner,
.btn.htmx-request .spinner {
  opacity: 1;
  animation: spin 640ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* ---------- Forms ---------- */

.stack {
  display: grid;
  gap: var(--s-5);
}

.field {
  display: grid;
  gap: var(--s-2);
  min-width: 0;
}

.label {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  font-weight: 600;
  font-size: var(--text-base);
  line-height: var(--lh-snug);
}

.label-tag {
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.input {
  width: 100%;
  min-height: 3rem;
  padding: var(--s-3) var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-base);
  line-height: var(--lh-snug);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}
.input:hover {
  border-color: var(--ink-3);
}
.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent);
}
.input:disabled,
.input[readonly] {
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: default;
}
.input[aria-invalid='true'] {
  border-color: var(--danger);
}
.input[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}

.textarea {
  min-height: 7rem;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: var(--s-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235a6a63' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
}

input[type='date'].input {
  min-width: 10rem;
}

.error-text {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--danger);
  line-height: var(--lh-snug);
}
.error-text[hidden] {
  display: none;
}
.error-text .icon {
  margin-top: 1px;
}

.warn-text {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: var(--text-sm);
  color: var(--warn-ink);
  line-height: var(--lh-snug);
}

/* Checkbox: native input kept for accessibility, drawn box beside it. */
.check {
  position: relative;
  display: grid;
  gap: var(--s-1);
}
.check > input {
  position: absolute;
  opacity: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.625rem 0 0 0.625rem;
}
.check > label {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-height: 2.75rem;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-2);
  border-radius: var(--r-md);
  cursor: pointer;
  line-height: var(--lh-snug);
}
.check-text {
  padding-top: 0.125rem;
}
.check-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.check > label:hover .check-box {
  border-color: var(--green);
}
.check > input:checked + label .check-box {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}
.check > input:focus-visible + label {
  box-shadow: var(--ring);
}
.check > input:disabled + label {
  cursor: not-allowed;
  opacity: 0.55;
}
.check.has-error .check-box {
  border-color: var(--danger);
}
.check > .help,
.check > .error-text {
  padding-left: calc(1.5rem + var(--s-3) + var(--s-2));
}

/* "Same as phone" style toggles: the second field shows only when the box is unticked. */
.reveal-group {
  display: grid;
  gap: var(--s-3);
}
.reveal-group:has(.reveal-toggle-inverse input:checked) .reveal-when-unchecked,
.reveal-group:not(:has(.reveal-toggle input:checked)) .reveal-when-checked {
  display: none;
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--danger-line);
  border-radius: var(--r-md);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 500;
}
.form-alert .icon {
  margin-top: 2px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  padding-top: var(--s-2);
}

.inline-form {
  display: inline;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
legend {
  padding: 0;
  font-weight: 600;
}

/* Segmented radio choices */
.choices {
  display: grid;
  gap: var(--s-2);
}
.choice {
  position: relative;
}
.choice > input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}
.choice > label {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 3rem;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}
.choice > label::before {
  content: '';
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.choice > label:hover {
  border-color: var(--green);
}
.choice > input:checked + label {
  border-color: var(--green);
  background: var(--green-tint);
}
.choice > input:checked + label::before {
  border-color: var(--green);
  box-shadow: inset 0 0 0 4px var(--surface);
  background: var(--green);
}
.choice > input:focus-visible + label {
  box-shadow: var(--ring);
}

.copy-field {
  display: grid;
  gap: var(--s-2);
}
.copy-row {
  display: flex;
  gap: var(--s-2);
}
.copy-input {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  min-width: 0;
}

/* ---------- Badges, bars, notes ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  max-width: 100%;
  padding: 0.125rem var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge-neutral {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink-2);
}
.badge-ok {
  background: var(--green-tint);
  color: var(--green-ink);
}
.badge-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}
.badge-danger {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger);
}
.badge-info {
  background: var(--info-bg);
  border-color: var(--info-line);
  color: var(--info-ink);
}
.badge-brand {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-2);
}

/* Completeness bar: width set by fill-N classes, animated on transform only. */
.bar {
  position: relative;
  height: 0.375rem;
  border-radius: var(--r-full);
  background: var(--line);
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--green);
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform var(--dur-slow) var(--ease-out);
}

.note {
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: var(--text-sm);
}
.note-info {
  border-left-color: var(--info-ink);
  background: var(--info-bg);
  color: var(--info-ink);
}
.note-warn {
  border-left-color: var(--warn-ink);
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin: 0 0 var(--s-4);
  padding: var(--s-3) var(--s-4);
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  line-height: var(--lh-snug);
}
.banner .icon {
  margin-top: 1px;
}
.banner-info {
  background: var(--info-bg);
  border-color: var(--info-line);
  color: var(--info-ink);
}
.banner-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}

/* ---------- Surfaces, lists, empty states ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.form-panel {
  display: grid;
  gap: var(--s-5);
  max-width: 40rem;
  padding: var(--s-5) var(--s-4);
}
@media (min-width: 40rem) {
  .form-panel {
    padding: var(--s-8);
  }
}

.list {
  display: grid;
}
.list > li + li {
  border-top: 1px solid var(--line);
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-4);
  min-height: 3.5rem;
}
.row-link {
  position: relative;
  color: inherit;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.row-link:hover {
  background: var(--surface-2);
  color: inherit;
}
.row-link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--green);
  border-radius: 0;
}
.row-main {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}
.row-title {
  font-weight: 600;
  color: var(--ink);
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--s-3);
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.row-meta > * {
  min-width: 0;
  max-width: 100%;
}
.row-meta > span:not(.truncate) {
  white-space: nowrap;
}
.row-chevron {
  display: grid;
  color: var(--ink-3);
}
.cell-lines {
  display: grid;
}

/* Request rows: progress on the right on wide screens, under the text on phones. */
.request-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
@media (max-width: 39.99rem) {
  .request-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .request-row .row-progress {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    text-align: left;
  }
  .request-row .row-chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

/* Expiry rows: date on the right, or under the text on phones. */
.expiry-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
@media (max-width: 39.99rem) {
  .expiry-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .expiry-row .expiry-aside {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
  }
}
.row-aside {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  justify-self: end;
}
.row-progress {
  display: grid;
  gap: var(--s-1);
  width: 7.5rem;
  font-size: var(--text-xs);
  color: var(--ink-3);
  text-align: right;
}

.empty {
  display: grid;
  justify-items: start;
  gap: var(--s-4);
  padding: var(--s-6) var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--ink-2);
}
.empty p {
  max-width: 44ch;
  text-wrap: pretty;
}
.panel .empty {
  border: 0;
  border-radius: 0;
}

.section {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-10);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--s-2) var(--s-4);
  font-size: var(--text-sm);
}
.kv dt {
  color: var(--ink-3);
}
.kv dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Segmented tabs (filters, 30/60/90) */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  padding: var(--s-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.tab {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 var(--s-3);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.tab:hover {
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
}
@media (max-width: 39.99rem) {
  .section-head .tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }
  .section-head .tab {
    justify-content: center;
  }
}
.tab[aria-current='page'],
.tab[aria-selected='true'] {
  background: var(--surface);
  color: var(--green-ink);
  box-shadow: var(--shadow-1);
}

/* Tables (admin) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th,
.table td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  max-width: 16rem;
}
.table thead th {
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
  white-space: nowrap;
}
.table tbody tr:last-child > * {
  border-bottom: 0;
}
.table tbody th {
  font-weight: 500;
}
.table .num-col {
  text-align: right;
}
.table .table-group th {
  background: var(--surface-2);
  color: var(--ink-3);
  font-weight: 600;
}
.row-label-indent {
  padding-left: var(--s-8) !important;
}
.actions-cell {
  white-space: nowrap;
  text-align: right;
}
.actions-cell > * + * {
  margin-left: var(--s-2);
}
.note-cell {
  min-width: 12rem;
  overflow-wrap: anywhere;
}

.stat {
  display: grid;
  gap: var(--s-1);
}
.stat-number {
  font-size: var(--text-5xl);
  line-height: 1;
  color: var(--green-ink);
}
.stat-label {
  color: var(--ink-2);
}

/* ---------- Toasts ---------- */

.toast-region {
  position: fixed;
  z-index: 80;
  left: var(--s-4);
  right: var(--s-4);
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
  display: grid;
  gap: var(--s-2);
  pointer-events: none;
}
.app-body .toast-region {
  bottom: calc(var(--tabbar-h) + var(--s-3) + env(safe-area-inset-bottom));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: toast-in-up var(--dur-base) var(--ease-out) both;
}
.toast p {
  flex: 1;
  padding-top: 1px;
  font-weight: 500;
}
.toast .icon {
  margin-top: 2px;
}
.toast-error {
  background: var(--danger);
  color: #fff;
}
.toast.is-leaving {
  animation: toast-out-down var(--dur-fast) var(--ease-in) both;
}
.toast-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  opacity: 0.8;
}
.toast-close:hover {
  opacity: 1;
}
.toast-close:focus-visible {
  outline: 2px solid currentColor;
}

@media (min-width: 60rem) {
  .toast-region,
  .app-body .toast-region {
    left: auto;
    right: var(--s-6);
    top: var(--s-6);
    bottom: auto;
    width: 24rem;
  }
  .toast {
    animation-name: toast-in-left;
  }
  .toast.is-leaving {
    animation-name: toast-out-right;
  }
}

@keyframes toast-in-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes toast-out-down {
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes toast-in-left {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
@keyframes toast-out-right {
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}

/* ---------- Dialogs ---------- */

.dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
}
.dialog[open] {
  animation: rise-in var(--dur-base) var(--ease-out) both;
}
.dialog::backdrop {
  background: rgb(10 20 16 / 0.45);
}
.dialog[open]::backdrop {
  animation: fade-in var(--dur-base) var(--ease-out) both;
}
.dialog-body {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-6);
}
.dialog-title {
  font-size: var(--text-xl);
  line-height: var(--lh-snug);
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-3);
  padding-top: var(--s-2);
}

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

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink);
  text-decoration: none;
}
.brand:hover {
  color: var(--ink);
}
.brand-name {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark-paper {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 1.75;
  stroke-linejoin: round;
}
.brand-mark-fold {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.75;
  stroke-linejoin: round;
}
.brand-mark-tape {
  fill: var(--tape);
}

/* ---------- Footer ---------- */

.site-footer {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-8) var(--s-4) calc(var(--s-8) + env(safe-area-inset-bottom));
  color: var(--ink-3);
  font-size: var(--text-sm);
}
.site-footer a {
  color: var(--ink-2);
}
.site-footer a:hover {
  color: var(--green);
}
.footer-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-6);
}
.attribution {
  font-size: var(--text-xs);
  letter-spacing: 0.01em;
}
.attribution a {
  font-weight: 600;
  text-decoration: none;
}
.attribution a:hover {
  text-decoration: underline;
}
.footer-invite a {
  font-weight: 600;
}
.site-footer-compact {
  padding-top: var(--s-12);
  padding-left: 0;
  padding-right: 0;
}

/* ---------- Public pages (auth, privacy, errors) ---------- */

.public {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--content);
  margin: 0 auto;
}
.public-head,
.landing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4);
}
.public-main {
  padding: var(--s-4) var(--s-4) var(--s-12);
}

.auth-layout {
  display: grid;
  gap: var(--s-8);
  align-items: start;
}
.auth-layout-single {
  max-width: 28rem;
  margin: 0 auto;
}
.auth-aside {
  display: grid;
  gap: var(--s-3);
}
.auth-card {
  display: grid;
  gap: var(--s-5);
  padding: var(--s-6) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.auth-switch {
  color: var(--ink-2);
}
@media (min-width: 40rem) {
  .auth-card {
    padding: var(--s-8);
  }
}
@media (min-width: 60rem) {
  .public-head,
  .landing-head {
    padding: var(--s-6) var(--s-8);
  }
  .public-main {
    padding: var(--s-8) var(--s-8) var(--s-16);
  }
  .auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
    gap: var(--s-16);
  }
  .auth-layout-single {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    position: sticky;
    top: var(--s-8);
    padding-top: var(--s-8);
  }
  .site-footer {
    padding-left: var(--s-8);
    padding-right: var(--s-8);
  }
}

.message-page {
  display: grid;
  justify-items: start;
  gap: var(--s-4);
  max-width: 34rem;
  margin: var(--s-12) auto 0;
}
.message-code {
  font-size: var(--text-5xl);
  line-height: 1;
  color: var(--line-strong);
}

.prose {
  display: grid;
  gap: var(--s-4);
  max-width: var(--measure);
  margin: 0 auto;
  line-height: var(--lh-prose);
}
.prose section {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.prose h2 {
  font-size: var(--text-xl);
  line-height: var(--lh-snug);
}
.prose p {
  text-wrap: pretty;
}

/* ---------- Lawyer app shell ---------- */

.shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
  padding: 0 var(--s-2) 0 var(--s-4);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-settings {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--r-md);
  color: var(--ink-2);
}
.topbar-settings[aria-current='page'] {
  color: var(--green);
  background: var(--green-tint);
}

.sidebar {
  display: none;
}

.main {
  min-width: 0;
  padding: var(--s-5) var(--s-4) calc(var(--tabbar-h) + var(--s-4) + env(safe-area-inset-bottom));
}
.main:focus {
  outline: none;
}
.content {
  max-width: var(--content);
}

.tabbar {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar .nav-link {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 0.125rem;
  padding: 0 var(--s-1);
  border-radius: 0;
  font-size: var(--text-xs);
}
.tabbar .nav-link[aria-current='page'] {
  background: transparent;
  color: var(--green);
}
.tabbar .nav-link[aria-current='page'] .icon {
  stroke-width: 2.25;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 2.75rem;
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-link[aria-current='page'] {
  background: var(--green-tint);
  color: var(--green-ink);
  font-weight: 600;
}
.nav-link:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.nav-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

@media (min-width: 60rem) {
  .shell {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    /* Sidebar colour runs the full height of long pages too. */
    background: linear-gradient(to right, var(--surface) 15.5rem, var(--line) 15.5rem, var(--line) calc(15.5rem + 1px), transparent calc(15.5rem + 1px));
  }
  .topbar,
  .tabbar {
    display: none;
  }
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-6);
    height: 100vh;
    height: 100dvh;
    padding: var(--s-6) var(--s-4);
  }
  .sidebar-brand {
    padding: 0 var(--s-3);
  }
  .nav-links {
    display: grid;
    gap: var(--s-1);
  }
  .sidebar-foot {
    display: grid;
    gap: var(--s-1);
    margin-top: auto;
    padding-top: var(--s-4);
    border-top: 1px solid var(--line);
  }
  .sidebar-who {
    display: grid;
    padding: 0 var(--s-3) var(--s-2);
    font-size: var(--text-sm);
    font-weight: 600;
  }
  .sidebar-chambers {
    font-weight: 400;
    color: var(--ink-3);
  }
  .main {
    padding: var(--s-8) var(--s-10) var(--s-8);
  }
  .app-body .toast-region {
    bottom: auto;
  }
}

/* Page header */
.page-head {
  display: grid;
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
.page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
}
.page-head-text {
  display: grid;
  gap: var(--s-2);
  min-width: 0;
  flex: 1 1 20rem;
}
.page-title {
  overflow-wrap: anywhere;
}
.page-sub {
  color: var(--ink-2);
  max-width: var(--measure);
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  justify-self: start;
  min-height: 2rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
}
.back-link:hover {
  color: var(--green);
}

.section-link {
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Two-column page body (matter, contact, home) */
.split {
  display: grid;
  gap: var(--s-8);
}
.split > * {
  min-width: 0;
}
.split-aside > .section:first-child {
  margin-top: 0;
}
.split-aside .copy-row {
  flex-direction: column;
}
@media (max-width: 71.99rem) {
  .split-aside-first {
    order: -1;
  }
}
@media (min-width: 72rem) {
  .split.home-split {
    grid-template-columns: minmax(0, 1fr) 24rem;
  }
  .split {
    grid-template-columns: minmax(0, 1fr) 20rem;
    align-items: start;
  }
  .split-aside {
    position: sticky;
    top: var(--s-8);
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.toolbar .field {
  flex: 1 1 14rem;
}
.search-row {
  display: flex;
  gap: var(--s-2);
}
.search-row .input {
  flex: 1;
}

/* ---------- App pages ---------- */

.head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-4);
  color: var(--ink-3);
  font-size: var(--text-sm);
}
.matter-note {
  margin-bottom: var(--s-6);
}
.section-first {
  margin-top: 0;
}
.subsection-title {
  margin-top: var(--s-2);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink-2);
}
.stack-tight {
  gap: var(--s-4);
}

.choices-row {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.filter-form {
  display: flex;
  gap: var(--s-2);
  flex: 1 1 16rem;
}
.filter-form .select {
  flex: 1;
  min-width: 0;
}

.row-count {
  font-size: var(--text-sm);
  color: var(--ink-3);
  white-space: nowrap;
}
.row-aside > .icon {
  color: var(--ink-3);
}
.expiry-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
}
.expiry-date {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.aside-section {
  display: grid;
  gap: var(--s-3);
}
.aside-section + .aside-section {
  margin-top: var(--s-8);
}
.aside-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
}
.aside-panel {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-4);
  margin-bottom: var(--s-8);
}
.aside-head {
  display: flex;
  gap: var(--s-2);
}
.aside-notes {
  white-space: pre-line;
  color: var(--ink-2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.attach-panel {
  padding: var(--s-4);
}

.people-list .person {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4);
}
.person-link {
  display: grid;
  gap: 0.125rem;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.person-link:hover .row-title {
  color: var(--green);
}

.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-3);
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.icon-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.icon-button:active {
  transform: scale(0.96);
}
.icon-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Disclosure (details/summary): inline editors */
.disclosure > summary {
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker {
  display: none;
}
.disclosure-summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 2.75rem;
  margin-top: var(--s-3);
  border-radius: var(--r-md);
  color: var(--green-ink);
  font-weight: 600;
}
.disclosure-summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.disclosure[open] > .disclosure-body {
  animation: rise-in var(--dur-base) var(--ease-out) both;
}
.disclosure-body {
  margin-top: var(--s-3);
}

/* Files on the lawyer side */
.file-group {
  overflow: hidden;
}
.file-group + .file-group {
  margin-top: var(--s-4);
}
.file-group-head {
  display: grid;
  gap: 0.125rem;
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--text-sm);
}
.file-group-title {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--ink);
  text-decoration: none;
}
.file-group-title:hover {
  color: var(--green);
}
.field-group + .field-group {
  border-top: 1px solid var(--line);
}
.field-group-title {
  padding: var(--s-3) var(--s-4) 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-3);
}
.file-list {
  display: grid;
}
.file-row {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
}
.file-row + .file-row {
  border-top: 1px dashed var(--line);
}
.file-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--s-3);
}
.file-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-sm);
  background: var(--green-tint);
  color: var(--green-ink);
}
.file-text {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}
.file-name {
  font-weight: 600;
}
.file-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}
.file-badges:empty {
  display: none;
}
.file-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--s-2);
  padding-left: calc(2.25rem + var(--s-3));
}
@media (max-width: 39.99rem) {
  .file-actions {
    padding-left: 0;
  }
}
.file-actions .disclosure > summary.btn {
  display: inline-flex;
}
.expiry-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s-2);
  width: 100%;
}
.file-actions .disclosure[open] {
  flex-basis: 100%;
  order: 3;
}

/* ---------- Templates ---------- */

.card-grid {
  display: grid;
  gap: var(--s-4);
}
@media (min-width: 48rem) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  }
}
.template-card {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: var(--s-4);
  padding: var(--s-5);
}
.template-card-text {
  display: grid;
  align-content: start;
  gap: var(--s-2);
}
.template-card-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: var(--lh-snug);
}
.template-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.details-panel {
  margin-bottom: var(--s-6);
  max-width: 40rem;
}
.details-panel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3rem;
  padding: 0 var(--s-4);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-lg);
}
.details-panel-summary::-webkit-details-marker {
  display: none;
}
.details-panel-summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.details-panel[open] > .details-panel-summary .icon,
.field-card details[open] > .fc-summary > .icon {
  transform: rotate(180deg);
}
.details-panel-body {
  padding: 0 var(--s-4) var(--s-4);
}
.details-panel[open] > .details-panel-body {
  animation: rise-in var(--dur-base) var(--ease-out) both;
}

.builder {
  display: grid;
  gap: var(--s-8);
}
.builder > * {
  min-width: 0;
}
.builder-fields {
  display: grid;
  align-content: start;
  gap: var(--s-4);
}
@media (min-width: 64rem) {
  .builder {
    grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
    align-items: start;
  }
  .builder-preview {
    position: sticky;
    top: var(--s-8);
    max-height: calc(100dvh - var(--s-16));
    overflow-y: auto;
    border-radius: var(--r-lg);
  }
}

.field-cards {
  display: grid;
  gap: var(--s-2);
}
.field-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.field-card:has(details[open]) {
  border-color: var(--green);
}
.fc-summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 3.5rem;
  padding: var(--s-2) var(--s-4);
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-lg);
}
.fc-summary::-webkit-details-marker {
  display: none;
}
.fc-summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.fc-summary > .icon {
  color: var(--ink-3);
  transition: transform var(--dur-fast) var(--ease-out);
}
.fc-index {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-2);
}
.fc-summary-text {
  display: grid;
  flex: 1;
  min-width: 0;
}
.fc-type {
  font-size: var(--text-xs);
  color: var(--ink-3);
  font-weight: 500;
}
.fc-label {
  font-weight: 600;
}
.fc-body {
  display: grid;
  gap: var(--s-4);
  margin: 0;
  padding: var(--s-2) var(--s-4) var(--s-4);
  border-top: 1px solid var(--line);
}
.field-card details[open] > .fc-body {
  animation: rise-in var(--dur-base) var(--ease-out) both;
}
.fc-tools {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--line);
}
.fc-remove {
  margin-left: auto;
}
.reveal-indent {
  margin-left: var(--s-8);
}
.add-field {
  padding: var(--s-4);
}

.preview-panel {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--surface-2);
}
.r-list-preview {
  pointer-events: none;
}
.r-list-preview .r-item {
  padding: var(--s-4) 0;
}

/* ---------- Checklist (client form and previews) ---------- */

.r-list {
  display: grid;
}
.r-item {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--line);
}
.r-item:first-child {
  border-top: 0;
}
.r-check {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.0625rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out);
}
.r-check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.r-check.is-done {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}
.r-check.just-done path {
  animation: draw-check var(--dur-slow) var(--ease-out) both;
  animation-delay: 60ms;
}
@keyframes draw-check {
  from {
    stroke-dashoffset: 1;
  }
}
.r-item.has-error .r-check {
  border-color: var(--danger);
}
.r-body {
  display: grid;
  gap: var(--s-2);
  min-width: 0;
}
.r-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--s-2);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: var(--lh-snug);
  color: var(--ink);
}
.r-label label {
  cursor: pointer;
}
.r-status {
  min-height: 1.25rem;
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.r-status:empty {
  min-height: 0;
}
.saved-text {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--green-ink);
}

/* Uploads */
.upload {
  display: grid;
  gap: var(--s-3);
}
.up-list {
  display: grid;
  gap: var(--s-2);
}
.up-list:empty {
  display: none;
}
.up-file {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.up-file-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
}
.up-file-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-sm);
  background: var(--green-tint);
  color: var(--green-ink);
}
.up-file-text {
  display: grid;
  min-width: 0;
}
.up-file-name {
  font-weight: 600;
  font-size: var(--text-sm);
}
.up-file-meta {
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.up-progress {
  position: relative;
  height: 0.25rem;
  border-radius: var(--r-full);
  background: var(--line);
  overflow: hidden;
}
.up-progress-fill {
  position: absolute;
  inset: 0;
  background: var(--green);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform var(--dur-base) var(--ease-out);
}
.up-file.is-failed {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}
.up-file.is-failed .up-progress-fill {
  background: var(--danger);
}
.up-file.is-settling {
  animation: settle var(--dur-slow) var(--ease-out) both;
}
@keyframes settle {
  from {
    opacity: 0.6;
    transform: translateY(2px);
  }
}
.up-expiry {
  display: grid;
  gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--line);
}
.up-expiry-label {
  font-size: var(--text-sm);
}
.up-expiry-input {
  max-width: 14rem;
}
.up-expiry-msg:empty {
  display: none;
}
.check-sm > label {
  min-height: 2.5rem;
  padding: var(--s-1) 0;
  font-size: var(--text-sm);
}
.check-sm > input {
  margin: 0.5rem 0 0 0;
}
.check-sm > input + label .check-box {
  width: 1.375rem;
  height: 1.375rem;
}
.up-add {
  position: relative;
}
.up-add[hidden] {
  display: none;
}
.up-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.up-input:focus-visible + .up-button {
  box-shadow: var(--ring);
}
.up-button {
  width: 100%;
  min-height: 3.25rem;
  border-style: dashed;
  cursor: pointer;
}
.up-button.is-disabled {
  cursor: default;
  opacity: 0.7;
}
.up-help {
  font-size: var(--text-xs);
}

/* ---------- Requests (lawyer side) ---------- */

.choice-text {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}
.choice-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.choice-meta {
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.sent {
  display: grid;
  justify-items: start;
  gap: var(--s-4);
  max-width: 34rem;
  margin: var(--s-4) auto 0;
}
.sent-mark {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--green-tint);
  color: var(--green-ink);
}
.sent .lede {
  margin-bottom: var(--s-2);
}
.share {
  display: grid;
  gap: var(--s-4);
  width: 100%;
}
.sent-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.request-summary {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-4);
}
.request-progress {
  display: grid;
  gap: var(--s-2);
  font-weight: 600;
}
.request-progress .bar {
  height: 0.5rem;
}
.missing {
  display: grid;
  gap: var(--s-2);
}
.missing-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--warn-ink);
}
.missing-list {
  display: grid;
  gap: var(--s-1);
  margin: 0;
  padding-left: var(--s-5);
  color: var(--ink-2);
}
.all-in {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--green-ink);
  font-weight: 600;
}

.answers {
  display: grid;
}
.answer {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4);
}
.answer + .answer {
  border-top: 1px solid var(--line);
}
.answer-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-3);
}
.answer-value {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.file-list-flush .file-row {
  padding-left: 0;
  padding-right: 0;
}
.aside-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* ---------- Client form (recipient) ---------- */

.r-page {
  background: var(--paper);
}
.r-page :is(input, textarea, select, .up-button) {
  scroll-margin-top: 6rem;
}
.r-header {
  padding: var(--s-8) var(--s-4) var(--s-6);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.r-header-inner,
.r-progress-inner,
.r-main {
  max-width: 36rem;
  margin: 0 auto;
}
.r-header-inner {
  display: grid;
  gap: var(--s-1);
}
.r-chambers {
  font-size: var(--text-xl);
  line-height: var(--lh-snug);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.r-from {
  font-size: var(--text-sm);
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.r-title {
  margin-top: var(--s-5);
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: var(--lh-snug);
  overflow-wrap: anywhere;
}
.r-intro {
  color: var(--ink-2);
  font-size: var(--text-sm);
}
.r-progress {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: var(--s-3) var(--s-4);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.r-progress-inner {
  display: grid;
  gap: var(--s-2);
}
.r-progress-text {
  font-size: var(--text-sm);
  font-weight: 600;
}
.r-progress .bar {
  height: 0.5rem;
}
.r-main {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-4) var(--s-8);
}
.r-main:focus {
  outline: none;
}
.r-form {
  display: grid;
  gap: var(--s-4);
}
.r-form .r-list {
  padding: var(--s-1) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.r-submit {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.r-done {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line));
  border-radius: var(--r-lg);
  background: var(--green-tint);
  color: var(--green-ink);
}
.r-done-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--green);
  color: var(--on-green);
}
.r-done-title {
  font-weight: 600;
  color: var(--ink);
}
.r-report {
  font-size: var(--text-sm);
  text-align: center;
}
.r-report a {
  color: var(--ink-3);
}
.r-report-form {
  margin-top: var(--s-4);
}
.r-message {
  justify-items: start;
  padding-top: var(--s-16);
  min-height: 60vh;
  align-content: start;
}
.r-message-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.r-page .site-footer {
  max-width: 36rem;
  margin: 0 auto;
  padding-top: var(--s-4);
}
.r-status.is-error {
  color: var(--danger);
}
.up-file-actions {
  display: flex;
  gap: var(--s-1);
}
.up-file.is-pending .up-file-icon {
  background: var(--surface-2);
  color: var(--ink-3);
}
@media (min-width: 40rem) {
  .r-header {
    padding-top: var(--s-12);
  }
  .r-chambers {
    font-size: var(--text-2xl);
  }
  .r-form .r-list,
  .r-submit {
    padding-left: var(--s-6);
    padding-right: var(--s-6);
  }
}

/* ---------- Landing ---------- */

.landing-body main {
  max-width: var(--content);
  margin: 0 auto;
}
.landing-head {
  max-width: var(--content);
  margin: 0 auto;
}
.landing-body .site-footer {
  max-width: var(--content);
  margin: 0 auto;
}

.hero {
  display: grid;
  gap: var(--s-10);
  padding: var(--s-8) var(--s-4) var(--s-12);
}
.hero-text {
  display: grid;
  align-content: center;
  gap: var(--s-5);
}
.hero-title {
  font-size: clamp(2.5rem, 9vw, var(--text-5xl));
  line-height: 1.04;
  letter-spacing: -0.02em;
  max-width: 13ch;
}
.hero-sub {
  font-size: var(--text-md);
  color: var(--ink-2);
  max-width: 34rem;
  text-wrap: pretty;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  padding-top: var(--s-2);
}
.hero-art {
  display: grid;
  justify-items: center;
}
@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: center;
    gap: var(--s-12);
    padding: var(--s-12) var(--s-8) var(--s-20);
  }
  .hero-sub {
    font-size: var(--text-lg);
  }
}

/* Phone illustration. Starts empty; plays once (.is-playing) or shows the end state (.is-done). */
.phone-wrap {
  padding: var(--s-4);
}
.phone {
  --ph-dur: 200ms;
  width: 17.5rem;
  aspect-ratio: 280 / 500;
  padding: 0.625rem;
  border-radius: 2.5rem;
  background: #17221d;
  box-shadow:
    0 40px 60px -30px rgb(22 35 30 / 0.45),
    0 0 0 1px rgb(22 35 30 / 0.08);
}
.phone-screen {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100%;
  padding: var(--s-6) var(--s-4) var(--s-4);
  border-radius: 1.9rem;
  background: #ffffff;
  color: #16231e;
  overflow: hidden;
}
.phone-screen::before {
  content: '';
  position: absolute;
  top: 0.5rem;
  left: 50%;
  width: 4.5rem;
  height: 1.1rem;
  margin-left: -2.25rem;
  border-radius: var(--r-full);
  background: #17221d;
}
@media (prefers-color-scheme: dark) {
  .phone {
    box-shadow:
      0 40px 60px -30px rgb(0 0 0 / 0.7),
      0 0 0 1px var(--line-strong);
  }
}
.ph-head {
  display: grid;
  gap: 0.125rem;
  padding: var(--s-3) 0 var(--s-3);
}
.ph-chambers {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.2;
}
.ph-title {
  font-size: var(--text-xs);
  color: #5a6a63;
}
.ph-progress {
  display: grid;
  gap: var(--s-2);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid #e3e9e5;
}
.ph-count {
  display: flex;
  align-items: center;
  gap: 0.25em;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.25rem;
}
.ph-odometer {
  display: inline-block;
  height: 1.25rem;
  overflow: hidden;
}
.ph-digits {
  display: grid;
  transform: translateY(0);
}
.ph-digits > span {
  height: 1.25rem;
}
.ph-bar {
  position: relative;
  height: 0.375rem;
  border-radius: var(--r-full);
  background: #d5ddd8;
  overflow: hidden;
}
.ph-bar-fill {
  position: absolute;
  inset: 0;
  background: #0e5a43;
  transform-origin: left center;
  transform: scaleX(0);
}
.ph-list {
  display: grid;
  align-content: start;
}
.ph-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.25rem var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid #edf1ee;
  font-size: var(--text-sm);
  font-weight: 600;
  color: #5a6a63;
}
.ph-check {
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  border: 2px solid #b4c2bb;
  border-radius: 50%;
  background: #ffffff;
  color: #ffffff;
}
.ph-check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.ph-line {
  grid-column: 2;
  height: 0.375rem;
  width: 70%;
  border-radius: var(--r-full);
  background: #e2efe8;
  transform-origin: left center;
  transform: scaleX(0);
}
.ph-item-2 .ph-line {
  width: 90%;
}
.ph-item-3 .ph-line,
.ph-item-4 .ph-line {
  width: 45%;
}
.ph-submit {
  display: grid;
  place-items: center;
  height: 2.5rem;
  border-radius: var(--r-md);
  background: #0e5a43;
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: 600;
  opacity: 0.35;
}

/* The sequence: item k completes at 300ms + 450ms x (k - 1). Total 2.1s, once. */
.phone.is-playing .ph-bar-fill {
  animation: ph-bar 2100ms linear forwards;
}
.phone.is-playing .ph-digits {
  animation: ph-count 2100ms linear forwards;
}
.phone.is-playing .ph-item {
  animation: ph-item var(--ph-dur) var(--ease-out) forwards;
}
.phone.is-playing .ph-check {
  animation: ph-check var(--ph-dur) var(--ease-out) forwards;
}
.phone.is-playing .ph-check path {
  animation: ph-draw var(--dur-slow) var(--ease-out) forwards;
}
.phone.is-playing .ph-line {
  animation: ph-line var(--dur-slow) var(--ease-out) forwards;
}
.phone.is-playing .ph-submit {
  animation: ph-submit var(--dur-base) var(--ease-out) 2000ms forwards;
}
.phone.is-playing .ph-item-1 .ph-line { animation-delay: 60ms; }
.phone.is-playing .ph-item-1,
.phone.is-playing .ph-item-1 .ph-check { animation-delay: 300ms; }
.phone.is-playing .ph-item-1 .ph-check path { animation-delay: 360ms; }
.phone.is-playing .ph-item-2 .ph-line { animation-delay: 510ms; }
.phone.is-playing .ph-item-2,
.phone.is-playing .ph-item-2 .ph-check { animation-delay: 750ms; }
.phone.is-playing .ph-item-2 .ph-check path { animation-delay: 810ms; }
.phone.is-playing .ph-item-3 .ph-line { animation-delay: 960ms; }
.phone.is-playing .ph-item-3,
.phone.is-playing .ph-item-3 .ph-check { animation-delay: 1200ms; }
.phone.is-playing .ph-item-3 .ph-check path { animation-delay: 1260ms; }
.phone.is-playing .ph-item-4 .ph-line { animation-delay: 1410ms; }
.phone.is-playing .ph-item-4,
.phone.is-playing .ph-item-4 .ph-check { animation-delay: 1650ms; }
.phone.is-playing .ph-item-4 .ph-check path { animation-delay: 1710ms; }

@keyframes ph-bar {
  0%, 14.3% { transform: scaleX(0); animation-timing-function: var(--ease-out); }
  23.8%, 35.7% { transform: scaleX(0.25); animation-timing-function: var(--ease-out); }
  45.2%, 57.1% { transform: scaleX(0.5); animation-timing-function: var(--ease-out); }
  66.7%, 78.6% { transform: scaleX(0.75); animation-timing-function: var(--ease-out); }
  88.1%, 100% { transform: scaleX(1); }
}
@keyframes ph-count {
  0%, 14.3% { transform: translateY(0); animation-timing-function: var(--ease-out); }
  20%, 35.7% { transform: translateY(-20%); animation-timing-function: var(--ease-out); }
  41.4%, 57.1% { transform: translateY(-40%); animation-timing-function: var(--ease-out); }
  62.9%, 78.6% { transform: translateY(-60%); animation-timing-function: var(--ease-out); }
  84.3%, 100% { transform: translateY(-80%); }
}
@keyframes ph-item {
  to { color: #16231e; }
}
@keyframes ph-check {
  to { background: #0e5a43; border-color: #0e5a43; }
}
@keyframes ph-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes ph-line {
  to { transform: scaleX(1); }
}
@keyframes ph-submit {
  to { opacity: 1; }
}
.phone.is-done .ph-item { color: #16231e; }
.phone.is-done .ph-check { background: #0e5a43; border-color: #0e5a43; }
.phone.is-done .ph-check path { stroke-dashoffset: 0; }
.phone.is-done .ph-bar-fill { transform: scaleX(1); }
.phone.is-done .ph-digits { transform: translateY(-80%); }
.phone.is-done .ph-line { transform: scaleX(1); }
.phone.is-done .ph-submit { opacity: 1; }

.steps {
  display: grid;
  gap: var(--s-6);
  margin: 0 var(--s-4);
  padding: var(--s-12) 0;
  border-top: 1px solid var(--line);
}
.steps-list {
  display: grid;
  gap: var(--s-8);
  counter-reset: none;
}
.step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-1) var(--s-4);
  align-items: baseline;
}
.step-n {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  color: var(--green-ink);
  background: var(--surface);
}
.step-title {
  font-size: var(--text-md);
  font-weight: 700;
  line-height: var(--lh-snug);
}
.step p {
  color: var(--ink-2);
  max-width: 34ch;
  text-wrap: pretty;
}
@media (min-width: 60rem) {
  .steps {
    margin: 0 var(--s-8);
    padding: var(--s-16) 0;
  }
  .steps-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-10);
  }
  .step {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .step-n {
    grid-row: auto;
  }
}

.assurance {
  display: grid;
  gap: var(--s-8);
  margin: 0 var(--s-4);
  padding: var(--s-8) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.assurance-item {
  display: grid;
  gap: var(--s-2);
  align-content: start;
}
.assurance-item > .icon {
  color: var(--green);
  margin-bottom: var(--s-1);
}
.assurance-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: var(--lh-snug);
}
.assurance-item p {
  color: var(--ink-2);
  max-width: 44ch;
  text-wrap: pretty;
}
@media (min-width: 60rem) {
  .assurance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-12);
    margin: 0 var(--s-8);
    padding: var(--s-12);
  }
}

.closing {
  display: grid;
  justify-items: start;
  gap: var(--s-4);
  padding: var(--s-16) var(--s-4) var(--s-12);
}
.closing-title {
  font-size: clamp(var(--text-2xl), 6vw, var(--text-4xl));
  line-height: var(--lh-tight);
}
.closing p {
  color: var(--ink-2);
  font-size: var(--text-md);
  margin-bottom: var(--s-2);
}
@media (min-width: 60rem) {
  .closing {
    padding: var(--s-20) var(--s-8) var(--s-16);
  }
}

/* ---------- Motion ---------- */

/* First load: content fades up 6px, at most three groups, 40ms apart. */
.enter {
  animation: fade-up var(--dur-slow) var(--ease-out) both;
}
.enter-2 {
  animation-delay: 40ms;
}
.enter-3 {
  animation-delay: 80ms;
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* htmx swaps fade in. */
.htmx-added {
  opacity: 0;
}
.htmx-settling .swap-fade,
.swap-fade {
  transition: opacity var(--dur-base) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .btn.is-busy .spinner,
  .btn.htmx-request .spinner {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.6;
  }
  @view-transition {
    navigation: none;
  }
}

/* Completeness steps (fill-0 to fill-100). Generated. */
.fill-0{--p:0}
.fill-1{--p:0.01}
.fill-2{--p:0.02}
.fill-3{--p:0.03}
.fill-4{--p:0.04}
.fill-5{--p:0.05}
.fill-6{--p:0.06}
.fill-7{--p:0.07}
.fill-8{--p:0.08}
.fill-9{--p:0.09}
.fill-10{--p:0.10}
.fill-11{--p:0.11}
.fill-12{--p:0.12}
.fill-13{--p:0.13}
.fill-14{--p:0.14}
.fill-15{--p:0.15}
.fill-16{--p:0.16}
.fill-17{--p:0.17}
.fill-18{--p:0.18}
.fill-19{--p:0.19}
.fill-20{--p:0.20}
.fill-21{--p:0.21}
.fill-22{--p:0.22}
.fill-23{--p:0.23}
.fill-24{--p:0.24}
.fill-25{--p:0.25}
.fill-26{--p:0.26}
.fill-27{--p:0.27}
.fill-28{--p:0.28}
.fill-29{--p:0.29}
.fill-30{--p:0.30}
.fill-31{--p:0.31}
.fill-32{--p:0.32}
.fill-33{--p:0.33}
.fill-34{--p:0.34}
.fill-35{--p:0.35}
.fill-36{--p:0.36}
.fill-37{--p:0.37}
.fill-38{--p:0.38}
.fill-39{--p:0.39}
.fill-40{--p:0.40}
.fill-41{--p:0.41}
.fill-42{--p:0.42}
.fill-43{--p:0.43}
.fill-44{--p:0.44}
.fill-45{--p:0.45}
.fill-46{--p:0.46}
.fill-47{--p:0.47}
.fill-48{--p:0.48}
.fill-49{--p:0.49}
.fill-50{--p:0.50}
.fill-51{--p:0.51}
.fill-52{--p:0.52}
.fill-53{--p:0.53}
.fill-54{--p:0.54}
.fill-55{--p:0.55}
.fill-56{--p:0.56}
.fill-57{--p:0.57}
.fill-58{--p:0.58}
.fill-59{--p:0.59}
.fill-60{--p:0.60}
.fill-61{--p:0.61}
.fill-62{--p:0.62}
.fill-63{--p:0.63}
.fill-64{--p:0.64}
.fill-65{--p:0.65}
.fill-66{--p:0.66}
.fill-67{--p:0.67}
.fill-68{--p:0.68}
.fill-69{--p:0.69}
.fill-70{--p:0.70}
.fill-71{--p:0.71}
.fill-72{--p:0.72}
.fill-73{--p:0.73}
.fill-74{--p:0.74}
.fill-75{--p:0.75}
.fill-76{--p:0.76}
.fill-77{--p:0.77}
.fill-78{--p:0.78}
.fill-79{--p:0.79}
.fill-80{--p:0.80}
.fill-81{--p:0.81}
.fill-82{--p:0.82}
.fill-83{--p:0.83}
.fill-84{--p:0.84}
.fill-85{--p:0.85}
.fill-86{--p:0.86}
.fill-87{--p:0.87}
.fill-88{--p:0.88}
.fill-89{--p:0.89}
.fill-90{--p:0.90}
.fill-91{--p:0.91}
.fill-92{--p:0.92}
.fill-93{--p:0.93}
.fill-94{--p:0.94}
.fill-95{--p:0.95}
.fill-96{--p:0.96}
.fill-97{--p:0.97}
.fill-98{--p:0.98}
.fill-99{--p:0.99}
.fill-100{--p:1.00}

/* ---------- Notifications (Settings) ---------- */

.form-panel + .form-panel {
  margin-top: var(--s-6);
}

.push-device,
.push-test {
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.push-title {
  font-size: var(--text-base);
  font-weight: 600;
}
.push-status {
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.push-device [hidden],
.push-device .form-actions:not(:has(> :not([hidden]))) {
  display: none;
}
.section-intro {
  gap: var(--s-2);
}
.push-test {
  display: grid;
  justify-items: start;
  gap: var(--s-3);
}
