/* FDE AI: one calm, warm system in light and dark, with a touch of the brand's yellow-to-coral.
   The values are the course site's house look (fde-aws web/theme, as the built course pages carry them inline), so
   that the portal and a course page in its reader are one product: the same paper, inks and lines, and the course's
   navy in the dark theme. The parts built from them (the frame, the title band, the pills) are in portal/house.css. */

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --surface-3: #e8e4db;
  --ink: #1d1c1a;
  --ink-2: #57544e;
  --ink-3: #6b675f;
  --line: #e3dfd6;
  --line-strong: #d3cec3;
  /* Brand: the circles mark runs from warm yellow to coral. Used sparingly. */
  --brand-a: #ffd266;
  --brand-b: #fe5d41;
  --brand-grad: linear-gradient(120deg, var(--brand-a), var(--brand-b));
  /* The course's navy: the title band, and the filled pill and button (--band), which turn cream in the dark theme.
     Text on the band uses the fixed ground inks in both themes. */
  --ground: #192B43;
  --ground-ink: #f3efe6;
  --ground-ink-2: #c3ccd9;
  --ground-ink-3: #8FA3BF;
  --band: #192B43;
  --band-ink: #f3efe6;
  --panel: #192B43;
  --panel-line: #192B43;
  /* Primary actions take the band: navy on paper, cream on navy. Coral is kept for the brand touches and links. */
  --primary: var(--band);
  --primary-hover: #24395a;
  --primary-ink: var(--band-ink);
  --accent: #b43e26;
  --accent-hover: #93311d;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e3;
  --accent-soft-ink: #8a2e1c;
  --focus: var(--ink-3);
  --danger: #c0412e;
  --danger-hover: #a53625;
  --ok: #276a43;
  --ok-soft: #e4f1e8;
  --warn: #8a5a12;
  --warn-soft: #f7ecd8;
  --shadow: 0 1px 2px rgb(28 25 20 / 5%), 0 10px 28px -14px rgb(28 25 20 / 18%);
  --shadow-lift: 0 2px 4px rgb(28 25 20 / 6%), 0 18px 40px -18px rgb(28 25 20 / 28%);
  --radius: 18px;
  --radius-sm: 14px;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --avatar-l: 88%;
  --avatar-c: 0.07;
  --avatar-ink-l: 34%;
  --topbar-h: 58px; /* measured by app.js; the chat and call use it to fit a phone screen */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #192B43;
    --surface: #223652;
    --surface-2: #2a4061;
    --surface-3: #33496c;
    --ink: #f3efe6;
    --ink-2: #c3ccd9;
    --ink-3: #8FA3BF;
    --line: #2E4260;
    --line-strong: #3d5478;
    --band: #f3efe6;
    --band-ink: #192B43;
    --panel: #223652;
    --panel-line: #3d5478;
    --primary-hover: #ffffff;
    --accent: #ff8a6b;
    --accent-hover: #ffa488;
    --accent-ink: #1a0d08;
    --accent-soft: #423c4a;
    --accent-soft-ink: #ffc9b8;
    --danger: #e0664f;
    --danger-hover: #ea7f6b;
    --ok: #6cc392;
    --ok-soft: #284651;
    --warn: #e3a94b;
    --warn-soft: #3d4244;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 28px -14px rgb(0 0 0 / 60%);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 30%), 0 18px 40px -18px rgb(0 0 0 / 70%);
    --avatar-l: 36%;
    --avatar-c: 0.06;
    --avatar-ink-l: 88%;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }

/* One maximum width for every page, the top bar's included: the course site's reading page less its gutters. */
.wrap { max-width: 1240px; margin: 0 auto; padding: 32px 24px 48px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; flex: none; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: block; width: 28px; height: 28px; flex: none; }
.brand-mark.large { width: 64px; height: 64px; margin: 0 auto; }
.brand-name { font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; }
.grad {
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
/* The view-as banner sits inside the sticky bar, so --topbar-h includes it. */
.viewas {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 8px; padding: 5px 16px;
  font-size: 13px; text-align: center; color: var(--ink);
  background: var(--warn-soft); border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.viewas strong { font-weight: 650; }
.viewas-exit {
  border: 0; background: none; padding: 0; cursor: pointer; font-size: 13px; font-weight: 620;
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.viewas-exit:hover { color: var(--accent-hover); }

/* A chat left open while the learner looks something up. It sits inside the sticky bar, below the
   nav (and the view-as banner), so --topbar-h includes it; it's hidden on the chat's own page. */
.chatbar { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.chatbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 6px 24px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px;
}
.chatbar-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 560; }
.chatbar-text > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatbar-dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-b);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-b) 22%, transparent);
}
.chatbar .btn.small { height: 28px; padding: 0 11px; font-size: 12.5px; }
.avatar.tiny { width: 24px; height: 24px; font-size: 10px; }

/* The course site's top-bar links: quiet pills, the current one filled with the band. */
.nav { display: flex; gap: 4px; min-width: 0; }
.nav button {
  position: relative; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  color: var(--ink-2); font-size: 14px; font-weight: 560;
}
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--band); color: var(--band-ink); }
.nav button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.nav-icon { display: grid; place-items: center; }
.nav-icon svg { width: 16px; height: 16px; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-count, .tab-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tab-count { margin-left: 6px; }
.nav-dot {
  position: absolute; top: 5px; left: 22px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand-b); box-shadow: 0 0 0 2px var(--surface-2);
}
.nav button[aria-current="page"] .nav-dot { box-shadow: 0 0 0 2px var(--band); }

/* A choice of one (the project in Admin): the house look's pills (portal/house.css), the chosen one filled. */
.switch { display: flex; flex-wrap: wrap; gap: 8px; }
.switch button small { color: inherit; opacity: .75; font-size: 12px; font-weight: 500; }

.me { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; min-width: 0; }
/* The top bar stays on one line, 60 px tall (the look verdict's ruling 2; M46): the programme's name, the pills and
   the controls keep their size, and only the person's name gives way, cut with an ellipsis (app.js puts the whole
   name in its title). */
@media (min-width: 641px) { .topbar .nav { flex: none; } } /* on a phone the pills fill the middle (below) */
.topbar .me > * { flex: none; }
.topbar .me > .me-identity { flex: 0 1000 auto; min-width: 3.5rem; grid-template-columns: minmax(0, 1fr); }
.topbar .me-name, .topbar .me-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The working cohort's menu gives way only once the name is as short as it goes (the name's shrink weighs a thousand
   times more), so that a long cohort's name never pushes the bar past the window. */
.topbar .me > .working-cohort { flex: 0 1 auto; min-width: 0; }
.topbar .working-cohort .select.small { flex: 0 1 auto; min-width: 6rem; }
/* A member of staff's bar also holds that menu, so it gives way sooner than a learner's: under 1,024 px "Tell the
   course team" is its icon, and under 901 px the programme's name is its mark alone, as on a phone (the link keeps
   the name for assistive technology). */
@media (max-width: 1023px) {
  .topbar-inner:has(.working-cohort:not([hidden])) .tell { width: 32px; padding: 0; justify-content: center; }
  .topbar-inner:has(.working-cohort:not([hidden])) .tell-label { display: none; }
  .topbar-inner:has(.working-cohort:not([hidden])) .tell-icon { display: grid; }
}
@media (max-width: 900px) {
  .topbar-inner:has(.working-cohort:not([hidden])) .brand-name { display: none; }
}
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- buttons ---------- */

