/* Redesign v4 shared primitives (r18 foundation). Loaded right after redesign-v3.css; area work USES these, it does not re-invent them.
 * Rules this file serves (design/2026-11-16/DESIGN-BRIEF.md): no coloured side edges, no card soup, no stat tiles, colour only for meaning,
 * a row is wholly clickable OR holds one named link. Reference page: ui-v2/design-v4-reference.html (not linked from the app).
 * Uses the existing tokens (--ink --mute --line --well --panel --late --soon --wait --ok ...); light and dark come from them. Phone safe at 390px. */

/* ---------- colour meaning: one meaning each ---------- */
:root {
  --m-late: var(--late);   /* needs you / overdue (red only for truly late or expired) */
  --m-soon: var(--soon);   /* due soon / behind pace */
  --m-wait: var(--wait);   /* waiting on others */
  --m-ok: var(--ok);       /* done */
  --m-mute: var(--mute);   /* everything else */
  --m-late-bg: color-mix(in srgb, var(--late) 9%, var(--panel));
  --m-soon-bg: color-mix(in srgb, var(--soon) 10%, var(--panel));
  --m-wait-bg: color-mix(in srgb, var(--wait) 9%, var(--panel));
  --m-ok-bg: color-mix(in srgb, var(--ok) 9%, var(--panel));
  --m-mute-bg: var(--well);
  --m-link: var(--ink);    /* links are ink and bold; blue is for "waiting on others" and the rare link that must stand out */
}
[data-s="late"] { --m: var(--m-late); --m-bg: var(--m-late-bg); }
[data-s="soon"] { --m: var(--m-soon); --m-bg: var(--m-soon-bg); }
[data-s="wait"] { --m: var(--m-wait); --m-bg: var(--m-wait-bg); }
[data-s="ok"] { --m: var(--m-ok); --m-bg: var(--m-ok-bg); }
[data-s="mute"] { --m: var(--m-mute); --m-bg: var(--m-mute-bg); }

/* ---------- the global link rule (pattern 6/7) ----------
 * A link inside a sentence is underlined. A whole title or row that is a link is ink, bold, and underlines on hover. Plain gray text is never a link.
 * Buttons do things, links go places. Use a.lnk for a clickable title; a.rl for the one named link inside a row. */
