/* Northframe Collect. Calm work tool: paper, ink rules, one blue for the main action, status as shape + word.
   Satoshi (ITF Free Font License) and Geist Mono (SIL OFL), self-hosted; licences in /assets/fonts. */
@font-face { font-family: 'Satoshi'; src: url('/assets/fonts/Satoshi-Variable.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/assets/fonts/geist-mono-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --paper: #f5f3ee; --surface: #ffffff; --ink: #14161a; --ink-2: #3d424b; --muted: #5e636d;
  --line: #dcd8cf; --line-strong: #b5b0a4; --hover: #ece9e2;
  --accent: #2346d6; --accent-hover: #1a37b0; --accent-soft: #e8ecfc;
  --s-missing: #7a7f88; --s-draft: #c27c0e; --s-draft-text: #845407; --s-submitted: #2346d6; --s-changes: #c43d12; --s-approved: #1f7a4c;
  --danger: #b42318;
  --sans: 'Satoshi', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --gut: clamp(16px, 4vw, 40px);
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 450 16px/1.55 var(--sans); overflow-x: clip; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4.2vw, 42px); line-height: 1.08; font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
h2 { font-size: 21px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 17px; font-weight: 650; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.01em; }
.muted { color: var(--muted); }
.eyebrow { font: 500 13px/1.3 var(--mono); color: var(--muted); letter-spacing: 0.02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 30; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 8px; }

/* ---------------------------------------------------------------- top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gut); border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; min-width: 0; }
.brand b { font-size: 19px; font-weight: 750; letter-spacing: -0.02em; }
.brand span { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a, .top nav button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; text-decoration: none; color: var(--ink-2); cursor: pointer; font-weight: 550; }
.top nav a:hover, .top nav button:hover { background: var(--hover); color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); background: var(--hover); }

main:focus { outline: none; }
main { padding: clamp(28px, 5vw, 56px) var(--gut) 96px; max-width: 1180px; margin: 0 auto; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.btn:hover { background: var(--hover); border-color: var(--ink-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:focus-visible { outline-color: var(--ink); }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); padding: 0 12px; }
.btn-quiet:hover { background: var(--hover); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 32px; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 650; font-size: 15px; }
.help { color: var(--muted); font-size: 14px; }
input[type=text], input[type=password], input[type=date], input[type=email], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 180px; }
.form { display: grid; gap: 22px; max-width: 620px; }
.choice { display: grid; gap: 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.choice legend { padding: 0; margin-bottom: 10px; }
textarea.short { min-height: 120px; }
.foot-note { margin-top: 20px; }
.dlg .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice label { display: grid; grid-template-columns: 22px 1fr; gap: 4px 12px; align-items: start; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input { margin: 4px 0 0; width: 18px; height: 18px; accent-color: var(--accent); }
.choice small { grid-column: 2; color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-weight: 600; }
.error:empty { display: none; }

/* ---------------------------------------------------------------- status: a shape plus a word, never colour alone */
.mark { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--s-missing); position: relative; }
.mark[data-s="draft"] { border-color: var(--s-draft); background: linear-gradient(90deg, var(--s-draft) 50%, transparent 50%); }
.mark[data-s="submitted"] { border-color: var(--s-submitted); background: var(--s-submitted); box-shadow: inset 0 0 0 2px var(--surface); }
.mark[data-s="changes_requested"] { border-radius: 2px; border-color: var(--s-changes); background: var(--s-changes); transform: rotate(45deg) scale(.86); }
.mark[data-s="approved"] { border-color: var(--s-approved); background: var(--s-approved); }
.mark[data-s="approved"]::after { content: ''; position: absolute; left: 3px; top: 0px; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.status[data-s="missing"] { color: var(--muted); }
.status[data-s="draft"] { color: var(--s-draft-text); }
.status[data-s="submitted"] { color: var(--s-submitted); }
.status[data-s="changes_requested"] { color: var(--s-changes); }
.status[data-s="approved"] { color: var(--s-approved); }

/* the segmented bar: one segment per item, coloured by its real status */
.segbar { display: flex; gap: 3px; height: 10px; }
.segbar span { flex: 1; border-radius: 2px; background: var(--line); }
.segbar span[data-s="draft"] { background: repeating-linear-gradient(135deg, var(--s-draft) 0 3px, #f0dcb6 3px 6px); }
.segbar span[data-s="submitted"] { background: var(--s-submitted); }
.segbar span[data-s="changes_requested"] { background: var(--s-changes); }
.segbar span[data-s="approved"] { background: var(--s-approved); }
.segbar.lg { height: 14px; gap: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .mark { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 32px; margin-bottom: 36px; }
.page-head .lede { margin-top: 10px; color: var(--ink-2); font-size: 17px; max-width: 60ch; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: -8px 0 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--ink); text-decoration: underline; }
.sample-flag { display: block; width: max-content; max-width: 100%; margin-bottom: 14px; padding: 3px 8px; border: 1px dashed var(--s-draft); border-radius: 4px; color: var(--s-draft-text); font: 500 12px var(--mono); }

/* ---------------------------------------------------------------- agency: project list */
.plist { border-top: 1px solid var(--ink); }
.plist-head, .prow { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) 120px 120px 110px; gap: 20px; align-items: center; }
.plist-head { padding: 10px 12px; border-bottom: 1px solid var(--line); font: 500 12px var(--mono); color: var(--muted); }
.prow { padding: 18px 12px; border-bottom: 1px solid var(--line); text-decoration: none; }
.prow:hover { background: var(--hover); }
.prow .who b { display: block; font-size: 17px; font-weight: 700; }
.prow .who span { color: var(--ink-2); }
.prow .who .sample-flag { margin: 8px 0 0; }
.prow .prog { display: grid; gap: 8px; }
.prow .prog small { font: 500 13px var(--mono); color: var(--ink-2); }
.num { font: 600 15px var(--mono); }
.num.hot { color: var(--accent); }
.num.zero { color: var(--muted); font-weight: 400; }
.cell-label { display: none; }
.setup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 18px; margin-bottom: 28px; border: 1px solid var(--s-draft); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); }
.empty { padding: 56px 24px; border: 1px dashed var(--line-strong); border-radius: 14px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.empty p { color: var(--ink-2); max-width: 46ch; }

/* ---------------------------------------------------------------- agency: project page */
.overview { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px 48px; padding: 28px 0 32px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.big-progress { display: grid; gap: 14px; align-content: start; }
.big-progress .linkbox { margin-top: 14px; }
.big-progress .count { font-size: 18px; color: var(--ink-2); }
.big-progress .count b { font-size: 40px; line-height: 1; color: var(--ink); font-weight: 750; letter-spacing: -0.03em; margin-right: 6px; }
.next-action { display: grid; gap: 14px; align-content: start; }
.next-action p { color: var(--ink-2); }
.linkbox { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.linkbox code { font: 13px/1.4 var(--mono); overflow-wrap: anywhere; color: var(--ink-2); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.section { margin-bottom: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.section-head small { font: 500 13px var(--mono); color: var(--muted); }
.item { border-bottom: 1px solid var(--line); scroll-margin-top: 24px; }
.item > summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; padding: 16px 8px; cursor: pointer; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary:hover { background: var(--hover); }
.item .title { font-weight: 650; font-size: 17px; }
.item .meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); }
.item .right { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 16px; }
.item .chev { width: 10px; height: 10px; border: solid var(--ink-2); border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -4px; transition: transform .2s; }
.item[open] .chev { transform: rotate(225deg); margin-top: 4px; }
.item[data-focus="1"] > summary { box-shadow: inset 3px 0 0 var(--accent); }
.detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px 40px; padding: 8px 8px 28px; }
.detail .desc { color: var(--ink-2); font-size: 15px; }
.content-block { display: grid; gap: 10px; align-content: start; }
.client-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink); border-radius: 4px 10px 10px 4px; font-size: 16px; }
.client-text.old { border-left-color: var(--line-strong); color: var(--ink-2); }
.nothing { color: var(--muted); font-style: italic; }
.review { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--surface); align-content: start; }
.review textarea { min-height: 96px; }
.review + .label { margin-top: 14px; }
.history { display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); padding: 0; margin: 0; list-style: none; }
.history li { display: grid; grid-template-columns: 128px 1fr; gap: 12px; }
.history time { font: 12px/1.6 var(--mono); color: var(--muted); }
.history q { display: block; color: var(--ink); quotes: '“' '”'; }
.task-form { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.task-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.add-row { padding: 14px 8px; }

/* files (both views) */
.files { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.file { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.thumb { width: 56px; height: 56px; border-radius: 6px; background: var(--hover); display: grid; place-items: center; overflow: hidden; font: 600 11px var(--mono); color: var(--ink-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .fname { font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.file small { display: block; color: var(--muted); font-size: 13px; }

/* dialogs */
dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(20, 22, 26, .18); }
dialog::backdrop { background: rgba(20, 22, 26, .38); }
.dlg { display: grid; gap: 18px; padding: 24px; }
.dlg textarea { min-height: 300px; font-size: 15px; }
.dlg .btn-row { justify-content: flex-end; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 40; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast[data-kind="error"] { background: var(--danger); }

/* ---------------------------------------------------------------- client view */
.client main { max-width: 760px; }
.client .top { border-bottom-color: transparent; max-width: calc(760px + 2 * var(--gut)); margin: 0 auto; }
.hero-progress { display: grid; gap: 14px; padding: 22px 0 26px; margin: 26px 0 30px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.hero-progress .count { font-size: 17px; color: var(--ink-2); }
.hero-progress .count b { font-size: 34px; line-height: 1; color: var(--ink); font-weight: 750; letter-spacing: -0.03em; margin-right: 4px; }
.next { display: grid; gap: 14px; padding: 22px; margin-bottom: 40px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.next .eyebrow { color: var(--accent); }
.next[data-s="changes_requested"] { border-color: var(--s-changes); border-left-width: 4px; }
.next[data-s="changes_requested"] .eyebrow { color: var(--s-changes); }
.next h2 { font-size: 22px; }
.next .btn { justify-self: start; }
.citems { list-style: none; margin: 0 0 36px; padding: 0; border-top: 1px solid var(--ink); }
.citems li { border-bottom: 1px solid var(--line); }
.citems a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; min-height: 64px; padding: 14px 6px; text-decoration: none; }
.citems a:hover { background: var(--hover); }
.citems .t { font-weight: 650; font-size: 17px; }
.citems .due { grid-column: 1; font-size: 14px; color: var(--muted); }
.citems .status { grid-column: 2; grid-row: 1 / span 2; }
.cgroup { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.cgroup small { font: 500 13px var(--mono); color: var(--muted); }

.task-page { display: grid; gap: 22px; }
.task-page .desc { font-size: 17px; color: var(--ink-2); max-width: 62ch; }
.callout { display: grid; gap: 6px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.callout.feedback { border-color: var(--s-changes); border-left-width: 4px; }
.callout.feedback b { color: var(--s-changes); }
.callout.locked { border-color: var(--s-approved); border-left-width: 4px; }
.callout.reopened { border-color: var(--s-draft); border-left-width: 4px; }
.callout q { quotes: '“' '”'; white-space: pre-wrap; overflow-wrap: anywhere; }
.drop { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 28px 18px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop p { color: var(--muted); font-size: 14px; max-width: 44ch; }
.upbar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.upbar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .1s; }
.savebar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.savebar .state { font-size: 14px; color: var(--muted); }
.counter { font: 12px var(--mono); color: var(--muted); text-align: right; }

/* ---------------------------------------------------------------- login / gone */
.narrow { max-width: 460px; margin: 0 auto; padding: clamp(48px, 12vh, 120px) var(--gut) 64px; display: grid; gap: 24px; }
.narrow .brand { margin-bottom: 8px; }
.narrow .sub { margin-top: 10px; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 900px) {
  .overview, .detail { grid-template-columns: minmax(0, 1fr); }
  .plist-head { display: none; }
  .prow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; padding: 18px 8px; }
  .prow .who, .prow .prog { grid-column: 1 / -1; }
  .cell-label { display: block; font: 500 12px var(--mono); color: var(--muted); }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .top nav .hide-sm { display: none; }
  .page-head { margin-bottom: 26px; }
  .page-head .btn-primary { width: 100%; }
  .task-form .row, .dlg .row { grid-template-columns: 1fr; }
  .item > summary { grid-template-columns: minmax(0, 1fr); }
  .item .right { grid-column: 1; grid-row: auto; justify-content: space-between; }
  .history li { grid-template-columns: 1fr; gap: 0; }
  /* client: the main action stays under the thumb */
  .savebar.sticky { position: sticky; bottom: 0; z-index: 5; margin: 0 calc(-1 * var(--gut)); padding: 12px var(--gut) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--paper); border-top: 1px solid var(--line); }
  .savebar.sticky .btn-primary { flex: 1 1 100%; order: -1; }
  .savebar.sticky .btn:not(.btn-primary) { flex: 1 1 auto; }
  .next .btn { justify-self: stretch; }
  /* notices float above the sticky action bar, never over the main button */
  body:has(.savebar.sticky) .toast { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
  .dlg { padding: 20px; }
  .dlg .btn-row .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------------------------------------------------------------- reading pages (privacy) */
.prose { display: grid; gap: 14px; align-content: start; }
.prose h1 { margin-bottom: 4px; }
.prose h2 { margin-top: 22px; font-size: 19px; }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
.prose p { color: var(--ink-2); max-width: 64ch; }
.lede-text { font-size: 18px; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.back-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; cursor: pointer; justify-self: start; }
.client-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 14px; color: var(--muted); }
