/* ==========================================================================
   Hird, Chu, Lawji — Client Portal
   Plain CSS, mobile-first. Neutral slate palette + one accent (deep green).
   ========================================================================== */

@font-face {
  font-family: "Hedvig Letters Serif";
  src: url("../fonts/hedvig-letters-serif.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #526071;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --brand: #1b2a3a;
  --brand-2: #243748;
  --on-brand: #e8edf2;
  --accent: #1f6f5c;
  --accent-hover: #185a4a;
  --accent-soft: #e8f3ef;
  --danger: #b42318;
  --danger-hover: #912018;
  --danger-soft: #fef3f2;
  --warning: #93370d;
  --warning-soft: #fffaeb;
  --info: #1d4ed8;
  --info-soft: #eff4ff;
  --success: #067647;
  --success-soft: #ecfdf3;

  --f-serif: "Hedvig Letters Serif", Georgia, "Times New Roman", serif;
  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --t-xs: .75rem;
  --t-sm: .875rem;
  --t-md: 1rem;
  --t-lg: 1.125rem;
  --t-xl: 1.375rem;
  --t-2xl: 1.75rem;
  --t-3xl: 2.125rem;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);
  --focus: 0 0 0 3px rgba(31, 111, 92, .35);
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-ui);
  font-size: var(--t-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-family: var(--f-serif); font-weight: 400; font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); font-weight: 600; }