/* The course site's buttons: a pill outlined in the strong line that fills with the band on hover (its pager's
   links), and the primary action filled with the band (its download button). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink);
  font-weight: 600; font-size: 14.5px; transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:hover { background: var(--band); border-color: var(--band); color: var(--band-ink); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 650; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.wide { width: 100%; height: 44px; }
/* A long label wraps on a narrow screen rather than push past its card. */
.btn.wrap { max-width: 100%; height: auto; min-height: 38px; padding-top: 8px; padding-bottom: 8px; white-space: normal; text-align: left; }
.btn.round { width: 56px; height: 56px; padding: 0; border-radius: 50%; }
.btn.round svg { width: 22px; height: 22px; }
.btn.icon-only { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn[disabled]:hover { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn.primary[disabled]:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.toggled { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- sign-in ---------- */

/* Keep this presentation aligned in First Call, Role Call and the capstone app. */
.view-login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: var(--bg);
}
/* The house look's card, opening with the title band (portal/house.css); the course's rings replace the mark. */
.login-card {
  position: relative; overflow: hidden;
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 0 32px 32px; box-shadow: var(--shadow-lift); text-align: left;
}
.login-card > .brand-mark { display: none; }
.login-card form { text-align: left; display: grid; gap: 16px; margin-top: 0; }
.login-card .login-field { display: grid; gap: 8px; min-width: 0; }
.login-card label { font-size: 13.5px; font-weight: 620; color: var(--ink); }
.login-card .login-field input {
  width: 100%; min-width: 0; height: 44px; min-height: 44px; margin: 0; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg);
  /* 16px prevents Safari from zooming the page when a sign-in field is focused. */
  font: inherit; font-size: 16px; color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.login-card .btn { min-height: 44px; font-size: 14px; font-weight: 600; }
.login-card .form-error {
  margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 14px; color: var(--ink);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.login-card .lede { color: var(--ink-2); margin: 0 0 24px; max-width: 36ch; text-wrap: pretty; }
.holding-who { color: var(--ink-3); font-size: 13.5px; margin: -12px 0 18px; }
.holding-who:empty { display: none; }

/* ---------- cast ---------- */

/* A small label in tracked capitals ("Your sponsor" on Home's card). The capstone's pages open with the house look's
   band (portal/house.css), as the portal's do. */
.eyebrow { font-size: 12.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--ink-3); font-weight: 750; }

/* The sponsor on Home: a house card (.card) with her portrait beside her name. */
.card.sponsor-card { flex-direction: row; align-items: center; gap: 18px; margin: 24px 0 0; }
.sponsor-card .who { min-width: 0; }
.sponsor-card .eyebrow { font-size: 11px; margin-bottom: 2px; }
.sponsor-card .name { font-weight: 620; }
.sponsor-card .role { color: var(--ink-2); font-size: 13.5px; }
/* The booking line can be long ("Book calls with Naomi through the course team"): it wraps, never widens the page. */
.sponsor-card .badge { margin-top: 6px; border-radius: 10px; align-items: baseline; line-height: 1.35; }
.sponsor-card .badge.human::before { flex: none; transform: translateY(-1px); }
/* An AI sponsor: Message her (or Call or message) from Home. The label wraps rather than widen the card. */
.sponsor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; }
.sponsor-actions .btn {
  max-width: 100%; white-space: normal; text-align: left; height: auto; min-height: 32px; padding-top: 5px; padding-bottom: 5px;
}
.sponsor-away { color: var(--warn); font-size: 12.5px; font-weight: 560; }
.sponsor-wait { flex-basis: 100%; color: var(--ink-3); font-size: 12.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge.human::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
/* "AI" after an AI character's name, wherever it heads a card, a chat or a call: small and quiet, never louder
   than the name, and never split across lines. */
.ai-mark {
  position: relative; /* holds its text alternative, which is visually hidden */
  display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 5px; vertical-align: 2px;
  font: 650 10px/1.3 var(--sans); letter-spacing: .06em; color: var(--ink-3); white-space: nowrap;
  border: 1px solid var(--line-strong); cursor: default;
}
.call-name .ai-mark { font-size: 11px; vertical-align: 5px; }
/* The AI sponsor's own conversations, wherever staff read them. */
.badge.sponsor {
  color: var(--accent-soft-ink); background: var(--accent-soft); white-space: nowrap;
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 24px;
  border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--ink); font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
/* A capstone page's notices stand under its band and opening paragraph, before its first section. */
.house-main > .notice { margin: 24px 0 0; }
.notice code { font-family: var(--mono); font-size: 12.5px; background: color-mix(in srgb, var(--surface) 70%, transparent); padding: 1px 6px; border-radius: 6px; }


.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 32px; }
/* The course site's white card (its day and door cards): radius 18, a line and its soft shadow. A card that is
   itself a link or a button lifts on hover, as the course's doors do. */
.card {
  display: flex; flex-direction: column; gap: 14px; padding: 22px 24px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: box-shadow .2s, transform .15s, border-color .15s;
  animation: rise .4s cubic-bezier(.2,.7,.2,1) both;
}
/* Only where there's a real pointer: on a phone a tap leaves :hover stuck and the card stays lifted. */
@media (hover: hover) {
  :is(a, button).card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
}
.card-head { display: flex; gap: 12px; align-items: center; }
.card-head .name { font-weight: 640; font-size: 16px; letter-spacing: -0.005em; }
.card-head .role { color: var(--ink-2); font-size: 13.5px; }
/* The remit, then what the person knows and can supply: together they fill the card, so the buttons line up. */
.card-text { flex: 1; display: grid; align-content: start; gap: 8px; }
.card .remit { color: var(--ink-2); font-size: 14px; }
.card .about { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.card .wait { color: var(--ink-3); font-size: 12.5px; }
.card .avail { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.card .avail svg { width: 14px; height: 14px; }
.card .avail.away { color: var(--warn); font-weight: 560; }
/* The AI sponsor, first on the page: a touch of the brand on her card, and "Your sponsor" over her name. */
/* Someone with no voice: one Message button, and this line instead of a Call button. */
.card .only { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; font-weight: 560; }
.card .only svg { width: 14px; height: 14px; }
.card.locked { background: var(--surface-2); }
.card.locked .avatar { filter: grayscale(.8); opacity: .7; }
.card.open { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.card .avail.open { color: var(--ok); font-weight: 600; }
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { flex: 1; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.avatar {
  --h: 180;
  position: relative; overflow: hidden;
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: oklch(var(--avatar-l) var(--avatar-c) var(--h));
  color: oklch(var(--avatar-ink-l) calc(var(--avatar-c) * 1.6) var(--h));
  font-weight: 650; font-size: 15px; letter-spacing: .02em; user-select: none;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-head .avatar { width: 72px; height: 72px; font-size: 23px; }
.sponsor-card .avatar { width: 60px; height: 60px; font-size: 20px; }
.avatar.small { width: 30px; height: 30px; font-size: 12px; }
.avatar.xl { width: 128px; height: 128px; font-size: 40px; font-family: var(--serif); font-weight: 600; }

/* ---------- conversation ---------- */

/* A call, a chat and a thread stand in the house look's frame (portal/house.css), under its bar with the breadcrumb
   (57 px with its margin), in the main column; their heights below leave room for that bar. */

/* A call: just the person, the status and the controls. */
.phone {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 48px 24px 36px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: min(620px, calc(100vh - 227px)); justify-content: center;
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--brand-a) 12%, transparent), transparent 70%),
    var(--surface-2);
}
.call-after { display: grid; gap: 10px; justify-items: center; margin-top: 22px; max-width: 44ch; }
.call-outcome { font-weight: 600; }
.call-next { color: var(--ink-2); font-size: 14px; }
.call-next:empty { display: none; }
.call-after-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
/* Under the role: how to show the colleague your work, and whether the call is written down. */
.call-line { color: var(--ink-2); font-size: 13.5px; max-width: 44ch; }
.call-role + .call-line { margin-top: 8px; }

.orb { --level: 0; position: relative; width: 200px; height: 200px; display: grid; place-items: center; margin-bottom: 18px; }
.orb .avatar { position: relative; z-index: 2; box-shadow: 0 10px 30px -10px rgb(0 0 0 / 35%); }
.orb .ring {
  position: absolute; inset: 36px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--brand-b) 55%, transparent);
  opacity: 0; transition: opacity .3s, border-color .3s;
}
.orb .r1 { transform: scale(calc(1.08 + var(--level) * 0.28)); }
.orb .r2 { transform: scale(calc(1.18 + var(--level) * 0.55)); border-width: 1px; border-color: color-mix(in srgb, var(--brand-a) 70%, transparent); }
.orb[data-mode="speaking"] .ring { opacity: 1; }
.orb[data-mode="listening"] .ring { opacity: .55; border-color: color-mix(in srgb, var(--ink-3) 45%, transparent); }
.orb[data-mode="connecting"] .r1 { opacity: 1; animation: pulse 1.4s ease-in-out infinite; }
.orb[data-mode="thinking"] .r1 { opacity: 1; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1.05); opacity: .2; } 50% { transform: scale(1.25); opacity: .9; } }

