/* Fileready — private-banking calm: petrol ink, cool porcelain, brass reserved for progress. */

/* Fileready: a well-kept case file. Evergreen brand chrome, quiet working surfaces,
   emerald for the one action and progress colour. Tokens follow the Fileready design system. */

@font-face { font-family: "Schibsted Grotesk"; src: url("/static/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Schibsted Grotesk"; src: url("/static/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 400 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800; font-display: swap; }

:root {
  /* Design-system tokens (light theme) */
  --surface: #F3F6F4; --surface-raised: #FFFFFF; --surface-sunken: #EBF0ED;
  --line: #DAE2DD; --line-strong: #B6C4BC;
  --ink: #13201C; --ink-muted: #56685F;
  --evergreen: #0D2620; --on-evergreen: #EAF4EF; --on-evergreen-muted: #A6C2B6; --mint: #6FDDB2;
  --emerald: #0E6A51; --emerald-hover: #0B5541; --on-emerald: #FFFFFF; --emerald-soft: #DFF0E8;
  --brass: #8E6110; --brass-soft: #F5EAD3;          /* reserved for the founding-firm offer */
  --success: #15643E; --success-soft: #DCF0E3;
  --warning: #774900; --warning-soft: #FAE9C8;
  --danger: #9B1E2B;  --danger-soft: #F8DDE1;
  --info: #1D4A8C;    --info-soft: #E0E9F6;
  --focus: #1F74DB;
  --display: "Schibsted Grotesk", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-xs: 4px; --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 28px; --radius-pill: 999px;
  --shadow-raised: 0 18px 50px rgba(9, 30, 24, 0.14);

  /* Older names, kept so existing rules follow the new tokens */
  --porcelain: var(--surface); --paper: var(--surface-raised); --slate: var(--ink-muted);
  --mist: var(--line); --mist-strong: var(--line-strong);
  --petrol: var(--emerald); --petrol-soft: var(--emerald-hover); --petrol-deep: var(--evergreen);
  --accent: var(--emerald); --accent-soft: var(--emerald-soft);
  --good: var(--success); --good-soft: var(--success-soft);
  --warn: var(--warning); --warn-soft: var(--warning-soft);
  --bad: var(--danger); --bad-soft: var(--danger-soft);
  --serif: var(--display);
  --r-surface: var(--radius-md); --r-control: var(--radius-sm);
  /* The logo mark on light grounds; dark chrome overrides these. */
  --mark-doc: var(--emerald); --mark-fold: var(--mint); --mark-check: #FFFFFF;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--porcelain); color: var(--ink);
  font: 400 15px/23px var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--petrol); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--petrol-soft); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--slate); }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font: 700 40px/44px var(--display); letter-spacing: -0.015em; }