h3 { font-size: var(--t-lg); font-weight: 600; }
h4 { font-size: var(--t-md); font-weight: 600; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only {
  position: absolute; 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: 8px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: var(--r-sm);
  box-shadow: var(--shadow);
}
.skip-link:focus { top: 8px; }

.icon { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.eyebrow {
  margin: 0 0 4px; font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--accent); --btn-fg: #fff; --btn-border: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  font: 600 var(--t-sm)/1.2 var(--f-ui); text-decoration: none; white-space: nowrap;
  color: var(--btn-fg); background: var(--btn-bg); border: 1px solid var(--btn-border);
  border-radius: var(--r-sm); cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { --btn-bg: var(--accent-hover); --btn-border: var(--accent-hover); color: var(--btn-fg); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn[disabled], .btn.is-loading { opacity: .65; cursor: not-allowed; }
.btn--secondary { --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-border: var(--line-strong); }
.btn--secondary:hover { --btn-bg: var(--surface-2); --btn-border: #94a3b8; --btn-fg: var(--ink); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--accent); --btn-border: var(--line-strong); }
.btn--ghost:hover { --btn-bg: var(--accent-soft); --btn-border: var(--accent); --btn-fg: var(--accent-hover); }
.btn--danger { --btn-bg: var(--danger); --btn-border: var(--danger); }
.btn--danger:hover { --btn-bg: var(--danger-hover); --btn-border: var(--danger-hover); }
.btn--text { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--accent); padding-inline: 8px; }
.btn--text:hover { --btn-bg: var(--accent-soft); --btn-border: transparent; --btn-fg: var(--accent-hover); }
.btn--danger-text { --btn-fg: var(--danger); }
.btn--danger-text:hover { --btn-bg: var(--danger-soft); --btn-fg: var(--danger-hover); }
.btn--sm { min-height: 36px; padding: 6px 12px; font-size: var(--t-sm); }
.btn--block { width: 100%; }
.btn .icon { width: 18px; height: 18px; }
.btn.is-loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn.is-loading .icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row--center { justify-content: center; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field__label { font-size: var(--t-sm); font-weight: 600; color: var(--ink); padding: 0; }
.field__label--sm { font-weight: 500; color: var(--ink-2); }
legend.field__label { margin-bottom: 6px; }
.req { color: var(--danger); }
.field__help { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.field__error {
  display: flex; gap: 6px; align-items: flex-start; margin: 0;
  font-size: var(--t-sm); font-weight: 500; color: var(--danger);
}
.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: 400 var(--t-md)/1.4 var(--f-ui); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #7b8794; }
.input:hover { border-color: #94a3b8; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
textarea.input { min-height: 96px; resize: vertical; }
select.input {
  appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23526071' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.input[aria-invalid="true"], .is-invalid .input { border-color: var(--danger); }
.is-invalid .input:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .25); }
.input-affix { position: relative; }
.input-affix__prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.input-affix .input { padding-left: 26px; }

.choices { display: grid; gap: 8px; }
.choices--inline { grid-template-columns: repeat(auto-fill, minmax(110px, max-content)); }
.choice {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  cursor: pointer; font-size: var(--t-md); line-height: 1.4;
  transition: border-color .15s, background-color .15s;
}
.choice:hover { border-color: #94a3b8; }
.choice input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
.is-invalid .choice { border-color: #f1a8a1; }

.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; gap: 18px; }

/* ---------- Badges, callouts ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  font-size: var(--t-xs); font-weight: 600; line-height: 1.5; letter-spacing: .01em;
  border-radius: 999px; white-space: nowrap; vertical-align: middle;
  background: var(--line); color: var(--ink-2);
}
.badge--firm { background: #fdf2e3; color: #7a3e06; font-size: 11px; padding: 1px 8px; }
.badge--muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.callout {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border-radius: var(--r); border: 1px solid; font-size: var(--t-sm);
}
.callout .icon { margin-top: 1px; }
.callout--info { background: var(--info-soft); border-color: #c7d7fe; color: #1e3a8a; }
.callout--warning { background: var(--warning-soft); border-color: #fedf89; color: var(--warning); }
.callout--danger { background: var(--danger-soft); border-color: #fecdca; color: var(--danger); }
.callout--success { background: var(--success-soft); border-color: #abefc6; color: var(--success); }

/* ---------- Cards & page structure ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card__body { padding: 20px; }
.card__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card__head h2, .card__head h3 { font-size: var(--t-lg); }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card--danger { border-color: #fecdca; }
.card--danger .card__head { background: var(--danger-soft); border-bottom-color: #fecdca; border-radius: var(--r-lg) var(--r-lg) 0 0; }

.page { width: 100%; max-width: 1160px; margin: 0 auto; padding: 24px var(--gutter) 64px; }
.page--narrow { max-width: 860px; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.page-head__sub { margin: 6px 0 0; color: var(--muted); }
.page-head__meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 8px; color: var(--muted); font-size: var(--t-sm); }
.breadcrumb { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; font-size: var(--t-sm); text-decoration: none; color: var(--muted); }
.breadcrumb:hover { color: var(--ink); }
.breadcrumb .icon { width: 16px; height: 16px; }
.section-gap { margin-top: 32px; }
.stack { display: grid; gap: 20px; }
.split { display: grid; gap: 20px; }

/* ---------- Client header ---------- */
.topbar { background: var(--brand); color: var(--on-brand); }
.topbar__inner {
  max-width: 1160px; margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 12px; min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand img { width: 40px; height: 40px; }
.brand__name { font-family: var(--f-serif); font-size: var(--t-lg); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__tag { display: block; font-family: var(--f-ui); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #aab6c3; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topnav a, .topnav button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px;
  color: var(--on-brand); text-decoration: none; font: 500 var(--t-sm)/1 var(--f-ui);
  background: none; border: 0; border-radius: var(--r-sm); cursor: pointer;
}
.topnav a:hover, .topnav button:hover { background: var(--brand-2); color: #fff; }
.topnav a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; }
.topnav form { margin: 0; }
.topnav__label { display: none; }

/* ---------- Auth layout ---------- */
.auth { min-height: 100vh; display: grid; background: var(--surface); }
.auth__brand {
  background: var(--brand); color: var(--on-brand); padding: 20px var(--gutter);
  display: flex; flex-direction: column; gap: 16px;
}
.auth__brand-body { display: none; }
.auth__main { display: flex; align-items: flex-start; justify-content: center; padding: 32px var(--gutter) 48px; }
.auth__card { width: 100%; max-width: 420px; }
.auth__card h1 { margin-bottom: 6px; }
.auth__lede { color: var(--muted); margin-bottom: 24px; }
.auth__alt { margin-top: 24px; text-align: center; font-size: var(--t-sm); color: var(--muted); }
.trust-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.trust-list li { display: flex; gap: 12px; align-items: flex-start; color: #c9d3dd; }
.trust-list .icon { color: #8fd3bf; margin-top: 2px; }
.trust-list strong { display: block; color: #fff; font-weight: 600; }
.code-input { letter-spacing: .5em; font-size: var(--t-xl); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label-row a { font-size: var(--t-sm); }

/* ---------- Dashboard ---------- */
.form-cards { display: grid; gap: 16px; }
.form-card {
  display: flex; flex-direction: column; gap: 12px; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.form-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.form-card__icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r);
  background: var(--accent-soft); color: var(--accent);
}
.form-card__icon .icon { width: 22px; height: 22px; }
.form-card h3 { font-size: var(--t-lg); }
.form-card p { color: var(--muted); font-size: var(--t-sm); flex: 1; }
.form-card form { margin: 0; }

/* ---------- Tables (become cards on mobile) ---------- */
.table-wrap { overflow: visible; }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
  text-align: left; font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--ink); }
.table th .icon { width: 14px; height: 14px; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfd; }
.table__primary { font-weight: 600; color: var(--ink); text-decoration: none; }
.table__primary:hover { text-decoration: underline; }
.table__actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.table__actions form { margin: 0; }

@media (max-width: 767px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table--cards tr:last-child { border-bottom: 0; }
  .table--cards td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border: 0; text-align: right; }
  .table--cards td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; flex: none; }
  .table--cards td.table__lead { display: block; text-align: left; padding-bottom: 6px; font-size: var(--t-md); }
  .table--cards td.table__lead::before { content: none; }
  .table--cards .table__actions { justify-content: flex-start; padding-top: 8px; }
  .table--cards td.table__actions::before { content: none; }
}

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 40px 20px; color: var(--muted);
}
.empty .icon { width: 36px; height: 36px; color: #94a3b8; margin-bottom: 4px; }
.empty h3 { color: var(--ink); font-size: var(--t-md); }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--muted); }
.pagination__links { display: flex; gap: 6px; }

/* ---------- Multi-step form ---------- */
.form-shell { display: grid; gap: 20px; }
.stepper-wrap { display: grid; gap: 12px; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: var(--t-sm); color: var(--muted); }
.progress-label strong { color: var(--ink); font-weight: 600; }
.stepper { display: none; list-style: none; margin: 0; padding: 0; }
.stepper__btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  font: 500 var(--t-sm)/1.3 var(--f-ui); color: var(--ink-2); text-align: left;
  background: none; border: 0; border-radius: var(--r-sm); cursor: pointer;
}
.stepper__btn:hover { background: var(--surface-2); color: var(--ink); }
.stepper__num {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%;
  font-size: var(--t-xs); font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong);
}
.stepper__btn[aria-current="step"] { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.stepper__btn[aria-current="step"] .stepper__num { background: var(--accent); color: #fff; border-color: var(--accent); }
.stepper__btn.is-done .stepper__num { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.stepper__btn.has-error .stepper__num { background: var(--danger); border-color: var(--danger); color: #fff; }

.form-step { padding: 20px; }
.js .app-form[data-layout="steps"] .form-step:not(.is-active) { display: none; }
.app-form[data-layout="stacked"] .form-step + .form-step { border-top: 1px solid var(--line); }
.form-step__head { margin-bottom: 20px; }
.form-step__title { font-family: var(--f-serif); font-weight: 400; font-size: var(--t-xl); }
.form-step__title:focus { outline: none; }
.form-step__intro { margin: 6px 0 0; color: var(--muted); }
.field-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.field-heading { font-size: var(--t-md); padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.field-grid > .field-heading:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.form-nav {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 20px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg); backdrop-filter: blur(6px);
}
.form-nav__status { font-size: var(--t-sm); color: var(--muted); margin-right: auto; display: flex; align-items: center; gap: 6px; }
.form-nav__status .icon { width: 16px; height: 16px; }
.form-nav__right { display: flex; gap: 10px; margin-left: auto; }

.repeater__items { display: grid; gap: 14px; }
.repeater__item { padding: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.repeater__item .repeater__item { background: var(--surface); }
.repeater__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.repeater__title { font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.repeater > [data-add-item] { justify-self: start; margin-top: 4px; }
.repeater { display: grid; gap: 12px; }

.signature { display: grid; gap: 10px; padding: 16px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r); }
.signature__name { font-family: var(--f-serif); font-size: var(--t-xl); }
.signature__date { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.choice--agree { background: var(--surface); }

.review { display: grid; gap: 16px; }
.review__section { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.review__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.review__head h3 { font-size: var(--t-md); }
.review__list { margin: 0; padding: 4px 16px; }
.review__row { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.review__row:last-child { border-bottom: 0; }
.review__row dt { font-size: var(--t-sm); color: var(--muted); }
.review__row dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review__row.is-missing dd { color: var(--danger); font-weight: 500; }

/* ---------- Uploads ---------- */
.uploads { margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.field .uploads { margin-top: 0; }
.uploads__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.uploads__head h3 { font-size: var(--t-md); display: flex; align-items: center; gap: 8px; }
.uploads__head p { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 18px; text-align: center; font-size: var(--t-sm); color: var(--ink-2);
  background: var(--surface); border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:has(input:focus-visible) { box-shadow: var(--focus); border-color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone strong { color: var(--accent); }
.dropzone .icon { color: var(--accent); }
.dropzone.is-busy { pointer-events: none; opacity: .7; }
.file-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.file-list:empty { display: none; }
.file-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.file-item > .icon { color: var(--muted); }
.file-item__body { flex: 1; min-width: 0; }
.file-item__name { display: block; font-weight: 600; font-size: var(--t-sm); overflow-wrap: anywhere; }
.file-item__meta { display: block; font-size: var(--t-xs); color: var(--muted); }
.file-item__actions { display: flex; gap: 2px; }
.file-item form { margin: 0; }

/* ---------- Read-only answers ---------- */
.answer-section { padding: 20px; }
.answer-section + .answer-section { border-top: 1px solid var(--line); }
.answer-section__title { font-family: var(--f-serif); font-weight: 400; font-size: var(--t-xl); margin-bottom: 14px; }
.answers { display: grid; gap: 14px 24px; margin: 0; }
.answers__row { min-width: 0; }
.answers__row dt { font-size: var(--t-sm); color: var(--muted); margin-bottom: 2px; }
.answers__row dd { margin: 0; overflow-wrap: anywhere; }
.answers__heading { font-weight: 600; padding-top: 10px; border-top: 1px solid var(--line); grid-column: 1 / -1; }
.answers__item { padding: 14px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.answers__item:first-child { margin-top: 4px; }
.answers__item-title { font-size: var(--t-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px; }
.answers--nested .answers__item { background: var(--surface); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; overflow-y: hidden; }
.tabs__btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 14px 12px; margin-bottom: -1px;
  font: 600 var(--t-sm)/1 var(--f-ui); color: var(--muted); text-decoration: none; white-space: nowrap;
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
}
.tabs__btn:hover { color: var(--ink); }
.tabs__btn[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs__count { background: var(--line); color: var(--ink-2); border-radius: 999px; padding: 2px 7px; font-size: 11px; }

/* ---------- Audit log ---------- */
.timeline { list-style: none; margin: 0; padding: 8px 20px 20px; }
.timeline__item { position: relative; padding: 14px 0 14px 26px; border-bottom: 1px solid var(--line); }
.timeline__item:last-child { border-bottom: 0; }
.timeline__item::before { content: ""; position: absolute; left: 4px; top: 21px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline__head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: var(--t-sm); }
.timeline__time { color: var(--muted); font-size: var(--t-xs); }
.diff { display: grid; gap: 8px; margin-top: 8px; font-size: var(--t-sm); }
.diff__val { padding: 8px 10px; border-radius: var(--r-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.diff__val--old { background: var(--danger-soft); color: #7a271a; }
.diff__val--new { background: var(--success-soft); color: #054f31; }
.diff__label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; opacity: .8; }

/* ---------- Admin layout ---------- */
.admin { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: 264px; max-width: 85vw;
  display: flex; flex-direction: column; background: var(--brand); color: var(--on-brand);
  transform: translateX(-100%); transition: transform .2s ease; visibility: hidden;
}
.sidebar.is-open { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
.sidebar__brand { padding: 16px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar__nav { flex: 1; padding: 12px; display: grid; align-content: start; gap: 2px; }
.sidebar__link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  color: #c9d3dd; text-decoration: none; font-size: var(--t-sm); font-weight: 500;
}
.sidebar__link:hover { background: var(--brand-2); color: #fff; }
.sidebar__link[aria-current="page"] { background: rgba(143, 211, 191, .14); color: #fff; box-shadow: inset 3px 0 0 #8fd3bf; }
.sidebar__foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar__user { padding: 6px 12px 10px; font-size: var(--t-sm); }
.sidebar__user strong { display: block; color: #fff; }
.sidebar__user span { color: #aab6c3; font-size: var(--t-xs); overflow-wrap: anywhere; }
.sidebar__foot form { margin: 0; }
.sidebar__foot .sidebar__link { width: 100%; background: none; border: 0; cursor: pointer; font-family: inherit; }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .45); }
.admin-top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line);
}
.admin-top__title { font-weight: 600; font-size: var(--t-md); }
.menu-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); cursor: pointer; }
.admin-main .page { padding-top: 24px; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: inherit; }
.stat__label { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--muted); }
.stat__value { font-size: var(--t-3xl); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.bars { list-style: none; margin: 0; padding: 8px 20px 20px; display: grid; gap: 14px; }
.bars__row { display: grid; gap: 6px; font-size: var(--t-sm); }
.bars__label { display: flex; justify-content: space-between; gap: 12px; }
.bars__label strong { font-variant-numeric: tabular-nums; }
.bars__track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bars__fill { height: 100%; width: 0; background: var(--accent); border-radius: inherit; }

.filters { display: grid; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.filters__grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.filters .field__label { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.filters .input { min-height: 40px; padding: 8px 10px; font-size: var(--t-sm); }
.date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.inline-form .input { min-height: 36px; padding: 6px 34px 6px 10px; font-size: var(--t-sm); width: auto; }

.status-list { list-style: none; margin: 0; padding: 0; }
.status-row { display: grid; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.status-row:last-child { border-bottom: 0; }
.status-row form { margin: 0; }
.status-row__edit { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; align-items: center; }
.status-row__edit .btn { grid-column: 1 / -1; justify-self: start; }
.status-row__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.color-input { width: 52px; height: 44px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }

.kv { display: grid; gap: 12px; margin: 0; }
.kv div { display: grid; gap: 2px; }
.kv dt { font-size: var(--t-sm); color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 90; left: var(--gutter); right: var(--gutter); top: 16px;
  display: grid; gap: 10px; justify-items: end; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; width: 100%; max-width: 420px;
  padding: 12px 14px; font-size: var(--t-sm); color: #fff; background: var(--ink);
  border-radius: var(--r); box-shadow: var(--shadow-lg); animation: toast-in .2s ease;
}
.toast--success { background: #064e3b; }
.toast--error { background: var(--danger); }
.toast--info { background: var(--brand); }
.toast p { flex: 1; margin: 0; }
.toast button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .8; }
.toast button:hover { opacity: 1; }
.toast .icon { width: 18px; height: 18px; margin-top: 1px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Modal ---------- */
.modal {
  width: calc(100% - 2 * var(--gutter)); max-width: 480px; padding: 0; border: 0;
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); color: var(--ink);
}
.modal::backdrop { background: rgba(15, 23, 42, .55); }
.modal__body { padding: 24px; display: grid; gap: 14px; }
.modal__icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--danger-soft); color: var(--danger); }
.modal__title { font-size: var(--t-lg); }
.modal__text { margin: 0; color: var(--ink-2); }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: var(--surface-2); border-top: 1px solid var(--line); }

/* ---------- Errors ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); text-align: center; }
.error-page__code { font-family: var(--f-serif); font-size: 4rem; line-height: 1; color: var(--line-strong); }

/* ==========================================================================
   Breakpoints
   ========================================================================== */
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  .form-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid > .field--full, .field-grid > .field-heading, .field-grid > .callout { grid-column: 1 / -1; }
  .answers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answers__row--full { grid-column: 1 / -1; }
  .filters__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diff { grid-template-columns: 1fr 1fr; }
  .status-row__edit { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .status-row__edit .btn { grid-column: auto; }
  .topnav__label { display: inline; }
  .form-grid--2 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  h1 { font-size: var(--t-3xl); }
  .page { padding-top: 32px; }
  .form-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .auth { grid-template-columns: minmax(360px, 5fr) 7fr; }
  .auth__brand { padding: 40px 48px; justify-content: space-between; min-height: 100vh; position: sticky; top: 0; }
  .auth__brand-body { display: block; }
  .auth__brand-body h2 { font-family: var(--f-serif); font-weight: 400; font-size: var(--t-3xl); color: #fff; margin-bottom: 14px; }
  .auth__brand-body p { color: #c9d3dd; max-width: 34ch; margin-bottom: 32px; }
  .auth__main { align-items: center; padding: 48px; }
  .form-shell { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
  .stepper-wrap { position: sticky; top: 24px; }
  .stepper { display: grid; gap: 2px; }
  .split { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filters__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .form-step { padding: 28px 32px; }
  .answer-section { padding: 24px 28px; }
  .form-nav { padding: 14px 32px; }
}

@media (min-width: 1100px) {
  .sidebar { transform: none; visibility: visible; }
  .scrim, .menu-btn { display: none !important; }
  .admin-body { margin-left: 264px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.auth__card .callout { margin-bottom: 20px; }
.section-gap-sm { margin-top: 20px; }
.page-head + .section-gap-sm { margin-top: 0; }
.auth__brand .muted { color: #aab6c3; }
.mono { white-space: nowrap; }
.input { min-width: 0; }
.date-pair .input { padding-left: 8px; padding-right: 6px; }
.firm-notes { border-color: #f5d9b0; }
.firm-notes .card__head { background: #fdf6ec; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.firm-notes h2 { display: flex; align-items: center; gap: 8px; }
.firm-notes h2 .icon { color: #7a3e06; }