:where(p, li, dd, td, .sub, .lede, small, .hint) a:not([class]) { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
:where(p, li, dd, td, .sub, .lede, small, .hint) a:not([class]):hover { text-decoration-color: var(--ink); }
a.lnk, a.rl { color: var(--ink); font-weight: 650; text-decoration: none; cursor: pointer; }
a.lnk:hover, a.rl:hover { text-decoration: underline; text-underline-offset: 3px; }
a.lnk.mu, a.rl.mu { color: var(--ink-2); }

/* ---------- .sec: a section is a bold heading + space, no box ----------
 * <section class="sec"><h3 class="bh">Overdue <span class="n">3</span><a class="more" href="#">All tasks</a></h3> ...rows... </section>
 * (.bh, .bh .n and .bh .more are redesign-v3.css; this only removes any box a section could pick up and spaces sections apart.) */
.sec { border: 0; background: none; box-shadow: none; border-radius: 0; }
.sec + .sec { padding-top: calc(6px * var(--s1-scale, 1)); }
.sec > .bh { margin-bottom: 6px; }
.sec > .bh .more { font-weight: 650; color: var(--ink-2); text-decoration: none; }
.sec > .bh .more:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- .vline: one-line verdict above a checklist ---------- */
.vline { display: flex; align-items: baseline; gap: calc(8px * var(--s1-scale, 1)); flex-wrap: wrap; margin: 0 0 6px; font: 650 var(--s1-fs-3)/1.35 var(--ui); color: var(--ink); }
.vline b { font-weight: 750; font-variant-numeric: tabular-nums; }
.vline .by { color: var(--mute); font-weight: 500; font-size: var(--s1-fs-2); }
.vline[data-s] b { color: var(--ink); } /* a verdict headline is calm ink; colour lives in the chip or the one row that is truly wrong */

/* ---------- .chip[data-s]: status chip. Every state has its own icon SHAPE, so it reads without colour ----------
 * late = triangle with !, soon = clock, wait = hourglass, ok = check, mute = dashed ring.  <span class="chip" data-s="late">3 days late</span>
 * (a bare .chip without data-s is the existing filter/starter chip and is unchanged). To use your own svg, put an <svg class="ic"> first: the shape is then not drawn. */
.chip[data-s] { height: auto; min-height: 22px; padding: 2px calc(9px * var(--s1-scale, 1)) 2px calc(7px * var(--s1-scale, 1)); border: 0; background: var(--m-bg); color: var(--m); cursor: default; font: 650 var(--s1-fs-1)/1.25 var(--ui); gap: 5px; max-width: 100%; }
.chip[data-s]:hover { color: var(--m); border-color: transparent; }
.chip[data-s]::before { content: ""; flex: none; width: 13px; height: 13px; background: currentColor; -webkit-mask: var(--shape) center / contain no-repeat; mask: var(--shape) center / contain no-repeat; }
.chip[data-s]:has(> .ic)::before { display: none; }
.chip[data-s] > .ic { width: 13px; height: 13px; }
.chip[data-s="mute"] { color: var(--ink-2); }
.chip[data-s="mute"]:hover { color: var(--ink-2); }
[data-s="late"] { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1.9 15 14H1z'/%3E%3Cpath d='M8 6.2v3.3M8 11.8v.1'/%3E%3C/svg%3E"); }
[data-s="soon"] { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='6.2'/%3E%3Cpath d='M8 4.6V8l2.4 1.5'/%3E%3C/svg%3E"); }
[data-s="wait"] { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.8 1.8h8.4M3.8 14.2h8.4M4.8 1.8c0 3.2 3.2 4.2 3.2 6.2s-3.2 3-3.2 6.2M11.2 1.8c0 3.2-3.2 4.2-3.2 6.2s3.2 3 3.2 6.2'/%3E%3C/svg%3E"); }
[data-s="ok"] { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.8 8.6 6.4 12.2 13.2 4.2'/%3E%3C/svg%3E"); }
[data-s="mute"] { --shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='5.6' stroke-dasharray='2.2 2.4'/%3E%3C/svg%3E"); }

/* ---------- .hnum: headline number, inline and unboxed, with a small vs-plan line ----------
 * <div class="hnum"><b>148</b><span class="u">of 240 charts</span><small class="vs" data-s="soon">12 behind plan</small></div> */
.hnum { display: inline-flex; flex-wrap: wrap; align-items: baseline; column-gap: calc(8px * var(--s1-scale, 1)); row-gap: 2px; background: none; border: 0; padding: 0; }
.hnum > b { font: 800 var(--s1-fs-7)/1.05 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.hnum > .u { font: 600 var(--s1-fs-3)/1.3 var(--ui); color: var(--ink-2); }
.hnum > .vs { flex-basis: 100%; font: 500 var(--s1-fs-1)/1.35 var(--ui); color: var(--mute); }
.hnum > .vs[data-s] { color: var(--m); font-weight: 650; }
.hnum + .hnum { margin-left: 28px; }
@media (max-width: 480px) { .hnum > b { font-size: var(--s1-fs-7); } .hnum + .hnum { margin-left: 18px; } }

/* ---------- .pace: one thin bar with a tick for where the plan says you should be today ----------
 * <div class="pace" style="--p:62; --t:70" data-s="soon" role="img" aria-label="62% done, plan says 70%"><i class="f"></i><i class="tk"></i></div>
 * --p and --t are plain numbers 0-100. data-s only when it means something (soon = behind plan, ok = done); default fill is ink. */
.pace { position: relative; height: 6px; border-radius: 99px; background: var(--track); margin: 8px 0; }
.pace > .f { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 1%); max-width: 100%; border-radius: 99px; background: var(--m, var(--ink)); }
.pace > .tk { position: absolute; top: -4px; bottom: -4px; left: calc(var(--t, 0) * 1%); width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.pace-l { display: flex; justify-content: space-between; gap: calc(12px * var(--s1-scale, 1)); flex-wrap: wrap; font-size: var(--s1-fs-1); color: var(--mute); font-variant-numeric: tabular-nums; }
.pace-l [data-s] { color: var(--m); font-weight: 650; }

/* ---------- .rows: hairline-separated list with the clickability rule built in ----------
 * Whole-row link:  <div class="rows"><a href="#"><span class="t">Title</span><span class="when">..</span></a> ...</div>   (no .rl inside)
 * One named link:  <div class="rows"><div><span class="t"><a class="rl" href="#">Title</a></span><span class="when">..</span></div> ...</div>
 * A row with neither (plain text) is fine only when it is not a link-looking thing. data-s on a row gives it a faint tinted fill (not a stripe).
 * Rows bleed 10px each side so the fill reaches past the text, while text stays on the page's shared left edge. */
div.rows, ul.rows, ol.rows { list-style: none; margin: 0; padding: 0; }
:is(div, ul, ol).rows > * { display: flex; align-items: center; gap: calc(14px * var(--s1-scale, 1)); min-width: 0; margin: 0 -10px; padding: calc(11px * var(--s1-scale, 1)) calc(10px * var(--s1-scale, 1)); border-top: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); border-radius: 0; background: none; }
:is(div, ul, ol).rows > :first-child { border-top: 0; }
:is(div, ul, ol).rows > [data-s] { background: var(--m-bg); }
:is(div, ul, ol).rows > a { cursor: pointer; }
:is(div, ul, ol).rows > a:hover { background: var(--well); }
:is(div, ul, ol).rows > a[data-s]:hover { background: color-mix(in srgb, var(--m) 14%, var(--panel)); }
:is(div, ul, ol).rows > a:hover .t { text-decoration: underline; text-underline-offset: 3px; }
:is(div, ul, ol).rows .t { flex: 1 1 auto; min-width: 0; font: 650 var(--s1-fs-3)/1.35 var(--ui); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(div, ul, ol).rows .t small, :is(div, ul, ol).rows .m { display: block; font: 500 var(--s1-fs-1)/1.35 var(--ui); color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:is(div, ul, ol).rows .t.wrap, :is(div, ul, ol).rows .t.wrap small { white-space: normal; }
:is(div, ul, ol).rows > * > .when, :is(div, ul, ol).rows > * > .who, :is(div, ul, ol).rows > * > .chip { flex: none; }
:is(div, ul, ol).rows > a:focus-visible { background: var(--well); }
@media (max-width: 560px) {
  :is(div, ul, ol).rows > * { flex-wrap: wrap; gap: 4px 12px; }
  :is(div, ul, ol).rows .t { flex-basis: 100%; white-space: normal; }
}

/* ---------- .who: a person cell (avatar + name) ---------- */
.who { display: inline-flex; align-items: center; gap: calc(8px * var(--s1-scale, 1)); min-width: 0; font: 550 var(--s1-fs-2)/1.3 var(--ui); color: var(--ink-2); }
.who .av { width: 24px; height: 24px; font-size: var(--s1-fs-1); letter-spacing: 0; }
.who .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--mute); font-size: var(--s1-fs-1); }

/* ---------- .when: a date cell, "in 5 days . 19 Nov" ----------
 * <span class="when" data-s="soon"><b>in 5 days</b><span>19 Nov</span></span>  The relative part is bold; colour only when late (red) or soon (amber). */
.when { display: inline-flex; align-items: baseline; gap: calc(6px * var(--s1-scale, 1)); white-space: nowrap; font: 500 var(--s1-fs-1)/1.3 var(--ui); color: var(--mute); font-variant-numeric: tabular-nums; }
.when > b { font-weight: 650; color: var(--ink-2); }
.when > span::before { content: "\00b7"; margin-right: 6px; }
.when[data-s="late"] > b, .when[data-s="soon"] > b { color: var(--m); }
.when[data-s="ok"] > b { color: var(--m-ok); }

/* ---------- .stages: stage row with a count per stage; the stage is the click target (pattern 14) ----------
 * <nav class="stages"><a class="on" href="#"><b>4</b><span>Writing</span></a> ...</nav>  (use <button> for a filter that does not navigate) */
.stages { display: flex; flex-wrap: wrap; gap: 4px calc(26px * var(--s1-scale, 1)); margin: 0; padding: 0; }
.stages > a, .stages > button { display: flex; flex-direction: column; gap: 2px; min-width: 72px; padding: calc(6px * var(--s1-scale, 1)) 0 calc(8px * var(--s1-scale, 1)); border: 0; border-bottom: 2px solid var(--line-soft); background: none; text-align: left; text-decoration: none; color: var(--ink-2); cursor: pointer; font: inherit; }
.stages > :is(a, button) > b { font: 800 var(--s1-fs-6)/1.1 var(--display); letter-spacing: -.015em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stages > :is(a, button) > span { font: 600 var(--s1-fs-1)/1.3 var(--ui); color: var(--mute); }
.stages > :is(a, button):hover { border-bottom-color: var(--mute); }
.stages > :is(a, button):hover > span { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.stages > :is(a, button).on, .stages > :is(a, button)[aria-current], .stages > :is(a, button)[aria-pressed="true"] { border-bottom-color: var(--ink); }
.stages > :is(a, button).on > span, .stages > :is(a, button)[aria-current] > span, .stages > :is(a, button)[aria-pressed="true"] > span { color: var(--ink); }
.stages > [data-s] > b { color: var(--m); }
@media (max-width: 480px) { .stages { gap: 4px 18px; } .stages > :is(a, button) { min-width: 64px; } }

/* ---------- .grid-cmp: people x requirements grid (pattern 16) ----------
 * <div class="grid-cmp"><table><thead><tr><th>Person</th><th>CITI</th>..</tr></thead><tbody><tr><th scope="row"><span class="who">..</span></th>
 * <td><span class="g" data-s="ok" title="Current to 3 Mar"><i>Current</i></span></td> ...</tr></tbody></table></div>
 * A cell is an icon of its state's own shape (the same shapes as .chip) with the word hidden visually but kept for screen readers.
 * The wrapper scrolls sideways on a phone and keeps the person column fixed; the page itself never scrolls sideways. */
.grid-cmp { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid-cmp > table { border-collapse: collapse; width: 100%; font-size: var(--s1-fs-2); }
.grid-cmp th, .grid-cmp td { padding: calc(9px * var(--s1-scale, 1)) calc(12px * var(--s1-scale, 1)); border-bottom: 1px solid var(--line-soft); text-align: center; white-space: nowrap; }
.grid-cmp thead th { font: 650 var(--s1-fs-1)/1.3 var(--ui); letter-spacing: .05em; text-transform: uppercase; color: var(--mute); border-bottom-color: var(--line); vertical-align: bottom; }
.grid-cmp th:first-child, .grid-cmp td:first-child { text-align: left; position: sticky; left: 0; background: var(--panel); padding-left: 0; z-index: 1; }
.grid-cmp tbody th { font-weight: 600; color: var(--ink); }
.grid-cmp .g { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--m); }
.grid-cmp .g::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--shape) center / contain no-repeat; mask: var(--shape) center / contain no-repeat; }
.grid-cmp .g > i { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.grid-cmp a.g:hover { background: var(--m-bg); border-radius: 6px; }
.grid-cmp tbody tr:hover td, .grid-cmp tbody tr:hover th { background: var(--well); }

/* ---------- .empty / .err: specific, plain, never blank ("No overdue tasks", "Training records did not load. Try again.") ---------- */
.empty, .err { margin: 0; padding: calc(14px * var(--s1-scale, 1)) 0; font: 500 var(--s1-fs-3)/1.45 var(--ui); color: var(--ink-2); background: none; border: 0; text-align: left; max-width: 64ch; }
.empty > b, .err > b { display: block; font-weight: 650; color: var(--ink); }
.empty > span, .err > span { color: var(--mute); }
.empty a, .err a, .err button.rl, .empty button.rl { font-weight: 650; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; text-decoration-thickness: 1.5px; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; font-size: inherit; }
.empty a:hover, .err a:hover, .err button.rl:hover, .empty button.rl:hover { text-decoration-color: var(--ink); }
.err { display: flex; align-items: baseline; gap: calc(8px * var(--s1-scale, 1)); flex-wrap: wrap; }
.err::before { content: ""; align-self: center; flex: none; width: 15px; height: 15px; background: var(--m-late); -webkit-mask: var(--err-shape) center / contain no-repeat; mask: var(--err-shape) center / contain no-repeat; }
.err { --err-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1.9 15 14H1z'/%3E%3Cpath d='M8 6.2v3.3M8 11.8v.1'/%3E%3C/svg%3E"); }

/* ---------- banned looks removed where SHARED css draws them ----------
 * (The shared stylesheets load after this one, so these use `html` to win; page-specific markup is left to the page's area.) */
/* no coloured side edge on an answer that failed: say it in the text */
html .ans.bad { display: flex; align-items: baseline; gap: calc(8px * var(--s1-scale, 1)); --err-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1.9 15 14H1z'/%3E%3Cpath d='M8 6.2v3.3M8 11.8v.1'/%3E%3C/svg%3E"); }
html .ans.bad::before { content: ""; align-self: center; flex: none; width: 15px; height: 15px; background: var(--m-late); -webkit-mask: var(--err-shape) center / contain no-repeat; mask: var(--err-shape) center / contain no-repeat; }
html .ans.bad > p:first-child { color: var(--ink-2); margin: 0; }
/* callouts and status lines are plain lines, not tinted bordered boxes; the tone is the title colour and the icon */
html .k-callout { border: 0; border-radius: 0; background: none; padding-inline: 0; }
html .k-callout b { color: var(--tone, var(--ink)); }
html .k-empty { border: 0; border-radius: 0; background: none; padding-inline: 0; } /* an empty state is a plain line, not a dashed box (pattern 18) */
/* a row's icon tile does not take a tinted square per tone */
html .k-row--late .k-tile, html .k-row--wait .k-tile, html .k-row--soon .k-tile { background: none; }
/* a stat is a figure on a rule, never a tinted rounded box */
html .k-stat, html .s1h-tile { background: none; border-radius: 0; box-shadow: none; }
html .s1h-tile { border-left: 0; border-right: 0; border-bottom: 0; border-top-width: 1px; }

/* A one-step progress strip says nothing the line under it does not: leave it out (request window). */
.k-pipe:has(> li:only-child) { display: none; }

/* the toast tick and a live dot are not status colours on the ink toast */
.k-toast .k-icon { color: var(--on-ink); }
.k-toast--late .k-icon { color: var(--on-ink); }
.k-toast { background: var(--ink); color: var(--on-ink); }
.k-toast-undo { color: var(--on-ink); }
/* dark theme: a filled .tp-btn never renders white on a near-white ink. Only the bare filled button: "Log progress" (--log), +1/+5 (--ghost)
   and "Fix total..." (--quiet) sit on the panel with their own ink colour, and this rule turned them white on white. */
html .tp-btn:not(.tp-btn--log, .tp-btn--ghost, .tp-btn--quiet) { color: var(--on-ink); }

/* a status that opens a sentence ("Will miss  Revised manuscript due...") sits on the sentence's baseline, not above it */
p:has(> .st:first-child) { display: flex; align-items: baseline; gap: calc(8px * var(--s1-scale, 1)); }
p:has(> .st:first-child) > .st { flex: none; }

/* r20: a send button that says what it does (Post, Reply): the round arrow plus its word. */
.inp .go.go--text { width:auto; min-width:32px; padding:0 calc(14px * var(--s1-scale, 1)) 0 calc(10px * var(--s1-scale, 1)); border-radius:999px; display:inline-flex; gap:calc(6px * var(--s1-scale, 1)); align-items:center; justify-content:center; font:inherit; font-size:var(--s1-fs-2); font-weight:600; white-space:nowrap; }
.inp .go.go--text svg { width:14px; height:14px; }

/* ---------- .rt: announcement text (RWTS1LibraryText.body / clamped). Paragraphs, a real list, linked addresses; a long one is clamped with a "Read more" button ----------
 * <div class="rt rt-clamp" style="--rt-lines:6">…</div><button class="rt-more" data-rt-more="id" aria-expanded="false">Read more</button> */
.rt { font-size: var(--s1-fs-2); line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; max-width: 72ch; }
.rt > :first-child { margin-top: 0; } .rt > :last-child { margin-bottom: 0; }
.rt p { margin: 0 0 .65em; }
.rt ul { margin: 0 0 .65em; padding: 0 0 0 1.25em; list-style: disc; }
.rt li { margin: .2em 0; padding: 0; } .rt li::marker { color: var(--mute); }
.rt a { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2.5px; } .rt a:hover { text-decoration-color: var(--ink); }
.rt-clamp:not(.is-open) { max-height: calc(var(--rt-lines, 5) * 1.5em); overflow: hidden; -webkit-mask-image: linear-gradient(#000 calc(100% - 2.2em), transparent); mask-image: linear-gradient(#000 calc(100% - 2.2em), transparent); }
.rt-more { display: inline-flex; align-items: center; margin: 6px 0 0; padding: 4px 0; border: 0; background: none; font: 650 var(--s1-fs-1)/1.2 var(--ui); color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.rt-more:hover { text-decoration-color: var(--ink); }