h2 { font: 700 19px/26px var(--display); letter-spacing: -0.01em; }
h3 { font: 600 15px/1.4 var(--sans); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--petrol); color: rgba(243, 244, 241, .78);
  display: flex; flex-direction: column; padding: 28px 20px 24px; position: sticky; top: 0; height: 100vh;
}
.wordmark { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 0 10px; }
.wordmark:hover { color: #fff; }
.wordmark span { font: 700 24px/1 var(--display); letter-spacing: -0.01em; }
.wordmark svg { flex: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 40px; }
.side nav a {
  color: inherit; text-decoration: none; padding: 9px 12px; border-radius: var(--r-control);
  font-weight: 500; position: relative;
}
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .08); }
.side nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -20px; top: 9px; bottom: 9px; width: 2px; background: var(--emerald);
}
.side .new { margin-top: 20px; }
.side .btn-new {
  display: block; text-align: center; padding: 10px 12px; border-radius: var(--r-control);
  border: 1px solid rgba(255, 255, 255, .22); color: #fff; text-decoration: none; font-weight: 600;
}
.side .btn-new:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side .who { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; }
.side .who strong { display: block; color: #fff; font-weight: 600; }
.side .who .acts { display: flex; gap: 14px; margin-top: 10px; }
.side .who a, .side .who button { color: rgba(243, 244, 241, .78); font: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.side .who a:hover, .side .who button:hover { color: #fff; text-decoration: underline; }
.side form { margin: 0; }

.main { padding: 44px 56px 80px; max-width: 1140px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.page-head p { margin: 8px 0 0; color: var(--slate); }
.back { display: inline-block; margin-bottom: 18px; color: var(--slate); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--petrol); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-control); border: 1px solid var(--petrol);
  background: var(--petrol); color: #fff; font: 600 14px/1.2 var(--sans); cursor: pointer;
  text-decoration: none; transition: background .15s ease;
}
.btn:hover { background: var(--petrol-deep); color: #fff; }
.btn.quiet { background: var(--paper); color: var(--ink); border-color: var(--mist-strong); }
.btn.quiet:hover { background: var(--porcelain); color: var(--ink); }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.wide { width: 100%; }
button.link {
  background: none; border: 0; padding: 0; font: 500 13px/1.4 var(--sans); color: var(--petrol);
  cursor: pointer; text-decoration: underline; text-decoration-color: var(--mist-strong); text-underline-offset: 3px;
}
button.link:hover { text-decoration-color: currentColor; }
button.link.danger { color: var(--bad); }
button.link.quiet { color: var(--slate); }
.btn.danger { background: var(--paper); color: var(--bad); border-color: #E5C4BC; }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--mist); display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.danger-zone p { flex-basis: 100%; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.row-actions form, .inline-form { margin: 0; display: inline; }
.title-link { color: inherit; text-decoration: none; }
.title-link:hover { color: var(--petrol); text-decoration: underline; text-decoration-thickness: 1px; }

label { display: block; font: 600 13px/1.4 var(--sans); color: var(--ink); margin: 0 0 16px; }
input, select {
  display: block; width: 100%; margin-top: 6px; height: 44px; padding: 0 12px;
  font: 400 15px var(--sans); color: var(--ink); background: var(--paper);
  border: 1px solid var(--mist-strong); border-radius: var(--r-control);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--line-strong); box-shadow: none; }
input[type=checkbox] { width: 16px; height: 16px; display: inline-block; margin: 0; accent-color: var(--petrol); }
input[type=file] { height: auto; padding: 8px; font-size: 13px; color: var(--slate); background: var(--porcelain); border-style: dashed; cursor: pointer; }
input[type=file]::file-selector-button {
  font: 600 13px var(--sans); color: var(--petrol); background: var(--paper); border: 1px solid var(--mist-strong);
  border-radius: 6px; padding: 8px 14px; margin-right: 12px; cursor: pointer;
}
input[type=file]:hover::file-selector-button { border-color: var(--petrol); }
.hint { font-weight: 400; color: var(--slate); font-size: 13px; margin: -8px 0 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.notice { padding: 12px 16px; border-radius: var(--r-control); margin: 0 0 20px; font-size: 14px; }
.notice.ok { background: var(--good-soft); color: var(--good); }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.bad-text { color: var(--bad); } .good-text { color: var(--good); }

/* ---------- surfaces ---------- */
.surface {
  background: var(--paper); border: 1px solid var(--mist); border-radius: var(--r-surface);
  box-shadow: 0 1px 2px rgba(9, 30, 24, .04);
}
.surface + .surface { margin-top: 20px; }
.surface-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px 0; }
.surface-body { padding: 20px 24px 24px; }
.form-surface { max-width: 560px; padding: 32px; }
.form-surface h1 { font-size: 32px; margin-bottom: 24px; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font: 600 12px/1.5 var(--sans); background: #ECEFED; color: #4A575C; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.brass { background: var(--emerald-soft); color: var(--emerald); }

/* ---------- dashboard ---------- */
.segments { display: inline-flex; background: #E9ECE9; border-radius: 10px; padding: 3px; gap: 2px; }
.segments a {
  padding: 7px 14px; border-radius: 8px; text-decoration: none; color: var(--slate); font-weight: 600; font-size: 13px;
  display: inline-flex; gap: 8px; align-items: baseline;
}
.segments a .count { font-variant-numeric: tabular-nums; font-weight: 500; }
.segments a[aria-current="page"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(9, 30, 24, .08); }
.segments a:hover { color: var(--ink); }

.ledger { width: 100%; border-collapse: collapse; }
.ledger th {
  text-align: left; font: 600 12px/1.4 var(--sans); color: var(--slate); padding: 14px 24px 12px;
  border-bottom: 1px solid var(--mist);
}
.ledger td { padding: 18px 24px; border-bottom: 1px solid var(--mist); vertical-align: middle; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger tbody tr { transition: background .12s ease; }
.ledger tbody tr:hover { background: #FAFBFA; }
.client-cell a { font: 700 18px/1.25 var(--display); color: var(--ink); text-decoration: none; }
.client-cell a:hover { color: var(--petrol); text-decoration: underline; }
.client-cell .sub { display: block; color: var(--slate); font-size: 13px; margin-top: 3px; }
.meter { display: flex; align-items: center; gap: 12px; min-width: 150px; }
.meter .track { flex: 1; height: 4px; background: var(--mist); border-radius: 2px; overflow: hidden; max-width: 120px; }
.meter .fill { display: block; height: 100%; background: var(--emerald); border-radius: 2px; }
.meter .frac { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--slate); min-width: 34px; }
.chasing-cell { font-size: 13px; color: var(--slate); white-space: nowrap; }
.chasing-cell strong { color: var(--ink); font-weight: 600; }
.empty { text-align: center; padding: 64px 24px; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--slate); margin: 0 0 24px; }

/* ---------- progress ring (the one brass moment) ---------- */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--mist); }
.ring .arc { stroke: var(--emerald); stroke-linecap: round; animation: ring-in 1.1s cubic-bezier(.2, .7, .2, 1) both; }
.ring .label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .label b { font: 700 30px/1 var(--display); font-variant-numeric: lining-nums; letter-spacing: -0.02em; }
.ring .label span { font-size: 12px; color: var(--slate); margin-top: 4px; }
@keyframes ring-in { from { stroke-dashoffset: var(--c); } }

/* ---------- case page ---------- */
.case-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; margin-bottom: 28px; }
.case-head h1 { font-size: 46px; }
.case-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; color: var(--slate); font-size: 14px; }
.case-meta span { display: inline-flex; align-items: center; gap: 6px; }
.case-state { display: flex; align-items: center; gap: 20px; }
.case-state .caption { font-size: 13px; color: var(--slate); max-width: 150px; }
.case-state .caption strong { display: block; color: var(--ink); font: 700 17px/1.3 var(--display); margin-bottom: 2px; }

.chase { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 22px 24px; align-items: start; }
.chase .status-line { font-size: 15px; margin: 6px 0 0; }
.chase .status-line strong { font-weight: 600; }
.chase .when { color: var(--emerald); font-weight: 600; }
.chase-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.chase-actions form { margin: 0; }
.sent-list { list-style: none; margin: 0; padding: 0 24px 20px; display: grid; gap: 8px; }
.sent-list li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--mist); }
.sent-list .t { color: var(--slate); font-variant-numeric: tabular-nums; }