.call-name { font-family: var(--serif); font-size: 30px; font-weight: 400; line-height: 1.15; letter-spacing: -0.02em; }
.call-role { color: var(--ink-2); font-size: 14px; }
.call-config { color: var(--ink-3); font-size: 12.5px; }
.call-status { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; font-weight: 560; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.busy { background: var(--warn); animation: blink 1s infinite; }
.dot.off { background: var(--ink-3); }
@keyframes blink { 50% { opacity: .35; } }
.call-timer { font-family: var(--mono); font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.call-controls { display: flex; gap: 14px; margin-top: 22px; align-items: center; }
.call-controls .caption { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.call-controls .ctl { display: flex; flex-direction: column; align-items: center; }

/* A chat: a messaging window. */
.chat {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); min-height: min(640px, calc(100vh - 177px));
}
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.chat-head .icon-btn { font-size: 18px; }
.chat-who { flex: 1; min-width: 0; }
.chat-who .name { font-weight: 640; }
.chat-status { font-size: 12.5px; color: var(--ink-3); }
.chat-config { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-closed {
  display: grid; gap: 10px; justify-items: center; text-align: center; padding: 16px;
  border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px;
}
.chat-closed p:empty { display: none; }

.transcript {
  list-style: none; margin: 0; padding: 22px; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; flex: 1; min-height: 260px; max-height: calc(100vh - 317px);
}
.transcript .empty { margin: auto; color: var(--ink-3); text-align: center; max-width: 36ch; font-size: 14px; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 62ch); animation: rise .25s ease both; }
.msg .bubble { padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.agent { align-self: flex-start; }
.msg.agent .bubble { background: var(--surface-2); border-top-left-radius: 6px; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.user .bubble { background: var(--primary); color: var(--primary-ink); border-top-right-radius: 6px; }
.msg.system { align-self: center; max-width: 100%; }
.msg.system .bubble { background: transparent; color: var(--ink-3); font-size: 13px; padding: 4px 8px; text-align: center; }
.msg-note { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
/* A message whose reply never arrived: kept, marked, and offered again. */
.msg.user.failed .bubble { background: color-mix(in srgb, var(--primary) 72%, var(--surface)); }
.msg-note.failed { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px 8px; color: var(--warn); font-weight: 600; }
.msg-note.failed svg { width: 13px; height: 13px; flex: none; }
.msg-again {
  border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 620;
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.msg-again:hover { color: var(--accent-hover); }
.msg-again:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.msg-again[disabled] { opacity: .5; cursor: default; }
.msg-cut { color: var(--ink-3); font-style: italic; font-size: .92em; }
.msg.settled, .transcript .file-card.settled { animation: none; } /* shown once; not again on return */
.msg.system.check .bubble { max-width: 46ch; text-align: center; }
.msg.streaming .bubble::after {
  content: ""; display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px;
  background: currentColor; opacity: .5; animation: blink .9s steps(2) infinite;
}
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 160px; padding: 9px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font: inherit; line-height: 1.45;
}
.composer textarea:focus { outline: 2px solid var(--focus); border-color: transparent; }
.composer-hint { margin-top: -6px; padding: 0 16px 12px; color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
/* Outside the phone layout the transcript's height is set against the window: the line under the composer takes its
   room from the transcript, so the chat still fits without scrolling the page. */
@media (min-width: 641px) and (min-height: 501px) {
  .chat:has(.composer-hint:not([hidden])) .transcript { max-height: calc(100vh - 367px); }
}

/* ---------- the thread with one person ---------- */

/* A line about the thread or one conversation in it, and the divider above each conversation and above a new chat. */
.thread-note { align-self: center; max-width: 52ch; text-align: center; color: var(--ink-3); font-size: 13px; }
.thread-note.intro { margin-bottom: 4px; }
.thread-divider {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--ink-3); font-size: 12.5px; font-weight: 560;
}
.thread-divider::before, .thread-divider::after { content: ""; flex: 1; min-width: 16px; height: 1px; background: var(--line); }
.thread-divider span { max-width: 52ch; text-align: center; }
.thread-divider.new { color: var(--ink-2); font-weight: 650; }
.transcript .earlier ~ .empty { margin: 8px auto 0; }
.thread-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.thread-actions[hidden] { display: none; }

/* ---------- documents colleagues send ---------- */

.file-stack { display: grid; gap: 8px; }
.file-card {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; text-align: left;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.file-card.fresh { animation: rise .35s cubic-bezier(.2,.7,.2,1) both, glow 2.4s ease-out both; }
@keyframes glow { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-a) 45%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }
.file-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.file-icon svg { width: 18px; height: 18px; }
.file-meta { display: grid; gap: 2px; min-width: 0; }
.file-meta strong { font-weight: 620; font-size: 14.5px; }
.file-meta > small { color: var(--ink-3); font-size: 12.5px; }
.file-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
/* A file to read or download: the house look's pill (portal/house.css), filled for the download of them all. */
.file-link { max-width: 100%; }
.file-link svg { width: 14px; height: 14px; flex: none; }
.file-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-link small { color: inherit; opacity: .75; font-weight: 500; white-space: nowrap; }
.file-more { width: 100%; }
.file-more summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); margin: 4px 0; list-style: none; }
.file-more summary::-webkit-details-marker { display: none; }
.file-more summary::before { content: "▸ "; }
.file-more[open] summary::before { content: "▾ "; }
.shared { width: min(460px, 100%); margin-top: 22px; display: grid; gap: 8px; }
.shared-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; text-align: left; }
/* A document a colleague sent, shown in the chat. Not `.attachment`: that's the composer's file chip. */
.msg.sent-doc { max-width: min(88%, 480px); }
.file-stack.received { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.file-stack.received:empty { display: none; }
.note-sent { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--ink-2); }
.note-sent svg { width: 14px; height: 14px; flex: none; margin-top: 3px; }

/* ---------- your conversations ---------- */

/* Under Your conversations: Reset availability (staff only), on a line of its own. */
.work > .link-btn { display: block; margin: 0 0 16px; }
.link-btn {
  margin-left: auto; border: 0; background: none; padding: 2px 0; cursor: pointer;
  color: var(--accent); font-size: 13.5px; font-weight: 560; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent-hover); }
/* The conversations in the house look's table box (.table-wrap): a rounded box of ruled rows. */
.work-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.work-list:empty { display: none; }
/* Who, then when and how it went, then what can be done with it: read a chat, or go back to the open one. */
.work-item {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1.5fr) auto; gap: 4px 12px; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px; min-height: 56px;
}
.work-item:first-child { border-top: 0; }
.work-item.open { background: color-mix(in srgb, var(--ok) 6%, var(--surface)); }
.work-who { display: flex; flex-direction: column; min-width: 0; }
.work-who strong { font-weight: 620; }
.work-who small { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Plain flowing text, so on a phone it wraps between words, never before a "·". */
.work-meta { display: block; min-width: 0; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.work-meta svg { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 6px; color: var(--ink-3); }
.work-meta > span + span { margin-left: 4px; }
.work-end.them { color: var(--warn); font-weight: 560; }
.open-now { color: var(--ok); font-weight: 650; white-space: nowrap; }
.work-action { display: flex; justify-content: flex-end; }

/* ---------- sponsor page (staff only) ---------- */

/* minmax(0, 1fr): a wide line inside a card (a row of badges, a long transcript line) must not
   push the card past the edge of a phone screen. */
.sponsor-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.sponsor-session { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sponsor-session > header { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.sponsor-session > header .badge.staff { align-self: center; color: var(--warn); background: var(--warn-soft); font-size: 12px; }
.sponsor-session h2 { font-size: 18px; font-weight: 650; }
.sponsor-session > header span { color: var(--ink-3); font-size: 13.5px; }
.note-card {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
/* The name and details take the room they need; the verdicts sit beside them when there's space
   and move underneath, together, when there isn't. */
.note-head { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.note-who { display: flex; flex-direction: column; flex: 1 1 14rem; min-width: 0; }
.note-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; }
.note-who small { color: var(--ink-3); font-size: 12.5px; }
.note-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.note-badges .badge, .tl-head .badge, .relation-head .badge { white-space: nowrap; }
.note-text {
  margin: 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong);
  font-family: var(--serif); font-size: 16px; line-height: 1.55; white-space: pre-wrap;
}
.note-pending { color: var(--ink-3); font-size: 14px; font-style: italic; }
.badge.handling.well { color: var(--ok); }
.badge.handling.mixed { color: var(--warn); }
.badge.handling.poorly { color: var(--danger); }
.badge.handling.unclear { color: var(--ink-2); font-weight: 560; }
/* Replies that failed: the app's fault, shown so nobody reads the gaps as the learner's. */
.badge.failures { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.failures svg { width: 12px; height: 12px; flex: none; }
.standing-note, .admin-intro .standing-note {
  flex: 1 1 100%; display: flex; align-items: flex-start; gap: 8px; color: var(--ink-2) !important; font-size: 13.5px;
  padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
}
.standing-note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--ink-3); }
.evidence { display: grid; gap: 4px; }
.evidence-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; }
.evidence ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.evidence li { font-size: 13px; color: var(--ink-2); padding-left: 10px; border-left: 2px solid var(--line-strong); overflow-wrap: anywhere; }
.badge.manners.courteous { color: var(--ok); }
.badge.manners.curt { color: var(--warn); }
.badge.manners.rude { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* A note's chips, under "Subjects raised" and "Flags". */
.chip-group { display: grid; gap: 4px; min-width: 0; }
.chip-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip.flag { background: var(--warn-soft); color: var(--ink); }
.note-card .link-btn { margin-left: 0; justify-self: start; }
.sponsor-transcript {
  list-style: none; margin: 0; padding: 12px 14px; display: grid; gap: 6px; font-size: 13.5px;
  background: var(--surface-2); border-radius: var(--radius-sm); color: var(--ink-2); overflow-wrap: anywhere;
}
/* The server's own lines: what happened, not what anyone said. */
.sponsor-transcript li.aside { color: var(--ink-3); font-style: italic; }
.sponsor-transcript li.tech { padding-left: 8px; border-left: 2px solid color-mix(in srgb, var(--warn) 60%, transparent); }
.empty-note { color: var(--ink-3); }

/* ---------- contact history on a card ---------- */

.card-meta { display: grid; gap: 4px; }
.card .spoken { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12.5px; }
.card .spoken svg { width: 13px; height: 13px; }

/* ---------- showing a colleague your work ---------- */

.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.attachments {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 0; border-top: 1px solid var(--line);
}
.attachment {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  max-width: 260px; padding: 6px 6px 6px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.attachment img, .attachment-icon {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2);
}
.attachment-icon svg { width: 18px; height: 18px; }
.attachment-name { display: grid; min-width: 0; font-size: 13px; }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-name small { color: var(--ink-3); font-size: 11.5px; }
.attachment.uploading { opacity: .7; }
.attachment.uploading img { animation: blink 1s infinite; }
.attachment-remove {
  width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-3); cursor: pointer;
}
.attachment-remove:hover { background: var(--surface-2); color: var(--ink); }
.attachment-remove svg { width: 14px; height: 14px; }
.chat.dropping { outline: 2px dashed var(--line-strong); outline-offset: -8px; }
.chat.dropping .transcript { background: color-mix(in srgb, var(--brand-a) 6%, transparent); }
.shown { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.shown-image {
  max-width: 220px; max-height: 160px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover;
  background: var(--surface-2);
}
.shown-file {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px;
}
.shown-file svg { width: 14px; height: 14px; }

/* ---------- sponsor page tabs, relationships and timelines (staff only) ---------- */

/* A row of tabs: the house look's pills (portal/house.css), the current one filled. */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.badge.rapport { gap: 4px; }
.badge.rapport.r-2 { color: var(--danger); }
.badge.rapport.r-1 { color: var(--warn); }
.badge.rapport.r0 { color: var(--ink-2); }
.badge.rapport.r1, .badge.rapport.r2 { color: var(--ok); }
.rapport-arrow { font-size: 9px; }
.rapport-arrow.same { display: none; }

.note-shown { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.promises li { display: flex; gap: 8px; align-items: baseline; color: var(--ink); }
.promises li::before { content: "○"; color: var(--warn); flex: none; }
.promises li.kept::before { content: "✓"; color: var(--ok); }
.promises li.dropped { color: var(--ink-3); text-decoration: line-through; }
.promises li.dropped::before { content: "✕"; color: var(--ink-3); }
.promises small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.learner {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.learner-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.learner-head h2 { font-size: 20px; font-weight: 650; font-family: var(--serif); }
.learner-head > span { color: var(--ink-3); font-size: 13.5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.stat {
  display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--line);
}
.stat strong { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat span { color: var(--ink-3); font-size: 12.5px; }
.relations { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.relation {
  display: grid; gap: 8px; align-content: start; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg);
}
.relation-head { display: flex; align-items: center; gap: 10px; }
.relation-who { display: grid; flex: 1; min-width: 0; }
.relation-who small { color: var(--ink-3); font-size: 12px; }
.relation-memory {
  margin: 0; padding-left: 10px; border-left: 2px solid var(--line-strong); color: var(--ink-2);
  font-family: var(--serif); font-size: 14.5px; line-height: 1.5;
}
.trail { display: flex; gap: 4px; align-items: center; }
.pip { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.pip.r-2 { background: var(--danger); }
.pip.r-1 { background: var(--warn); }
.pip.r1 { background: color-mix(in srgb, var(--ok) 60%, var(--surface)); }
.pip.r2 { background: var(--ok); }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tl-item {
  display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; position: relative; padding: 12px 0;
  border-top: 1px solid var(--line);
}
.tl-time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-top: 6px; }
.tl-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-kind { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.tl-kind svg { width: 13px; height: 13px; }
.tl-item.hung-up .tl-kind { color: var(--warn); }
.tl-note { color: var(--ink-2); font-size: 14px; }
.tl-body .link-btn { margin-left: 0; justify-self: start; }
.tl-told { color: var(--ink-2); font-size: 13.5px; }
.known-line { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.chip.doc { display: inline-flex; align-items: center; gap: 4px; }
.chip.doc svg { width: 12px; height: 12px; }

/* ---------- documents (the reader, Start here, the records' notes) ---------- */

/* A document in the reader sits in the house look's frame (portal/house.css); its title is the light serif. */
.md { font-size: 15.5px; line-height: 1.65; color: var(--ink); }
.md h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 4vw, 38px); line-height: 1.15; margin: 8px 0 18px; letter-spacing: -0.02em; }
.md h3 { font-size: 20px; margin: 30px 0 10px; letter-spacing: -0.01em; }
.md h4, .md h5 { font-size: 16px; margin: 22px 0 8px; }
.md p { margin: 0 0 14px; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 6px; }
.md code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.md pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; margin: 0 0 16px; }
.md pre code { background: none; padding: 0; font-size: 13px; }
.md blockquote { margin: 0 0 14px; padding-left: 14px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.md a { color: var(--accent); }
.md .md-ref { border-bottom: 1px dotted var(--ink-3); }
.md > :last-child { margin-bottom: 0; }
/* A document's table: the house look's table (.admin-table), a rounded box with a header band in small capitals. */
.md-table { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { text-align: left; vertical-align: top; padding: 9px 12px; border-top: 1px solid var(--line); }
.md thead th { border-top: 0; background: var(--surface-2); font-size: 12px; font-weight: 750; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-2); }
.md th.right, .md td.right { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- shared bits for the new pages ---------- */

.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;
}
.muted { color: var(--ink-3); }
/* A small action: the course's day-link pill. */
.btn.small { height: 32px; padding: 0 13px; border-radius: 999px; font-size: 13.5px; gap: 6px; }
.btn.small svg { width: 14px; height: 14px; }
/* Fields: the course site's boxed control (its contents box on a phone), radius 12 on the surface. */
.select, .input {
  height: 40px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: 0 12px; font: inherit; font-size: 15px; min-width: 0;
}
.input { padding: 0 12px; }
.select.small { height: 32px; font-size: 13px; padding: 0 8px; }
textarea.input { height: auto; min-height: 96px; padding: 9px 12px; line-height: 1.45; resize: vertical; }
input[type="file"].input { height: auto; padding: 6px 8px; }
.select:focus-visible, .input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.notice.calm { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.empty-box {
  padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  color: var(--ink-3); font-size: 14px;
}
.status-chip {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.status-chip.requested { background: var(--warn-soft); color: var(--warn); }
.status-chip.released { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.status-chip.declined { background: color-mix(in srgb, var(--danger) 11%, transparent); color: var(--danger); }

/* ---------- home ---------- */

/* Home's sections are the house look's (portal/house.css): This week, the inbox and Start here. */

/* This week: the deadlines, with the cohort's links where they're set, in a house card (.card). */
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.week-list li { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 2px 16px; align-items: baseline; font-size: 15px; }
.week-when { color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.week-what { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.week-what > span { font-weight: 560; }
.week-what .btn, .week-links .btn { max-width: 100%; white-space: normal; text-align: left; height: auto; min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
.week-what .btn svg, .week-links .btn svg { width: 13px; height: 13px; }
.week-plain { color: var(--ink-3); font-size: 12.5px; margin-top: -4px; }
.week-foot { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.week-foot .week-plain { margin-top: 0; }
.week-links { display: flex; flex-wrap: wrap; gap: 8px; }
/* The ways on to Colleagues and Materials, after the last section: the portal's cards (portal/portal.css). */
.home-links { margin-top: 54px; }

/* The sponsor's messages: one line each, opening to the text and its attachments. */
.messages { display: grid; gap: 8px; }
.message { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.message > summary {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 1px; align-items: baseline;
  padding: 11px 14px; cursor: pointer; list-style: none; border-radius: var(--radius-sm);
}
.message > summary::-webkit-details-marker { display: none; }
.message > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.message-dot { grid-row: 1 / span 2; align-self: center; width: 8px; height: 8px; border-radius: 50%; }
.message.unread .message-dot { background: var(--brand-b); }
.message-from { grid-column: 2; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-date { grid-column: 3; grid-row: 1; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.message-subject { grid-column: 2 / 4; font-weight: 560; display: flex; align-items: center; gap: 6px; }
.message.unread .message-subject { font-weight: 700; }
.message-clip { display: inline-grid; color: var(--ink-3); }
.message-clip svg { width: 13px; height: 13px; }
.message[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.message-body {
  padding: 14px 16px 14px 32px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.6;
}
/* The memo: Markdown, drawn as the documents are, at the size of a message. */
.message-body.md { white-space: normal; font-size: 14.5px; line-height: 1.6; }
.message-body.md h2, .message-body.md h3, .message-body.md h4, .message-body.md h5 {
  font-family: var(--sans); font-size: 15.5px; letter-spacing: 0; margin: 16px 0 6px;
}
.message-body.md > :first-child { margin-top: 0; }
.message-files { padding: 0 16px 14px 32px; margin-top: 0; }
.messages > .file-links { margin-top: 2px; }
.messages > .rehearse { justify-self: start; margin-left: 0; }
/* The course team's notice, above the grid: a small heading over plain paragraphs. */
.home-notice { flex-direction: column; align-items: stretch; gap: 6px; }
.home-notice h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; }
.home-notice-text { display: grid; gap: 8px; white-space: pre-line; overflow-wrap: anywhere; }
/* Before you submit: the checks as the course's reading list, then the form in a house card (.card). */
.submission-checks ul { max-width: 44rem; margin: 0 0 16px; padding-left: 22px; }
.submission-checks li + li { margin-top: 6px; }
.submit-form { margin-top: 28px; }

/* ---------- materials ---------- */

/* The documents, each a house card (.card) with its title in the card's serif. */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card.doc-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-content: start; }
.doc-meta { display: grid; gap: 6px; min-width: 0; }
.doc-meta small { color: var(--ink-2); font-size: 14.5px; line-height: 1.5; }
.doc-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* The client's records: a house card (.card) with the download beside the name. */
.card.records-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px 14px; align-items: center; }
.records-card .file-meta strong { font-size: 16px; }
.records-about { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; }
.records-about summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); font-weight: 560; }
.records-about .md { margin-top: 10px; font-size: 14.5px; }
.records-about .md h2 { font-family: var(--sans); font-size: 17px; margin: 4px 0 8px; letter-spacing: -0.01em; }
.records-about .md h3 { font-size: 15px; margin: 16px 0 6px; }

/* Item, records, held by; a fourth column, for Ask, only with a staff sponsor. The house look's table (.admin-table):
   a rounded box with a header band in small capitals. */
.cat-label { margin: 32px 0 12px; }
.catalogue { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.cat-row {
  display: grid; grid-template-columns: 52px minmax(0, 1.6fr) minmax(0, 1fr); gap: 6px 14px; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px;
}
.catalogue.asking .cat-row { grid-template-columns: 52px minmax(0, 1.4fr) minmax(0, 0.9fr) minmax(180px, 1fr); }
/* "Held by" is the column's heading on a wide screen, and said in the row on a phone. */
.cat-held-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.cat-earlier { margin: 4px 0 0 8px; vertical-align: middle; }
/* How a learner came to know a row, in a catalogue that grows; and, for staff, what learners see of it. */
.cat-known { display: block; margin-top: 2px; color: var(--ink-3); font-size: 12.5px; }
.cat-note { margin: -4px 0 10px; }
.cat-row:first-child { border-top: 0; }
.cat-row.cat-head {
  font-size: 12px; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-2); font-weight: 750;
  background: var(--surface-2); padding-top: 11px; padding-bottom: 11px;
}
.cat-id { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cat-held { color: var(--ink-2); }
.cat-action { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; }
.cat-reply { flex-basis: 100%; text-align: right; font-size: 12.5px; color: var(--ink-2); }

/* ---------- admin (staff only) ---------- */

/* The title, then the project the notes, downloads and "view as learner" use. */
/* Under the band: the project (its label in the house look's small capitals, its choice as pills) and the tabs. */
.admin-project { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 28px 0 0; }
.admin-tabs { margin: 20px 0 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button { white-space: nowrap; display: inline-flex; align-items: center; }
.admin-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 24px; }
/* Each tab's heading and its sections are the house look's numbered sections (portal/house.css). */
.admin-intro > .btn { margin: 0 0 12px; }
.admin-toggle { margin-left: auto; color: var(--ink-2); }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.admin-toolbar .field { font-size: 14px; font-weight: 600; }
/* A filter's menu is never wider than the window: on a phone it takes the row and its longest option is cut (K6). */
.admin-toolbar .field { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0;
  max-width: 100%; }
.admin-toolbar .select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
/* A toolbar's small buttons are the house controls' size, as on every row (the look check's small finding 7). */
.admin-toolbar .btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
@media (max-width: 640px) {
  .admin-toolbar .field { flex: 1 1 100%; }
  .admin-toolbar .field .select { flex: 1 1 auto; width: 100%; }
}
.field-note { flex-basis: 100%; color: var(--ink-3); font-size: 13px; }
.admin-card {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  padding: 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.admin-card > div { flex: 1 1 320px; min-width: 0; }
.admin-card strong { font-weight: 640; font-size: 15.5px; }
.admin-card p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.settings-summary { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px !important; color: var(--ink-3) !important; font-size: 13px !important; }

/* A cohort setting (the sponsor, how learners reach people, call transcripts): its choices, each saying what it
   means for learners, and Save. */
.setting-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: stretch; }
.mode-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.mode-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 4px; align-content: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.mode-option:hover { border-color: var(--line-strong); }
.mode-option:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
.mode-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.mode-option:has(input:disabled) { cursor: not-allowed; opacity: .6; }
.mode-option input { grid-row: span 2; margin: 3px 0 0; accent-color: var(--primary); }
.mode-name { font-weight: 620; font-size: 14.5px; }
.mode-desc { grid-column: 2; color: var(--ink-2); font-size: 13px; line-height: 1.45; }

/* Course links: four addresses and Save. */
.links-form { display: grid; gap: 14px; align-items: stretch; }
.links-form > div { flex: none; }
.links-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 640px) { .links-fields { grid-template-columns: minmax(0, 1fr); } }
.links-field { display: grid; gap: 4px; min-width: 0; }
.links-field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.links-field .input { width: 100%; }
.links-field small { color: var(--ink-3); font-size: 12px; }
.links-actions { display: flex; justify-content: flex-end; }
.form-error {
  color: var(--danger) !important; font-size: 13.5px !important; padding: 8px 12px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 9%, transparent); overflow-wrap: anywhere;
}

/* The course site's table: a rounded box with a header band in small capitals, the cells in the secondary ink. A
   heading wraps between its words, so that a long heading over a short value does not widen its column (K1). A
   table wider than its column still scrolls inside its box, as the portal's wide ones do. */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.admin-table th {
  text-align: left; padding: 11px 16px; background: var(--surface-2);
  font-size: 12px; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-2); font-weight: 750;
}
.admin-table td { padding: 11px 16px; border-top: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.admin-table td:first-child { color: var(--ink); }
.admin-table .cell-name { min-width: 9rem; }
.admin-table .cell-name strong { font-weight: 620; }
.admin-table .cell-name small { display: block; color: var(--ink-3); font-size: 12px; }
.admin-table .num { font-variant-numeric: tabular-nums; }
.admin-table .row-actions { text-align: right; }
.admin-table .row-actions .link-btn { display: block; margin: 2px 0 2px auto; white-space: nowrap; }
.admin-table tr.learner-detail > td { border-top: 0; padding: 0 12px 16px; }
.learner-detail .learner { background: var(--bg); }

.request-list { display: grid; gap: 10px; }
.request-card {
  display: grid; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.request-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.request-head strong { font-weight: 640; }
.request-head small { color: var(--ink-3); font-size: 12.5px; margin-left: auto; }
.request-item { font-size: 14.5px; }
.request-note {
  margin: 0; padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--ink-2);
  font-family: var(--serif); font-size: 15px; overflow-wrap: anywhere;
}
.request-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.request-actions .input { flex: 1 1 240px; height: 32px; font-size: 13.5px; }

.history { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.history li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px;
}
.history li:first-child { border-top: 0; }
.history-main small { color: var(--ink-3); font-size: 12.5px; }
.history-side { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.history-side small { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.history-reply { grid-column: 1 / -1; color: var(--ink-2); font-size: 13.5px; overflow-wrap: anywhere; }

.download-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
/* minmax(0, 1fr): a long item's name shortens with an ellipsis instead of widening the card on a phone. */
.download-card {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.download-who { display: grid; }
.download-who strong { font-weight: 640; }
.download-who small { color: var(--ink-3); font-size: 13px; }
.download-card .file-links { margin-top: 0; }
/* The sponsor's own items, for staff, under the project's files. */
.download-sub {
  padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650;
}
.download-items { min-width: 0; }
.download-items .muted { font-size: 13px; }
/* A line that belongs under its heading, not beside it. */

/* ---------- submitting your work ---------- */

/* The form is a course-links card (.links-form); the list below it and Admin's list share one table. */
.submit-also a { overflow-wrap: anywhere; }
/* The long parts (a file's name, a link, a note) wrap rather than widen the table. */
.submit-table td { vertical-align: top; }
.submit-table td > small { display: block; color: var(--ink-3); font-size: 12px; }
.submit-table a:not(.file-link) { color: var(--accent); }
.submit-table .file-link { margin-top: 6px; }
.submit-file { display: block; font-weight: 560; overflow-wrap: anywhere; }
.submit-link { overflow-wrap: anywhere; }
.submit-table .cell-note { max-width: 30rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.hash { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.hash-copy { margin-left: 8px; }

/* ---------- confirm ---------- */

.confirm {
  width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift);
}
.confirm::backdrop { background: rgb(20 18 15 / 38%); }
.confirm h2 { font-size: 18px; font-weight: 650; }
.confirm p { color: var(--ink-2); margin-top: 8px; font-size: 14px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.confirm label { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.confirm textarea {
  display: block; width: 100%; min-height: 84px; resize: vertical; padding: 9px 12px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.45;
}
.confirm textarea:focus { outline: 2px solid var(--focus); border-color: transparent; }

/* ---------- experiment settings (local app only) ---------- */

.lab {
  width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lift);
}
.lab::backdrop { background: rgb(20 18 15 / 38%); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.lab[open] { animation: rise .2s ease both; }
.lab-form { display: flex; flex-direction: column; }
.lab-head {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1; background: var(--surface);
}
.lab-head h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.lab-head p { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.lab-head .icon-btn { flex: none; }
.lab-section { padding: 16px 22px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.lab-section h3 { margin: 0; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; }
.lab-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
.lab-row label, .lab-wide { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.lab select {
  height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink);
  padding: 0 10px; font: inherit; font-size: 14px; font-weight: 400; min-width: 0; width: 100%;
}
.lab select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.lab select:disabled { opacity: .55; }
.lab-note { font-size: 12.5px; color: var(--ink-3); }

.lab-profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.lab-profile {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: start; align-content: start; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  transition: border-color .15s, background .15s;
}
.lab-profile:hover { border-color: var(--line-strong); }
.lab-profile:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
.lab-profile:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.lab-profile input { grid-row: span 2; margin: 3px 0 0; accent-color: var(--primary); }
.lab-profile-name { font-weight: 620; font-size: 14px; }
.lab-profile-desc { grid-column: 2; font-size: 12.5px; color: var(--ink-2); }
.lab-profile.unavailable { cursor: not-allowed; opacity: .55; }

.lab-delivery { display: grid; gap: 8px; margin-top: 4px; }
.lab-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.lab-check input { accent-color: var(--primary); }
.lab-check:has(input:disabled) { cursor: not-allowed; color: var(--ink-3); }
.lab-range { display: grid; grid-template-columns: 80px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.lab-range input { accent-color: var(--primary); width: 100%; }
.lab-range input:disabled { opacity: .45; }
.lab-range output { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }

.lab-foot {
  display: flex; justify-content: space-between; gap: 12px; padding: 14px 22px 18px;
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); margin-top: -1px;
}

/* ---------- toast ---------- */

/* Centred with auto margins, not a transform, so it can use the full width less the gutters. */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: 24px; margin-inline: auto; width: fit-content; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow-lift); max-width: 560px;
  animation: rise .25s ease both;
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  /* The learner table becomes one card per person. */
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table td { display: block; }
  .admin-table tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px;
    padding: 14px 16px; border-top: 1px solid var(--line);
  }
  .admin-table tbody tr:first-child { border-top: 0; }
  .admin-table td { padding: 0; border: 0; min-width: 0; }
  .admin-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650;
  }
  .admin-table .cell-name, .admin-table .row-actions { grid-column: 1 / -1; }
  .admin-table .row-actions { text-align: left; white-space: normal; display: flex; flex-wrap: wrap; gap: 6px 18px; }
  .admin-table .row-actions .link-btn { margin-left: 0; }
  .admin-table .select.small { width: 100%; }
  .admin-table tr.learner-detail { display: block; padding: 0 12px 14px; border-top: 0; }
  .admin-table tr.learner-detail > td { padding: 0; }
  .admin-table .cell-wide { grid-column: 1 / -1; }
  .submit-table .cell-note { max-width: none; }
  .orb { width: 150px; height: 150px; margin-bottom: 8px; }
  .avatar.small { width: 30px; height: 30px; font-size: 12px; }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; }
  .transcript { max-height: calc(100vh - 287px); }
}
@media (max-width: 640px) {
  .wrap { padding: 20px 16px 36px; }
  /* One slim row, so the sticky bar doesn't take a fifth of a phone screen: the mark, the nav
     filling the middle (icons over short labels), then sign-out. The name is on the sign-out button. */
  .topbar-inner { padding: 6px 10px 6px 16px; gap: 10px; }
  .nav { flex: 1; }
  .nav button { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 1px; padding: 4px 1px; font-size: 11px; letter-spacing: -0.01em; }
  .nav-icon svg { width: 18px; height: 18px; }
  .nav-label { max-width: 100%; }
  .nav-dot { top: 4px; left: calc(50% + 6px); }
  .nav-count { position: absolute; top: 1px; left: calc(50% + 4px); min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  .me { flex: none; gap: 2px; margin-left: 0; }
  .me-name { display: none; }
  .switch { flex: 1 1 100%; min-width: 0; }
  .switch button { flex: 1; justify-content: center; padding: 6px 8px; }
  .switch button small { display: none; }
  .cast-grid { grid-template-columns: 1fr; }
  .message-body, .message-files { padding-left: 16px; }
  .records-card { grid-template-columns: auto minmax(0, 1fr); }
  .records-card > .btn { grid-column: 1 / -1; }
  .cat-row, .catalogue.asking .cat-row { grid-template-columns: 44px minmax(0, 1fr); gap: 4px 10px; padding: 12px 14px; align-items: baseline; }
  .cat-row.cat-head { display: none; }
  .cat-row:nth-child(2) { border-top: 0; }
  .cat-held, .cat-action { grid-column: 2; }
  .cat-held { font-size: 13px; color: var(--ink-3); }
  .cat-held-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
  .cat-earlier { margin-left: 0; }
  .cat-action { justify-content: flex-start; margin-top: 4px; }
  .cat-reply { text-align: left; }
  .admin-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history li { grid-template-columns: minmax(0, 1fr); }
  .history-side { justify-content: flex-start; }
  .admin-toggle { margin-left: 0; }
  .admin-tabs { display: flex; }
  .admin-tabs button { flex: 1 1 auto; justify-content: center; padding: 6px 5px; font-size: 12.5px; }
  .tab-count { margin-left: 4px; }
  .request-head small { margin-left: 0; }
  .msg { max-width: 88%; }
  .file-stack.received { grid-template-columns: 1fr; }
  .work-item { grid-template-columns: 30px minmax(0, 1fr) auto; row-gap: 2px; padding: 10px 14px; }
  .work-item .avatar { grid-row: 1 / span 2; align-self: start; margin-top: 2px; }
  .work-item .work-who { grid-column: 2; }
  .work-item .work-meta { grid-column: 2; grid-row: 2; font-size: 12.5px; }
  .work-item .work-action { grid-column: 3; grid-row: 1 / span 2; }
  .chatbar-inner { padding: 5px 10px 5px 16px; gap: 8px; font-size: 13px; }
  .chatbar .btn.small { padding: 0 9px; }
  .week-list li { grid-template-columns: minmax(0, 5.6rem) minmax(0, 1fr); column-gap: 10px; font-size: 14px; }
  .card.sponsor-card { align-items: flex-start; }
  .lab-row { grid-template-columns: 1fr; }
  .lab-head, .lab-section, .lab-foot { padding-left: 16px; padding-right: 16px; }
  .tl-item { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .relations { grid-template-columns: 1fr; }
  .attachment { max-width: 100%; }
  .note-card { padding: 14px; }
  .learner { padding: 16px; }
}
/* The call and the chat fill the screen below the top bar, so the controls and the message
   box are always in view (dvh follows Safari's toolbars; vh is the fallback). On a phone, and on
   a phone turned on its side, where the desktop sizing would push the chat under the top bar. */
@media (max-width: 640px), (max-height: 500px) {
  /* 75 px: the frame's 12 px above and below, and the bar's 35 px with its 16 px margin. */
  :is(.view-call, .view-chat) .wrap.house-frame { padding-top: 12px; padding-bottom: 12px; }
  :is(.view-call, .view-chat) .house-bar { margin-bottom: 16px; }
  .phone {
    padding: 28px 16px 24px;
    min-height: calc(100vh - var(--topbar-h) - 75px); min-height: calc(100dvh - var(--topbar-h) - 75px);
  }
  .chat {
    height: calc(100vh - var(--topbar-h) - 75px); height: calc(100dvh - var(--topbar-h) - 75px);
    min-height: 360px; border-radius: 16px;
  }
  .transcript { min-height: 0; max-height: none; padding: 16px; }
  .chat-head { padding: 10px 12px; gap: 10px; }
  .composer { padding: 10px 12px; gap: 8px; }
  .view-thread .chat-closed { padding: 10px 12px; gap: 8px; font-size: 13px; }
  .view-thread .chat-closed .btn { height: 34px; }
  .composer-hint { padding: 0 12px 10px; }
}
@media (max-height: 500px) {
  .chat { min-height: 0; } /* a landscape phone is shorter than the portrait minimum */
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .chatbar-tail { display: none; } /* "Chat with Marcus", then the two buttons, on a phone */
}
@media (max-width: 350px) {
  .nav button { font-size: 10px; }
}

/* Safari on iPhone zooms the page into any text box under 16px when it's tapped. */
@media (pointer: coarse) {
  .login-card input, .composer textarea, .lab select, .select, .input, .confirm textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* Printing: only a document open in the reader, as clean pages. Used for "Save as PDF". */
@media print {
  @page { margin: 18mm; }
  html, body { background: #fff !important; color: #000; }
  .topbar, .chatbar, .viewas, .toast, .reader-top, dialog, .view:not(.view-reader) { display: none !important; }
  .view-reader, .view-reader .wrap.house-frame { display: block !important; max-width: none; margin: 0; padding: 0; }
  .view-reader .md { border: 0; box-shadow: none; padding: 0; background: none; font-size: 11pt; }
  .view-reader .md h1, .view-reader .md h2, .view-reader .md h3 { break-after: avoid; }
  .view-reader .md table, .view-reader .md pre, .view-reader .md li { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* What's wrong, for staff: above the Admin tabs. Hidden when all is well. */
.admin-health { display: grid; gap: 8px; margin: 20px 0 0; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--warn-soft); }
.health-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0; }
.health-line svg { width: 16px; height: 16px; flex: none; color: var(--warn); }
.health-line.alert svg { color: var(--danger); }
.health-line span { flex: 1 1 280px; }
.note-again { margin-top: 8px; }

/* What a learner could have found: a fold-out table in their timeline. */
.found { margin: 14px 0; }
.found > summary { cursor: pointer; font-weight: 600; }
.found-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.found-table td { vertical-align: top; }
.found-table td small { display: block; color: var(--ink-3); }

/* The local sign-in page's "as a learner" choice. */
.login-check { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: 14px; color: var(--ink-2); }
.login-check input { width: auto; margin: 0; }

/* ---------- admin: assessment (staff only) ---------- */

/* Seven tabs: where they don't fit on one line they wrap onto a second, rather than hide past the edge. */
.admin-tabs { flex-wrap: wrap; }

/* Both tables here hold many short columns, so they become one card per row sooner than the other admin tables do.
   Child selectors keep the cohort's rules off the colleague table inside a learner's panel. */
.assess-cohort td > small { display: block; color: var(--ink-3); font-size: 12px; }
@media (min-width: 1101px) {
  .assess-cohort > thead th { white-space: normal; }
  .assess-cohort > thead th, .assess-cohort > tbody > tr > td { padding-left: 8px; padding-right: 8px; }
  .assess-cohort > thead th:first-child, .assess-cohort > tbody > tr > td:first-child { padding-left: 14px; }
}
@media (max-width: 1100px) {
  .assess-table > thead { display: none; }
  .assess-table, .assess-table > tbody, .assess-table > tbody > tr > td { display: block; }
  .assess-table > tbody > tr {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px;
    padding: 14px 16px; border-top: 1px solid var(--line);
  }
  .assess-table > tbody > tr:first-child { border-top: 0; }
  .assess-table > tbody > tr > td { padding: 0; border: 0; min-width: 0; }
  .assess-table > tbody > tr > td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650;
  }
  .assess-table > tbody > tr > .cell-name, .assess-table > tbody > tr > .row-actions { grid-column: 1 / -1; }
  .assess-table > tbody > tr > .row-actions { text-align: left; }
  .assess-table > tbody > tr > .row-actions .link-btn { margin-left: 0; }
  .assess-table > tbody > tr.learner-detail { display: block; padding: 0 12px 14px; border-top: 0; }
  .assess-table > tbody > tr.learner-detail > td { padding: 0; }
}
@media (max-width: 860px) { .assess-table > tbody > tr { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .assess-table > tbody > tr { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Courteous, curt and rude as three small counts; a count of none stays quiet. */
.tally { display: grid; gap: 1px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.tally strong { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tally .courteous strong { color: var(--ok); }
.tally .curt strong { color: var(--warn); }
.tally .rude strong { color: var(--danger); }
.tally .zero strong { color: var(--ink-3); font-weight: 500; }

/* A learner's panel: the timeline's box, in parts with small headings. */
.assess .learner-head h3 { margin: 0; font-size: 20px; font-weight: 650; font-family: var(--serif); }
.assess .learner-head .badge { border-radius: 10px; } /* it may wrap on a phone */
.assess-part { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.assess h4, .review-part h5 {
  margin: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650;
}
.assess-text { color: var(--ink-2); font-size: 14px; }
.assess-part > .btn { justify-self: start; }
/* A long button label wraps (.btn.wrap); the page container's .wrap margin doesn't belong here. */
.assess .btn.wrap { margin: 0; }

/* Signals, not marks: each ratio a short neutral bar, never coloured as good or bad, with its arithmetic beside it. */
.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.signal { display: grid; grid-template-columns: 8rem minmax(0, 1fr); align-items: center; gap: 2px 14px; }
.signal-bar { display: block; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.signal-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ink-2); }
.signal-text { font-size: 14px; color: var(--ink-2); min-width: 0; }
.signal-text strong { color: var(--ink); font-weight: 620; }
.signal-note { grid-column: 2; color: var(--ink-3); font-size: 12.5px; }

/* The colleague table's headings wrap, so eight columns fit inside the panel. */
.assess-colleagues th { white-space: normal; }
.assess-colleagues td { vertical-align: top; }
@media (min-width: 1101px) {
  .assess-colleagues th, .assess-colleagues td { padding-left: 10px; padding-right: 10px; }
}
.assess-subjects > summary {
  cursor: pointer; white-space: nowrap; list-style: none;
  text-decoration: underline dotted var(--ink-3); text-underline-offset: 3px;
}
.assess-subjects > summary::-webkit-details-marker { display: none; }
.assess-subjects > summary::after { content: " ▸"; color: var(--ink-3); font-size: 11px; }
.assess-subjects[open] > summary::after { content: " ▾"; }
.assess-subjects[open] > summary { margin-bottom: 4px; }
.assess-sub { display: block; color: var(--ink-3); font-size: 12px; }
.assess-flags { margin-top: 4px; }
.assess-flags .chip { font-size: 11.5px; padding: 1px 7px; }

/* The update, the sponsor, the submission and conduct: a label and a line each. */
.assess-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.assess-facts dt {
  padding-top: 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650;
}
.assess-facts dd { margin: 0; min-width: 0; color: var(--ink-2); }
.assess-facts dd .chips { margin-top: 4px; }

/* The rubric hints: six areas, each with the signals that bear on it. */
.rubric-hints {
  list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.rubric-hints li {
  display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: 2px 16px;
  padding: 9px 14px; border-top: 1px solid var(--line); font-size: 14px;
}
.rubric-hints li:first-child { border-top: 0; }
.rubric-hints strong { font-weight: 620; }
.rubric-hints span { color: var(--ink-2); overflow-wrap: anywhere; }

/* The two AI drafts: each button with its cost, the reason beneath when it can't be asked for. */
.draft-actions { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-start; }
.draft-action { display: grid; gap: 4px; justify-items: start; flex: 1 1 260px; min-width: 0; }
.draft-cost { font-size: 12.5px; font-weight: 500; opacity: .75; white-space: nowrap; }
.draft-why { color: var(--ink-3); font-size: 12.5px; }

/* Stored drafts, newest first; each opens to its sections. */
.review-list { display: grid; gap: 8px; }
.review-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.review-card > summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 14px; cursor: pointer; list-style: none;
}
.review-card > summary::-webkit-details-marker { display: none; }
.review-card > summary::before { content: "▸"; color: var(--ink-3); font-size: 12.5px; }
.review-card[open] > summary::before { content: "▾"; }
.review-card > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.review-card > summary strong { font-weight: 620; }
.review-card > summary small { color: var(--ink-3); font-size: 12.5px; }
.review-card > summary .status-chip { margin-left: auto; }
.review-body {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 12px 14px 14px;
  border-top: 1px solid var(--line); overflow-wrap: anywhere;
}
.review-part { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.review-area { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.review-part > h5 + .review-area { padding-top: 0; border-top: 0; }
.review-area-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.review-area h6 { margin: 0; font-size: 14.5px; font-weight: 650; }
.review-plain { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; color: var(--ink-2); }
.review-where { color: var(--ink-3); font-size: 12px; }
.review-where code, .review-paths code { font-family: var(--mono); font-size: 12px; }
.review-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.review-checks li { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); gap: 10px; align-items: baseline; }
.review-checks .status-chip { justify-content: center; }
.review-paths { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; color: var(--ink-3); }
.status-chip.pass, .status-chip.done { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.status-chip.warn, .status-chip.running { background: var(--warn-soft); color: var(--warn); }
.status-chip.fail, .status-chip.failed { background: color-mix(in srgb, var(--danger) 11%, transparent); color: var(--danger); }

@media (max-width: 640px) {
  .signal { grid-template-columns: 4.5rem minmax(0, 1fr); gap: 2px 10px; }
  .assess-facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .assess-facts dd { margin-bottom: 8px; }
  .rubric-hints li { grid-template-columns: minmax(0, 1fr); }
  .review-card > summary .status-chip { margin-left: 0; }
}

/* ---------- tell the course team ---------- */

/* In the top bar on every page, beside sign-out: a quiet text button with its icon; on a phone the icon alone,
   with the label kept for assistive technology in the button's name. */
.tell {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 13.5px; font-weight: 560;
  white-space: nowrap;
}
.tell:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.tell:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.tell-icon { display: grid; place-items: center; }
.tell-icon svg { width: 16px; height: 16px; }
@media (max-width: 860px) {
  .tell { width: 32px; padding: 0; justify-content: center; }
  .tell-label { display: none; }
}

/* The two dialogs with fields (the checkpoint, feedback): a count under each box, a plain note, the server's answer. */
.confirm.ask label + textarea { margin-top: 0; }
.confirm .dialog-count { display: block; margin-top: 4px; text-align: right; color: var(--ink-3); font-size: 12px; }
.confirm .dialog-note { color: var(--ink-3); font-size: 13px; margin-top: 14px; }
.confirm .form-error { margin-top: 12px; }
.confirm.checkpoint, .confirm.feedback { width: min(520px, calc(100vw - 32px)); }

/* ---------- one clock: the expedited pace ---------- */

/* Above the update's emails and at the top of the marking document: how to read the week's days. */
.pace-note {
  padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 13.5px;
}
.md > .pace-note { margin-bottom: 18px; font-size: 14px; }

/* A quiet line under a reply the server marked: cut short at the cap, or a promise with nothing sent. */
.msg.system.aside .bubble { max-width: 46ch; }

/* ---------- admin: feedback ---------- */

.tab-count.soft { background: var(--surface-3); color: var(--ink-2); }
.feedback-table td { vertical-align: top; }
.feedback-table td > small { display: block; color: var(--ink-3); font-size: 12px; }
.feedback-table .cell-note { max-width: 24rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-table .cell-code code { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.feedback-table .submit-file { font-weight: 560; }

/* ---------- admin: assessment, the new blocks ---------- */

/* The checkpoint under the UPDATE line, and the sponsor's decision under the SPONSOR line. */
.assess-sub-line { display: block; margin-top: 6px; color: var(--ink-2); font-size: 13.5px; }
.checkpoint-text { margin-top: 6px; font-size: 14.5px; }
.decision { display: grid; gap: 6px; margin-top: 8px; }
.decision p { color: var(--ink); }
.decision strong { font-weight: 620; }
.decision-label { display: inline-block; margin-bottom: 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; }
.decision .review-plain { color: var(--ink); }
.decision.none { margin-top: 6px; color: var(--ink-2); font-size: 13.5px; }

/* Promises under their colleagues, each with its status control. The control sits at the end of the line and
   drops under the words on a phone. */
.promise-group { display: grid; gap: 6px; }
.promise-group > strong { font-weight: 620; font-size: 14px; }
.promise-list li { flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.promise-list .promise-text { flex: 1 1 16rem; min-width: 0; overflow-wrap: anywhere; }
.promise-list .promise-text small { display: block; white-space: normal; }
.promise-list li.dropped .promise-text { text-decoration: line-through; }
.promise-list li.dropped .promise-text small { text-decoration: none; }
.promise-list .select { flex: none; width: auto; }

/* Inside the submission: the file list (folded beyond thirty) and the README as it is. */
.inside { display: grid; gap: 10px; min-width: 0; }
.inside > .btn { justify-self: start; }
.inside-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13px; }
.inside-files li { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.inside-files code { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; min-width: 0; }
.inside-files small { color: var(--ink-3); white-space: nowrap; }
.inside-readme {
  margin: 0; padding: 12px 14px; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