.highlight { border-color: var(--emerald); background: #FDFBF7; }
.highlight .surface-body p { margin: 6px 0 14px; color: var(--slate); }
input.copy { font: 500 13px var(--sans); letter-spacing: .01em; background: var(--porcelain); }

ul.checklist { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 18px 24px; border-top: 1px solid var(--mist); }
.item:first-child { border-top: 0; }
.item-main strong { font-weight: 600; }
.item-main .help { color: var(--slate); font-size: 13px; margin-top: 2px; }
.item-main .opt { color: var(--slate); font-weight: 400; font-size: 13px; }
.item-main .note { font-size: 13px; margin-top: 6px; }
.item.status-accepted .item-main strong, .item.status-waived .item-main strong { color: var(--slate); }
.file { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; flex-wrap: wrap; }
.file a { font-weight: 500; }
.file svg { flex: none; color: var(--slate); }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; min-width: 230px; }
.item .actions { display: flex; gap: 16px; }
.item .actions form, .item form.reject { margin: 0; }
.item form.reject { display: flex; gap: 8px; align-items: center; }
.item form.reject input { width: 170px; height: 32px; margin: 0; font-size: 13px; }
form.add { display: flex; gap: 12px; align-items: center; padding: 16px 24px; border-top: 1px solid var(--mist); background: #FAFBFA; border-radius: 0 0 var(--r-surface) var(--r-surface); }
form.add input[name=label] { flex: 1; margin: 0; height: 40px; }
label.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; font-weight: 500; white-space: nowrap; }

ul.plain { list-style: none; margin: 0; padding: 0; }
.links li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--mist); font-size: 13px; }
.links li:first-child { border-top: 0; }
.links form { margin: 0; }
.history li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 8px 0; font-size: 13px; border-top: 1px solid var(--mist); }
.history li:first-child { border-top: 0; }
.history .t { color: var(--slate); font-variant-numeric: tabular-nums; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.two-col .surface + .surface { margin-top: 0; }

/* ---------- login ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art {
  background: var(--petrol); color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden;
}
.auth-art .wordmark { padding: 0; }
.auth-art .motif { position: absolute; right: -150px; bottom: -190px; width: 520px; height: 520px; pointer-events: none; }
.auth-art blockquote { margin: 0; max-width: 420px; position: relative; }
.auth-art blockquote p { font: 700 34px/1.2 var(--display); letter-spacing: -0.015em; margin: 0 0 16px; }
.auth-art blockquote span { color: rgba(243, 244, 241, .7); font-size: 14px; }
.auth-form { display: grid; place-items: center; padding: 48px 24px; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 34px; margin-bottom: 8px; }
.auth-form .lede { color: var(--slate); margin: 0 0 32px; }
.auth-form .btn { margin-top: 8px; }

/* ---------- client upload page ---------- */
.client-page { max-width: 640px; margin: 0 auto; padding: 40px 20px 64px; }
.client-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 36px; }
.client-top .firm { font: 700 18px/1.2 var(--display); }
.client-top .secure { display: inline-flex; gap: 6px; align-items: center; color: var(--slate); font-size: 13px; }
.client-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; margin-bottom: 28px; }
.client-hero h1 { font-size: 36px; margin-bottom: 10px; }
.client-hero p { margin: 0; color: var(--slate); }
.client .item { grid-template-columns: 1fr; gap: 12px; }
.client .item-side { align-items: stretch; min-width: 0; flex-direction: row; gap: 10px; }
.client .item-side input[type=file] { margin: 0; flex: 1; min-width: 0; }
.client .uploading { display: none; font-size: 13px; color: var(--emerald); font-weight: 600; }
.js .client .item-side button { display: none; }
.js .client form.busy input[type=file] { display: none; }
.js .client form.busy .uploading { display: block; }
.js .client form.failed .uploading { display: block; color: var(--bad); font-weight: 500; }
.client .done-mark { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--good); margin-top: 6px; }
.client-foot { margin-top: 28px; color: var(--slate); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.client-foot svg { flex: none; margin-top: 2px; }

/* ---------- plain pages ---------- */
.plain-page { max-width: 560px; margin: 0 auto; padding: 72px 20px; }
.plain-page .wordmark { color: var(--petrol); padding: 0; margin-bottom: 40px; }
.plain-page .wordmark span { color: var(--ink); }
.plain-page h1 { font-size: 34px; margin-bottom: 12px; }
.plain-page p { color: var(--slate); }
.outbox { max-width: 760px; margin: 0 auto; padding: 48px 20px; }
.outbox h1 { margin-bottom: 8px; }
.outbox pre { white-space: pre-wrap; font: 400 14px/1.6 var(--sans); background: var(--porcelain); padding: 16px; border-radius: var(--r-control); margin: 12px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 20px; }
  .side nav { flex-direction: row; margin: 0; }
  .side nav a[aria-current="page"]::before { display: none; }
  .side .new { margin: 0 0 0 auto; }
  .side .who { margin: 0; padding: 10px 0 0; width: 100%; display: flex; justify-content: space-between; align-items: center; }
  .side .who .acts { margin: 0; }
  .main { padding: 28px 20px 64px; }
  .two-col { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 240px; padding: 32px 24px; gap: 32px; }
  .auth-art blockquote p { font-size: 26px; }
  .auth-art .motif { width: 300px; height: 300px; right: -150px; top: -150px; bottom: auto; opacity: .7; }
}
@media (max-width: 700px) {
  h1 { font-size: 32px; }
  .case-head { grid-template-columns: 1fr; }
  .case-head h1 { font-size: 36px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { padding: 16px 20px; border-bottom: 1px solid var(--mist); }
  .ledger td { padding: 4px 0; border: 0; }
  .item, .chase { grid-template-columns: 1fr; }
  .item-side, .chase-actions { align-items: flex-start; min-width: 0; }
  .two { grid-template-columns: 1fr; }
  .sent-list li, .history li { grid-template-columns: 1fr; gap: 2px; }
  .client-hero { grid-template-columns: 1fr; }
  .client-hero .ring { justify-self: start; }
  .client .item-side { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- feature pack ---------- */
textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: 400 15px/1.5 var(--sans); color: var(--ink);
  background: var(--paper); border: 1px solid var(--mist-strong); border-radius: var(--r-control); resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: none; }
.today { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.today-item { display: flex; align-items: baseline; gap: 10px; padding: 18px 20px; background: var(--paper); border: 1px solid var(--mist);
  border-radius: var(--r-surface); text-decoration: none; color: var(--slate); transition: border-color .15s ease; }
.today-item b { font: 700 32px/1 var(--display); color: var(--ink); }
.today-item:hover { border-color: var(--mist-strong); color: var(--ink); }
.today-item.on { border-color: var(--emerald); }
.chip.plain::before { display: none; }
.due-form { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.due-form input { width: auto; height: 34px; display: inline-block; margin: 0 0 0 6px; font-size: 13px; }
.note-form { display: flex; gap: 12px; align-items: flex-start; }
.note-form textarea { margin: 0; flex: 1; }
.notes li { padding: 12px 0; border-top: 1px solid var(--mist); }
.notes li:first-child { margin-top: 12px; }
.notes p { margin: 0 0 4px; white-space: pre-wrap; }
.link-plain { font: 500 13px var(--sans); }
.role-form { display: inline-flex; gap: 8px; align-items: center; }
.role-form select { height: 34px; width: auto; margin: 0; font-size: 13px; padding: 0 8px; }
.qr { width: 200px; margin: 16px 0; border: 1px solid var(--mist); border-radius: var(--r-control); padding: 8px; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
ol.steps { padding-left: 20px; margin: 0 0 8px; } ol.steps li { margin-bottom: 4px; }
ul.codes { list-style: none; padding: 16px; margin: 16px 0 24px; background: var(--porcelain); border-radius: var(--r-control); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-weight: 600; letter-spacing: .02em; }
.prose h2 { margin: 24px 0 8px; } .prose h2:first-child { margin-top: 0; } .prose p, .prose li { color: var(--ink); } .prose ul { padding-left: 20px; }

@media (max-width: 700px) { .today { grid-template-columns: 1fr; } .note-form { flex-direction: column; align-items: stretch; } }

/* When GSAP drives the ring (motion.js), turn off the CSS version. */
.motion .ring .arc { animation: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* legal pages */
.legal-page { max-width: 780px; }
.legal-word { color: var(--petrol); padding: 0; } .legal-word span { color: var(--ink); }
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 8px 0 28px; font: 500 14px var(--sans); }
.legal-nav a { color: var(--slate); text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.legal-nav a:hover { color: var(--ink); }
.legal-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--emerald); }
.legal-page h1 { margin-bottom: 8px; }
.legal-date { margin: 0 0 28px; }
.prose h3 { font: 600 16px/1.4 var(--sans); margin: 18px 0 6px; color: var(--ink); }
.prose code { font-size: .92em; background: var(--porcelain); padding: 1px 5px; border-radius: 4px; }

/* ---------- phones and tablets: compact top bar instead of the sidebar ---------- */
@media (max-width: 960px) {
  .side { display: grid; grid-template-columns: 1fr auto; gap: 12px 12px; padding: 14px 16px 10px; }
  .side .side-top { grid-column: 1; grid-row: 1; }
  .side .wordmark { padding: 0; }
  .side .new { grid-column: 2; grid-row: 1; margin: 0; }
  .side nav { grid-column: 1 / -1; grid-row: 2; flex-direction: row; gap: 4px; margin: 0 -16px; padding: 0 16px 2px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; min-width: 0; }
  .side nav::-webkit-scrollbar { display: none; }
  .side nav a { flex: none; padding: 10px 12px; }
  .side .who { grid-column: 1 / -1; grid-row: 3; margin: 0; padding: 10px 0 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .side .who > div:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side .who .acts { margin: 0; flex: none; }
  .main { min-width: 0; }
}
/* Comfortable tap targets (WCAG 2.2: at least 24 by 24 pixels) */
button.link, .link-plain, .side .who .acts a, .side .who .acts button { min-height: 32px; display: inline-flex; align-items: center; }
@media (max-width: 700px) {
  button.link, .link-plain { min-height: 40px; }
  .row-actions { flex-wrap: wrap; gap: 4px 16px; }
  .due-form input { height: 40px; }
  .role-form select { height: 40px; }
  table, pre { max-width: 100%; }
  .qr { width: 180px; }
  ul.codes { grid-template-columns: 1fr; }
  .main { overflow-wrap: anywhere; }
}

/* 404 */
.nf { max-width: 520px; }
.nf-word { color: var(--petrol); padding: 0; margin-bottom: 48px; } .nf-word span { color: var(--ink); }
.nf-code { margin: 0 0 8px; font: 600 14px var(--sans); color: var(--emerald); }
.nf h1 { margin: 0 0 16px; }
.nf-search { display: flex; gap: 12px; align-items: flex-end; margin: 28px 0 20px; }
.nf-search label { flex: 1; margin: 0; } .nf-search input { margin-bottom: 0; }
.nf-links { list-style: none; padding: 0; margin: 28px 0 0; display: flex; gap: 24px; font-weight: 500; }
@media (max-width: 520px) { .nf-search { flex-direction: column; align-items: stretch; } }
/* Long checkbox labels wrap instead of running off the screen */
label.inline { white-space: normal; align-items: flex-start; max-width: 100%; }
label.inline input[type="checkbox"], label.inline input[type="radio"] { flex: none; margin-top: 3px; }
/* Name links in lists and tables get a taller tap area */
td a, .plain li > a, .results a { display: inline-block; padding-block: 3px; }

/* Validation: highlight a field only after the person has typed in it */
input:user-invalid, textarea:user-invalid, select:user-invalid { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(168, 50, 40, .12); }
button[aria-busy="true"] { opacity: .7; cursor: progress; }

/* Website stats */
.segments a { text-decoration: none; }
.stat-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-tile { background: var(--paper); border: 1px solid var(--mist); border-radius: var(--r-surface); padding: 18px 20px; }
.stat-tile span { display: block; font-size: 13px; color: var(--slate); margin-bottom: 8px; }
.stat-tile b { font: 700 32px/1 var(--display); color: var(--ink); }
.bars { display: grid; grid-template-columns: auto 1fr; gap: 10px; height: 200px; }
.bars-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--slate); text-align: right; }
.bars-plot { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--mist-strong);
  background: linear-gradient(var(--mist) 1px, transparent 1px) 0 0 / 100% 50%; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; cursor: default; }
.bar-col i { display: block; width: 100%; max-width: 18px; min-height: 2px; background: var(--emerald); border-radius: 4px 4px 0 0; }
.bar-col:hover i { background: var(--emerald); }
.bar-col em, .lead-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--petrol); }
.bar-col em { position: absolute; bottom: -12px; }
.lead-dot { display: inline-block; vertical-align: middle; margin-right: 4px; }
.bars-x { display: flex; justify-content: space-between; margin: 16px 0 0 34px; }
.table-view { margin-top: 16px; } .table-view summary { cursor: pointer; font: 500 14px var(--sans); color: var(--petrol); }
.table-view table { margin-top: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 20px 0; }
.stat-grid .surface { margin: 0; }
.rank { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank th { text-align: left; font: 500 12px var(--sans); color: var(--slate); padding: 0 0 8px; }
.rank th.num, .rank td.num { text-align: right; width: 80px; }
.rank td { padding: 7px 0; position: relative; border-top: 1px solid var(--mist); }
.rank td:first-child { padding-left: 8px; }
.rank-bar { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--emerald-soft); border-radius: 4px; z-index: 0; }
.rank-k { position: relative; z-index: 1; }
@media (max-width: 960px) { .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-grid { grid-template-columns: 1fr; } }

/* ======================================================================
   Fileready design system: brand rules layered over the base styles
   ====================================================================== */

/* Brand chrome: evergreen bands, on-evergreen text, mint emphasis */
.side, .auth-art { background: var(--evergreen); color: var(--on-evergreen-muted); }
.side, .auth-art, .on-evergreen { --mark-doc: var(--mint); --mark-fold: #B9EED8; --mark-check: var(--evergreen); }
.side nav a:hover, .side nav a[aria-current="page"] { color: var(--on-evergreen); }
.side nav a[aria-current="page"]::before { background: var(--mint); }
.side .btn-new { border-radius: var(--radius-pill); border-color: rgba(234, 244, 239, .28); color: var(--on-evergreen); }
.side .who strong, .wordmark, .wordmark:hover { color: var(--on-evergreen); }

/* Wordmark: lowercase name in Schibsted Grotesk */
.wordmark span, .h-word span { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; text-transform: lowercase; }
.plain-page .wordmark, .legal-word, .nf-word, .client-top .wordmark { color: var(--ink); }
.plain-page .wordmark span, .legal-word span, .nf-word span { color: var(--ink); }

/* The one action colour: emerald, fully rounded */
.btn { border-radius: var(--radius-pill); background: var(--emerald); border-color: var(--emerald); color: var(--on-emerald); padding: 11px 20px; }
.btn:hover { background: var(--emerald-hover); border-color: var(--emerald-hover); color: var(--on-emerald); }
.btn.quiet { background: var(--surface-raised); color: var(--ink); border-color: var(--line-strong); }
.btn.quiet:hover { background: var(--surface-sunken); color: var(--ink); border-color: var(--line-strong); }
.btn.danger { background: var(--surface-raised); color: var(--danger); border-color: #E8B9C0; }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
a { color: var(--emerald); } a:hover { color: var(--emerald-hover); }
button.link { color: var(--emerald); }
input[type=checkbox], input[type=radio] { accent-color: var(--emerald); }
input, select, textarea { border-color: var(--line-strong); border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus { box-shadow: none; }

/* Working surfaces: white panels with a hairline, no shadow */
.surface, .stat-tile, .today-item, .h-card-flat { box-shadow: none; border: 1px solid var(--line); border-radius: var(--radius-md); }
.segments { background: var(--surface-sunken); border-radius: var(--radius-pill); }
.segments a { border-radius: var(--radius-pill); }
.segments a[aria-current="page"] { box-shadow: none; border: 1px solid var(--line); }
.today-item b, .stat-tile b { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
.today-item.on { border-color: var(--emerald); }

/* Status pills: soft background, strong text, a glyph and a word (never colour alone) */
.chip { border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--ink-muted); gap: 5px; font-weight: 600; }
.chip::before { content: none; }
.chip.good, .chip.brass { background: var(--success-soft); color: var(--success); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.warn, .chip.waiting { background: var(--warning-soft); color: var(--warning); }
.chip.bad, .chip.returned { background: var(--danger-soft); color: var(--danger); }
.chip.good::before, .chip.brass::before { content: "\2713"; width: auto; height: auto; background: none; opacity: 1; }
.chip.info::before { content: "\25CF"; width: auto; height: auto; background: none; opacity: 1; font-size: .8em; }
.chip.waiting::before { content: "\25CB"; width: auto; height: auto; background: none; opacity: 1; }
.chip.warn::before, .chip.bad::before { content: "!"; width: auto; height: auto; background: none; opacity: 1; font-weight: 800; }
.chip.returned::before { content: "\21BA"; width: auto; height: auto; background: none; opacity: 1; }
.chip.plain::before { content: none; }

/* Paperwork's own voice: file names and logged dates */
.ref, .file-name { font-family: var(--mono); font-size: 12.5px; line-height: 18px; font-weight: 500; letter-spacing: 0; }

/* Progress: emerald on light, mint on dark */
.ring .arc { stroke: var(--emerald); }
.ring .track { stroke: var(--surface-sunken); }
.bar-col em, .lead-dot { background: var(--evergreen); }

/* Reserved: the founding-firm offer badge (the only place brass appears) */
.offer-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--brass-soft); color: var(--brass); font: 600 12px/16px var(--sans); }

/* Search: a small icon beside the logo, opening the search page */
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-search-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  border-radius: var(--radius-pill); color: var(--on-evergreen-muted); text-decoration: none; }
.side-search-btn:hover, .side-search-btn[aria-current="page"] { color: var(--on-evergreen); background: rgba(234, 244, 239, .1); }

/* ------------------------------------------------------------ plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-top: 12px; }
.plan { position: relative; display: flex; flex-direction: column; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 20px; min-width: 0; }
.plan-main { border-color: var(--emerald); box-shadow: 0 0 0 1px var(--emerald) inset; }
.plan h2, .plan h3 { margin: 0 0 4px; font-family: var(--display); }
.plan-tag { position: absolute; top: -11px; left: 18px; }
.plan-price { margin: 12px 0 2px; }
.plan-price b { font-family: var(--display); font-size: 30px; letter-spacing: -0.02em; }
.plan-annual { margin: 0 0 12px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 18px; flex: 1; font-size: 14px; }
.plan-features li { padding: 5px 0 5px 22px; position: relative; }
.plan-features li::before { content: "\2713"; position: absolute; left: 0; color: var(--emerald); font-weight: 700; }
.founding { border-color: var(--brass); background: var(--brass-soft); }
.founding h2 { color: var(--brass); }
.chip.founding { background: var(--brass-soft); color: var(--brass); }
.chip.founding::before { display: none; }
.usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.usage > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.usage b { font-size: 18px; }
.usage .bar { height: 6px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; }
.usage .bar span { display: block; height: 100%; background: var(--emerald); }
.pricing-page { max-width: 1040px; }
