
  svg:where([width="14"][height="14"]) { width: var(--icon-xs); height: var(--icon-xs); }
  svg:where([width="16"][height="16"]) { width: var(--icon-sm); height: var(--icon-sm); }
  svg:where([width="18"][height="18"]) { width: var(--icon-md); height: var(--icon-md); }
  svg:where([width="24"][height="24"]) { width: var(--icon-lg); height: var(--icon-lg); }
  svg:where([width="32"][height="32"]) { width: var(--icon-xl); height: var(--icon-xl); }
  svg:where([width="40"][height="40"]) { width: var(--icon-2xl); height: var(--icon-2xl); }



  *, *::before, *::after { box-sizing: border-box; }
  /* --page-gutter, --card-pad, --page-pad-top and the page widths are tokens now (tokens.ts, the inline sheet every page carries). */
  html, body { height: 100%; }
  body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--fs-body);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; }
  button, input, textarea, select { font: inherit; color: inherit; }

  /* Style the native picker itself, preserving form values, labels and keyboard handling.
     Browsers without customizable selects retain their native, functional picker.
     https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Customizable_select */
  @supports (appearance: base-select) {
    select:not([multiple]), select:not([multiple])::picker(select) { appearance: base-select; }
    select:not([multiple]) { align-items: center; gap: var(--space-3); cursor: pointer; }
    select:not([multiple]):disabled { cursor: not-allowed; }
    select:not([multiple])::picker(select) {
      background: var(--surface); color: var(--text-primary); font: inherit;
      border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-1);
      margin-block-start: var(--space-2); min-inline-size: anchor-size(self-inline);
      max-inline-size: calc(100vw - 24px); max-block-size: min(320px, 70dvh);
      overflow-y: auto; overscroll-behavior: contain;
      box-shadow: 0 8px 24px color-mix(in srgb, var(--text-primary) 14%, transparent);
    }
    select:not([multiple])::picker-icon {
      content: ''; width: 7px; height: 7px; margin: calc(var(--space-1) * -1) var(--space-1) 0 auto;
      border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
      transform: rotate(45deg); color: var(--text-tertiary);
    }
    select:not([multiple]):open::picker-icon { transform: rotate(225deg); margin-top: var(--space-1); }
    select:not([multiple]) option {
      display: flex; align-items: center; gap: var(--space-4); min-height: 42px;
      padding: var(--space-2) var(--space-3); border: 0; border-radius: 8px;
      background: transparent; color: var(--text-primary); cursor: pointer;
    }
    select:not([multiple]) option:checked { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
    select:not([multiple]) option:not(:disabled):hover { background: var(--surface-hover); }
    select:not([multiple]) option:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
    select:not([multiple]) option:disabled { color: var(--text-tertiary); cursor: not-allowed; }
    select:not([multiple]) option::checkmark { order: 1; margin-left: auto; color: var(--accent); }
    @media (forced-colors: active) {
      select:not([multiple]) option:checked { background: Highlight; color: HighlightText; }
      select:not([multiple]) option::checkmark { color: inherit; }
    }
  }

  /* Visible focus, always. Removing the outline is the most common keyboard-only
     failure and it is usually done for looks.

     2026-09-01: and this file then did it four times, about 120 lines below. Every text
     input inside a styled container carried outline: none at specificity (0,2,0) or
     higher, which beats this rule at (0,1,0) — so the composer, the rail search and the
     command palette had NO focus indicator at all. Found by tabbing through the running
     app; invisible to the 29 captures, because a screenshot has nothing focused.

     The intent was that the container shows the state and the input stays clean. Restored
     by letting the input keep its own ring rather than by adding :has(), which is a
     newer selector than this stylesheet otherwise relies on. WCAG 2.4.7. */
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

  .topbar :focus-visible { outline-color: var(--focus); }

  /* button.plain-link is retired (ds-v2 W1a fix round, item 16): those are Button variant=link, or a .ds-menu-item inside a menu. */

  /* Visually hidden text remains available to assistive technology. The page's actual
     skip link opts back into a visible, focusable shape below. Reusing the old off-screen
     skip-link rule for labels and count suffixes could draw clipped white pills at the top
     of positioned panels, including S09's test composer. */
  .skip {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
    white-space: nowrap; border: 0;
  }
  .skip-link {
    left: var(--space-2); top: calc(var(--space-12) * -1); z-index: 100; width: auto; height: auto; margin: 0;
    overflow: visible; clip: auto; clip-path: none; white-space: normal;
    background: var(--surface); color: var(--text-primary);
    padding: var(--space-3) var(--space-4); border-radius: var(--radius); border: 1px solid var(--border-strong);
    transition: top .12s;
  }
  .skip-link:focus { top: var(--space-2); }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  }

  /* --rail-bg, --rail-hover and --rail-active moved into ui/tokens.ts on 2026-09-07.
     They are per-theme values with a measured contrast gate now, and a second definition
     here would silently win over the generated one. */

  /* ── Top bar ─────────────────────────────────────────────────────────── */

  /* 2026-10-18 (ds-v2 topbar fit): .topbar is the bar and a size container; .topbar-row inside it is the grid. The tight and compact layouts (end of this sheet) switch on the
     bar's own width with @container, in em of the bar's font-size (the body size, so it follows the display mode), because what has to fit is the nav and the end group in the
     current mode, not the viewport: Stor's nav no longer ran under the role pill at 1280. */
  .topbar {
    flex: 0 0 auto;
    background: var(--topbar-bg); color: var(--topbar-text);
    border-bottom: 1px solid var(--border); position: relative; z-index: 50;
    container-type: inline-size;
  }
  .topbar-row {
    min-height: 76px;
    display: grid; grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr); align-items: center; gap: var(--space-5);
    padding: var(--space-3) var(--space-8);
  }
  .brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; flex: 0 0 auto; }
  .brand-mark {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--accent-fill); color: var(--accent-fill-text);
    display: grid; place-items: center;
    font-weight: 700; font-size: var(--fs-prose); line-height: 1;
  }
  .brand-name { font-weight: 700; font-size: var(--fs-title); letter-spacing: -.01em; }
  /* arch 580 (F-40 3.1): the school's logo beside the brand; only drawn with a logo. */
  .topbar-lead { display: flex; align-items: center; min-width: 0; }
  .topbar-school { display: flex; align-items: center; margin-left: var(--space-3); padding-left: var(--space-4); border-left: 1px solid var(--border); min-width: 0; }
  .topbar-school .school-logo { display: block; height: auto; max-height: 2rem; width: auto; max-width: 10rem; object-fit: contain; }
  @media (max-width: 640px) {
    .topbar-school { margin-left: var(--space-2); padding-left: var(--space-3); }
    .topbar-school .school-logo { max-height: 1.5rem; max-width: 6rem; }
  }

  /* The centred group is centred in what is LEFT of the bar, which is why it sits 20px
     right of dead centre when the wordmark is long. "flex: 1" on both sides keeps it
     symmetrical instead. */
  .topbar-mid { flex: 1 1 auto; display: flex; justify-content: center; }
  /* 2026-10-16 (ds-v2 S4, decisions 9): no track fill behind the items; the current one is a Turkis pill with white text (4.5:1+). */
  .segmented {
    display: flex; align-items: center; gap: var(--space-half);
  }
  .segmented a {
    padding: var(--space-2) var(--space-5); border-radius: var(--radius-pill);
    font-size: var(--fs-small); font-weight: 600; text-decoration: none;
    color: var(--text-secondary); white-space: nowrap;
  }
  .segmented a[aria-current="page"] { background: var(--accent-fill); color: var(--accent-fill-text); }
  .segmented a:hover:not([aria-current]) { background: var(--surface-hover); color: var(--text-primary); }

  .topbar-end { justify-self: end; display: flex; align-items: center; gap: var(--space-4); }
  .usage-track {
    width: 52px; height: 6px; border-radius: var(--radius-pill);
    border: 1px dashed var(--text-tertiary); background: color-mix(in srgb, var(--topbar-text) 5%, transparent);
  }
  .usage-link {
    display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) 0; min-height: var(--control-sm);
    color: var(--topbar-text); text-decoration: none;
  }
  .usage-link .usage-track { border-style: solid; border-color: var(--accent); }
  .usage-copy { display: flex; flex-direction: column; gap: var(--space-half); font-size: var(--fs-xs); line-height: 1.2; }
  .usage-copy span { white-space: nowrap; }
  /* The disabled meter (its second line, Deaktiveret) is gone: a control that is never available is absent, not disabled (decision 35, ds-v2 S10). */
  @media (max-width: 900px) { .usage-track { display: none; } }
  .avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600;
    border: 0; cursor: pointer;
  }
  /* Inline on the Konto page: the page column already supplies the gutter, so no margin of its own (it
     pushed the panel 20px past the right edge at 320px), and never wider than the column. It is part of the page,
     not a popup, so it is never a second scroller inside the page (D4): no viewport-height cap, and clip rather
     than scroll to keep the rounded corners. */
  .menu.account-panel { margin: 0; width: min(100%, 320px); max-width: 100%; max-height: none; overflow: clip; }
  .account-menu {
    display: none; position: absolute; top: var(--space-10); right: 0; z-index: 70;
    color: var(--text-primary); text-align: left;
  }
  .account-popover[open] .account-menu { display: block; }
  .badge-shield {
    display: inline-flex; align-items: center; gap: var(--space-2);
    background: rgba(255,255,255,.08); border-radius: var(--radius-pill);
    padding: var(--space-2) var(--space-4); font-size: var(--fs-small); font-weight: 600;
  }

  /* ── Shell ───────────────────────────────────────────────────────────── */

  .shell { display: flex; height: 100vh; height: 100dvh; flex-direction: column; }
  .body-row { flex: 1 1 auto; display: flex; min-height: 0; }

  .rail {
    flex: 0 0 var(--rail-w); min-width: 0;
    background: var(--rail-bg); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; overflow: hidden;
  }
  /* FD 12/11 ("Siden hopper ved tekstindtastning"): positioned so the history rows' visually hidden labels (.skip, position:absolute) stay inside the rail's
     scroller. Unpositioned, their containing block was .shell, so a long assistant history made the 'overflow: hidden' shell taller than the window, and
     scrollIntoView (assistant-chat.ts after a turn) scrolled it 188px: the top bar went and an empty band showed at the bottom. Not 'overflow: clip' on the
     shell or the page instead: a clipping ancestor switches off Chromium's lazy-load margin, so the template gallery's thumbnails never loaded (e2e 21). */
  .rail-scroll { flex: 1 1 auto; overflow-y: auto; padding: 0 var(--space-4); position: relative; }
  .assistant-navigation-content { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .sidebar-controls { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3); }
  .sidebar-controls[hidden], .assistant-navigation-content[hidden] { display: none; }
  .sidebar-caption { font-weight: 600; }
  .sidebar-toggle { border-radius: var(--radius); flex-shrink: 0; width: var(--control-md); height: var(--control-md); }
  /* The collapsed rail is its toggle plus the controls' padding plus the border, in every display mode (Stor made the toggle and the padding larger than a fixed 62px, which clipped it). */
  /* arch 693: the collapsed rail is only its toggle, so it does not clip the toggle's tooltip (e2e 50). */
  .assistant-rail[data-collapsed="true"] { flex-basis: calc(var(--control-md) + var(--space-3) * 2 + 1px); overflow: visible; }
  .assistant-rail[data-collapsed="true"] .sidebar-caption { display: none; }
  .rail-top { padding: var(--space-4) var(--space-4) var(--space-2); }
  .rail-bottom { border-top: 1px solid var(--border); padding: var(--space-4); }
  /* The rail's code field (components/code-entry.tsx), at the foot of the rail. */
  .code-entry { margin-top: auto; }
  .code-claim { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; }
  .code-claim .rail-label { padding: 0; }
  .code-claim-row { display: flex; gap: var(--space-2); align-items: center; }
  .code-claim-row input { flex: 1 1 auto; min-width: 0; min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-primary); font: inherit; font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .06em; }
  .code-claim-row .btn { flex: 0 0 auto; }

  main.page { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
  .shell { position: relative; overflow: hidden; }

  @media (max-width: 900px) {
    .shell { height: auto; overflow: visible; }
    .body-row { flex-direction: column; }
    .rail { flex: 1 1 auto; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
    .rail-scroll { overflow: visible; }
    .assistant-rail[data-collapsed="true"] { flex-basis: auto; }
    .assistant-rail[data-collapsed="true"] .sidebar-caption { display: inline; }
    main.page { overflow: visible; }
  }

  /* ── Rail parts ──────────────────────────────────────────────────────── */


  .rail-search {
    display: flex; align-items: center; gap: var(--space-2);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--space-half) var(--space-3); margin-top: var(--space-3);
    color: var(--text-tertiary);
  }
  /* arch 681 v5: ONE toolbar rule for a search field beside a primary button: both are --control-lg high, stretch to the same top and bottom,
     and carry no margin of their own (.rail-search has a top margin for the rail it was drawn for; it stays there). */
  .list-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: stretch; margin-bottom: var(--space-3); }
  .list-toolbar > .rail-search { margin: 0; flex: 1 1 16rem; min-width: 0; max-width: 100%; height: var(--control-lg); padding-block: 0; box-sizing: border-box; }
  .list-toolbar > form, .list-toolbar > .btn { margin: 0; }
  .list-toolbar .btn { min-height: var(--control-lg); box-sizing: border-box; }
  .list-toolbar select { min-height: var(--control-lg); box-sizing: border-box; }
  .list-toolbar > .rail-search input { min-height: var(--control-md); }
  .rail-search input {
    border: 0; background: transparent; flex: 1 1 auto; min-width: 0; min-height: var(--control-sm);
    font-size: var(--fs-small);
  }
  .kbd { font-size: var(--fs-xs); color: var(--text-tertiary); }

  .rail-label {

    color: var(--text-tertiary); padding: var(--space-4) var(--space-2) var(--space-1);
  }
  .rail-section > summary { display: flex; align-items: center; gap: var(--space-2); list-style: none; cursor: pointer; border-radius: var(--radius); }
  .rail-section > summary::-webkit-details-marker { display: none; }
  .rail-section[open] > summary > svg { transform: rotate(90deg); }
  .rail-section > summary:hover { color: var(--text-primary); background: var(--rail-hover); }
  .rail-history { margin-top: var(--space-3); border-top: 1px solid var(--border); padding-bottom: var(--space-4); }
  .rail-history-hint { font-size: var(--fs-xs); color: var(--text-tertiary); padding: 0 var(--space-2); margin: var(--space-1) 0 var(--space-3); }
  .history-conversations { padding-left: var(--space-3); }
  .history-conversations > li { display: flex; align-items: center; gap: var(--space-half); }
  .history-conversations > li > a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
  .history-title { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .history-conversations small {
    color: var(--text-tertiary); font-size: var(--fs-xs); line-height: 1rem;
    max-height: 0; opacity: 0; overflow: hidden; transform: translateY(-4px);
    transition: max-height .18s ease, opacity .18s ease, transform .18s ease;
  }
  .history-conversations > li:hover small,
  .history-conversations > li:focus-within small {
    max-height: 1rem; opacity: 1; transform: translateY(0);
  }
  .history-conversations > li > .ds-menu { flex-shrink: 0; }
  /* A mærkat row in the rail is one line, icon, ellipsed name and its count, the count always shown (it is the row's content, not a hover hint). */
  [data-rail-tags] .history-conversations > li > a { flex-direction: row; align-items: center; gap: var(--space-2); }
  [data-rail-tags] .history-title { flex: 1; width: auto; }
  [data-rail-tags] .history-conversations small { max-height: none; opacity: 1; transform: none; flex-shrink: 0; }
  nav.wrap-row > .btn { max-width: 100%; min-width: 0; }
  .tag-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .fag {
    display: flex; align-items: center; gap: var(--space-2); width: 100%; text-decoration: none;
    padding: var(--space-3) var(--space-2); border-radius: var(--radius);
    background: transparent; border: 0; cursor: pointer; text-align: left;
    font-size: var(--fs-body); color: var(--text-primary);
  }
  .fag:hover { background: var(--rail-hover); }
  .fag[aria-expanded="true"] { background: var(--rail-active); font-weight: 600; }
  .assistant-tag-group > summary { list-style: none; cursor: pointer; }
  .rail a.btn-block { text-decoration: none; }
  .assistant-tag-group > summary::-webkit-details-marker { display: none; }
  .assistant-tag-group[open] > summary { background: var(--rail-active); font-weight: 600; }
  .assistant-tag-group[open] > summary .chev { transform: rotate(90deg); }
  .fag .chev { color: var(--text-tertiary); flex: 0 0 auto; }
  .fag .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fag .count { color: var(--text-tertiary); font-size: var(--fs-label); }
  .fag-mark {
    width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
    display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700;
  }

  .samtaler { list-style: none; margin: var(--space-half) 0 var(--space-1); padding: 0 0 0 var(--space-8); }
  .samtaler a, .samtaler .rail-start > button {
    position: relative; display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3); border-radius: var(--radius);
    font-size: var(--fs-small); text-decoration: none; color: var(--text-secondary);
  }
  .samtaler a:hover, .samtaler .rail-start > button:hover { background: var(--rail-hover); }
  /* architecture#555: a rail name that starts a conversation is a form's button, drawn as the link it replaced. */
  .samtaler .rail-start > button { width: 100%; border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; }
  /* The pupil's history is flat (no assistant group above it): it starts at the section's edge, its page link a quiet row. */
  .samtaler.history-flat { padding-left: 0; }
  .rail-history > .rail-more { padding: var(--space-2) var(--space-3); font-size: var(--fs-small); color: var(--text-secondary); }
  /* 2026-10-16 (ds-v2 S4, decision 10): the current row is the white fill plus a 3px Turkis bar on the left (4.5:1 on Sand). */
  .samtaler a[aria-current="page"], .samtaler .rail-start > button[aria-current="page"] { background: var(--rail-active); color: var(--text-primary); font-weight: 600; }
  .samtaler a[aria-current="page"]::before, .samtaler .rail-start > button[aria-current="page"]::before {
    content: ""; position: absolute; left: 0; top: var(--space-2); bottom: var(--space-2); width: calc(var(--space-half) * 1.5);
    border-radius: var(--radius-pill); background: var(--accent);
  }

  .rail-link {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-1); font-size: var(--fs-body); text-decoration: none; color: var(--text-primary);
  }
  .rail-link:hover { color: var(--accent); }


  /* ── Page header ─────────────────────────────────────────────────────── */

  .page-head {
    flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-4) var(--page-gutter); min-height: 64px;
  }
  .page-col .page-head { padding: 0 0 var(--space-5); min-height: 0; }
  .crumbs { display: flex; align-items: center; gap: var(--space-2); flex: 1 1 auto; min-width: 0; font-size: var(--fs-body); }
  .crumbs .sep { color: var(--text-tertiary); }
  .crumbs .cur { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .crumbs strong { font-weight: 600; }
  .crumbs h1 { font-size: var(--fs-title); font-weight: 600; margin: 0; }
  .page-title { font-size: var(--fs-h1); font-weight: 700; margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
  .page-sub { color: var(--text-secondary); font-size: var(--fs-small); margin: var(--space-half) 0 0; }

  .pill {
    display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-pill); padding: var(--space-2) var(--space-3);
    font-size: var(--fs-small); font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .pill:hover { border-color: var(--border-strong); }
  .pill .hex { color: var(--accent); }

  /* ── Generic surface kit ─────────────────────────────────────────────── */

  .scroll { flex: 1 1 auto; overflow-y: auto; position: relative; scrollbar-gutter: stable; padding: var(--page-pad-top) var(--page-gutter) var(--space-6); }
  .page-col { width: 100%; margin-inline: auto; min-width: 0; }
  .page-col-text { max-width: var(--page-max-text); }
  .page-col-chat { max-width: var(--page-max-chat); }
  .page-col-wide { max-width: var(--page-max-wide); }
  .page-col-workspace { max-width: var(--page-max-workspace); }
  @media (max-width: 900px) { .scroll { overflow: visible; } .composer-wrap { position: sticky; bottom: 0; background: var(--bg); } }

  .card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--card-pad);
  }
  .card + .card { margin-top: var(--space-4); }
  .card-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
  .card-head h2, .card-head h3 { margin: 0; font-size: var(--fs-prose); font-weight: 700; }
  .card-head .grow { flex: 1 1 auto; }
  .muted { color: var(--text-secondary); }
  .tiny { font-size: var(--fs-label); }
  .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
  @media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }
  .grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); }
  .row { display: flex; align-items: center; gap: var(--space-3); }
  .row.wrap-row { flex-wrap: wrap; }
  .grow { flex: 1 1 auto; min-width: 0; }
  .stack > * + * { margin-top: var(--space-3); }

  /* Buttons (00-design-system.md section 8.1): variants primary, secondary (the bare .btn), ghost, danger (outline) and link; sizes sm 32, md 40
     (44 under pointer: coarse, through --control-md), lg 44; states hover, focus (the global ring), active, aria-disabled and loading. Never opacity. */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); text-decoration: none; box-sizing: border-box;
    min-height: var(--control-md); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-primary);
    border-radius: var(--radius); padding: var(--space-2) var(--space-4);
    font-size: var(--fs-small); font-weight: 600; line-height: 1.25; white-space: nowrap; cursor: pointer;
  }
  .btn:hover { background: var(--surface-hover); }
  .btn:active { background: var(--surface-hover); }
  .btn-sm { min-height: var(--control-sm); padding: var(--space-1) var(--space-3); font-size: var(--fs-label); }
  .btn-lg { min-height: var(--control-lg); padding: var(--space-3) var(--space-5); font-size: var(--fs-body); }
  @media (pointer: coarse) { .btn-sm { min-height: var(--control-lg); } }
  /* A long label wraps instead of running off a 320px screen or a 200% zoom (08-reflow-zoom, W1b fix round); above 640px a button stays one line. */
  @media (max-width: 640px) { .btn { white-space: normal; max-width: 100%; text-align: center; } }
  .btn-primary {
    background: var(--accent-fill); border-color: var(--accent-fill);
    color: var(--accent-fill-text);
  }
  .btn-primary:hover, .btn-primary:active { background: var(--accent-800); border-color: var(--accent-800); }
  .btn-danger { color: var(--danger); border-color: var(--danger); }
  .btn-danger:hover, .btn-danger:active { background: var(--danger-soft); }
  .btn-ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
  .btn-ghost:hover, .btn-ghost:active { background: var(--surface-hover); border-color: transparent; color: var(--text-primary); }
  /* Inverted (8.31): only inside .composer-card-inverted, whose ground is the body ink; the outline and the label take the card's ink, hover underlines (a fill would be the light surface-hover under light ink). */
  .btn-inverted { background: transparent; color: inherit; border-color: currentColor; }
  .btn-inverted:hover, .btn-inverted:active { background: transparent; text-decoration: underline; }
  /* Pill (composer-card panel actions): the shape of the toolbar's .pill and .voice-toggle. Height and padding stay the card's own compact .btn rule. */
  .btn-pill { border-radius: var(--radius-pill); border-color: var(--border); }
  .btn-pill:hover, .btn-pill:active { border-color: var(--border-strong); }
  /* A link button often holds a user's own text (a quiz title, a deck title, an assistant name): it wraps at any width, and an unbroken run breaks anywhere, instead of
     running out of a 320px column (ds-v2 W2a fix round, item 5). .btn-wrap is the same for any other Button that holds user text. */
  .btn-link { border-color: transparent; background: transparent; color: var(--accent); padding-left: 0; padding-right: 0; }
  .btn-link, .btn-wrap { white-space: normal; max-width: 100%; min-width: 0; text-align: left; overflow-wrap: anywhere; }
  .btn-link:hover, .btn-link:active { background: transparent; text-decoration: underline; color: var(--accent-800); }
  .btn-link.btn-link-danger, .btn-link.btn-link-danger:hover { color: var(--danger); }
  /* The current choice among link buttons (a folder filter, W1a item 16: the retired .pill): a ground and an edge as well as aria-current. */
  .btn[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); }
  .btn-block { display: flex; width: 100%; }
  .btn:disabled, .btn[aria-disabled="true"] { background: var(--bg); border-color: var(--border); color: var(--text-tertiary); cursor: not-allowed; text-decoration: none; }
  .btn-primary:disabled, .btn-primary[aria-disabled="true"], .btn-danger:disabled, .btn-danger[aria-disabled="true"] { background: var(--bg); border-color: var(--border); color: var(--text-tertiary); }
  .btn-ghost:disabled, .btn-ghost[aria-disabled="true"], .btn-link:disabled, .btn-link[aria-disabled="true"] { background: transparent; border-color: transparent; }
  .btn[aria-busy="true"] { pointer-events: none; }
  .btn-spinner {
    flex: 0 0 auto; width: 16px; height: 16px; box-sizing: border-box; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: btn-spin .7s linear infinite;
  }
  @keyframes btn-spin { to { transform: rotate(360deg); } }

  .chip {
    display: inline-flex; align-items: center; gap: var(--space-2);
    border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3);
    font-size: var(--fs-label); font-weight: 600;
    background: var(--surface-hover); color: var(--text-secondary);
  }
  .chip-ok      { background: var(--success-soft); color: var(--success); }
  .chip-warn    { background: var(--warning-soft); color: var(--warning); }
  .chip-danger  { background: var(--danger-soft);  color: var(--danger); }
  .chip-info    { background: var(--accent-soft);  color: var(--accent); }
  .chip-accent  { background: var(--accent-soft);  color: var(--accent); }
  .chip-ai      { background: var(--ai-soft);      color: var(--ai); }
  /* W2b item 5: nothing interactive below --control-sm (32), and 44 under a coarse pointer (the S13 modes scale both tokens). */
  .chip-interactive { min-height: var(--control-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-primary); font-family: inherit; text-decoration: none; cursor: pointer; }
  .chip-interactive:hover:not(:disabled):not([aria-disabled="true"]) { border-color: var(--accent); background: var(--accent-soft); }
  .chip-interactive[aria-pressed="true"], .chip-interactive[aria-current="true"], .chip-interactive.selected { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-fill-text); }
  .chip-interactive:disabled, .chip-interactive[aria-disabled="true"] { background: var(--bg); border-color: var(--border); color: var(--text-tertiary); cursor: not-allowed; }
  @media (pointer: coarse) { .chip-interactive { min-height: var(--control-lg); } }
  .chip-plain { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-secondary); }

  table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
  table.data th {
    text-align: left; font-size: var(--fs-label); font-weight: 500;
    color: var(--text-tertiary);
    padding: 0 var(--space-3) var(--space-3); border-bottom: 1px solid var(--border);
  }
  table.data td { padding: var(--space-4) var(--space-3); border-bottom: 1px solid var(--border); vertical-align: middle; }
  table.data tr:last-child td { border-bottom: 0; }
  table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

  .bar { height: 8px; border-radius: 4px; background: var(--surface-hover); overflow: hidden; }
  .bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent-fill); }
  .bar > i.ok { background: var(--success); }
  .bar > i.warn { background: var(--warning); }
  .bar > i.danger { background: var(--danger); }

  .kpi { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .kpi-label { color: var(--text-tertiary); }

  /* The switch, the checkbox, the radio, the range, the fieldset and the disclosure are drawn in components/form-fields.tsx (CONTROLS_CSS) and accordion.tsx (ds-v2 S3, 2026-10-16). */

  .field { display: block; }
  .field > span { display: block; font-size: var(--fs-label); font-weight: 600; margin-bottom: var(--space-2); }
  .field input, .field textarea, .field select {
    width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius);
    padding: var(--space-3) var(--space-4); background: var(--surface);
  }
  /* Text-like inputs only: a checkbox, radio, range or file input inside a .field has its own states (W1a fix round, item 11). */
  /* A native file input (the frozen template upload) keeps the 32px floor in every display mode (WCAG 2.5.8); the overlay and drop-zone inputs are drawn by their own components. */
  input[type=file]:not(.file-input-overlay, .ds-drop-input) { min-height: var(--control-sm); }
  .field input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=hidden]):hover, .field textarea:hover, .field select:hover { border-color: var(--text-secondary); }
  .field textarea { min-height: 86px; resize: vertical; }

  /* ── Chat ────────────────────────────────────────────────────────────── */

  .thread { display: flex; flex-direction: column; gap: var(--space-5); padding-bottom: var(--space-2); }
  /* 55 % of the 790px column, which is the 437px the mockup draws. The user bubble
     hugs its text up to that and then wraps — it is not a full-width block. */
  .msg-user { align-self: flex-end; max-width: 55%; }
  .msg-user .bubble {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5);
  }
  .msg-ai .who {
    display: flex; align-items: center; gap: var(--space-2);
    color: var(--text-secondary); font-size: var(--fs-small); margin-bottom: var(--space-3);
  }
  .msg-ai .who .hex { color: var(--accent); }
  .prose p { margin: 0 0 var(--space-3); }
  .prose h3 { font-size: var(--fs-title); font-weight: 700; margin: var(--space-5) 0 var(--space-3); }
  .prose ol { margin: 0 0 var(--space-3); padding: 0; list-style: none; counter-reset: n; }
  .prose ol li { counter-increment: n; display: flex; gap: var(--space-3); margin-bottom: var(--space-3); }
  .prose ol li::before { content: counter(n) "."; color: var(--accent); font-weight: 700; flex: 0 0 auto; }
  .prose ul { margin: 0 0 var(--space-3); padding-left: var(--space-5); }
  .prose ul li { margin-bottom: var(--space-2); }

  .codeblock { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .codeblock header {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border);
  }
  .codeblock header .lang { flex: 1 1 auto; font-family: var(--font-mono); font-size: var(--fs-label); color: var(--text-tertiary); }
  .codeblock pre { margin: 0; padding: var(--space-4) var(--space-5); overflow-x: auto; }
  .codeblock code { font-family: var(--font-mono); font-size: var(--fs-label); line-height: 1.7; }

  .sources {
    display: inline-flex; align-items: center; gap: var(--space-2);
    background: var(--ai-soft); color: var(--ai);
    border-radius: var(--radius); padding: var(--space-2) var(--space-3); font-size: var(--fs-small);
  }
  .sources a { color: inherit; text-decoration: none; }
  .sources a:hover { text-decoration: underline; }
  /* What an answer shows about its web searches (F-11 3.14 drawing G, ui/web-search-view.tsx): one collapsed row per search, set under the answer's icon row and indented to the answer text (--instruction-avatar + gap). */
  .web-search { margin: calc(-1 * var(--space-4)) 0 0 calc(var(--instruction-avatar) + var(--space-3)); display: grid; gap: var(--space-2); }
  .web-search-row { display: block; margin: 0; font-size: var(--fs-small); color: var(--text-secondary); }
  .web-search-row summary, p.web-search-row { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: var(--space-2); cursor: pointer; }
  .web-search-row summary { color: inherit; font-weight: 400; padding: var(--space-1) 0; }
  /* The chevron centred on the globe icon (4px + 16px / 2 = 12px from the top, an 8px box): the selector out-weighs the disclosure sheet's 'margin: 0 …', which
     tied with the old '.web-search-row summary::before' and won by order, leaving the chevron above the text line (Odd Job, 2026-11-11). */
  .ds-disclosure.web-search-row > summary::before { margin: var(--space-2) var(--space-1) 0; }
  .web-search-row svg { flex: 0 0 auto; margin-top: var(--space-1); }
  .web-search-text { min-width: 0; flex: 1 1 auto; }
  p.web-search-row { cursor: default; }
  .web-search-count { color: var(--text-tertiary); }
  .web-search-list { margin: var(--space-2) 0 0; padding-left: var(--space-5); }

  .msg-actions {
    display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-3);
    color: var(--text-secondary);
  }
  .icon-btn {
    display: inline-flex; align-items: center; gap: var(--space-2);
    background: transparent; border: 0; cursor: pointer;
    padding: var(--space-1) var(--space-3); border-radius: var(--radius); justify-content: center;
    min-width: var(--control-md); min-height: var(--control-md);
    font-size: var(--fs-small); color: var(--text-secondary);
  }
  .icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
  /* The round icon button (spec 8.1): a 40px circle, transparent. Composer tools and Send. */
  .icon-btn-round { width: var(--control-md); height: var(--control-md); padding: 0; border-radius: 50%; }
  /* The dense icon button (--control-sm, 32px; the hit area is never under 24px): the history rows of the rail, whose menu summary grew from 32 to 40px with the default size
     (ds-v2 W2a fix round, item 10). Under a coarse pointer it is the touch size, as .btn-sm is. */
  .icon-btn-sm { min-width: var(--control-sm); min-height: var(--control-sm); padding: var(--space-1); }
  @media (pointer: coarse) { .icon-btn-sm { min-width: var(--control-lg); min-height: var(--control-lg); } }
  /* 2026-10-16 (ds-v2 S4, decision 8): the AI marking is an ai-tone Chip (chip chip-ai, Lilla, sparkle) at the right end of the action row; .ai-tag stays as the hook
     tests and e2e read, and only places it. The old grey pill is gone. */
  .ai-tag { margin-left: auto; gap: var(--space-1); }

  /* Local read-aloud (F-35 V0); why the highlight is a CSS Highlight is in ui/read-aloud.ts */
  .read-aloud-actions { margin: var(--space-1) 0 0 calc(var(--space-2) * -1); }
  /* 2026-10-17 (ds-v2 W1a fix round, item 16): .read-aloud-button is retired; the read-aloud buttons are plain .icon-btn, found by their data hooks. In the
     answer's action row an icon-btn is the dense size (--control-sm), as the row has always been. */
  .instruction-message-actions .icon-btn, .msg-actions .icon-btn, .read-aloud-actions .icon-btn, details.home-message-actions > summary.icon-btn { width: var(--control-sm); height: var(--control-sm); padding: 0; justify-content: center; color: var(--text-tertiary); }
  .icon-btn[data-read-aloud-for] > span, .icon-btn[data-read-aloud-server-for] > span { display: inline-grid; }
  .icon-btn[data-read-aloud-for][aria-pressed="true"] > .read-aloud-play, .icon-btn[data-read-aloud-for]:not([aria-pressed="true"]) > .read-aloud-stop,
  .icon-btn[data-read-aloud-server-for][aria-pressed="true"] > .read-aloud-play, .icon-btn[data-read-aloud-server-for]:not([aria-pressed="true"]) > .read-aloud-stop { display: none; }
  .icon-btn[data-read-aloud-for][aria-pressed="true"], .icon-btn[data-read-aloud-server-for][aria-pressed="true"], .dictation-mic[aria-pressed="true"] { color: var(--text-primary); border-color: var(--border-strong); }
  .icon-btn.read-aloud-server-button{width:auto;padding:0 var(--space-2);gap:var(--space-1)}
  .read-aloud-ai{font-size:var(--fs-xs);font-weight:600}
  .read-aloud-speed:not([hidden]) { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--text-secondary); }
  .read-aloud-speed > label { display: inline-flex; align-items: center; }
  .read-aloud-speed select { width: auto; min-height: 30px; padding: var(--space-half) var(--space-2); font-size: var(--fs-label); }
  .read-aloud-error:not([hidden]) { margin: var(--space-2) 0 0; }
  /* arch 552: the copy buttons. Idle shows the copy icon; the script sets data-copied for about two seconds and the check takes its place. */
  .copy-idle, .copy-done { display: inline-flex; align-items: center; gap: var(--space-1); }
  .copy-done, [data-copied="true"] > .copy-idle { display: none; }
  [data-copied="true"] > .copy-done { display: inline-flex; }
  .code-block { margin: 0 0 .85em; }
  .code-block-bar { display: flex; justify-content: flex-end; margin-bottom: var(--space-1); }
  .instruction-message-text .code-block pre { margin: 0; }
  .instruction-message-actions { display: flex; align-items: center; gap: var(--space-half); margin: var(--space-1) 0 0 calc(var(--space-2) * -1); }
  .read-aloud-note { margin: var(--space-3) 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); }
  .read-aloud-note ul { margin: var(--space-2) 0; padding-left: var(--space-5); }
  ::highlight(faellesai-read-aloud) {
    background-color: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--text-primary);
    text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px;
  }
  .dictation-notice h2 { margin: 0 0 var(--space-2); font-size: var(--fs-prose); }
  .dictation-actions, .dictation-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-2) 0; }
  .dictation-bar[hidden] { display: none; }
  /* The error boxes are Notes (tone danger, compact); only their hide rule stays here. */
  .dictation-alert-box:has(.dictation-alert[hidden]), .read-aloud-error[hidden] { display: none; }
  .dictation-alert { margin: 0; }
  .dictation-meter { width: 80px; height: 6px; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
  .dictation-meter > span { display: block; height: 100%; width: 0; background: var(--text-primary); }

  .mem-toggle.is-active { background: var(--accent-soft); color: var(--accent); }
  .mem-toggle[aria-expanded="true"]:not(.is-active) { background: var(--neutral-150); }
  .composer-panel-heading { margin: 0; font-weight: 600; }
  .home-tools-menu-list { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-1) 0; }
  .home-tools-menu-list a { display: flex; align-items: center; gap: var(--space-2); }
  .mem-panel-body { padding: var(--space-1) 0; display: flex; gap: var(--space-4); flex-wrap: wrap; align-items: flex-end; }
  .mem-panel-course { display: flex; gap: var(--space-2); align-items: flex-end; }
  .home-composer-tool.voice-toggle{display:inline-flex;align-items:center;width:auto;padding:0 var(--space-3);gap:var(--space-2);border:1px solid transparent;border-radius:999px;font-size:var(--fs-small);line-height:1;white-space:nowrap}
  [data-read-aloud-for][data-voice-hold]{display:none}
  [data-voice-novoice]{display:none !important}
  .composer-lang{display:inline-flex;align-items:center;gap:var(--space-1);color:var(--text-secondary)}
  .composer-lang select{width:auto;min-height:var(--control-sm);padding:var(--space-half) var(--space-2);font-size:var(--fs-label)}
  .lang-note{margin:var(--space-1) 0 0;font-size:var(--fs-label);color:var(--text-secondary)}
  .lang-note[hidden]{display:none}
  .home-composer-tool.voice-toggle[aria-checked="true"]{color:var(--text-primary);border-color:var(--border-strong)}
  /* D3: .composer-card, see voice-session-view.tsx. */
  .composer-card{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2);margin:var(--space-2) 0 0;padding:var(--space-1) var(--space-3);border:1px solid var(--border);border-radius:var(--radius);font-size:var(--fs-small);line-height:1.35}
  .composer-card[hidden]{display:none}
  .composer-card>*{margin:0}
  .composer-card .btn{min-height:30px;padding:var(--space-1) var(--space-3);font-size:var(--fs-small);line-height:1.35}
  .composer-card .chip{font-size:var(--fs-xs);line-height:1.35}
  .composer-locked-chip{display:inline-flex;align-items:center;gap:var(--space-1);color:var(--text-secondary);cursor:not-allowed}
  .composer-card small{font-size:var(--fs-label);color:var(--text-secondary)}
  .voice-session[hidden],.voice-draft[hidden],.voice-withheld[hidden]{display:none}
  .voice-disclosure{flex:0 1 auto}
  .voice-disclosure .btn{margin-left:var(--space-2)}
  .voice-loop{display:inline-flex;flex-wrap:wrap;gap:var(--space-1) var(--space-2);align-items:center;margin:0}
  .voice-loop-status{margin:0;font-weight:600}
  .voice-loop [hidden]{display:none}
  .voice-settings{margin-left:auto}
  .voice-session:has(.voice-menu[open]) .voice-settings{flex:1 1 100%;margin-left:0}
  .voice-menu>summary{display:inline-flex;align-items:center;gap:var(--space-2);cursor:pointer;list-style:none;color:var(--text-secondary);min-height:30px}
  .voice-menu>summary::-webkit-details-marker{display:none}
  .voice-menu>summary:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
  .voice-menu-body{display:grid;grid-template-columns:1fr;gap:var(--space-2);margin:var(--space-2) 0 var(--space-half)}
  .voice-menu-row{display:flex;flex-wrap:wrap;gap:var(--space-half) var(--space-2);align-items:center}
  .voice-menu-row>small{flex-basis:100%}
  .voice-draft{gap:var(--space-2) var(--space-2)}
  .voice-draft-label,.voice-withheld{margin:0;font-weight:600}
  .voice-withheld{flex-basis:100%}
  .composer-panel-heading{flex:0 0 auto}
  .composer-card .home-tools-menu-list,.composer-card .mem-panel-body{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3);padding:0}
  .composer-card .mem-panel-course{align-items:center}
  /* A form that is a control row of a card (the memory toggle, the course picker) sits on the card's one centre line: no inherited form margin. */
  .composer-card form{margin:0}
  .composer-card .dictation-actions,.composer-card .dictation-bar{margin:0}
  .composer-card.dictation-notice h2{margin:0;font-size:var(--fs-small)}
  .composer-card.dictation-notice>p,.composer-card.dictation-notice details{flex:1 1 100%}
  .composer-card.dictation-bar{margin:var(--space-2) 0 0}
  .instruction-message-user[data-voice-spoken]::before{content:attr(data-voice-spoken) " ";color:var(--text-secondary)}

  /* ── Quiz material inside an assistant conversation ─────────────────── */
  .chat-quiz-message > p:not(.who) { margin: 0 0 var(--space-3); font-size: var(--fs-title); }
  .chat-quiz-card {
    display: flex; align-items: center; gap: var(--space-4); width: 100%; padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface);
  }
  .chat-quiz-card strong, .chat-quiz-card small { display: block; }
  .chat-quiz-card small { color: var(--text-tertiary); }
  .chat-quiz-icon {
    flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center;
    border-radius: 11px; background: var(--accent-fill); color: var(--accent-fill-text);
  }
  .chat-quiz-stage {
    margin-top: var(--space-6); padding: var(--card-pad) 0 var(--space-2); border-top: 1px solid var(--border);
  }
  .chat-quiz-stage > h2 { margin: var(--space-4) 0 var(--space-3); font-size: var(--fs-title); }
  .chat-quiz-progress-row { display: flex; align-items: center; gap: var(--space-4); color: var(--text-secondary); font-size: var(--fs-label); }
  .chat-quiz-progress-row > strong { white-space: nowrap; }
  .chat-quiz-progress {
    flex: 1 1 auto; height: 7px; overflow: hidden; border-radius: var(--radius-pill); background: var(--border);
  }
  .chat-quiz-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent-fill); }
  .chat-quiz-choices { display: grid; gap: var(--space-2); margin: 0; padding: 0; border: 0; }
  .chat-quiz-choice {
    display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer;
  }
  .chat-quiz-choice:hover { border-color: var(--accent); }
  .chat-quiz-choice input { position: static; opacity: 1; pointer-events: auto; cursor: pointer; }
  .chat-quiz-choice:not(.is-correct):not(.is-wrong):has(input:checked) {
    border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
  }
  .chat-quiz-choice:not(.is-correct):not(.is-wrong):has(input:checked) .chat-quiz-choice-key {
    background: var(--accent-fill); color: var(--accent-fill-text);
  }
  .chat-quiz-choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
  .chat-quiz-choice-key {
    flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center;
    border-radius: 7px; background: var(--surface-hover); color: var(--text-secondary); font-weight: 700;
  }
  .chat-quiz-choice.is-selected { border-color: var(--accent); background: var(--accent-soft); }
  .chat-quiz-choice.is-correct { border-color: var(--success); background: var(--success-soft); }
  .chat-quiz-choice.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
  .chat-quiz-choice-mark { display: grid; place-items: center; color: var(--success); }
  .chat-quiz-actions { display: grid; grid-template-columns: minmax(0, 1fr) 112px; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
  .chat-quiz-actions > :last-child { justify-self: stretch; width: 112px; min-height: 42px; text-align: center; justify-content: center; }
  .chat-quiz-answer-result { color: var(--text-secondary); font-size: var(--fs-label); font-weight: 600; text-align: center; }
  .chat-quiz-complete { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-8) var(--space-6); text-align: center; }
  .chat-quiz-complete h2, .chat-quiz-complete p { margin: 0; }
  .chat-quiz-complete p { color: var(--text-secondary); }

  .composer-wrap { flex: 0 0 auto; padding: var(--space-3) var(--page-gutter) var(--space-4); }
  /* #1165: pupil rename/delete scroll with the page, outside the sticky block; no Enter hint on a touch keyboard (kept for aria-describedby). */
  .pupil-chat-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: 0 var(--page-gutter) var(--space-4); }
  @media (pointer: coarse) { #pupil-send-hint { display: none; } }
  .composer-shell { box-sizing: border-box; padding: var(--space-3) var(--space-4) var(--space-2); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-1); }
  .composer-shell:focus-within { border-color: var(--accent); }
  .composer-form { margin: 0; padding: 0; border: 0; background: transparent; }
  .composer-form textarea { display: block; width: 100%; box-sizing: border-box; min-height: var(--control-sm); max-height: 40vh; resize: none; overflow-y: auto; padding: var(--space-2) var(--space-1); margin: 0; background: transparent; color: var(--text-primary); border: 0; font: inherit; font-size: var(--fs-prose); line-height: 1.5; }
  .composer-form textarea::placeholder { color: var(--text-tertiary); }
  .composer-form textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
  .composer-form > input[type="text"] { display: block; width: 100%; box-sizing: border-box; padding: var(--space-2) var(--space-1); border: 0; background: transparent; font: inherit; font-size: var(--fs-prose); }
  .composer-form > input[type="text"]:disabled { color: var(--text-tertiary); cursor: not-allowed; }
  .composer-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; column-gap: var(--space-2); row-gap: var(--space-2); max-width: 100%; margin-top: var(--space-2); }
  .composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
  .composer-more { position: relative; }
  .composer-more > summary { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; list-style: none; }
  .composer-more[open] > summary { background: var(--accent-soft); color: var(--accent); }
  .composer-memchip { display: inline-flex; align-items: center; min-height: var(--control-sm); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font: inherit; font-size: var(--fs-small); font-weight: 600; cursor: pointer; }
  .composer-memchip.is-off { background: var(--bg); color: var(--text-secondary); text-decoration: line-through; }
  .composer-memchip:disabled { cursor: not-allowed; }
  .composer-more-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
  .composer-more-chips:empty { display: none; }
  .composer-more-chips .composer-chip-web { background: var(--warning-soft); color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); }
  .composer-more-panel { position: absolute; left: 0; bottom: calc(100% + var(--space-2)); z-index: var(--z-dropdown); box-sizing: border-box; display: flex; flex-direction: column; gap: var(--space-1); width: max-content; min-width: calc(var(--space-12) * 5); max-width: calc(100vw - var(--space-12)); max-height: calc(100dvh - var(--space-16) - var(--space-8)); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
  .composer-more-panel.composer-more-fixed { position: fixed; bottom: auto; }
  .composer-more-panel.composer-more-below { bottom: auto; top: calc(100% + var(--space-2)); }
  .composer-more-panel .icon-btn.home-composer-tool:not([hidden]) { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-3); box-sizing: border-box; width: 100%; height: auto; min-height: var(--control-md); padding: var(--space-2) var(--space-3); border: 1px solid transparent; border-radius: var(--radius-lg); font-size: var(--fs-body); line-height: 1.3; white-space: normal; text-align: left; }
  .composer-more-panel .icon-btn.home-composer-tool:not(.web-toggle):not(.voice-toggle):not(:has(.composer-tool-label))::after { content: attr(aria-label); }
  .composer-more-panel .home-composer-tool:is([aria-pressed="true"], [aria-checked="true"], .is-active) { background: var(--accent-soft); color: var(--text-primary); }
  .composer-more-panel :is(.composer-tool-label, .web-toggle-label, .voice-toggle-label) { font-size: var(--fs-body); }
  .composer-more-panel .home-attach { position: relative; }
  .composer-more-panel .composer-lang:not([hidden]), .composer-more-panel .read-aloud-speed:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) var(--space-3); font-size: var(--fs-body); color: var(--text-primary); }
  .composer-more-panel .composer-lang label.skip, .composer-more-panel .read-aloud-speed .skip { position: static; width: auto; height: auto; margin: 0; clip: auto; clip-path: none; overflow: visible; white-space: normal; }
  .composer-more-panel .read-aloud-speed > label { order: 0; gap: var(--space-3); }
  .composer-more-panel .web-note { padding: 0 var(--space-3); }
  .composer-right { grid-column: 2; grid-row: 1; align-self: start; display: flex; align-items: center; gap: var(--space-2); }
  .composer-send { margin-left: 0; display: grid; place-items: center; width: var(--control-md); height: var(--control-md); flex: 0 0 var(--control-md); padding: 0; border: 1px solid var(--accent-fill); border-radius: 50%; background: var(--accent-fill); color: var(--accent-fill-text); cursor: pointer; transition: transform var(--motion-fast); }
  .composer-send:hover:not(:disabled):not([aria-disabled="true"]) { transform: translateY(-1px); }
  .composer-send:disabled, .composer-send[aria-disabled="true"] { background: var(--bg); border-color: var(--border); color: var(--text-tertiary); cursor: not-allowed; }
  .composer-send:focus-visible, .composer-memchip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) { .composer-send { transition: none; } }
  @media (max-width: 360px) { .composer-right .ai-picker [data-model-label] { display: none; } }
  .composer-shell.composer-shell-sticky { position: sticky; bottom: 0; z-index: var(--z-sticky); }
  .home-composer-tool.web-toggle { display: inline-flex; align-items: center; width: auto; padding: 0 var(--space-3); gap: var(--space-2); border: 1px solid transparent; border-radius: var(--radius-pill); font-size: var(--fs-small); line-height: 1; white-space: nowrap; }
  .home-composer-tool.web-toggle[aria-pressed="true"], .composer-more-panel .home-composer-tool.web-toggle[aria-pressed="true"] { color: var(--warning); border-color: var(--warning); background: var(--warning-soft); }
  .composer-viden-toggle { position: relative; }
  .composer-viden-count { position: absolute; top: calc(-1 * var(--space-1)); right: calc(-1 * var(--space-1)); min-width: var(--space-4); padding: 0 var(--space-1); border-radius: var(--radius-pill); background: var(--accent-fill); color: var(--accent-fill-text); font-size: var(--fs-label); line-height: var(--space-4); text-align: center; }
  .composer-viden-count[hidden] { display: none; }
  .composer-viden .file-library-list { max-height: 40vh; overflow-y: auto; }
  .composer-error[role="alert"] { display: flex; align-items: flex-start; gap: var(--space-2); box-sizing: border-box; margin: var(--space-2) 0 0; padding: var(--space-2) var(--space-3); border: 1px solid var(--danger); border-radius: var(--radius-lg); background: var(--danger-soft); color: var(--danger); font-size: var(--fs-body); line-height: 1.45; }
  .composer-error[role="alert"]:empty { display: none; }
  .composer-error-icon { display: inline-flex; flex: 0 0 auto; margin-top: 1px; }
  .composer-error a { color: inherit; text-decoration: underline; }
  .web-note { font-size: var(--fs-label); color: var(--text-secondary); }
  .handwriting-status, .handwriting-note { margin: var(--space-2) 0 0; font-size: var(--fs-label); color: var(--text-secondary); }
  .handwriting .helpline-card { margin-top: var(--space-3); }
  @media (max-width: 640px) {
.composer-shell .composer-form textarea{min-height:calc(3em + var(--space-4));field-sizing:content}
.composer-shell .composer-tools .composer-more-button{width:var(--control-lg);height:var(--control-lg);padding:0;justify-content:center}
.composer-shell .composer-more-panel :is(.composer-lang select,.read-aloud-speed select){min-height:var(--control-lg)}
.composer-shell :is(.composer-lang select,.composer-tools .btn,.ai-picker>summary){min-height:var(--control-lg)}
.composer-shell .ai-picker>summary{box-sizing:border-box}
.composer-send{width:var(--control-lg);height:var(--control-lg);flex-basis:var(--control-lg)}}

.assistant-sample .composer-form textarea{min-height:calc(3em + var(--space-4));field-sizing:content}
.assistant-sample .composer-tools .composer-more-button{width:var(--control-lg);height:var(--control-lg);padding:0;justify-content:center}
.assistant-sample .composer-more-panel :is(.composer-lang select,.read-aloud-speed select){min-height:var(--control-lg)}
.assistant-sample :is(.composer-lang select,.composer-tools .btn,.ai-picker>summary){min-height:var(--control-lg)}
.assistant-sample .ai-picker>summary{box-sizing:border-box}
  .disclaimer { text-align: center; color: var(--text-tertiary); font-size: var(--fs-label); margin: var(--space-3) 0 0; }
  .home-quota { margin: var(--space-2) 0 0; font-size: var(--fs-label); line-height: 1.45; color: var(--text-tertiary); }
  .home-quota a { margin-left: var(--space-2); }
  .home-quota-warning, .home-quota-exhausted { flex-wrap: wrap; }
  .home-quota-bar { flex: 1 1 100%; width: 100%; height: 8px; }
  .home-quota-exhausted p { flex: 1 1 100%; margin: 0; }

  @media (max-width: 680px) {
    .chat-quiz-card { align-items: flex-start; flex-wrap: wrap; }
    .chat-quiz-card .btn { width: 100%; justify-content: center; }
    .chat-quiz-progress-row { flex-wrap: wrap; }
    .chat-quiz-progress { order: 3; flex-basis: 100%; }
    .chat-quiz-actions { grid-template-columns: minmax(0, 1fr) 112px; }
    .chat-quiz-answer-result { text-align: left; }
  }

  /* ── Employee chat home (S32) ───────────────────────────────────────── */

  .home-scroll:has(> .home-wrap[data-chat-active="true"]) { scroll-padding-bottom: calc(var(--home-composer-height, 12.5rem) + var(--space-3)); }
  /* At <= 900px the document is the scroller and the composer shell sticks to its bottom: the same clearance for focus and scrollIntoView
     (home-chat.ts publishes --home-composer-height on <html> too). 2026-10-15. */
  @media (max-width: 900px) { html:has(.home-wrap[data-chat-active="true"]) { scroll-padding-bottom: calc(var(--home-composer-height, 12.5rem) + var(--space-3)); } }
  /* Assistant chat, the same clearance (2026-11-05; assistant-chat.ts sets the height). */
  .scroll:has(#assistant-chat-messages) { scroll-padding-bottom: calc(var(--assistant-composer-height, 12.5rem) + var(--space-3)); }
  @media (max-width: 900px) { html:has(#assistant-chat-messages) { scroll-padding-bottom: calc(var(--assistant-composer-height, 12.5rem) + var(--space-3)); } }
  .home-wrap { padding-top: var(--space-6); }
  .home-welcome { text-align: center; margin-bottom: var(--space-8); }
  .home-welcome p { margin: 0 0 var(--space-3); color: var(--accent); font-weight: 600; font-size: var(--fs-body); }
  .home-welcome h1 { margin: 0; font-family: var(--font-display); font-size: var(--fs-display); font-weight: 500; line-height: 1.25; letter-spacing: -.02em; }
  @media (max-width: 640px) { .home-welcome h1 { font-size: var(--fs-h1); } }

  /* Hjem draws the ONE composer (components/composer-css.ts); its look rules (radius 24, padding, a 17px field with a 32px floor) are retired, and what is left here is LAYOUT:
     the space under it and, while a chat is open, pinned under the thread. */
  .home-wrap > .composer-shell { margin-bottom: var(--space-8); }
  .composer-shell[data-composer-open] .voice-settings { display: none; }
  .home-mock-chat[hidden], .home-upload-status[hidden] { display: none; }
  .home-wrap[data-chat-active="true"] > .home-welcome,
  .home-wrap[data-chat-active="true"] > .home-actions,
  .home-wrap[data-chat-active="true"] > .home-assistants { display: none; }
  .home-wrap[data-chat-active="true"] > .composer-shell { position: sticky; bottom: 0; margin-bottom: 0; }
  .home-chat-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
  .home-chat-heading h1 { font-size: var(--fs-h1); margin: 0; }
  .home-chat-messages { display: flex; flex-direction: column; gap: var(--space-5); margin: var(--space-8) 0; }
  .home-chat-message { max-width: 85%; padding: var(--space-4) var(--space-5); border-radius: 18px; overflow-wrap: anywhere; }
  .home-chat-message.is-user { align-self: flex-end; background: var(--accent-soft); color: var(--text-primary); }
  .home-chat-message.is-demo { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
  .home-chat-message strong { font-size: var(--fs-xs); color: var(--text-secondary); }
  /* arch#659: the school's own guidelines keep their line breaks, and a long word never widens the page. */
  .school-guidelines-text { white-space: pre-line; overflow-wrap: anywhere; }
  .home-chat-message p { margin: var(--space-2) 0 0; white-space: pre-wrap; }
  .home-chat-note { font-size: var(--fs-xs); color: var(--text-tertiary); margin: var(--space-2) 0 0; }
  .home-chat-note:empty { margin: 0; }
  .home-attach { position: relative; cursor: pointer; overflow: hidden; }
  .home-attach input.file-input-overlay { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: inherit; }
  .home-attach:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
  .home-attach:has(input:disabled) { color: var(--text-tertiary); cursor: wait; }
  .home-upload-status { font-size: var(--fs-label); margin: var(--space-3) 0 0; }
  .home-upload-status[data-state="error"] { color: var(--danger); }
  .home-upload-status[data-state="success"] { color: var(--success); }
  .home-upload-link { display: inline-flex; align-items: center; min-height: var(--control-sm); font-size: var(--fs-xs); color: var(--accent); margin-top: var(--space-2); }
  /* .home-composer-tool is retired as a LOOK (ds-v2 W1a fix round, item 16): the composer tools are icon-btn icon-btn-round; the name stays as the hook the
     composer scripts and tests find them by. */
  .home-composer-tool { flex: 0 0 auto; }
  .home-composer-tool:disabled { cursor: not-allowed; color: var(--text-tertiary); }
  .home-composer-tool[hidden] { display: none; }

  .home-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-10); }
  .home-action-card {
    position: relative; min-height: 180px; display: flex; flex-direction: column; align-items: flex-start;
      padding: var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
    color: var(--text-primary); text-decoration: none;
  }
  a.home-action-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
  .home-action-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--space-3); }
  .home-action-card strong { font-size: var(--fs-prose); }
  .home-action-card p { color: var(--text-secondary); margin: var(--space-2) 0 var(--space-3); font-size: var(--fs-small); }
  .home-action-link { display: inline-flex; align-items: center; gap: var(--space-2); margin-top: auto; font-size: var(--fs-small); font-weight: 700; }
  .home-action-card.is-disabled { background: var(--surface-hover); color: var(--text-tertiary); cursor: not-allowed; opacity: .68; }
  .home-action-card.is-disabled .home-action-icon { background: var(--border); color: var(--text-tertiary); }
  .home-action-card.is-disabled p, .home-action-card.is-disabled .home-action-link { color: var(--text-tertiary); }
  /* Customer's violet, mint and navy fields, adapted to the employee V1 actions. */
  .home-action-assistant { background: var(--home-assistant-bg); color: #FFFFFF; border-color: transparent; }
  .home-action-assistant p { color: #FFFFFF; }
  .home-action-assistant .home-action-icon { background: rgba(255,255,255,.16); color: #FFFFFF; }
  .home-action-knowledge { background: var(--home-knowledge-bg); color: var(--home-knowledge-text); border-color: transparent; }
  .home-action-knowledge p { color: var(--home-knowledge-text); }
  .home-action-knowledge .home-action-icon { background: color-mix(in srgb, var(--home-knowledge-icon) 10%, transparent); color: var(--home-knowledge-icon); }
  .home-action-card.home-action-tools { background: var(--home-tools-bg); color: #FFFFFF; opacity: 1; border: 1px dashed var(--home-tools-border); }
  .home-action-card.home-action-tools .home-action-icon { background: rgba(255,255,255,.1); color: var(--home-tools-text); }
  .home-action-card.home-action-tools p, .home-action-tools.is-disabled .home-action-link { color: var(--home-tools-text); }
  .home-action-tools .home-coming { color: var(--home-tools-text); }
  a.home-action-card { transition: transform .15s ease, box-shadow .15s ease; }
  a.home-action-card:hover { box-shadow: 0 6px 20px color-mix(in srgb, var(--text-primary) 12%, transparent); }
  .home-coming { position: absolute; top: var(--space-5); right: var(--space-5);  }

  .home-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }
  .home-section-head h2 { margin: 0; font-size: var(--fs-title); }
  .home-section-head a { display: inline-flex; align-items: center; min-height: var(--control-sm); color: var(--text-secondary); font-size: var(--fs-small); text-decoration: none; }
  .home-section-head a:hover { color: var(--accent); text-decoration: underline; }

  /* ── Empty assistant workshop (S02-1) ───────────────────────────────── */

  .assistant-templates { width: min(560px, 100%); margin-top: var(--space-10); }
  .assistant-templates h3 {
    margin: 0 0 var(--space-3); color: var(--text-tertiary);
  }
  .assistant-templates h3 span { margin-left: var(--space-2); font-size: var(--fs-xs); }
  .assistant-template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .assistant-template-grid button {
    padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-hover); color: var(--text-tertiary); text-align: left;
  }
  .assistant-template-grid button:disabled { cursor: not-allowed; opacity: .62; }

  @media (max-width: 760px) {
    .home-wrap { padding-top: 0; }
    .home-welcome { align-items: flex-start; }
    .home-actions { grid-template-columns: 1fr; }
    .home-action-card { min-height: 150px; }
    .assistant-template-grid { grid-template-columns: 1fr; }
  }

  /* Dialogs are native dialog elements and their rules are in components/dialog.tsx (DIALOG_CSS). The overlay and modal div pair and its stale-navy
     scrim are retired (ds-v2 S6, 00-design-system.md section 8.19). */

  /* The account menu, and it was UNREACHABLE below 930px of viewport.

     2026-09-01: it is 866px tall, anchored 64px from the top by account.tsx, with no
     max-height and overflow:hidden. So the box simply extended past the bottom of the
     window and the overflow was CLIPPED rather than scrolled. Measured at 1366x768, an
     ordinary laptop: cut off by 162px, and what fell off the bottom was the role switcher,
     Tilføj testdata and Log ud.

     That is not a cosmetic defect. A tester on a 768px screen could not log out, could not
     reset, and could not change role -- which is the one control the test exists to
     offer. The 1440x900 capture was clipping it too, by 30px, so the committed screenshot
     had been recording the bug rather than the menu.

     overflow-y AFTER overflow, deliberately: overflow:hidden is what clips the children
     to the rounded corners and has to stay on the x axis, so this narrows only y. 82px is
     the 64px offset plus an 18px gap at the bottom, matching the 18px inset account.tsx
     already uses on the right. */
  .menu { overflow: hidden; width: 320px;
    max-height: calc(100vh - 82px); overflow-y: auto;
  }
  .menu .who { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); }
  .menu .who .big {
    width: 44px; height: 44px; border-radius: 50%; background: var(--accent-fill); color: var(--accent-fill-text);
    display: grid; place-items: center; font-weight: 700; font-size: var(--fs-small);
  }
  /* The name/e-mail block shrinks and breaks inside the row instead of widening it (1.4.10 at 320px, 200% text). */
  .menu .who > span:not(.big) { min-width: 0; overflow-wrap: anywhere; }
  .menu .who .big { flex: 0 0 auto; overflow: hidden; }
  /* arch 557: the profile picture fills the avatar circle (alt is empty: the name is beside it, or in the summary's label). */
  .avatar { overflow: hidden; }
  .avatar img, .menu .who .big img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .menu .who-name { display: block; font-size: var(--fs-prose); }
  .menu .rail-label { padding: var(--space-3) var(--space-4) var(--space-half); }
  .menu .menu-note { padding: 0 var(--space-4); font-size: var(--fs-xs); }
  .menu .item-muted { color: var(--text-tertiary); }
  .menu .sec { border-top: 1px solid var(--border); }

  /* The theme picker, on the Tilgængelighed page. A plain select: three named states,
     one of them current, which is exactly what a select is for — and it stays one row
     tall on a phone, where three segments wrapped.

     A select cannot carry a colour swatch, so the labels do the work alone. That is the
     trade, and it is why they say "Lyst" and "Mørkt" rather than naming the palette. */
  .theme-pick { display: inline-flex; align-items: center; gap: var(--space-2); }
  .theme-select {
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--text-primary);
    padding: var(--space-2) var(--space-3); font-size: var(--fs-body); min-width: 16ch;
  }

  .menu .item {
    display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--control-lg);
    padding: var(--space-2) var(--space-4); background: transparent; border: 0; cursor: pointer;
    text-align: left; font-size: var(--fs-body); text-decoration: none; color: inherit;
  }
  .menu .item:hover:not(:disabled) { background: var(--surface-hover); }
  .menu .item:disabled { color: var(--text-tertiary); cursor: not-allowed; }
  .menu .item .grow { flex: 1 1 auto; }

  /* Note (components/note.tsx): the one notice. Navy body text; the icon, the title and the 1px border take the tone. */
  .note {
    display: flex; gap: var(--space-3); align-items: flex-start; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4);
    font-size: var(--fs-small); color: var(--text-primary);
  }
  .note > svg { flex: 0 0 auto; margin-top: 1px; }
  .note-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
  .note-body > * { margin: 0; }
  .note-body > * + * { margin-top: var(--space-1); }
  .note-title { display: block; font-weight: 700; font-size: var(--fs-body); }
  .note-action { flex: 0 0 auto; align-self: center; }
  .note-info   { background: var(--accent-soft);  border-color: var(--accent); }
  .note-info > svg, .note-info .note-title { color: var(--accent); }
  .note-ok     { background: var(--success-soft); border-color: var(--success); }
  .note-ok > svg, .note-ok .note-title { color: var(--success); }
  .note-warn   { background: var(--warning-soft); border-color: var(--warning); }
  .note-warn > svg, .note-warn .note-title { color: var(--warning); }
  .note-danger { background: var(--danger-soft);  border-color: var(--danger); }
  .note-danger > svg, .note-danger .note-title { color: var(--danger); }
  .note-ai     { background: var(--ai-soft);      border-color: var(--ai); }
  .note-ai > svg, .note-ai .note-title { color: var(--ai); }
  .note-compact { padding: var(--space-1) var(--space-3); margin-top: var(--space-2); font-size: var(--fs-small); }
  .note-band { border-width: 1px 0; border-radius: 0; padding: var(--space-2) var(--space-6); }
  .note-gap { margin: 0 0 var(--space-4); }
  .note[hidden] { display: none; }
  @media (max-width: 640px) { .note { flex-wrap: wrap; } .note-action { margin-left: var(--space-8); } .note-band { padding: var(--space-2) var(--space-4); } }

  .list-plain { list-style: none; margin: 0; padding: 0; }
  .list-plain > li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
  .list-plain > li:last-child { border-bottom: 0; }


  .thumb {
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-hover); aspect-ratio: 4 / 3;
    display: grid; place-items: center; color: var(--text-tertiary);
  }

  .rail-group { display: flex; align-items: center; gap: var(--space-2); padding-left: var(--space-1); }
  .samtaler-flat { padding-left: var(--space-1); }
  .samtaler-flat a { font-size: var(--fs-body); color: var(--text-primary); padding: var(--space-2) var(--space-3); }

  .empty-caption { margin: 0; text-align: center; color: var(--text-tertiary); padding: var(--space-6) 0; font-size: var(--fs-body); }

  /* ── Long forms (S09) ────────────────────────────────────────────────── */

  /* The page column is the PageContent width (section 4.3: text, chat, wide, workspace); no screen caps its own column (the 680, 1180, 1120 and 880px ones are retired). */
  /* About 45/55 since 2026-11-05 (FB 08/10); was minmax(0, 1.72fr) minmax(300px, .9fr), a 385px preview at 1280. */
  /* arch#675 D1: one column at every width (the preview pane is gone). */
  /* FD 2026-11-12: the column is centred at every width (it was left-stuck inside the wide page column), and each group is its own white card. */
  .assistant-builder-layout { display: block; max-width: 760px; margin-inline: auto; }
  .assistant-card { margin: 0 0 var(--space-4); min-width: 0; }
  .assistant-card > .field, .assistant-card > fieldset > .field, .assistant-card > .ds-fieldset { margin-bottom: var(--space-4); }
  .assistant-card > :last-child, .assistant-card > fieldset > :last-child { margin-bottom: 0; }
  .assistant-sample.assistant-card { padding: var(--card-pad); margin-top: 0; }
  /* arch#695: "+ Tilføj" menu (name and a one-line help per item) and the compact add-on rows (icon, name, one line, Redigér, Fjern). Tokens only. */
  .assistant-add-menu { position: relative; }
  .assistant-add-menu .assistant-add-options { position: absolute; z-index: 25; right: 0; top: 100%; margin-top: var(--space-1); min-width: 18rem; max-width: calc(100vw - var(--space-8)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 var(--space-2) var(--space-6) color-mix(in srgb, var(--text-primary) 14%, transparent); }
  .assistant-add-options > :is(a, button).ds-menu-item { display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; text-align: left; padding: var(--space-2) var(--space-3); border-radius: var(--radius); color: var(--text-primary); font-size: var(--fs-small); text-decoration: none; }
  .assistant-add-options > :is(a, button).ds-menu-item:hover { background: var(--surface-hover); }
  .assistant-add-options > .ds-menu-item[hidden] { display: none; }
  .assistant-addon { margin-bottom: var(--space-2); }
  .assistant-addon[hidden], .addon-row[hidden], .addon-body[hidden] { display: none; }
  .addon-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .addon-row .grow { min-width: 0; display: grid; gap: var(--space-half); }
  .addon-row .grow strong { font-size: var(--fs-small); }
  .addon-row .grow small { color: var(--text-tertiary); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .assistant-form:not([data-js]) :is([data-addon-edit], [data-addon-remove]) { display: none; }
  .addon-body { margin-top: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); }
  .assistant-addons-empty { margin: 0; }
  .assistant-addons-empty[hidden] { display: none; }
  .assistant-builder-main { margin-bottom: var(--space-3); }
  .assistant-addons { margin-bottom: var(--space-5); }
  .assistant-materials { margin-top: var(--space-3); }
  .assistant-form { min-width: 0; padding: 0 0 var(--space-16); }
  .assistant-form > .field, .assistant-form > fieldset > .field, .assistant-form > .ds-field, .assistant-form > fieldset > .ds-field { margin-bottom: var(--space-5); }
  .field-hint { display: block; font-size: var(--fs-label); color: var(--text-tertiary); margin: calc(var(--space-half) * -1) 0 var(--space-2); font-weight: 400; }
  .field > span > .field-hint { margin-top: var(--space-1); }
  .assistant-save-state { color: var(--text-tertiary); font-size: var(--fs-small); overflow-wrap: anywhere; }
  /* arch#695: the editor's head. The back link on its own line, then name, status pill, who pill and links; the save controls on the right. Sticky once the page scrolls as a document. */
  .assistant-head-main { display: flex; flex-direction: column; gap: var(--space-1); flex: 1 1 auto; min-width: 0; }
  .assistant-head-line { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--space-3); row-gap: var(--space-1); min-width: 0; }
  .assistant-head-line h1 { font-size: var(--fs-title); font-weight: 600; margin: 0; overflow-wrap: anywhere; }
  .assistant-head-link { display: inline-flex; align-items: center; min-height: var(--control-sm); color: var(--accent); font-weight: 600; text-decoration: none; }
  .assistant-head-line { position: relative; }
  .assistant-head-line .ds-tooltip { position: static; }
  .assistant-head-line .ds-tooltip > .ds-tooltip-text { max-width: min(16rem, 100%); }
  .assistant-head-link:hover { color: var(--accent-800); text-decoration: underline; }
  .page-head:has(.assistant-head-main) { align-items: flex-end; }
  .assistant-head-actions { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; align-items: center; min-width: 0; }
  .assistant-saved { color: var(--text-secondary); font-size: var(--fs-label); }
  .assistant-saved[hidden] { display: none; }
  .assistant-who-pill { cursor: default; }
  @media (max-width: 900px) { .page-head:has(.assistant-head-main) { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); } }
  .assistant-section-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
    margin-bottom: var(--space-2);
  }
  .assistant-section-head strong { display: block; font-size: var(--fs-label); font-weight: 600; }
  .assistant-section-head small { display: block; margin-top: var(--space-1); color: var(--text-tertiary); font-size: var(--fs-label); }
  .assistant-material-row .grow { display: grid; gap: var(--space-half); }
  .assistant-material-row .grow strong { font-size: var(--fs-small); }
  .assistant-material-row .grow small { color: var(--text-tertiary); font-size: var(--fs-xs); }
  .row-card {
    display: flex; align-items: center; gap: var(--space-3);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--space-3) var(--space-4);
  }
  .select-pill {
    display: inline-flex; align-items: center; gap: var(--space-2);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: var(--space-3) var(--space-4); font-size: var(--fs-body);
    min-width: 270px; cursor: pointer;
  }
  .select-pill .grow { flex: 1 1 auto; text-align: left; }
  .head-actions { display: flex; align-items: center; gap: var(--space-3); }
  .back-link { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-sm); color: var(--text-secondary); text-decoration: none; }

  .assistant-sample { min-width: 0; padding: var(--space-4) 0 var(--space-6); }
  .assistant-sample > h2 { margin: 0 0 var(--space-3); color: var(--text-secondary); }
  .assistant-sample .composer-shell { margin-top: var(--space-3); text-align: left; }
  .assistant-sample-note { margin: var(--space-3) auto 0; color: var(--text-tertiary); font-size: var(--fs-label); line-height: 1.4; }

  /* ── Model picker (S11) ──────────────────────────────────────────────── */

  .model-menu {
    width: 400px; max-width: 100%; overflow: hidden;
  }
  .model-foot {
    display: flex; gap: var(--space-2); align-items: flex-start;
    padding: var(--space-4) var(--space-5); font-size: var(--fs-label); color: var(--text-tertiary);
  }

  /* ── Group register and permissions (S13) ────────────────────────────── */

  .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
  .panel + .panel { margin-top: var(--space-5); }
  /* An open row menu must not be clipped by the panel (the last row's menu has nowhere else to go without script). */
  .panel:has(.ds-popover[open]), .panel:has(.ds-menu[open]) { overflow: visible; }
  .panel > header {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-4) var(--card-pad); border-bottom: 1px solid var(--border);
  }
  .panel > header h2 { margin: 0; font-size: var(--fs-prose); font-weight: 700; flex: 1 1 auto; }
  .panel > header .aside { font-size: var(--fs-label); color: var(--text-tertiary); }
  .panel-body { padding: var(--card-pad); }
  .panel-body-flush { padding: 0; }
  .panel-block { margin: 0; padding: var(--card-pad); }
  /* A bare EmptyState sentence inside a padded panel body has its own top padding on top of the body's: it takes a plain block of space instead (W1a item 8). */
  .own-cap { padding: var(--space-3) var(--card-pad); }
  .panel-body-flush .list-plain > li { padding-left: var(--card-pad); padding-right: var(--card-pad); }
  .panel-body > :first-child { margin-top: 0; }
  .panel-body > :last-child { margin-bottom: 0; }
  .panel .inner { padding: 0 var(--card-pad); }
  .panel .foot-note {
    display: flex; gap: var(--space-2); align-items: flex-start;
    padding: var(--space-4) var(--card-pad); border-top: 1px solid var(--border);
    font-size: var(--fs-label); color: var(--text-secondary);
  }
  .yes { color: var(--success); }
  .no { color: var(--danger); }
  .na { color: var(--text-tertiary); }

  /* ── Audit log (S14) ─────────────────────────────────────────────────── */

  .filterbar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-6); flex-wrap: wrap; }
  .list-row, .list-plain > li.list-row {
    position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-3) var(--card-pad);
    border-bottom: 1px solid var(--border); background: var(--surface);
  }
  .list-row:last-child { border-bottom: 0; }
  .list-row-lead { flex: 0 0 auto; display: inline-flex; align-items: center; color: var(--text-tertiary); }
  .list-row-main { flex: 1 1 auto; min-width: 0; }
  .list-row-title { margin: 0; font-size: var(--fs-body); font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list-row-wrap .list-row-title { white-space: normal; overflow-wrap: anywhere; }
  /* A title lets its info card out while the card is open: the trigger ellipsises itself, and overflow: hidden here clipped every open card to the title line (arch 689).
     Only while open, as .panel does: a closed card still has its box, and at 320 px it widened the page (08-reflow, train-120 CI). */
  .list-row-title:has(> .ds-hovercard:hover, > .ds-hovercard:focus-within, > .ds-hovercard[data-open="true"]) { overflow: visible; }
  .list-row-meta { margin: var(--space-half) 0 0; font-size: var(--fs-label); color: var(--text-tertiary); overflow-wrap: anywhere; }
  .list-row-details { width: 100%; }
  .list-row-details > summary { display: flex; align-items: center; gap: var(--space-2); min-height: var(--space-12); padding: var(--space-1) var(--space-2); border-radius: var(--radius); cursor: pointer; list-style: none; }
  .list-row-details > summary::-webkit-details-marker { display: none; }
  .list-row-details > summary:hover { background: var(--surface-hover); }
  .list-row-summary { display: block; flex: 1 1 auto; min-width: 0; }
  .list-row-summary > small { display: block; }
  /* arch#681 v5: inside an expandable row the title is an inline <strong>, so the ellipsis never applied and the trail drew over it. */
  .list-row-summary > .list-row-title { display: block; }
  .list-row-detail p { margin: var(--space-3) 0 0; color: var(--text-tertiary); font-size: var(--fs-small); }
  .list-row-detail ul { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
  .list-row-detail li + li { border-top: 1px solid var(--border); }
  .list-row-detail a { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-lg); padding: var(--space-2); border-radius: var(--radius); }
  .list-row-detail a:hover { background: var(--surface-hover); }
  .list-row-detail a span { flex: 1; overflow-wrap: anywhere; min-width: 0; }
  .list-row-detail { margin: var(--space-2) 0 var(--space-1); padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
  .list-row:has(.list-row-details[open]) { align-items: flex-start; }
  /* W2b item 1: NO z-index here. A z-index made every trail a stacking context, so an open row menu (a popover inside the trail) was painted under the NEXT
     row, which caught its clicks. position: relative alone puts the trail after the stretched link's ::after in paint order (it is later in the tree), and
     the popover's own --z-dropdown layer then competes in the page's context. */
  .list-row-trail { flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-2); position: relative; }
  /* A bare form is block-level: its line box was taller than its button and left it above the badge and the menu. Flex makes it as tall as the button (8.22). */
  .list-row-trail > form { display: flex; align-items: center; margin: 0; }
  .list-row-link { color: inherit; text-decoration: none; }
  .list-row-start { display: inline-flex; align-items: center; min-height: var(--control-sm); background: none; border: 0; padding: 0; margin: 0; font: inherit; text-align: left; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .list-row-link::after { content: ""; position: absolute; inset: 0; }
  .list-row-whole:hover { background: var(--surface-hover); }
  .list-row-link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
  .list-row.is-pending { color: var(--text-secondary); }
  .list-row.is-locked, .list-row.is-locked .list-row-title { color: var(--text-tertiary); }
  .list-row time { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--text-tertiary); min-width: 84px; text-align: right; }
  @media (max-width: 640px) {
    .list-row { flex-wrap: wrap; gap: var(--space-2); }
    .list-row-main { flex: 1 1 8rem; }
    /* A long title wraps at phone width instead of running out of the row: the link is as wide as its title, not as its text (e2e 08, Samtaler in Stor). */
    .list-row-title { white-space: normal; overflow-wrap: anywhere; }
    .list-row-trail { flex: 1 1 100%; flex-wrap: wrap; }
    /* arch#681 v5: a wrapped trail starts under the title, not at the row edge left of the icon. A row whose lead is not an 18px icon sets --list-row-lead-w. */
    .list-row-lead ~ .list-row-trail { padding-inline-start: calc(var(--list-row-lead-w, var(--icon-md)) + var(--space-2)); }
    /* F-37 section 3.8, back after the row rewrite (S9): a row's own buttons and its menu are 44 by 44 at phone width (e2e 19). */
    .list-row-trail .btn, .list-row-trail .icon-btn { min-height: var(--control-lg); min-width: var(--control-lg); }
  }

  /* ── Stepper (S29) ───────────────────────────────────────────────────── */

  /* §8.11: one group, 1px --border-strong, buttons 40x40, a value cell of at least 56px (40 + 16), dividers --border. The two forms (A- and A+) dissolve
     into the group (display: contents) so the buttons are its flex items, and the group never shrinks: it is 136px wide, and the row's text
     is what gives way at 320px (2026-10-16, W0 fix round: the group was clipped there). */
  .stepper { display: inline-flex; align-items: stretch; flex: 0 0 auto; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .stepper form { display: contents; }
  .stepper button { border: 0; background: transparent; cursor: pointer; width: var(--control-md); min-height: var(--control-md); padding: 0; font: inherit; font-weight: 600; color: var(--text-primary); }
  .stepper .val { display: flex; align-items: center; justify-content: center; min-width: calc(var(--space-10) + var(--space-4)); padding: 0 var(--space-2); font-size: var(--fs-small); border-left: 1px solid var(--border); border-right: 1px solid var(--border); font-variant-numeric: tabular-nums; }
  .setting-row { display: flex; align-items: center; gap: var(--space-4); min-height: 56px; padding: var(--space-4) var(--card-pad); border-bottom: 1px solid var(--border); }
  .setting-row:last-child { border-bottom: 0; }
  /* arch 580 (F-40 3.6): the logo card; the preview is always on a light panel. */
  .school-logo-row { flex-wrap: wrap; align-items: flex-start; }
  .school-logo-box {
    display: flex; align-items: center; justify-content: center; min-width: 10rem; min-height: 6rem; padding: var(--space-3);
    background: var(--neutral-0); border: 1px solid var(--border); border-radius: var(--radius);
  }
  .school-logo-box img { display: block; max-width: 100%; max-height: 8rem; width: auto; height: auto; }
  .school-logo-empty { color: var(--text-tertiary); font-size: var(--fs-label); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: var(--space-5) var(--space-6); }
  .school-logo-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-left: auto; align-items: center; }
  .school-logo-actions label.btn { position: relative; overflow: hidden; }
  .school-logo-actions .file-input-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  /* arch#638: the school's login link: the address wraps anywhere, and the copy button sits under it on a phone. */
  .school-login-link { flex-wrap: wrap; align-items: flex-start; }
  .school-login-link code { overflow-wrap: anywhere; flex: 1 1 14rem; min-width: 0; }
  .school-switch-locked { display: inline-flex; align-items: center; gap: var(--space-3); }
  @media (max-width: 640px) {
    .school-logo-box { width: 100%; }
    .school-logo-actions { margin-left: 0; width: 100%; flex-direction: column; align-items: stretch; }
    .school-logo-actions .btn, .school-logo-actions form { width: 100%; justify-content: center; }
  }
  /* 2026-10-16 (ds-v2 S4, decision 20): a disabled setting is disabled + tertiary text + the visible reason ("Deaktiveret", the sub line), never opacity (.45 measured 2.86:1). */
  .setting-disabled { background: var(--surface); }
  .setting-disabled strong { color: var(--text-secondary); }
  .setting-disabled-label { display: inline-flex; align-items: center; gap: var(--space-1); margin: var(--space-1) 0; font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); }
  .setting-disabled :disabled:not(.switch) { cursor: not-allowed; color: var(--text-tertiary); background-color: var(--bg); border-color: var(--border); }
  .setting-row .grow { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
  .setting-row strong { display: block; font-size: var(--fs-body); font-weight: 600; }
  .setting-row span.sub { display: block; color: var(--text-tertiary); font-size: var(--fs-label); }
  /* Block inside a table cell too; see screens/operator.tsx for what inline cost. */
  table.data td span.sub { display: block; color: var(--text-tertiary); font-size: var(--fs-label); }

  /* ── Memory (S24) ────────────────────────────────────────────────────── */

  .memhead { display: flex; align-items: center; gap: var(--space-4); }
  .memhead .grow { flex: 1 1 auto; }
  .memhead strong { display: block; font-size: var(--fs-prose); font-weight: 700; }
  .memhead span.sub { display: block; color: var(--text-secondary); font-size: var(--fs-small); }
  /* (The memrow rows are retired: every list row is the ListRow, ds-v2 S9.) */

  /* ── Prompt library (S18) ────────────────────────────────────────────── */

  .prompt-card { margin-bottom: var(--space-4); }
  .prompt-card .top { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
  .prompt-card h3 { margin: 0; font-size: var(--fs-prose); font-weight: 700; }
  .prompt-card .used { margin-left: auto; font-size: var(--fs-label); color: var(--text-tertiary); }
  .prompt-card .body { margin: 0 0 var(--space-4); color: var(--text-secondary); }
  .prompt-card .foot { display: flex; align-items: center; gap: var(--space-2); }

  .brand-rail { padding: var(--space-1) var(--space-1) var(--space-4); color: var(--text-primary); }
  .brand-mark-dark { background: var(--topbar-bg); color: var(--topbar-text); }

  /* The refusal surfaces. This is the single product grammar for the designed chat and
     every other screen; the retired standalone chat and its second token vocabulary are gone. */
  .hjaelp { font-size: var(--fs-body); }
  .hjaelp a { font-weight: 700; }
  /* ESC-13: the staff support card is calm, not a warning (F-27 §3.4: the surface token, no marker). It is not a notice, so it has no tone. */
  .helpline-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); background: var(--surface); }
  .helpline-card h2 { margin: 0 0 var(--space-2); font-size: var(--fs-title); font-weight: 700; }
  .helpline-card p { margin: 0 0 var(--space-2); }
  .helpline-card p:last-child { margin-bottom: 0; }
  .helpline-card ul.hjaelp { margin: 0 0 var(--space-2); padding-left: var(--space-5); }
  .helpline-card ul.hjaelp li { margin-bottom: var(--space-2); }

  /* An input that sits inline in a row of text, so a value can be edited where it is
     read rather than behind a dialog. */
  .inline-input {
    border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface);
    padding: var(--space-1) var(--space-2); font-size: var(--fs-label); width: 15ch; color: var(--text-primary);
  }
  /* A retention period can cite its legal basis, and the citation is the point: S28's
     comment says "a period with no cited basis is one nobody can defend to a DPO". At
     15ch, '10 år — jf. arkivloven' (22 characters) was cut to '10 år — jf. arkiv' on
     screen — the Archives Act reduced to a common noun, in a field a DPO reads. Widened
     here rather than on '.inline-input' itself because S05's quota fields share that class
     and hold values like '40 besk./dag', which would then sit in an oversized box. */
  .inline-input.wide { width: 24ch; }
  .mini-select {
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    padding: var(--space-1) var(--space-2); font-size: var(--fs-label); max-width: 15ch;
  }

  .rail .empty-caption, .rail-list .empty-caption { text-align: left; font-size: var(--fs-label); padding: var(--space-1) var(--space-3); }
  .crumb-link { color: var(--text-secondary); text-decoration: none; }
  .crumb-link:hover { color: var(--accent); }
  .role-pick { display: flex; flex-direction: column; gap: var(--space-half); padding: var(--space-1) 0; }
  .role-pick button {
    display: flex; align-items: center; gap: var(--space-3); width: 100%;
    padding: var(--space-3) var(--space-4); background: transparent; border: 0; cursor: pointer;
    text-align: left; font-size: var(--fs-body);
  }
  .role-pick button:hover { background: var(--surface-hover); }
  .role-pick button[aria-current="true"] { font-weight: 700; color: var(--accent); }

  /* ── Assistant / object cards ────────────────────────────────────────── */

  .obj-card { display: flex; flex-direction: column; gap: 0; padding: 0; }
  .obj-card .top { display: flex; gap: var(--space-4); padding: var(--space-5) var(--card-pad) var(--space-4); }
  .obj-icon {
    width: 44px; height: 44px; border-radius: var(--radius); flex: 0 0 auto;
    background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center;
  }
  .obj-card h3 { margin: 0 0 var(--space-1); font-size: var(--fs-title); font-weight: 700; letter-spacing: -.01em; }
  .obj-card .where { margin: 0 0 var(--space-3); color: var(--text-secondary); font-size: var(--fs-small); }
  .obj-card .foot {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border);
  }
  button.assistant-builder-link { border: 0; background: transparent; cursor: pointer; }
  .fag-dashed { border-radius: 50% !important; }

  /* ── KPI strip ───────────────────────────────────────────────────────── */

  .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
  @media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .kpis .card { padding: var(--space-4) var(--space-5); }
  .kpis .kpi-label { margin-bottom: var(--space-2); text-transform: none; letter-spacing: 0; font-size: var(--fs-small); font-weight: 400; color: var(--text-secondary); }
  .kpis .kpi { display: block; margin-bottom: var(--space-1); }
  .kpis .foot { font-size: var(--fs-label); color: var(--text-tertiary); }
  .kpi-ok { color: var(--success); }
  .kpi-danger { color: var(--accent); }

  .quota + .quota { margin-top: var(--space-2); border-top: 1px solid var(--border); padding-top: var(--space-4); }
  .quota .head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
  .quota .head h3 { margin: 0; font-size: var(--fs-body); font-weight: 700; }
  .quota .head .pct { margin-left: auto; font-weight: 700; font-size: var(--fs-small); }
  .quota .meta { display: flex; align-items: center; gap: var(--space-5); margin-top: var(--space-3); font-size: var(--fs-label); color: var(--text-tertiary); }
  .quota .meta .grow { flex: 1 1 auto; }

  .kv { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
  .kv td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .kv tr:last-child td { border-bottom: 0; }
  .kv td:first-child { color: var(--text-secondary); }
  .kv td:last-child { font-weight: 700; text-align: right; }
  .kv-boxed { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

  .dotlist { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
  .dotlist li { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-1) 0; font-size: var(--fs-small); }
  .dotlist .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-fill); flex: 0 0 auto; }
  .dotlist b { font-variant-numeric: tabular-nums; }
  .dotlist span { color: var(--text-secondary); }

  .split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
  @media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

  /* ── Exam lockdown ───────────────────────────────────────────────────── */

  .center-card {
    flex: 1 1 auto; display: grid; place-items: center; padding: var(--space-6); overflow-y: auto;
  }
  .center-card > .card { width: min(560px, 100%); padding: var(--space-8) var(--space-10); text-align: center; }
  .center-card h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -.02em; margin: var(--space-6) 0 var(--space-3); }
  .center-card > .card > p { color: var(--text-secondary); margin: 0 0 var(--space-6); }
  .kv-mid td { text-align: left; }
  .kv-mid td:last-child { text-align: left; width: 55%; }

  /* ── Theme catalogue (S03) ───────────────────────────────────────────── */

  .pane-split { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); min-height: 0; }
  .pane { overflow-y: auto; padding: var(--card-pad) var(--page-gutter) var(--space-6); }
  .pane + .pane { border-left: 1px solid var(--border); }
  @media (max-width: 1100px) { .pane-split { grid-template-columns: 1fr; overflow-y: auto; } .pane { overflow: visible; } .pane + .pane { border-left: 0; border-top: 1px solid var(--border); } }

  /* S09-1 / S09-2: deterministic authoring conversations.  These look like the
     conversational builder without implying that a model is connected. */
  .builder-panes { background: var(--bg); }
  .builder-thread { display: grid; gap: var(--space-8); max-width: 700px; padding: var(--space-3) var(--space-3) var(--space-6); }
  .builder-ai, .builder-user { border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); font-size: var(--fs-title); line-height: 1.45; }
  .builder-ai { justify-self: start; background: var(--surface); border: 1px solid var(--border); max-width: 72%; }
  .builder-user { justify-self: end; background: var(--accent-soft); color: var(--text-primary); max-width: 62%; }
  .builder-draft { max-width: 620px; margin: var(--space-3) auto; }
  .builder-draft > label:not(.skip) { display: block; font-size: var(--fs-small); font-weight: 700; letter-spacing: .04em; margin-bottom: var(--space-2); }
  .builder-draft textarea { width: 100%; resize: vertical; margin: var(--space-3) 0; line-height: 1.45; }
  .builder-draft input[type="text"] { width: 100%; margin-bottom: var(--space-3); }
  .builder-note { display: flex; align-items: center; gap: var(--space-2); color: var(--text-tertiary); font-size: var(--fs-label); margin: var(--space-3) 0; }
  .builder-submit { width: 100%; justify-content: center; margin-top: var(--space-3); }

  /* V1 quiz: wide conversation, compact keyboard-operable question cards.
     Independent of the instruction builder and the shared split panes. */
  .quiz-page { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
  .quiz-page .page-head { border-bottom: 1px solid var(--border); flex-wrap: wrap; }
  .quiz-page .page-title { font-size: var(--fs-title); }
  .quiz-page .crumbs { flex-wrap: wrap; }
  .quiz-assistant-name { font-size: var(--fs-small); overflow-wrap: anywhere; max-width: 180px; }
  .quiz-panes { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0,1.75fr) minmax(360px,1fr); gap: var(--space-8); padding: var(--space-6) var(--space-6) var(--space-8); overflow-y: auto; align-content: start; }
  @media (max-width: 900px) { .quiz-panes, .center-card { overflow: visible; } }
  .quiz-conversation, .quiz-draft { min-width: 0; }
  .quiz-conversation .builder-thread { max-width: none; padding: 0 0 var(--space-4); gap: var(--space-5); }
  .quiz-conversation .builder-ai, .quiz-conversation .builder-user { font-size: var(--fs-prose); overflow-wrap: anywhere; }
  .quiz-conversation .builder-ai { max-width: 78%; }
  .quiz-conversation .builder-user { max-width: 68%; }
  .quiz-model { display: inline-flex; align-items: center; gap: var(--space-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3); }
  .quiz-model select { background: transparent; border: 0; font-size: var(--fs-small); max-width: 155px; }
  .quiz-draft h2 { font-size: var(--fs-small); margin: 0 0 var(--space-3); }
  .quiz-note { color: var(--text-tertiary); font-size: var(--fs-label); line-height: 1.5; margin: var(--space-3) 0; }
  .quiz-draft h2 + .quiz-note { margin-top: 0; }
  .quiz-title-field { margin-bottom: var(--space-4); }
  .quiz-title-field input { background: var(--surface); border-color: var(--border); }
  .quiz-question-list { display: grid; gap: var(--space-3); }
  .quiz-question { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0; overflow: hidden; }
  .quiz-question summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); cursor: pointer; list-style: none; }
  .quiz-question summary::-webkit-details-marker { display: none; }
  .quiz-question summary:hover { background: var(--surface-hover); }
  .quiz-question summary:focus-visible { outline-offset: -3px; }
  .quiz-question-copy { min-width: 0; overflow-wrap: anywhere; }
  .quiz-question-title { display: block; font-size: var(--fs-small); line-height: 1.45; }
  .quiz-question-meta { display: block; margin-top: var(--space-1); color: var(--text-tertiary); font-size: var(--fs-label); }
  .quiz-question-editor { padding: 0 var(--space-3) var(--space-3); }
  .quiz-question-editor textarea { font-size: var(--fs-small); line-height: 1.5; }
  .quiz-scope-note { font-size: var(--fs-xs); }
  @media (max-width: 1100px) {
    .quiz-panes { grid-template-columns: minmax(0,1fr); }
    .quiz-page .head-actions { flex-wrap: wrap; }
    .quiz-assistant-name { display: none; }
  }
  @media (max-width: 600px) {
    .quiz-panes { padding: var(--space-4) var(--space-4) var(--space-6); }
    .quiz-page .page-head { padding: var(--space-4); }
    .quiz-conversation .builder-ai, .quiz-conversation .builder-user { max-width: 90%; }
  }

  /* S36 — a server-rendered tag catalogue.  Selection is a URL, so opening a tag is
     linkable and the edit drawer still works with scripts disabled. */
  .tag-admin { padding-top: var(--space-6); }
  .tag-admin-groups { display: grid; gap: var(--space-6); margin: var(--space-8) 0; }
  .tag-admin-group { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); }
  .tag-admin-group.has-instructions { background: color-mix(in srgb, var(--accent) 5%, transparent); }
  .tag-admin-group h2 { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--fs-title); }
  .tag-admin-group.has-instructions h2 > svg { color: var(--accent); }
  .tag-admin-group .n, .tag-linked-assistants .n { font-size: var(--fs-small); color: var(--text-tertiary); font-weight: 500; }
  .tag-admin-group > .field-hint { max-width: 72ch; }
  .tag-admin-group .tag-admin-list { margin: var(--space-5) 0 0; gap: var(--space-2); }
  .tag-admin-chip { flex-wrap: wrap; max-width: 100%; overflow-wrap: anywhere; }
  .tag-kind { display: flex; align-items: center; gap: var(--space-2); color: var(--accent); font-size: var(--fs-small); }
  .tag-linked-assistants { margin: var(--space-6) 0; padding: var(--space-5) 0; border-block: 1px solid var(--border); }
  .tag-linked-assistants h3 { margin: 0 0 var(--space-2); font-size: var(--fs-prose); }
  .tag-linked-assistants ul { list-style: none; padding: 0; margin: var(--space-3) 0 0; }
  .tag-linked-assistants a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2); color: var(--text-primary); text-decoration: none; border-radius: var(--radius); }
  .tag-linked-assistants a:hover { background: var(--surface-hover); }
  .tag-linked-assistants a > span { flex: 1; overflow-wrap: anywhere; }
  .tag-editor { scroll-margin-top: var(--space-4); }
  .tag-admin-list { display: flex; flex-wrap: wrap; gap: var(--space-4); list-style: none; padding: 0; margin: var(--space-6) 0; }
  .tag-admin-chip .n { color: var(--text-tertiary); font-size: var(--fs-label); font-weight: 500; }
  .tag-editor { margin-top: var(--space-10); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-6); box-shadow: 0 18px 42px color-mix(in srgb, var(--text-primary) 10%, transparent); }
  .tag-editor-head, .tag-editor-actions { display: flex; align-items: center; gap: var(--space-3); }
  .tag-editor-head { margin-bottom: var(--space-5); }
  .tag-editor-head h2 { margin: 0; font-size: var(--fs-title); flex: 1 1 auto; }
  .tag-editor .field { margin-bottom: var(--space-5); }
  .tag-editor textarea { width: 100%; resize: vertical; }
  .tag-editor-actions .grow { flex: 1 1 auto; }

  .theme-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
  .theme-list > summary, .theme-head {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
    font-weight: 600; cursor: pointer; list-style: none;
  }
  .theme-group {

    color: var(--text-tertiary); padding: var(--space-2) var(--space-4) var(--space-1); background: var(--bg);
    border-top: 1px solid var(--border);
  }
  /* (The theme-row rows are retired: ds-v2 S9.) */
  .swatch {
    width: 30px; height: 22px; border-radius: 6px; flex: 0 0 auto;
    border: 1px solid var(--border-strong); overflow: hidden;
    display: flex; flex-direction: column;
  }
  .swatch i { display: block; flex: 1 1 0; }
  .radio-on { color: var(--accent-fill); }
  .chip-aa { background: var(--success-soft); color: var(--success); }

  .test-strip {

    color: var(--text-tertiary); background: var(--bg);
    border: 1px solid var(--border); border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0; padding: var(--space-3) var(--space-4);
  }
  .test-panel { border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); padding: var(--space-5); }
  .test-panel .who { display: flex; align-items: center; gap: var(--space-3); font-weight: 700; margin-bottom: var(--space-3); }
  .test-panel .mark {
    width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
    font-weight: 700; font-size: var(--fs-small);
  }
  .test-panel .acts { display: flex; gap: var(--space-3); margin-top: var(--space-5); }
  .test-panel .acts button { border-radius: var(--radius); padding: var(--space-3) var(--card-pad); font-weight: 600; border: 1px solid transparent; cursor: pointer; }
  .prev-light { background: var(--neutral-50); color: var(--neutral-800); }
  .prev-light .mark { background: var(--neutral-800); color: #fff; }
  .prev-light .send { background: var(--neutral-800); color: #fff; }
  .prev-light .cancel { background: transparent; border-color: var(--neutral-300); color: var(--neutral-800); }
  .prev-dark { background: var(--neutral-900); color: var(--neutral-50); border-color: var(--neutral-900); }
  .prev-dark .mark { background: var(--accent-500); color: var(--neutral-0); }
  .prev-dark .send { background: var(--accent-500); color: var(--neutral-0); }
  .prev-dark .cancel { background: transparent; border-color: var(--neutral-600); color: var(--neutral-50); }

  /* ── S02: the assistant table, its filters and its row menu (2026-09-02) ─── */
  .search-wide { margin-bottom: var(--space-3); }
  .search-wide input { width: 100%; }
  .filters { display: flex; align-items: center; gap: var(--space-2); padding: 0 0 var(--space-4); flex-wrap: wrap; }
  .filters .grow { flex: 1 1 auto; }
  .filters .clear { color: var(--text-tertiary); text-decoration: none; font-size: var(--fs-small); }
  .filters .clear:hover { color: var(--accent); text-decoration: underline; }
  table.data.assistant-table th { padding-top: var(--space-3); padding-bottom: var(--space-3); }
  /* Row menus are positioned outside their cells. The shared panel clips by default to
     preserve rounded corners, so this table opts out and the two bottom rows open upward. */
  .panel.assistant-table-panel { overflow: visible; }
  .sort-head {
    display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--control-sm);
    color: inherit; text-decoration: none;
  }
  th.num .sort-head { width: 100%; justify-content: flex-end; }
  .sort-head:hover { color: var(--text-primary); }
  .sort-arrow { font-size: var(--fs-xs); line-height: 1; opacity: .42; }
  .sort-head.active .sort-arrow { color: var(--accent); opacity: 1; }
  /* <details> is the one disclosure widget HTML has without a script. The summary is the pill,
     the list is the menu, and every entry is a LINK carrying the query. */
  details.filter { position: relative; }
  details.filter > summary .n { color: var(--text-tertiary); font-weight: 400; }
  details.filter[open] > summary { border-color: var(--accent); }
  .filter-menu {
    position: absolute; top: calc(100% + var(--space-2)); left: 0; min-width: 220px; padding: var(--space-1); list-style: none; margin: 0;
  }
  .filter-menu a {
    display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: 6px;
    text-decoration: none; color: var(--text-primary); font-size: var(--fs-small);
  }
  .filter-menu a:hover { background: var(--surface-hover); }
  .filter-menu a[aria-current="true"] { background: var(--rail-active); font-weight: 600; }
  .filter-menu a .n { margin-left: auto; color: var(--text-tertiary); font-size: var(--fs-label); }
  table.data .name-cell { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
  table.data .name-cell a { color: inherit; text-decoration: none; }
  table.data .name-cell a:hover { text-decoration: underline; }
  table.data .name-cell .ico { color: var(--text-tertiary); flex: 0 0 auto; display: inline-grid; }
  table.data td.tags, table.data td.when { color: var(--text-secondary); }
  table.data td.when { white-space: nowrap; }
  .assistant-table .row-actions { position: relative; display: inline-flex; flex-wrap: nowrap; white-space: nowrap; justify-content: flex-end; min-width: 0; align-items: center; gap: var(--space-2); }
  .assistant-table .row-actions form { margin: 0; }
  /* arch issue 555: the name link and the ended-share chip link carry the control height (Kompakt target size). */
  .assistant-table .name-cell > a, .assistant-table a[href*=visning] { display: inline-flex; align-items: center; min-height: var(--control-sm); }
  .assistant-table .name-cell > .name-start { display: inline-flex; align-items: center; min-height: var(--control-sm); padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
  .assistant-table .name-cell > .name-start:hover { text-decoration: underline; }
  .assistant-table .ds-menu { display: inline-block; }
  /* The row menu is the DropdownMenu (arch#683-B). Its trigger is the quiet .icon-btn, and the last two rows open it upwards so it stays inside the panel. */
  .assistant-table .ds-menu > summary { color: var(--text-tertiary); }
  .assistant-table .ds-menu > summary:hover { background: var(--surface-hover); color: var(--text-primary); }
  .assistant-table tbody tr:nth-last-child(-n+2) .ds-menu-list { top: auto; bottom: calc(100% + var(--space-2)); margin: 0; }

  /* SLD-9 (architecture issue 471): Hjem's message menu, same dropdown treatment as the row menu. */
  details.home-message-actions { position: relative; display: inline-block; }
  details.home-message-actions > summary { list-style: none; cursor: pointer; color: var(--text-tertiary); }
  details.home-message-actions > summary::-webkit-details-marker { display: none; }
  details.home-message-actions > summary:hover { background: var(--surface-hover); color: var(--text-primary); }
  /* ONE panel holds every entry: a form (slides) and a bare button (F-37's export entry, Gemte filer's delete) alike.
     When the form itself was the panel, a button beside it laid out under the panel, hidden (tst, 2026-10-07). */
  .home-message-actions-menu { position: absolute; top: calc(100% + var(--space-2)); left: 0; right: auto; min-width: 220px; padding: var(--space-1); margin: 0; }
  .home-message-action-form { margin: 0; }
  /* F-37 §3.8 at phone width: export sheet, Gemte filer rows, history row menu (rationale beside the dialog component). */
  @media (max-width: 600px) {
    dialog.export-sheet { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
    dialog.export-sheet footer { position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
    dialog.export-sheet .body { padding: var(--space-5) var(--space-4); }
    li[data-file-id] summary { min-width: 44px; min-height: var(--control-lg); }
    li[data-file-id] summary { display: inline-flex; align-items: center; justify-content: center; }
  }
  .pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-4) var(--space-1) 0; font-size: var(--fs-small); color: var(--text-tertiary); }
  .pager .grow { flex: 1 1 auto; }
  .pager a {
    display: inline-flex; align-items: center; gap: var(--space-2); border: 1px solid var(--border); background: var(--surface);
    border-radius: var(--radius-pill); padding: var(--space-2) var(--space-3); text-decoration: none; color: var(--text-primary); font-weight: 600;
  }

  /* ── S09: tag chips, the instruction box, the knowledge rows (2026-09-02) ── */
  .tag-chip-wrap { display: inline-flex; align-items: center; gap: var(--space-half); }
  .tag-chip-remove { min-width: var(--control-sm); min-height: var(--control-sm); }
  .tag-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-start; }
  .files-headline { margin: 0 0 var(--space-3); color: var(--text-secondary); }
  .files-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; margin-bottom: var(--space-3); }
  .files-toolbar .ds-field { margin: 0; }
  .files-toolbar input, .files-toolbar select, .files-toolbar .btn { min-height: var(--control-lg); }
  .file-facts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; }
  .file-facts div { display: flex; gap: var(--space-1); }
  .file-facts dt { color: var(--text-tertiary); }
  .file-facts dt::after { content: ':'; }
  .file-facts dd { margin: 0; }
  .file-row-expired .file-tile { opacity: .6; }
  .file-row-expired .ds-hovercard-trigger, .file-row-expired .list-row-title { color: var(--text-secondary); }
  .item-tags-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-3); }
  /* Mærkater filter, phone width: menu as wide as its bar, entries wrap (e2e 08, Viden in Stor). */
  @media (max-width: 640px) {
    .item-tags-bar { position: relative; }
    .item-tags-bar details.filter { position: static; max-width: 100%; }
    .item-tags-bar details.filter > summary { max-width: 100%; flex-wrap: wrap; }
    .item-tags-bar .filter-menu { left: 0; right: 0; min-width: 0; max-width: none; }
    .item-tags-bar .filter-menu a { overflow-wrap: anywhere; }
  }
  .assistant-live-tags { display: contents; }
  .tag-chip { max-width: 100%; }
  button.assistant-live-tag { cursor: pointer; color: var(--text-secondary); font: inherit; }
  button.assistant-live-tag.has-context { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
  button.assistant-live-tag:hover { border-color: var(--accent); }
  .assistant-live-tag-remove { color: var(--text-tertiary); font-size: var(--fs-title); line-height: 1; }
  details.tag-context { position: relative; display: inline-block; }
  details.tag-context > summary { list-style: none; cursor: pointer; color: var(--text-secondary); }
  details.tag-context > summary::-webkit-details-marker { display: none; }
  details.tag-context > summary.has-context { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
  details.tag-context[open] > summary { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 12%, transparent); }
  .tag-context-panel {
    position: absolute; left: 0; top: calc(100% + var(--space-2));
    width: min(430px, calc(100vw - 80px)); padding: var(--space-3);
  }
  .tag-context-state { display: flex; align-items: center; gap: var(--space-2); color: var(--text-tertiary); margin-bottom: var(--space-3); font-size: var(--fs-label); }
  .tag-context-state.has-context { color: var(--accent); }
  .tag-context-panel > label, .tag-panel-label { display: block; margin-bottom: var(--space-2); font-size: var(--fs-label); font-weight: 600; }
  .field .tag-context-panel textarea { width: 100%; resize: vertical; min-height: 78px; }
  .tag-context-panel p { margin: var(--space-2) 0 var(--space-3); }
  .tag-context-actions { display: flex; align-items: center; gap: var(--space-2); }
  .tag-context-actions .grow { flex: 1 1 auto; }
  details.inline-add { position: relative; display: inline-block; }
  .inline-add-panel {
    margin-top: var(--space-2); width: min(470px, calc(100vw - 80px)); padding: var(--space-3);
  }
  .inline-add-panel > label { display: block; margin-bottom: var(--space-2); font-size: var(--fs-label); font-weight: 600; }
  .inline-add-controls { display: flex; align-items: center; gap: var(--space-2); }
  /* architecture issue 471: full-width rows, like the row menu's, not loose browser buttons. */
  .assistant-add-options { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-half); width: auto; min-width: 220px; padding: var(--space-1); }
  .assistant-add-options > button { width: 100%; text-align: left; padding: var(--space-2) var(--space-3); border-radius: 6px; color: var(--text-primary); font-size: var(--fs-small); }
  .assistant-add-options > button:hover { background: var(--surface-hover); }
  .assistant-add-options small { display: block; padding: 0 var(--space-3) var(--space-1); color: var(--text-tertiary); font-size: var(--fs-xs); }
  .assistant-decks { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-2); }
  .assistant-decks .btn { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-label); }
  .field .tag-add-panel input { flex: 1 1 auto; min-width: 170px; width: auto; }
  .tag-create-button { flex: 0 0 auto; white-space: nowrap; padding: var(--space-2) var(--space-3); }
  .assistant-tags-field { position: relative; }
  .tag-add { position: relative; }
  .tag-add-panel {
    position: absolute; z-index: 25; right: 0; width: min(430px, calc(100vw - 64px)); text-align: left;
    /* architecture#629 (2026-11-05): the whole panel scrolls within the viewport, so "Opret mærkat" stays reachable with many tags. */
    max-height: max(16rem, calc(100vh - 12rem)); max-height: max(16rem, calc(100svh - 12rem)); overflow-y: auto;
  }
  .tag-suggestions { margin-bottom: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
  .tag-search-control { position: relative; margin-bottom: var(--space-2); }
  .tag-search-control[hidden], .tag-search-empty[hidden], .tag-suggestion[hidden] { display: none; }
  .tag-search-control > svg { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }
  .field .tag-add-panel .tag-search-control input { width: 100%; min-width: 0; padding-left: var(--space-8); }
  .tag-search-count { margin: 0 0 var(--space-2); color: var(--text-tertiary); font-size: var(--fs-xs); }
  .tag-search-empty { margin: var(--space-3) 0; color: var(--text-secondary); font-size: var(--fs-label); }
  /* architecture#629 (2026-11-05): was overscroll contain, so the wheel stopped at the list's end ("scroll works only sometimes"). */
  .tag-suggestion-list { display: flex; flex-direction: column; gap: var(--space-1); max-height: 240px; overflow-y: auto; overscroll-behavior: auto; padding: var(--space-1); }
  .tag-suggestion {
    display: flex; flex: 0 0 auto; align-items: center; gap: var(--space-2); min-height: var(--control-lg); width: 100%; text-align: left;
    border: 1px solid transparent; border-radius: 8px;
    background: var(--surface); color: var(--text-secondary); padding: var(--space-2) var(--space-3); cursor: pointer; font: inherit; font-size: var(--fs-label);
  }
  label.tag-suggestion { position: relative; }
  .field .tag-add-panel label.tag-suggestion input[type="checkbox"] {
    position: static; opacity: 1; pointer-events: auto; flex: 0 0 auto;
    /* The tag panel's text field rule above (min-width: 170px) matched this box too and made a 170px checkbox; its own size back (ds-v2 S13). */
    width: var(--space-5); min-width: var(--space-5);
  }
  .tag-suggestion > span { overflow-wrap: anywhere; }
  .tag-suggestion > svg { flex: 0 0 auto; }
  /* flex 0 1 (ds-v2 S13): it shrinks and wraps at 320px and in Stor; 0 0 made the row a 344px scroller inside a 230px list. */
  .tag-suggestion small { margin-left: auto; flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; text-align: right; color: var(--text-tertiary); font-size: var(--fs-xs); }
  label.tag-suggestion:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
  .tag-suggestion:hover { border-color: var(--accent); color: var(--accent); }
  label.tag-suggestion:has(input:checked) {
    border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 10%, transparent);
  }
  button.tag-suggestion:disabled { cursor: default; opacity: .62; }
  .instruction-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .field .instruction-box textarea { border: 0; border-radius: var(--radius); min-height: 110px; }
  .instruction-box .foot { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); }
  .instruction-box .foot .grow { flex: 1 1 auto; }
  .instruction-box .foot .hex { color: var(--accent); display: inline-grid; }
  .field .instruction-box select { width: auto; border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3); font-size: var(--fs-small); }
  .assistant-section-kicker {
    color: var(--text-tertiary);
  }
  .assistant-tag-instruction-box {
    overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  }
  .assistant-tag-instructions[hidden] { display: none; }
  .assistant-tag-instruction {
    padding: var(--space-3) var(--space-4);
  }
  .assistant-tag-instruction + .assistant-tag-instruction { border-top: 1px solid var(--border); }
  .assistant-tag-instruction strong { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-small); }
  .assistant-tag-instruction p { margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: var(--fs-label); }
  .assistant-tag-instructions > .field-hint { margin: var(--space-2) 0 0; }
  .doc-row {
    display: flex; align-items: center; gap: var(--space-3); background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-2);
  }
  /* architecture#606: a long unbroken file name wraps inside its cell instead of widening the page at 390px, and Fjern keeps its width. */
  .doc-row .grow { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
  .doc-row > .btn { flex: none; white-space: nowrap; }
  .doc-row .ico { color: var(--text-tertiary); display: inline-grid; }
  .field .doc-row select { width: auto; flex: 1 1 auto; }
  .file-add-button {
    position: relative; display: flex; width: 100%; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: var(--control-lg); border: 1px dashed var(--border-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--accent); padding: var(--space-3) var(--space-4); cursor: pointer; font-weight: 600;
  }
  .file-add-button:hover { background: var(--accent-soft); border-color: var(--accent); }
  .file-add-button:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
  .file-add-button:has(input:disabled) { opacity: .55; cursor: not-allowed; }
  .file-add-button.file-add-inline {
    width: auto; min-height: 0; flex: 0 0 auto; justify-content: flex-start; padding: var(--space-1);
    border: 0; background: transparent; color: var(--text-primary); font-size: var(--fs-label);
  }
  .file-add-button.file-add-inline:hover { color: var(--accent); background: transparent; }
  details.file-library-add { flex: 0 0 auto; }
  .file-library-panel { position: absolute; z-index: 25; right: 0; width: min(430px, calc(100vw - 64px)); }
  .file-library-panel .file-add-button { margin-bottom: var(--space-4); }
  .file-library-panel > .tag-panel-label:not(:first-child) { padding-top: var(--space-half); }
  .file-library-list { display: grid; gap: var(--space-2); margin: 0 0 var(--space-3); }
  .file-library-option {
    display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    color: var(--text-primary); cursor: pointer; font: inherit; text-align: left;
  }
  .file-library-option:hover { border-color: var(--accent); background: var(--accent-soft); }
  /* Architecture issue 582: a chosen file is visible on its row: the design system's selected state (as .chat-quiz-choice), with the checkbox as the second cue. */
  .file-library-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 var(--space-half) color-mix(in srgb, var(--accent) 18%, transparent); }
  .file-library-option:has(input:focus-visible), .file-library-option:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: var(--space-half); }
  .assistant-file-count { color: var(--text-secondary); font-size: var(--fs-small); white-space: nowrap; }
  .file-library-option > input { flex: 0 0 auto; width: auto; }
  .file-library-option strong, .file-library-option small { display: block; overflow-wrap: anywhere; }
  .file-library-option small { margin-top: var(--space-half); color: var(--text-tertiary); font-size: var(--fs-xs); }
  .assistant-material-title { color: inherit; text-decoration: none; text-align: left; justify-self: start; padding: 0; max-width: 100%; overflow-wrap: anywhere; }
  .assistant-material-title:hover { color: var(--accent); text-decoration: underline; }
  .field input.file-input-overlay { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: inherit; }
  /* The Note look (navy text, a 1px tone border, a tone ground) by CSS: the upload script writes plain text into this element, so it cannot be the Note component. */
  .file-upload-status { margin: var(--space-2) 0 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--accent); border-radius: var(--radius); overflow-wrap: anywhere; font-size: var(--fs-small); background: var(--accent-soft); color: var(--text-primary); }
  .file-upload-status[data-state="success"] { background: var(--success-soft); border-color: var(--success); }
  .file-upload-status[data-state="error"] { background: var(--danger-soft); border-color: var(--danger); }
  .file-upload-progress { width: 100%; margin-top: var(--space-3); accent-color: var(--accent); }
  .file-upload-status[hidden], .file-upload-progress[hidden] { display: none; }
  .styled-file-input { flex: 1 1 auto; min-width: 0; background: var(--surface); }
  .styled-file-input::file-selector-button {
    margin: calc(var(--space-3) * -1) var(--space-3) calc(var(--space-3) * -1) calc(var(--space-3) * -1); padding: var(--space-3) var(--space-4); border: 0; border-right: 1px solid var(--border);
    background: var(--surface); color: var(--accent); font-weight: 600; cursor: pointer;
  }
  /* arch#689 (2026-11-15): Samtaler in the Viden v5 style. It reuses the knowledge-* layout, the tree panel and the viden-* handle and card; these are the row's own parts. */
  .conversation-row .list-row-lead, .file-row .list-row-lead { display: inline-flex; align-items: center; gap: var(--space-1); }
  .conversation-source-icon, .conversation-flag { display: inline-flex; color: var(--text-tertiary); }
  .conversation-source, .conversation-date, .conversation-flag, .file-source, .file-date, .file-soon { font-size: var(--fs-small); white-space: nowrap; }
  .conversation-source, .conversation-date, .file-source, .file-date { color: var(--text-secondary); }
  .conversation-source, .file-source { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
  .conversation-pin { display: inline-flex; color: var(--accent); }
  .conversation-phone-meta, .file-phone-meta { display: none; }
  .conversation-panel nav + nav, .conversation-panel nav + .knowledge-tree-links, .files-panel nav + nav, .files-panel nav + .knowledge-tree-links { margin-top: var(--space-3); }
  /* arch#683 step 2 v2: Gemte filer on the same template. The status word, the sort select and the card's dates. */
  .file-tile { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: calc(var(--space-8) + var(--space-1)); height: calc(var(--space-8) + var(--space-1)); border-radius: var(--radius); font-size: var(--fs-label); font-weight: 700; line-height: 1; letter-spacing: .02em; }
  .file-soon { color: var(--warning); font-weight: 600; }
  .files-sort { flex: 0 0 auto; max-width: 100%; }
  .ds-hovercard-link { text-decoration: none; }
  .knowledge-heading h1 { margin: 0; }
  .knowledge-heading p { margin: var(--space-half) 0 0; color: var(--text-tertiary); font-size: var(--fs-small); }
  /* architecture#681 (2026-11-12): a calmer head (the intro at body size, the count as small meta), one toolbar row, the mærkat tree and the row menu rows. */
  .knowledge-heading .knowledge-intro { color: var(--text-secondary); font-size: var(--fs-body); }
  .knowledge-global-link { display: inline-block; margin-top: var(--space-1); font-size: var(--fs-small); color: var(--accent); }
  .knowledge-layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: var(--space-6); align-items: start; }
  .knowledge-main { min-width: 0; }
  .viden-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); padding: var(--space-1) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: var(--fs-small); }
  .viden-status[data-state="error"] { color: var(--danger); }
  .viden-status[hidden], #viden-nomatch[hidden], .knowledge-list [data-knowledge-row][hidden] { display: none; }
  .knowledge-clear { margin: 0 0 var(--space-3); font-size: var(--fs-small); }
  .knowledge-link-form { margin-bottom: var(--space-3); }
  /* arch#681: rows are 44 px targets; the chevron summary sits over the row's chev-gap, so the filter link is never inside it. */
  .knowledge-page[data-tag-drag="true"] .knowledge-tree-item[data-drop-tag] { outline: thin dashed var(--border-strong); }
  .knowledge-tree-item[data-drop-over="true"] { outline: medium dashed var(--accent); background: var(--accent-soft); }
  .knowledge-tree-heading { margin: 0 0 var(--space-1); padding: 0 var(--space-2); color: var(--text-tertiary); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .knowledge-drag-tip { margin: var(--space-3) 0 0; }
  .viden-drag-handle { display: inline-flex; align-items: center; margin-right: var(--space-1); cursor: grab; color: var(--text-tertiary); }
  [data-knowledge-row][data-dragging="true"] { background: var(--surface-hover); }
  /* Point 7: the row a tree link points at. Marked server-side (aria-current), tokens only. Point 8 and v4: the assistants panel ends inside the row, one audience line per assistant. */
  .knowledge-list [data-knowledge-row][aria-current="true"] { background: var(--accent-soft); box-shadow: inset var(--space-1) 0 0 var(--accent); scroll-margin-top: var(--space-6); }
  .knowledge-list [data-knowledge-row][aria-current="true"]:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: calc(-1 * var(--space-half)); }
  .viden-menu-row { align-items: flex-start; }
  .viden-menu-row > svg { flex: 0 0 auto; margin-top: var(--space-half); }
  .viden-menu-text { display: flex; flex-direction: column; gap: var(--space-half); min-width: 0; }
  .viden-menu-help { color: var(--text-tertiary); font-size: var(--fs-xs); font-weight: 400; }
  .ds-menu-item.viden-menu-disabled { color: var(--text-tertiary); font-weight: 400; cursor: not-allowed; }
  .ds-menu-item.viden-menu-disabled:hover { background: transparent; }
  @media (pointer: coarse) { .viden-drag-handle, .ds-tooltip > .viden-drag-handle[tabindex]:not([tabindex="-1"]), .knowledge-drag-tip { display: none; } }
  /* arch 681 v5: the head is one line (intro, then "N filer · X MB"), the admin link to the right; the page has no padding of its own (the shell's column pads it). */
  .knowledge-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-6); width: 100%; }
  .knowledge-heading-text { min-width: 0; flex: 1 1 26rem; }
  .knowledge-heading .knowledge-intro { color: var(--text-secondary); font-size: var(--fs-body); }
  .knowledge-heading .knowledge-meta { display: inline; margin: 0; font-size: var(--fs-small); color: var(--text-tertiary); white-space: nowrap; }
  .knowledge-heading .knowledge-global-link { margin-top: 0; text-decoration: underline; text-underline-offset: var(--space-1); }
  .knowledge-search input { width: 100%; }
  /* The flat mærkat rail: Alle filer, each mærkat with its count, Uden mærkater. No file lists, no chevrons. */
  .knowledge-tree { position: sticky; top: var(--space-4); padding: var(--space-3) var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .knowledge-tree-list, .knowledge-tree-links { list-style: none; margin: 0; padding: 0; }
  .knowledge-tree-list { display: flex; flex-direction: column; gap: var(--space-half); }
  .knowledge-tree-links { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--border); }
  .knowledge-tree-links a { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-md); padding: var(--space-2); border-radius: var(--radius); color: var(--accent); font-size: var(--fs-small); text-decoration: none; }
  .knowledge-tree-links a:hover { background: var(--surface-hover); }
  .knowledge-tree .fag-link { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: var(--space-2); align-self: stretch; color: inherit; text-decoration: none; }
  .knowledge-tree .fag-link[aria-current="true"] .name { font-weight: 600; }
  .knowledge-tree .fag-all { background: var(--surface-hover); color: var(--text-secondary); }
  .knowledge-tree-item { border-radius: var(--radius); position: relative; }
  .knowledge-tree .fag { position: relative; box-sizing: border-box; max-width: 100%; min-height: var(--control-lg); padding-block: 0; cursor: default; }
  .knowledge-tree .fag-link { position: relative; }
  .knowledge-tree-item { min-width: 0; max-width: 100%; }
  .knowledge-tree-item:has(> .fag > .fag-link[aria-current="true"]) { background: var(--rail-active); }
  /* The row: drag handle, a file-type tile, the name (the hover card's trigger), the access icon, the menu. */
  .knowledge-list .list-row-lead { gap: var(--space-2); }
  .knowledge-list .list-row-main { display: flex; flex-direction: column; align-items: flex-start; }
  /* align-items: flex-start sizes the title to its text: cap it, so a long name ellipsises instead of running under the trail (Samtaler, arch#689). */
  .knowledge-list .list-row-main > .list-row-title { max-width: 100%; }
  .knowledge-list .ds-hovercard { display: block; max-width: 100%; }
  .knowledge-list .ds-hovercard-trigger { font-weight: 600; font-size: var(--fs-body); line-height: 1.3; }
  .viden-card-title { margin: 0; font-weight: 600; font-size: var(--fs-body); }
  .viden-card-info, .viden-card-status { color: var(--text-secondary); font-size: var(--fs-label); }
  .viden-card-status[data-state="failed"] { color: var(--danger); }
  .viden-card-note { margin-top: var(--space-1); color: var(--text-secondary); font-size: var(--fs-label); }
  .viden-card-assistants li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: var(--control-sm); }
  .viden-card-assistants a { flex: 1 1 auto; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
  .viden-card-assistants .viden-assistant-audience { color: var(--text-tertiary); font-size: var(--fs-label); white-space: nowrap; }
  .viden-card-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  @media (max-width: 900px) {
    .knowledge-layout { grid-template-columns: minmax(0, 1fr); }
    .knowledge-tree { position: static; }
  }
  .knowledge-upload-form { display: flex; align-items: stretch; }
  .knowledge-upload-button { position: relative; overflow: hidden; }
  .knowledge-upload-button input.file-input-overlay {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
  }
  .knowledge-page { position: relative; min-height: 60vh; width: 100%; }
  .knowledge-page[data-dropping="true"] { outline: medium dashed var(--accent); outline-offset: calc(-1 * var(--space-2)); border-radius: var(--radius); background: var(--accent-soft); }
  .knowledge-drop-hint { display: none; margin: 0; position: absolute; inset: 0; align-items: center; justify-content: center; font-size: var(--fs-title); font-weight: 600; color: var(--accent); pointer-events: none; }
  .knowledge-page[data-dropping="true"] .knowledge-drop-hint { display: flex; }
  details.knowledge-actions { position: relative; flex: 0 0 auto; }
  details.knowledge-actions > summary { list-style: none; color: var(--text-tertiary); cursor: pointer; }
  details.knowledge-actions > summary::-webkit-details-marker { display: none; }
  details.knowledge-actions > summary:hover, details.knowledge-actions[open] > summary { background: var(--surface-hover); color: var(--text-primary); }
  .knowledge-actions-menu {
    position: absolute; top: calc(100% + var(--space-2)); right: 0; width: 18.75rem; padding: var(--space-2);
  }

  /* ── S35: personal colleague profile ─────────────────────────────────── */
  .profile-page {
    width: 100%; padding: 0 0 var(--space-16); display: grid; gap: var(--space-4); min-width: 0;
  }
  .profile-card {
    overflow: visible; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 48%, var(--bg));
  }
  .profile-card > h2 {
    margin: 0; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
    background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-size: var(--fs-body); font-weight: 700;
  }
  .profile-photo-row { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-5) var(--space-4); }
  .profile-card, .profile-photo-row > * { min-width: 0; }
  .profile-avatar {
    flex: 0 0 auto; width: 70px; height: 70px; display: grid; place-items: center;
    overflow: hidden; border-radius: 50%; background: var(--accent-fill); color: var(--accent-fill-text);
    font-size: var(--fs-h1); font-weight: 700;
  }
  .profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .profile-photo-content { min-width: 0; }
  .profile-photo-content > p, .profile-setting > p, .profile-visibility p {
    margin: 0 0 var(--space-2); color: var(--text-tertiary); font-size: var(--fs-label);
  }
  .profile-photo-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
  .profile-photo-actions form { margin: 0; }
  .profile-photo-button { position: relative; overflow: hidden; }
  .profile-photo-button input.file-input-overlay {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
  }
  .profile-photo-remove { min-height: var(--control-sm); border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; }
  .profile-photo-remove:disabled { color: var(--text-tertiary); cursor: not-allowed; opacity: .7; }
  .profile-facts { margin: 0; }
  .profile-facts > div {
    display: grid; grid-template-columns: minmax(135px, 190px) minmax(0, 1fr); align-items: center;
    min-height: 58px; padding: var(--space-3) var(--card-pad); border-bottom: 1px solid var(--border);
  }
  .profile-facts > div:last-child { border-bottom: 0; }
  .profile-facts dt { color: var(--text-secondary); font-weight: 600; }
  .profile-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
  .profile-facts dd strong, .profile-facts dd small { display: block; }
  .profile-facts dd small { color: var(--text-tertiary); font-size: var(--fs-xs); }
  .profile-setting { padding: var(--space-4); border-bottom: 1px solid var(--border); }
  .profile-setting:last-child { border-bottom: 0; }
  .profile-setting > strong, .profile-setting label > strong, .profile-visibility strong { display: block; margin-bottom: var(--space-1); }
  .profile-subjects { display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--space-2); }
  .profile-subjects form { margin: 0; }
  .profile-bio > input {
    width: 100%; min-width: 0; border: 1px solid var(--border-strong);
    border-radius: var(--radius); background: var(--surface); padding: var(--space-3) var(--space-4);
  }
  .profile-bio > button { margin-top: var(--space-3); }
  .profile-visibility { display: flex; align-items: center; gap: var(--space-5); }
  .profile-visibility > span { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
  .profile-visibility .switch { flex: 0 0 auto; }
  .profile-visibility p { margin-bottom: 0; }
  .profile-visibility form { margin: 0; }
  .profile-visibility .switch:disabled { cursor: not-allowed; }
  @media (max-width: 760px) {
    .assistant-form { padding-inline: 0; }
    .head-actions .muted { display: none; }
    .inline-add-controls { align-items: stretch; flex-direction: column; }
    .assistant-section-head { align-items: stretch; flex-direction: column; gap: var(--space-2); }
    .file-add-button.file-add-inline { align-self: flex-start; }
    .file-library-panel { right: auto; left: 0; }
    .tag-add-panel { right: auto; left: 0; }
    .profile-facts > div { grid-template-columns: 120px minmax(0, 1fr); }
  }
  /* Below ~400px the label and its value stack, and the photo row stacks under the avatar. */
  @media (max-width: 420px) {
    .profile-facts > div { grid-template-columns: minmax(0, 1fr); gap: var(--space-half); }
    .profile-photo-row { flex-wrap: wrap; }
    .profile-photo-content { flex: 1 1 100%; }
  }

  /* Transient menus fit inside the viewport; persistent sidebar/quiz disclosures keep their own behaviour. */
  .menu { max-width: calc(100vw - 24px); }
  .account-menu { width: 320px; }
  .filter-menu, .knowledge-actions-menu, .inline-add-panel, .tag-context-panel, .home-message-action-form { max-width: calc(100vw - 24px); overscroll-behavior: contain; }
  /* architecture#629 (2026-11-05): undo the rule above for the scrolling tag panel, so the wheel reaches the page. Keep it after that rule. */
  .tag-add-panel { overscroll-behavior: auto; }
  .account-popover[open] > summary { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
  button:disabled { cursor: not-allowed; }
  /* The type scale (spec 3.2, 3.3; ds-v2 S7). Set once on the elements: h1 Sora 24/700, h2 title 18, h3 16, h4 15, all Inter below h1. A screen class that sets its own size wins. */
  h1 { font-family: var(--font-display); font-size: var(--fs-h1); font-weight: 700; line-height: 1.333; letter-spacing: -.01em; }
  h2 { font-size: var(--fs-title); font-weight: 700; line-height: 1.444; }
  h3 { font-size: var(--fs-prose); font-weight: 700; line-height: var(--lh-body); }
  h4 { font-size: var(--fs-body); font-weight: 700; line-height: var(--lh-body); }
  /* Chat messages and long reading are prose: 16px on 1.65 (spec 3.2). Everything else is UI text at the body size set on <body>. */
  .instruction-message-text, .instruction-message-user, .prose { font-size: var(--fs-prose); line-height: var(--lh-prose); }
  /* The ONE eyebrow (spec 3.2): 12px, 700, +0.08em, uppercase. The class .eyebrow is canonical; the others are the labels that were ten separate variants. */
  .eyebrow, .rail-label, .kpi-label, .home-coming, .assistant-templates h3, .assistant-sample > h2, .theme-group, .test-strip, .assistant-section-kicker {
    font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; line-height: 1.333;
  }
  .head-actions { flex-wrap: wrap; }
  /* The tight layout (was @media max-width 1000px): asymmetric columns and smaller paddings. Switches on when the symmetric one no longer fits: 82em of the bar is 1148 / 1230 / 1476px
     in Kompakt / Normal / Stor, against the roughly 1000 / 1110 / 1310px it needs with four nav items, a role pill and the usage link (measured 2026-10-18, e2e topbar ladder). */
  @container (max-width: 82em) {
    .topbar-row { grid-template-columns: auto 1fr auto; gap: var(--space-3); padding-inline: var(--space-5); }
    .topbar-end { gap: var(--space-3); }
    .segmented a { padding-inline: var(--space-3); }
  }
  /* The compact layout (was @media max-width 720px): the nav on its own row under the brand and the end group. 65em is 910 / 975 / 1170px; the tight layout stops fitting at 752 / 904 / 1072px (measured the same way). */
  @container (max-width: 65em) {
    /* The brand keeps its width and the end group takes the rest and WRAPS (a person with a picture, a usage link and 200% text did not fit 320px: WCAG 1.4.10). */
    .topbar-row { grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3) var(--space-4); }
    .topbar-mid { grid-row: 2; grid-column: 1 / -1; }
    .topbar-end { grid-column: 2; grid-row: 1; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
    .usage-link { min-width: 0; }
    .usage-copy { min-width: 0; overflow-wrap: anywhere; }
    .usage-copy span { white-space: normal; }
    /* Four items (Gemte filer, F-37 §3.6) are wider than 320px: wrap rather than scroll the page (WCAG 1.4.10). */
    .segmented { width: 100%; justify-content: center; flex-wrap: wrap; }
    .segmented a { flex: 1 1 auto; text-align: center; padding: var(--space-2) var(--space-3); font-size: var(--fs-label); }
  }
  /* The bar's own rules moved to the container queries above, but a container query cannot reach what sits OUTSIDE the bar (a page's inline segmented nav, the logo on the sign-in page and in the rail), so the viewport rules for those stay; the logo's phone size stays with them (a 127px literal in a container query would count as a raw px). */
  @media (max-width: 1000px) {
    .segmented a { padding-inline: var(--space-3); }
  }
  @media (max-width: 720px) {
    /* Viden at phone width (arch 681 v5): the rail is a row of pills (Alle filer, each mærkat, Uden mærkater); the links stay under it; no drag handle, no mouse tip. */
    .knowledge-tree { padding: var(--space-2); }
    .knowledge-tree-list { flex-direction: row; flex-wrap: wrap; gap: var(--space-2); }
    .knowledge-tree .fag { width: auto; }
    .knowledge-tree .fag { min-height: var(--control-md); padding-inline: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-pill); }
    .knowledge-tree-heading { display: none; }
    .knowledge-tree-item:has(> .fag > .fag-link[aria-current="true"]) { background: transparent; }
    .knowledge-tree-item:has(> .fag > .fag-link[aria-current="true"]) > .fag { background: var(--accent-soft); border-color: var(--accent); }
    .viden-drag-handle, .knowledge-drag-tip { display: none; }
    .ds-tooltip > .viden-drag-handle[tabindex]:not([tabindex="-1"]) { display: none; } /* arch 693: the Tooltip wrapper rule would otherwise keep the handle on a phone */
    .conversation-source, .conversation-date, .file-source, .file-date { display: none; }
    .conversation-phone-meta, .file-phone-meta { display: block; }
    .conversation-panel nav + nav, .files-panel nav + nav { margin-top: var(--space-2); }
    /* The rail is pills above the list; the panel button, Ny samtale and the code field stay on Hjem. */
    .template-rail .sidebar-controls, .template-rail .rail-top, .template-rail .code-entry { display: none; }
    .template-rail .rail-scroll { padding: var(--space-2) var(--space-3); }
    .template-rail .rail-section > summary { display: none; }
    .template-rail .ds-name-tip { width: auto; }
    .knowledge-list .list-row { --list-row-lead-w: calc(var(--space-8) + var(--space-1)); }
    .segmented { width: 100%; justify-content: center; flex-wrap: wrap; }
    .segmented a { flex: 1 1 auto; text-align: center; padding: var(--space-2) var(--space-3); font-size: var(--fs-label); }
    .brand-logo img { width: 127px; height: var(--space-10); }
    .home-actions { grid-template-columns: 1fr; gap: var(--space-3); }
    .home-action-card { min-height: 170px; padding: var(--space-5); }
    .home-welcome { margin-bottom: var(--space-6); }
      .home-chat-message { max-width: 95%; }
    .page-head { flex-wrap: wrap; gap: var(--space-4); padding: var(--space-5) var(--space-4); }
    .head-actions { gap: var(--space-2); }
    .head-actions .btn { padding-inline: var(--space-3); }
  }

  /* arch 693 (2026-11-17): the ONE template of Samtaler, Viden and Gemte filer (ui/template-page.tsx). The filter panel is Hjem's rail now: the frame is the shell's, so the tree loses its
     own card (sticky, border, background); the rail scrolls vertically only and a long name is cut with an ellipsis that the white tooltip reads in full. */
  .template-rail .rail-scroll { overflow-x: hidden; padding-inline: var(--space-3); }
  .template-rail .knowledge-tree { position: static; padding: 0; background: transparent; border: 0; border-radius: 0; }
  .template-rail .rail-section { margin-bottom: var(--space-2); }
  .template-rail .rail-section > summary.rail-label { padding-inline: var(--space-2); }
  .template-rail .fag { position: relative; }
  .template-rail .rail-info { display: inline-flex; align-items: center; color: var(--text-tertiary); padding: var(--space-1); }
  .template-rail .ds-tooltip-text { max-width: 13rem; white-space: normal; }
  .ds-name-tip { display: flex; flex: 1 1 auto; min-width: 0; width: 100%; }
  .ds-name-tip > .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* arch 693: a rail name's tooltip wraps in its row, inside the rail (e2e 50, Stor). */
  .rail .ds-name-tip > .ds-tooltip-text { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .template-page { display: block; }
  .template-sections { min-width: 0; }
  .template-page .knowledge-main { max-width: 100%; }
  .filter-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-3); }
  .filter-row-left { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
  .filter-shown { color: var(--text-secondary); font-size: var(--fs-small); }
  .filter-chip { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--control-sm); padding: 0 var(--space-1) 0 var(--space-3); border: 1px solid var(--accent); border-radius: var(--radius-pill); background: var(--accent-soft); font-size: var(--fs-small); }
  .filter-chip-x { display: inline-flex; align-items: center; justify-content: center; min-width: var(--control-sm); min-height: var(--control-sm); border-radius: var(--radius-pill); color: var(--text-secondary); }
  .filter-chip-x:hover { background: var(--surface-hover); color: var(--text-primary); }
  .filter-sort { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: var(--fs-small); color: var(--text-secondary); }
  .filter-sort select { min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-primary); font: inherit; }
  .conversation-source-deleted, .file-source-deleted { color: var(--text-tertiary); font-style: italic; }
  .filter-chip-soon { padding: var(--space-half) var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--text-secondary); }
  .viden-row-unused { color: var(--text-tertiary); }
  .viden-row-used { color: var(--text-secondary); font-size: var(--fs-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
  /* The drag image (ui/drag-image.ts): ONE white card with the title, drawn off screen for setDragImage. */
  .ds-drag-card { position: fixed; top: calc(-1 * var(--space-10)); left: 0; max-width: 16rem; padding: var(--space-2) var(--space-3); background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); font-size: var(--fs-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


  /* Popover and menu surface (components/popover.tsx): one skin. */
  .ds-popover { position: relative; }
  .ds-popover-panel, .menu, .filter-menu, .home-message-actions-menu, .knowledge-actions-menu, .tag-context-panel, .inline-add-panel, .model-menu, .role-menu,
  .assistant-quiz-menu, .slides-menu, .ds-menu-list, .ai-picker-panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); z-index: var(--z-dropdown);
    overflow-wrap: anywhere;
  }
  .ds-popover-panel { position: absolute; left: 0; top: calc(100% + var(--space-2)); width: 320px; max-width: calc(100vw - 32px); max-height: min(70vh, 480px); overflow-y: auto; padding: var(--space-4); }
  .role-menu-inline { box-shadow: none; }
  @media (max-width: 640px) {
    .ds-popover-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-3); }
  }

  .ds-hovercard { position: relative; display: inline-block; max-width: 100%; min-width: 0; }
  .ds-hovercard-trigger { display: block; max-width: 100%; margin: 0; padding: var(--space-1) 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ds-hovercard-trigger:hover { color: var(--accent); }
  .ds-hovercard-trigger:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: var(--space-half); border-radius: var(--radius); }
  .ds-hovercard-panel {
    position: absolute; left: 0; top: calc(100% + var(--space-1)); z-index: var(--z-dropdown); box-sizing: border-box;
    width: min(23.75rem, calc(100vw - 2 * var(--space-4))); padding: var(--space-3) var(--space-4);
    background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
    font-size: var(--fs-small); font-weight: 400; line-height: 1.45; white-space: normal; text-align: left;
    visibility: hidden; opacity: 0;
  }
  /* The bridge: the gap between trigger and panel still counts as the panel, so the pointer can cross it. */
  .ds-hovercard-panel::before { content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--space-2)); height: var(--space-2); }
  .ds-hovercard[data-place="above-end"] > .ds-hovercard-panel { left: auto; right: 0; top: auto; bottom: calc(100% + var(--space-1)); }
  .ds-hovercard[data-place="above-end"] > .ds-hovercard-panel::before { top: auto; bottom: calc(-1 * var(--space-2)); }
  .ds-hovercard[data-flip="true"] > .ds-hovercard-panel { top: auto; bottom: calc(100% + var(--space-1)); }
  .ds-hovercard[data-flip="true"] > .ds-hovercard-panel::before { top: auto; bottom: calc(-1 * var(--space-2)); }
  .ds-hovercard:hover > .ds-hovercard-panel, .ds-hovercard:focus-within > .ds-hovercard-panel, .ds-hovercard[data-open="true"] > .ds-hovercard-panel { visibility: visible; opacity: 1; }
  /* Esc (script) dismisses a card the pointer or focus still holds; it comes back on the next pointer entry or focus. */
  .ds-hovercard[data-dismissed="true"][data-dismissed="true"] > .ds-hovercard-panel { visibility: hidden; opacity: 0; }
  /* An open card must not be clipped by the panel that holds the row. */
  /* A closed card still occupies its place, so a panel that clips its children clips (and never scrolls or widens the page) until the card is shown. */
  .panel:has(.ds-hovercard) { overflow: clip; }
  .panel:has(.ds-hovercard:hover, .ds-hovercard:focus-within, .ds-hovercard[data-open="true"]) { overflow: visible; }
  .ds-hovercard-panel :is(h3, h4) { margin: var(--space-3) 0 var(--space-1); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary); }
  .ds-hovercard-panel p { margin: 0; overflow-wrap: anywhere; }
  .ds-hovercard-panel ul { list-style: none; margin: 0; padding: 0; }
  /* Only the opacity may transition: a global reduced-motion rule makes every transition 1e-5s, and a left that is still on its way would be measured by the script at the old value. */
  .ds-hovercard-panel { transition-property: opacity; }
  @media (prefers-reduced-motion: no-preference) { .ds-hovercard-panel { transition: opacity .12s; } }
  /* The tooltip (components/tooltip.tsx) shares the card's placement; the access icon and the row status (components/status.tsx). arch#693 (2026-11-17): white like the hover card (surface, border, hover-card shadow; radius 10 for the small tooltip, 14 for the card), no dark tooltip. */
  .ds-tooltip { position: relative; display: inline-flex; align-items: center; max-width: 100%; }
  .ds-tooltip > [tabindex]:not([tabindex="-1"]) { display: inline-flex; align-items: center; min-height: 1.5rem; min-width: 1.5rem; }
  .ds-tooltip-text {
    position: absolute; right: 0; bottom: calc(100% + var(--space-1)); z-index: var(--z-dropdown); box-sizing: border-box; width: max-content; max-width: min(16rem, calc(100vw - 2 * var(--space-4)));
    padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); box-shadow: var(--shadow-2);
    font-size: var(--fs-label); font-weight: 400; line-height: 1.4; text-align: left; white-space: normal; pointer-events: none;
    visibility: hidden; opacity: 0; transition-property: opacity;
  }
  /* arch#693 is staff only: outside a staff frame (a pupil's frame, which keeps its markup byte for byte) the tooltip stays dark as before (plan default 12). */
  .shell:not([data-audience="staff"]) .ds-tooltip-text { background: var(--text-primary); color: var(--surface); border: 0; box-shadow: none; }
  .ds-tooltip[data-place="below-start"] > .ds-tooltip-text { right: auto; left: 0; top: calc(100% + var(--space-1)); bottom: auto; }
  .ds-tooltip[data-flip="true"] > .ds-tooltip-text { top: auto; bottom: calc(100% + var(--space-1)); }
  .ds-tooltip:hover > .ds-tooltip-text, .ds-tooltip:focus-within > .ds-tooltip-text, .ds-tooltip[data-open="true"] > .ds-tooltip-text { visibility: visible; opacity: 1; }
  .ds-tooltip[data-dismissed="true"][data-dismissed="true"] > .ds-tooltip-text { visibility: hidden; opacity: 0; }
  .panel:has(.ds-tooltip:hover, .ds-tooltip:focus-within, .ds-tooltip[data-open="true"]) { overflow: visible; }
  @media (prefers-reduced-motion: no-preference) { .ds-tooltip-text { transition: opacity .12s; } }
  .access-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: calc(var(--space-8) + var(--space-1)); height: calc(var(--space-8) + var(--space-1)); border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); }
  .access-icon:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: var(--space-half); }
  .row-status { display: block; margin: 0; font-size: var(--fs-label); color: var(--text-tertiary); }
  .row-status[data-state="failed"], .row-status[data-state="stopped"] { color: var(--danger); }


  .role-chip {
    display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer;
    border-radius: var(--radius-pill); padding: var(--space-1) var(--space-3); min-height: var(--control-sm);
    font-size: var(--fs-label); font-weight: 600;
    /* The top bar's own tokens, so the chip has the bar's contrast in every theme. */
    background: color-mix(in srgb, var(--topbar-text) 8%, transparent); color: var(--topbar-text);
    border: 1px solid color-mix(in srgb, var(--topbar-text) 24%, transparent);
  }
  .role-chip-on { background: var(--topbar-text); color: var(--topbar-bg); }
  .role-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .role-menu {
    position: absolute; right: 0; top: calc(100% + var(--space-2)); width: min(340px, 92vw); color: var(--text-primary); padding: var(--space-2);
  }
  .role-menu-inline { position: static; width: auto; max-width: 420px; box-shadow: none; }
  .role-heading { margin: var(--space-2) var(--space-2) var(--space-2); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; color: var(--text-secondary); }
  /* A role row is a menu item (components/dropdown-menu.tsx): the one item, plus a radio and a two-line text. (The old role-row skin is retired, ds-v2 S9.) */
  .ds-menu-item.role-item { align-items: flex-start; padding: var(--space-3); }
  .ds-menu-item.role-item:focus-visible { outline-offset: -2px; }
  .ds-menu-item.role-item-link { padding-left: var(--space-10); }
  .role-item-link .role-name { text-decoration: underline; }
  .ds-menu-item.role-item-current { background: var(--accent-soft); }
  .ds-menu-item.role-item[disabled] { cursor: not-allowed; color: var(--text-tertiary); }
  .role-radio { flex: none; width: 18px; height: 18px; margin-top: var(--space-half); border-radius: 50%; border: 2px solid var(--text-secondary); }
  .role-radio-on { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 9px var(--accent); }
  .role-text { display: flex; flex-direction: column; gap: var(--space-half); }
  .role-name { font-weight: 600; }
  .role-line { font-size: var(--fs-label); color: var(--text-secondary); }
  .role-footer { display: flex; gap: var(--space-2); margin: var(--space-2) 0 var(--space-half); padding: var(--space-3) var(--space-2) var(--space-1); border-top: 1px solid var(--border); font-size: var(--fs-label); color: var(--text-secondary); }
  /* The acting-as band is a Note with the band form (components/note.tsx); the role-band class stays as the hook the e2e journeys and probes read. */
  .role-band form { margin: 0; }
  /* WCAG 1.4.10 at 320 and 375 px: the top bar's end group (chip, Mit forbrug, avatar) is wider than the bar once the chip
     carries its word, so the word collapses to the icon. The accessible name stays on the summary (aria-label), and the
     band under the bar still says which role is acting. The bar's own end gap is tightened with it (styles.ts, 720 px). */
  @media (max-width: 720px) {
    .role-chip { padding: var(--space-1) var(--space-2); min-width: 32px; justify-content: center; }
    .role-chip-text { display: none; }
  }


  /* Dialogs (components/dialog.tsx, section 8.19): native <dialog>, one surface. Tokens only. */
  dialog.modal, dialog.drawer {
    padding: 0; border: 1px solid var(--border); color: var(--text-primary); background: var(--surface); box-shadow: var(--shadow-3);
  }
  dialog.modal::backdrop, dialog.drawer::backdrop { background: var(--scrim); opacity: .4; }
  dialog.modal {
    width: min(520px, calc(100% - 32px)); max-height: 86vh; overflow: auto; border-radius: var(--radius-lg);
  }
  dialog.modal-wide { width: min(880px, calc(100% - 32px)); }
  dialog.modal[open] { animation: ds-dialog-in var(--motion-slow, .24s) ease-out; }
  @keyframes ds-dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  dialog.modal header, dialog.drawer > header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border); }
  dialog.modal header h2, dialog.drawer > header h2 { margin: 0; font-size: var(--fs-title); font-weight: 700; flex: 1 1 auto; }
  dialog.modal .body { padding: var(--space-6); }
  dialog.modal footer, dialog.drawer > footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border);
  }
  dialog.modal footer { position: sticky; bottom: 0; background: var(--surface); z-index: var(--z-sticky); }
  dialog.drawer {
    position: fixed; inset: 0 0 0 auto; margin: 0; width: min(520px, 100%); height: 100%; max-height: 100%;
    border-width: 0 0 0 1px; border-radius: 0;
  }
  dialog.drawer[open] { display: flex; flex-direction: column; }
  dialog.drawer > .body { flex: 1 1 auto; overflow-y: auto; padding: var(--space-6); }
  /* No script: a dialog the server drew open is not in the top layer, so it is placed like the modal (fixed, centred, same size, scrolling inside), above the page, with the scrim as a shadow. */
  dialog.modal[open]:not(:modal) {
    position: fixed; inset: 0; margin: auto; height: fit-content; z-index: var(--z-dialog);
    box-shadow: var(--shadow-3), 0 0 0 100vmax color-mix(in srgb, var(--scrim) 40%, transparent);
  }
  dialog.drawer[open]:not(:modal) { z-index: var(--z-dialog); box-shadow: var(--shadow-3), 0 0 0 100vmax color-mix(in srgb, var(--scrim) 40%, transparent); }
  dialog.confirm-danger > form > header h2 { color: var(--danger); }
  dialog.confirm .body > * + * { margin-top: var(--space-3); }
  dialog.confirm .body p { margin: 0; }
  @media (max-width: 640px) {
    dialog.modal, dialog.modal[open]:not(:modal) { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0; border-width: 0; }
    dialog.modal footer .btn, dialog.drawer > footer .btn { flex: 1 1 auto; justify-content: center; }
  }

  /* Accordion (components/accordion.tsx). Tokens only. */
  .accordion { display: block; }
  .accordion-item + .accordion-item { border-top: 1px solid var(--border); }
  .accordion-head { margin: 0; font-size: inherit; font-family: inherit; }
  .accordion-trigger {
    display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 48px; padding: var(--space-3) var(--card-pad);
    border: 0; background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer;
  }
  .accordion-trigger:hover { background: var(--surface-hover); }
  .accordion-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
  .accordion-trigger > svg { flex: 0 0 auto; color: var(--text-tertiary); }
  .accordion-trigger[aria-expanded="true"] > svg { transform: rotate(180deg); }
  .accordion-panel { padding: var(--space-1) var(--card-pad) var(--space-4) var(--card-pad); color: var(--text-secondary); font-size: var(--fs-small); }
  .accordion-panel[hidden] { display: none; }
  /* Disclosure (components/accordion.tsx DISCLOSURE_CSS). Tokens only. */
  summary { list-style: none; }
  summary::-webkit-details-marker { display: none; }
  /* The defaults of a plain disclosure sit at the LOWEST specificity (:where), so a screen's own summary or panel rule (.quiz-question summary,
     .list-row-details > summary, .memory-disclosure) wins a tie instead of losing to this sheet; ds-v2 W1a fix round, item 5. */
  :where(.ds-disclosure) > summary {
    display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-lg); box-sizing: border-box; cursor: pointer;
    font-size: var(--fs-small); font-weight: 600; color: var(--text-primary);
  }
  /* The ONE chevron, drawn in CSS: two borders of a rotated square (pointing right closed, down open). Never a data: image or mask, because the CSP is
     img-src 'self' (W1a fix round item 14). */
  .ds-disclosure > summary::before {
    content: ""; flex: 0 0 var(--space-2); box-sizing: border-box; width: var(--space-2); height: var(--space-2); margin: 0 var(--space-1);
    border: solid currentColor; border-width: 0 var(--space-half) var(--space-half) 0;
    transform: rotate(-45deg); transition: transform var(--motion-base) var(--ease-standard);
  }
  .ds-disclosure[open] > summary::before { transform: rotate(45deg); }
  .ds-disclosure > summary:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: var(--space-half); border-radius: var(--radius-sm); }
  :where(.ds-disclosure) > :where(:not(summary)) { margin-left: var(--space-6); font-size: var(--fs-small); }
  @media (prefers-reduced-motion: reduce) { .ds-disclosure > summary::before { transition: none; } }
  .ds-popover > summary, .ds-nav-group > summary { list-style: none; cursor: pointer; }
  .ds-popover > summary::-webkit-details-marker, .ds-nav-group > summary::-webkit-details-marker { display: none; }

  /* FilePicker (components/file-picker.tsx), and the field error text beside any field. Tokens only. */
  .file-picker-zone {
    position: relative; overflow: hidden; display: flex; align-items: center; gap: var(--space-4);
    border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5);
    background: var(--surface); color: var(--text-secondary); cursor: pointer;
  }
  .file-picker-zone:hover, .file-picker-zone.is-over { border-color: var(--accent); background: var(--accent-soft); }
  .file-picker-zone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
  .file-picker-zone > svg { flex: 0 0 auto; color: var(--accent); }
  .file-picker-text { display: flex; flex-direction: column; gap: var(--space-half); min-width: 0; }
  .file-picker-text strong { color: var(--text-primary); font-size: var(--fs-body); }
  .file-picker-text small { color: var(--text-secondary); font-size: var(--fs-label); }
  .file-picker input.file-input-overlay { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
  .file-picker-chosen { margin: var(--space-2) 0 0; min-height: 1.2em; font-size: var(--fs-small); color: var(--text-primary); overflow-wrap: anywhere; }
  .field-error { margin: var(--space-2) 0 0; font-size: var(--fs-label); color: var(--danger); }
  .field-error:empty { display: none; }
  .field[data-invalid] input, .field[data-invalid] select, .file-picker[data-invalid] .file-picker-zone { border-color: var(--danger); }

  .empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; padding: var(--space-10) var(--space-6); }
  .empty-state-art { display: inline-grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
  .empty-state h2 { margin: var(--space-2) 0 0; font-size: var(--fs-title); font-weight: 700; }
  .empty-state p { margin: 0; max-width: 46ch; color: var(--text-secondary); font-size: var(--fs-body); }
  .empty-state-action { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); }

  /* Card (components/card.tsx). Tokens only. */
  .ds-card {
    position: relative; display: flex; flex-direction: column; min-width: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  }
  .ds-card:hover { border-color: var(--border-strong); }
  .ds-card:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
  .ds-card-media {
    display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-hover);
    border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; color: var(--text-secondary);
  }
  .ds-card[data-state="busy"] .ds-card-media, .ds-card[data-state="failed"] .ds-card-media { opacity: .75; }
  .ds-card-body { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-3) var(--space-1); min-width: 0; flex: 1 1 auto; }
  .ds-card-title { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 700; overflow-wrap: anywhere; }
  .ds-card-link { color: inherit; text-decoration: none; }
  .ds-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
  .ds-card-link:focus-visible { outline: none; }
  .ds-card-status { font-size: var(--fs-label); }
  .ds-card-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2) var(--space-2) var(--space-3); min-height: var(--control-md); }
  /* The foot is its own stacking context (z-index 1), so in a grid the NEXT card's foot paints over an open menu of the card before it. The foot that
     holds an open menu (or focus inside it) goes above every other foot. */
  .ds-card-foot:has(.ds-menu[open]), .ds-card-foot:focus-within { z-index: 30; }
  .ds-card-meta { flex: 1 1 auto; min-width: 0; color: var(--text-tertiary); font-size: var(--fs-label); }
  .ds-card-meta > * { display: block; }
  .ds-card-line { margin: 0; color: var(--text-secondary); font-size: var(--fs-label); }
  .ds-card-add {
    align-items: center; justify-content: center; gap: var(--space-2); min-height: 160px; text-decoration: none; color: var(--accent);
    border: 1px dashed var(--border-strong); background: transparent;
  }
  .ds-card-add:hover { background: var(--accent-soft); border-color: var(--accent); }
  .ds-card-add:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  .ds-card-add-title { font-weight: 700; font-size: var(--fs-body); }

  /* Radio card (components/radio-card.tsx). Tokens only. */
  .ds-radio-cards { border: 0; margin: 0; padding: 0; min-width: 0; }
  .ds-radio-cards > legend { padding: 0; margin-bottom: var(--space-2); font-size: var(--fs-body); font-weight: 700; }
  .ds-radio-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); }
  .ds-radio-card { position: relative; display: block; cursor: pointer; }
  .ds-radio-card-input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
  .ds-radio-card-box {
    display: flex; flex-direction: column; gap: var(--space-2); height: 100%; padding: var(--space-4) var(--space-5); box-sizing: border-box;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  }
  .ds-radio-card:hover .ds-radio-card-box { border-color: var(--accent); }
  .ds-radio-card-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-weight: 700; font-size: var(--fs-body); }
  .ds-radio-card-title > svg { visibility: hidden; color: var(--accent); }
  .ds-radio-card-text { color: var(--text-secondary); font-size: var(--fs-label); }
  .ds-radio-card-input:checked + .ds-radio-card-box { border: 2px solid var(--accent); padding: var(--space-3) var(--space-4); background: var(--accent-soft); }
  .ds-radio-card-input:checked + .ds-radio-card-box .ds-radio-card-title > svg { visibility: visible; }
  .ds-radio-card-input:focus-visible + .ds-radio-card-box { outline: 2px solid var(--focus); outline-offset: 2px; }

  /* File drop zone (components/file-drop-zone.tsx). Tokens only. */
  .ds-drop { display: block; }
  .ds-drop-files { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
  .ds-drop-files:empty { display: none; }
  .ds-drop-target {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; padding: var(--space-4) var(--space-5);
    border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text-secondary);
  }
  .ds-drop-target > svg { color: var(--accent); }
  .ds-drop[data-over] .ds-drop-target { border-color: var(--accent); background: var(--accent-soft); }
  .ds-drop-prompt { margin: 0; color: var(--text-primary); font-size: var(--fs-body); }
  .ds-drop-hint { margin: 0; font-size: var(--fs-label); color: var(--text-secondary); }
  .ds-drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
  .ds-drop[hidden] { display: none; }

  /* Rich paste field (components/rich-paste-field.tsx). Tokens only. */
  .ds-paste { display: block; }
  .ds-drop + .ds-paste { margin-top: var(--space-4); }
  .ds-paste-label { display: block; font-size: var(--fs-label); font-weight: 600; margin-bottom: var(--space-2); }
  .ds-paste-field {
    display: block; width: 100%; box-sizing: border-box; min-height: 140px; resize: vertical; padding: var(--space-3) var(--space-4);
    font: inherit; color: var(--text-primary); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius);
  }
  .ds-paste-field:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
  .ds-paste-hint { margin: var(--space-2) 0 0; font-size: var(--fs-label); color: var(--text-secondary); }

  /* Progress bar (components/progress-bar.tsx). Tokens only. */
  .ds-progress { display: block; }
  .ds-progress[hidden] { display: none; }
  .ds-progress-label { margin: 0 0 var(--space-2); font-size: var(--fs-small); color: var(--text-secondary); }
  .ds-progress-bar { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-hover); }
  .ds-progress-bar::-webkit-progress-bar { background: var(--surface-hover); }
  .ds-progress-bar::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-pill); }
  .ds-progress-bar::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-pill); }
  .ds-progress-bar:indeterminate { background: linear-gradient(90deg, var(--surface-hover) 0%, var(--accent) 50%, var(--surface-hover) 100%); background-size: 200% 100%; animation: ds-progress-move 1.4s linear infinite; }
  @keyframes ds-progress-move { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  @media (prefers-reduced-motion: reduce) { .ds-progress-bar:indeterminate { animation: none; background: var(--accent); } }

  /* Data table (components/data-table.tsx). Tokens only. At 640px EVERY table.data stacks (section 8.23, ds-v2 S9): one card per row, each cell led by its
     data-label, the head row kept for screen readers. The editing grids of Slidebygger (table.work-cells) are inputs, not data, and keep their own scroller. */
  /* The title starts where the first column's text starts: a cell pads itself with --space-3, so the header does too (hk 2026-10-19). Every Panel whose flush body holds a table follows.
     Below 640px the rows stack and pad themselves with --card-pad, so the title goes back to it. */
  .ds-data > header { padding: var(--space-3); }
  .panel:has(> .panel-body-flush table.data:not(.work-cells)) > header { padding-left: var(--space-3); padding-right: var(--space-3); }
  /* Screens wrap a flush panel's table in .inner, which pads --card-pad (styles.ts) and so pushed the text 12px right of the title: a flush body is flush, the cell does the padding.
     A table straight in a padded body (no .inner) is pulled out by the cell's own padding instead, so its text sits on the body edge, where the title is. */
  .panel-body-flush > .inner:has(> table.data:not(.work-cells)) { padding-left: 0; padding-right: 0; }
  :is(.panel-body:not(.panel-body-flush), .panel-body:not(.panel-body-flush) > .stop-body) > table.data:not(.work-cells) { margin-left: calc(-1 * var(--space-3)); margin-right: calc(-1 * var(--space-3)); width: calc(100% + 2 * var(--space-3)); }
  @media (max-width: 640px) {
    .ds-data > header { padding-left: var(--card-pad); padding-right: var(--card-pad); }
    .panel:has(> .panel-body-flush table.data:not(.work-cells)) > header { padding-left: var(--card-pad); padding-right: var(--card-pad); }
    :is(.panel-body:not(.panel-body-flush), .panel-body:not(.panel-body-flush) > .stop-body) > table.data:not(.work-cells) { margin-left: calc(-1 * var(--card-pad)); margin-right: calc(-1 * var(--card-pad)); width: calc(100% + 2 * var(--card-pad)); }
  }
  .ds-data-table td .sub { display: block; color: var(--text-tertiary); font-size: var(--fs-label); }
  @media (max-width: 640px) {
    table.data:not(.work-cells) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    table.data:not(.work-cells), table.data:not(.work-cells) tbody, table.data:not(.work-cells) tfoot, table.data:not(.work-cells) tr,
    table.data:not(.work-cells) td, table.data:not(.work-cells) tbody th, table.data:not(.work-cells) tfoot th { display: block; width: 100%; box-sizing: border-box; }
    table.data:not(.work-cells) tr { border-bottom: 1px solid var(--border); padding: var(--space-3) var(--card-pad); }
    table.data:not(.work-cells) tr:last-child { border-bottom: 0; }
    table.data:not(.work-cells) td, table.data:not(.work-cells) tbody th, table.data:not(.work-cells) tfoot th {
      border: 0; padding: var(--space-1) 0; display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); text-align: right;
    }
    table.data:not(.work-cells) td::before, table.data:not(.work-cells) tbody th::before, table.data:not(.work-cells) tfoot th::before {
      content: attr(data-label); flex: 0 0 auto; color: var(--text-tertiary); font-size: var(--fs-label); font-weight: 400; text-align: left;
    }
    table.data:not(.work-cells) td:first-child, table.data:not(.work-cells) tbody th:first-child, table.data:not(.work-cells) tfoot th:first-child {
      display: block; text-align: left; font-weight: 700;
    }
    table.data:not(.work-cells) td:first-child::before, table.data:not(.work-cells) tbody th:first-child::before, table.data:not(.work-cells) tfoot th:first-child::before { content: none; }
    table.data:not(.work-cells) td.num { text-align: right; }
  }

  /* Tabs (components/tabs.tsx). Tokens only. */
  /* The strip scrolls inside itself when its tabs are wider than the screen (W0 fix round: Mine delinger pushed the page 47px sideways at 320). */
  .ds-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
  .ds-tabs ul { min-width: max-content; list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); }
  .ds-tab {
    display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-lg); padding: 0 var(--space-3); margin-bottom: -1px;
    color: var(--text-secondary); text-decoration: none; font-weight: 600; font-size: var(--fs-body);
    border-bottom: 3px solid transparent; white-space: nowrap;
  }
  .ds-tab:focus-visible { outline-offset: -2px; }
  .ds-tab:hover { color: var(--text-primary); background: var(--surface-hover); }
  .ds-tab[aria-current="page"] { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 700; }
  .ds-tab-count { min-width: 1.5em; justify-content: center; }

  /* Dropdown menu (components/dropdown-menu.tsx). Tokens only. */
  .ds-menu { position: relative; }
  .ds-menu > summary { list-style: none; cursor: pointer; min-width: 44px; min-height: var(--control-lg); justify-content: center; }
  .ds-menu > summary::-webkit-details-marker { display: none; }
  .ds-menu[open] > summary { background: var(--surface-hover); color: var(--text-primary); }
  .ds-menu-list {
    position: absolute; right: 0; top: 100%; min-width: 200px; margin: var(--space-1) 0 0; padding: var(--space-1); list-style: none;
  }
  .ds-menu-list form { margin: 0; }
  .ds-menu-item {
    display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: var(--control-md); padding: var(--space-2) var(--space-3); box-sizing: border-box;
    border: 0; border-radius: var(--radius); background: transparent; color: var(--text-primary);
    font: inherit; font-size: var(--fs-body); text-align: left; text-decoration: none; cursor: pointer;
  }
  .ds-menu-item:hover, .ds-menu-item:focus-visible { background: var(--surface-hover); }
  .ds-menu-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  .ds-menu-danger { color: var(--danger); font-weight: 600; }
  .ds-menu-divider { height: 1px; margin: var(--space-2) var(--space-1); background: var(--border); }
  @media (max-width: 520px) {
    .ds-menu-list { position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0; min-width: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-3) var(--space-3) var(--space-5); }
    .ds-menu-item { min-height: 48px; }
    .assistant-table tbody tr:nth-last-child(-n+2) .ds-menu .ds-menu-list { bottom: 0; }
  }

  /* Toast (components/toast.tsx). Tokens only. */
  /* Bottom-right, 24px in, on the toast layer (decision 19, section 8.26; it was bottom-centre). Above the composer where a page has one, never over it:
     the clearance is the composer's height: --composer-height, which home-chat.ts publishes on <html> from the real shell (W2b item 6), and 11rem where no script measures it. At 640px and below it is full width with 16px margins. Inverted: --text-primary ground. */
  .ds-toast {
    position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: var(--z-toast); display: flex; align-items: center; gap: var(--space-2);
    max-width: min(26.25rem, calc(100% - 2 * var(--space-4))); padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); background: var(--text-primary); color: var(--surface);
    border-radius: var(--radius); box-shadow: var(--shadow-2);
  }
  html:has(.composer-shell) .ds-toast { bottom: calc(var(--space-6) + max(11rem, var(--composer-height, 0px))); }
  @media (max-width: 640px) {
    .ds-toast { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); max-width: none; }
    html:has(.composer-shell) .ds-toast { bottom: calc(var(--space-4) + max(11rem, var(--composer-height, 0px))); }
  }
  .ds-toast[hidden] { display: none; }
  .ds-toast-text { margin: 0; font-size: var(--fs-small); }
  .ds-toast-form { margin: 0; }
  .ds-toast .btn, .ds-toast .icon-btn { color: var(--surface); }
  .ds-toast .btn:hover, .ds-toast .icon-btn:hover { background: transparent; text-decoration: underline; color: var(--surface); }
  .ds-toast .btn:focus-visible, .ds-toast .icon-btn:focus-visible { outline: 2px solid var(--surface); outline-offset: 2px; }

  /* Form fields (components/form-fields.tsx). Tokens only. */
  .ds-field[data-invalid] input { border-color: var(--danger); }
  .ds-chipbox { border: 0; margin: 0; padding: 0; min-width: 0; }
  .ds-chipbox > legend { padding: 0; margin-bottom: var(--space-2); font-size: var(--fs-label); font-weight: 600; }
  .ds-chipbox-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  .ds-chipbox-chip { position: relative; display: inline-block; cursor: pointer; }
  .ds-chipbox-input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
  .ds-chipbox-face {
    display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-3); box-sizing: border-box;
    border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface);
    color: var(--text-primary); font-size: var(--fs-small); font-weight: 600;
  }
  .ds-chipbox-face > svg { display: none; }
  .ds-chipbox-input:checked + .ds-chipbox-face { background: var(--accent-soft); border-color: var(--accent); border-width: 2px; padding: 0 var(--space-3); }
  .ds-chipbox-input:checked + .ds-chipbox-face > svg { display: inline-block; color: var(--accent); }
  .ds-chipbox-input:focus-visible + .ds-chipbox-face { outline: 2px solid var(--focus); outline-offset: 2px; }
  .ds-file-chip {
    display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); min-height: var(--control-lg); box-sizing: border-box;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  }
  .ds-file-chip > svg { flex: 0 0 auto; color: var(--text-secondary); }
  .ds-file-chip-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: var(--fs-small); font-weight: 600; }
  .ds-file-chip-detail { flex: 0 1 auto; color: var(--text-secondary); font-size: var(--fs-label); }
  .ds-file-chip[data-state="failed"] { border-color: var(--danger); }
  .ds-file-chip[data-state="failed"] .ds-file-chip-detail { color: var(--danger); }
  .ds-file-chip[data-state="busy"] .ds-file-chip-detail::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: var(--space-2); vertical-align: -2px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: ds-spin 0.8s linear infinite; }
  @keyframes ds-spin { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) { .ds-file-chip[data-state="busy"] .ds-file-chip-detail::before { animation: none; } }
  /* Controls (components/form-fields.tsx CONTROLS_CSS). Tokens only. */
  /* The edge of a disabled box: half way from --border-strong to the surface, about 2:1 on the ground in both themes (it was --border, 1.3:1, and a
     disabled control must stay visible, spec 8.21). Computed on :root, so it follows the theme. */
  :root { --control-disabled-edge: color-mix(in srgb, var(--border-strong) 50%, var(--surface)); }
  input.ds-checkbox, input.ds-radio,
  input:where([type="checkbox"], [type="radio"]):not(.ds-chipbox-input, .ds-radio-card-input, .ds-segment-input, .ds-switch-input) {
    appearance: none; -webkit-appearance: none; box-sizing: border-box;
    flex: 0 0 var(--space-5); width: var(--space-5); height: var(--space-5); min-width: var(--space-5); min-height: var(--space-5);
    margin: var(--space-half) 0; padding: 0;
    border: var(--space-half) solid var(--border-strong); border-radius: var(--radius-sm); background-color: var(--surface);
    background-repeat: no-repeat; background-position: center; background-size: 100% 100%;
    cursor: pointer; vertical-align: middle;
    transition: background-color var(--motion-fast) var(--ease-fast), border-color var(--motion-fast) var(--ease-fast);
  }
  input.ds-radio, input[type="radio"]:not(.ds-radio-card-input, .ds-segment-input) { border-radius: 50%; }
  /* The marks are drawn in CSS, never as an image: the CSP is img-src 'self' (security-headers.ts), so a data: URL background draws nothing (W1b finding,
     W1a fix round item 14). The tick is a rotated L of two borders, the minus a bar; both are ::before of the input, which a box with appearance: none draws. */
  input.ds-checkbox:checked, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):checked,
  input.ds-checkbox:indeterminate, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):indeterminate {
    background-color: var(--accent-fill); border-color: var(--accent-fill);
  }
  input.ds-checkbox:checked::before, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):checked::before {
    content: ""; display: block; box-sizing: border-box; width: calc(var(--space-1) + 1px); height: calc(var(--space-2) + var(--space-half));
    margin: 1px auto 0; border: solid var(--accent-fill-text); border-width: 0 var(--space-half) var(--space-half) 0; transform: rotate(45deg);
  }
  input.ds-checkbox:indeterminate::before, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):indeterminate::before {
    content: ""; display: block; box-sizing: border-box; width: calc(var(--space-2) + var(--space-half)); height: var(--space-half);
    margin: calc(var(--space-2) - 1px) auto 0; border-radius: 1px; background: var(--accent-fill-text);
  }
  input.ds-radio:checked, input[type="radio"]:not(.ds-radio-card-input, .ds-segment-input):checked {
    background-color: var(--accent-fill-text); border: calc(var(--space-1) + var(--space-half)) solid var(--accent-fill);
  }
  input.ds-checkbox:focus-visible, input.ds-radio:focus-visible,
  input:where([type="checkbox"], [type="radio"]):not(.ds-chipbox-input, .ds-radio-card-input, .ds-segment-input, .ds-switch-input):focus-visible {
    outline: var(--space-half) solid var(--focus); outline-offset: var(--space-half);
  }
  input.ds-checkbox:disabled, input.ds-radio:disabled,
  input:where([type="checkbox"], [type="radio"]):not(.ds-chipbox-input, .ds-radio-card-input, .ds-segment-input, .ds-switch-input):disabled {
    background-color: var(--bg); border-color: var(--control-disabled-edge); cursor: not-allowed;
  }
  input.ds-radio:disabled:checked, input[type="radio"]:not(.ds-radio-card-input, .ds-segment-input):disabled:checked { border-color: var(--border-strong); background-color: var(--bg); }
  input.ds-checkbox:disabled:checked, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):disabled:checked { background-color: var(--border-strong); border-color: var(--border-strong); }

  /* A bare box (one outside a .ds-check row, whose whole row is the target) gets a 24px minimum hit area: the 20px box plus 2px each side (WCAG 2.5.8,
     W1a fix round item 9). The extra is a transparent ::after, which an input with appearance: none hit-tests as part of itself. */
  input:where(.ds-checkbox, .ds-radio):not(.ds-check > *) { position: relative; }
  input:where(.ds-checkbox, .ds-radio):not(.ds-check > *)::after { content: ""; position: absolute; inset: calc(var(--space-half) * -1); }

  /* ONE focus ring. A choice card or a layout option that rings its own label (.chat-quiz-choice, .slide-layout-option, label.tag-suggestion) does not ring
     the box inside it as well (W1a fix round item 7). */
  .chat-quiz-choice input:focus-visible, .slide-layout-option input:focus-visible, label.tag-suggestion input:focus-visible { outline: none; }

  /* The row: the whole row is the label, 44px tall, the box on the first text line, the caption under the text (§8.6). */
  .ds-check, label.row:has(> input:where([type="checkbox"], [type="radio"])) {
    display: flex; align-items: flex-start; gap: var(--space-3); min-height: var(--control-lg); padding: var(--space-2) 0; box-sizing: border-box; cursor: pointer; line-height: 1.5;
  }
  :where(.ds-check + .ds-check) { margin-top: var(--space-1); }
  .ds-check-text { display: block; min-width: 0; }
  .ds-check-hint { display: block; color: var(--text-tertiary); font-size: var(--fs-label); line-height: 1.4; }
  .ds-check:has(> input:disabled) { cursor: not-allowed; color: var(--text-tertiary); }

  /* The switch (§8.8): one control, 40x24, a visible Til or Fra. A <button role="switch" aria-checked> drawn by CSS alone, so the scripts that flip
     aria-checked keep working; the state word is the button's ::after. The knob is a radial gradient moved with background-position. */
  .switch {
    appearance: none; -webkit-appearance: none; flex: 0 0 auto; display: inline-flex; align-items: center; gap: var(--space-2);
    min-height: var(--control-lg); margin: 0; padding: 0; border: 0; background: transparent; color: var(--text-primary);
    font: inherit; font-size: var(--fs-label); font-weight: 600; cursor: pointer;
  }
  .switch::before, input.ds-switch-input {
    content: ""; flex: 0 0 var(--space-10); box-sizing: border-box; width: var(--space-10); height: var(--space-6); border-radius: var(--radius-pill);
    background-color: var(--border-strong);
    background-image: radial-gradient(circle closest-side, var(--switch-knob, var(--accent-fill-text)) 75%, transparent calc(75% + 1px));
    background-repeat: no-repeat; background-size: var(--space-6) var(--space-6); background-position: 0 0;
    transition: background-color var(--motion-fast) var(--ease-fast), background-position var(--motion-fast) var(--ease-fast);
  }
  .switch::after { content: var(--switch-off-word, ""); min-width: var(--space-6); text-align: left; }
  .switch[aria-checked="true"]::before { background-color: var(--accent-fill); background-position: var(--space-4) 0; }
  .switch[aria-checked="true"]::after { content: var(--switch-on-word, ""); }
  .switch:focus-visible, input.ds-switch-input:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: var(--space-half); }
  .switch:disabled, .switch[aria-disabled="true"] { cursor: not-allowed; color: var(--text-tertiary); }
  /* Disabled (§8.8, §8.21): never opacity and never white on pale. OFF is an outlined track with a knob in the tertiary text colour (the colour the
     palette guarantees 4.5:1 on a page ground); ON is a filled tertiary track with the white knob. Both read as a switch, and as not available. */
  .switch:disabled::before, .switch[aria-disabled="true"]::before {
    --switch-knob: var(--text-tertiary); background-color: var(--surface); box-shadow: inset 0 0 0 var(--space-half) var(--text-tertiary);
  }
  .switch:disabled[aria-checked="true"]::before, .switch[aria-disabled="true"][aria-checked="true"]::before {
    --switch-knob: var(--accent-fill-text); background-color: var(--text-tertiary); box-shadow: none;
  }
  /* The switch that posts with a form: a real checkbox (role="switch") drawn as the track, and the state word as a REAL element beside it (a label
     span), not a ::after on the input, which Firefox does not draw (W1a fix round item 4). Both words are in the markup; the checked state shows one. */
  .ds-switch-field { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-lg); flex: 0 0 auto; cursor: pointer; font-size: var(--fs-label); font-weight: 600; color: var(--text-primary); }
  input.ds-switch-input { appearance: none; -webkit-appearance: none; position: relative; margin: 0; padding: 0; border: 0; cursor: pointer; }
  .ds-switch-word { display: inline-block; min-width: var(--space-6); }
  .ds-switch-word > .ds-switch-on, input.ds-switch-input:checked ~ .ds-switch-word > .ds-switch-off { display: none; }
  input.ds-switch-input:checked ~ .ds-switch-word > .ds-switch-on { display: inline; }
  input.ds-switch-input:checked { background-color: var(--accent-fill); background-position: var(--space-4) 0; }
  input.ds-switch-input:disabled { --switch-knob: var(--text-tertiary); background-color: var(--surface); box-shadow: inset 0 0 0 var(--space-half) var(--text-tertiary); cursor: not-allowed; }
  input.ds-switch-input:disabled:checked { --switch-knob: var(--accent-fill-text); background-color: var(--text-tertiary); box-shadow: none; }
  .ds-switch-field:has(> input:disabled) { cursor: not-allowed; color: var(--text-tertiary); }
  /* The group label (§8.9): a label, not a box. The browser's etched fieldset is gone everywhere. */
  .ds-fieldset-contents { display: contents; }
  /* :where, so a screen's own fieldset margin (.chat-quiz-choices { margin: 0 }) wins a tie (W1a fix round, item 6). */
  :where(fieldset, .ds-fieldset) { border: 0; margin: 0 0 var(--space-6); padding: 0; min-inline-size: 0; }
  legend, .ds-fieldset > legend { padding: 0; margin-bottom: var(--space-2); font-size: var(--fs-label); font-weight: 600; }
  legend > strong { font-weight: inherit; }

  /* The range (§8.12): a 4px track with the filled part, a 20px thumb in a 44px hit area. --ds-range-fill is set by the script that moves it. */
  input.ds-range, input[type="range"] {
    appearance: none; -webkit-appearance: none; width: 100%; height: var(--control-lg); margin: 0; padding: 0; background: transparent; cursor: pointer; accent-color: var(--accent-fill);
  }
  input.ds-range::-webkit-slider-runnable-track, input[type="range"]::-webkit-slider-runnable-track {
    height: var(--space-1); border-radius: var(--radius-pill);
    background: linear-gradient(to right, var(--accent-fill) var(--ds-range-fill, 0%), var(--border-strong) var(--ds-range-fill, 0%));
  }
  input.ds-range::-moz-range-track, input[type="range"]::-moz-range-track { height: var(--space-1); border-radius: var(--radius-pill); background: var(--border-strong); }
  input.ds-range::-moz-range-progress, input[type="range"]::-moz-range-progress { height: var(--space-1); border-radius: var(--radius-pill); background: var(--accent-fill); }
  input.ds-range::-webkit-slider-thumb, input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; box-sizing: border-box; width: var(--space-5); height: var(--space-5); margin-top: calc(var(--space-2) * -1);
    border-radius: 50%; border: var(--space-half) solid var(--accent-fill-text); background: var(--accent-fill);
  }
  input.ds-range::-moz-range-thumb, input[type="range"]::-moz-range-thumb {
    box-sizing: border-box; width: var(--space-5); height: var(--space-5); border-radius: 50%; border: var(--space-half) solid var(--accent-fill-text); background: var(--accent-fill);
  }
  input.ds-range:focus-visible, input[type="range"]:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: var(--space-half); border-radius: var(--radius-sm); }

  /* The segmented choice (§8.7): a radio group drawn as joined pills. The native radio is visually hidden, the span is the pill. */
  .ds-segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; }
  .ds-segment > label { position: relative; display: block; cursor: pointer; }
  .ds-segment > label + label { border-left: 1px solid var(--border-strong); }
  .ds-segment-input { position: absolute; opacity: 0; width: var(--space-half); height: var(--space-half); margin: 0; }
  .ds-segment > label > span { display: flex; align-items: center; justify-content: center; padding: var(--space-2) var(--space-3); min-height: var(--control-md); box-sizing: border-box; text-align: center; font-size: var(--fs-small); font-weight: 600; line-height: var(--space-6); color: var(--text-primary); }
  .ds-segment-input:checked + span { background: var(--accent-fill); color: var(--accent-fill-text); }
  /* A segment whose choices cannot sit side by side on a phone or at 200% text (the display mode, Tilgængelighed) stacks them below 640px (ds-v2 S13). */
  @media (max-width: 640px) {
    .ds-segment.ds-segment-stack { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); border-radius: var(--radius-lg); }
    .ds-segment-stack > label + label { border-left: 0; border-top: 1px solid var(--border-strong); }
  }
  .ds-segment-input:focus-visible + span { outline: var(--space-half) solid var(--focus); outline-offset: calc(var(--space-half) * -1); }

  /* High Contrast (Windows forced colours, WCAG 1.4.11; ds-v2 W2a fix round, item 8). The browser replaces every background colour, so a mark drawn as a background
     (the indeterminate minus, the filled box, the radio's centre, the switch track and the selected segment) would vanish. These controls opt out of the override and
     name SYSTEM colours: the selected state is Highlight with HighlightText on it, an unselected box keeps its CanvasText edge, a disabled one is GrayText. The tick is
     a border and survives, but it is named too, so it stays HighlightText on the Highlight box. */
  @media (forced-colors: active) {
    input.ds-checkbox, input.ds-radio,
    input:where([type="checkbox"], [type="radio"]):not(.ds-chipbox-input, .ds-radio-card-input, .ds-segment-input, .ds-switch-input) { forced-color-adjust: none; background-color: Canvas; border-color: CanvasText; }
    input.ds-checkbox:checked, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):checked,
    input.ds-checkbox:indeterminate, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):indeterminate { background-color: Highlight; border-color: Highlight; }
    input.ds-checkbox:checked::before, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):checked::before { border-color: HighlightText; }
    input.ds-checkbox:indeterminate::before, input:where([type="checkbox"]):not(.ds-chipbox-input, .ds-switch-input):indeterminate::before { background: HighlightText; }
    input.ds-radio:checked, input[type="radio"]:not(.ds-radio-card-input, .ds-segment-input):checked { background-color: HighlightText; border-color: Highlight; }
    input.ds-checkbox:disabled, input.ds-radio:disabled,
    input:where([type="checkbox"], [type="radio"]):not(.ds-chipbox-input, .ds-radio-card-input, .ds-segment-input, .ds-switch-input):disabled { border-color: GrayText; }
    .switch, input.ds-switch-input { forced-color-adjust: none; }
    .switch { color: CanvasText; }
    .switch:disabled, .switch[aria-disabled="true"] { color: GrayText; }
    .switch::before, input.ds-switch-input { --switch-knob: Canvas; background-color: CanvasText; }
    .switch[aria-checked="true"]::before, input.ds-switch-input:checked { --switch-knob: HighlightText; background-color: Highlight; }
    .switch:disabled::before, .switch[aria-disabled="true"]::before, input.ds-switch-input:disabled { --switch-knob: GrayText; background-color: Canvas; box-shadow: inset 0 0 0 var(--space-half) GrayText; }
    .ds-segment-input:checked + span { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  }


  /* Slide thumbnail (components/slide-thumbnail.tsx). Tokens only. */
  .ds-thumb { display: block; width: 100%; height: 100%; box-sizing: border-box; }
  .ds-thumb-img { object-fit: cover; border: 1px solid var(--border); }
  .ds-thumb-none { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); text-align: center; background: var(--surface); }
  .ds-thumb-title { font-weight: 700; font-size: var(--fs-body); color: var(--text-primary); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .ds-thumb-note { font-size: var(--fs-xs); color: var(--text-secondary); }

  /* Colour swatch (components/colour-swatch.tsx). Tokens only; the chip's colour is the template's own. */
  .ds-swatch { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: var(--fs-label); }
  .ds-swatch-chip { flex: 0 0 auto; width: 22px; height: 22px; box-sizing: border-box; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-hover); }
  .ds-swatch-text { color: var(--text-primary); white-space: nowrap; font-variant-numeric: tabular-nums; }
  @media (max-width: 640px) { .ds-swatch-text { white-space: normal; } }

  /* Skeleton (components/skeleton.tsx). Tokens only. */
  .ds-skeleton-group { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  .ds-skeleton { display: block; background: linear-gradient(90deg, var(--surface-hover) 0%, var(--border) 50%, var(--surface-hover) 100%); background-size: 200% 100%; animation: ds-skeleton-move 1.4s linear infinite; border-radius: var(--radius); }
  .ds-skeleton-swatch { width: 148px; height: 30px; border-radius: var(--radius-pill); }
  .ds-skeleton-thumb { width: 96px; height: 54px; }
  .ds-skeleton-line { width: 100%; height: 14px; }
  .ds-skeleton-group-line { flex-direction: column; }
  @keyframes ds-skeleton-move { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  @media (prefers-reduced-motion: reduce) { .ds-skeleton { animation: none; background: var(--surface-hover); } }



  :root { --file-word-bg: #E6EEF9; --file-word-fg: #1F4FA3; --file-ppt-bg: #FCEBE1; --file-ppt-fg: #A3400F; --file-xls-bg: #E7F3E5; --file-xls-fg: #2F7A2F; --file-md-bg: #ECE7E0; --file-md-fg: #3D4552; --file-pdf-bg: #FBEAE8; --file-pdf-fg: #9B1C12; --file-html-bg: #E2F4EE; --file-html-fg: #0B4F48; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --file-word-bg: #1B2F54; --file-word-fg: #A9C6F5; --file-ppt-bg: #4A2A1C; --file-ppt-fg: #F6BC97; --file-xls-bg: #1F3D26; --file-xls-fg: #9BDDA5; --file-md-bg: #2E3A52; --file-md-fg: #CBD4E2; --file-pdf-bg: #4A2224; --file-pdf-fg: #FFB1A9; --file-html-bg: #17403D; --file-html-fg: #92DFCE; } }
  :root[data-theme="dark"] { --file-word-bg: #1B2F54; --file-word-fg: #A9C6F5; --file-ppt-bg: #4A2A1C; --file-ppt-fg: #F6BC97; --file-xls-bg: #1F3D26; --file-xls-fg: #9BDDA5; --file-md-bg: #2E3A52; --file-md-fg: #CBD4E2; --file-pdf-bg: #4A2224; --file-pdf-fg: #FFB1A9; --file-html-bg: #17403D; --file-html-fg: #92DFCE; }
  .file-tile[data-look="word"] { background: var(--file-word-bg); color: var(--file-word-fg); }
  .file-tile[data-look="ppt"] { background: var(--file-ppt-bg); color: var(--file-ppt-fg); }
  .file-tile[data-look="xls"] { background: var(--file-xls-bg); color: var(--file-xls-fg); }
  .file-tile[data-look="md"] { background: var(--file-md-bg); color: var(--file-md-fg); }
  .file-tile[data-look="pdf"] { background: var(--file-pdf-bg); color: var(--file-pdf-fg); }
  .file-tile[data-look="html"] { background: var(--file-html-bg); color: var(--file-html-fg); }


  /* Slide thumbnail rail (components/slide-rail.tsx). Tokens only. */
  .ds-rail { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
  .ds-rail-list { list-style: none; margin: 0; padding: var(--space-half); display: flex; flex-direction: column; gap: var(--space-2); }
  .ds-rail-option { display: grid; grid-template-columns: 1.4em minmax(0, 1fr); gap: var(--space-2); align-items: start; cursor: pointer; border-radius: var(--radius); padding: var(--space-1); }
  .ds-rail-option:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
  .ds-rail-option[aria-selected="true"] { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -1px; }
  .ds-rail-option[aria-selected="true"]:focus-visible { outline-color: var(--focus); outline-offset: 1px; }
  .ds-rail-n { color: var(--text-secondary); font-size: var(--fs-label); font-variant-numeric: tabular-nums; text-align: right; padding-top: var(--space-half); }
  .ds-rail-option[aria-selected="true"] .ds-rail-n { color: var(--text-primary); font-weight: 700; }
  .ds-rail-frame { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 4px; background: var(--surface-hover); }
  .ds-rail-frame .ds-thumb { position: absolute; inset: 0; width: 100%; height: 100%; }
  .ds-rail-frame .ds-thumb-none { padding: var(--space-1) var(--space-2); gap: var(--space-half); }
  .ds-rail-frame .ds-thumb-title { font-size: var(--fs-xs); -webkit-line-clamp: 3; }
  .ds-rail[data-busy] .ds-rail-frame, .ds-rail-list[aria-busy="true"] .ds-rail-frame { animation: ds-rail-pulse 1.4s ease-in-out infinite; }
  @keyframes ds-rail-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
  @media (prefers-reduced-motion: reduce) { .ds-rail-list[aria-busy="true"] .ds-rail-frame { animation: none; } }
  .ds-rail-badge { position: absolute; right: var(--space-half); bottom: var(--space-half); z-index: 1; }
  .ds-rail-links { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
  .ds-rail-add { padding-left: 1.4em; }
  @media (max-width: 1023px) {
    .ds-rail-list { flex-direction: row; overflow-x: auto; padding-bottom: var(--space-1); }
    .ds-rail-option { flex: 0 0 160px; grid-template-columns: 1.2em minmax(0, 1fr); }
    .ds-rail-add { padding-left: 0; }
  }

  /* Slide preview (components/slide-view.tsx). Tokens only; the picture keeps its own colours inside a 1 px frame. */
  .ds-slideview { margin: 0; min-width: 0; }
  .ds-slideview-frame { position: relative; aspect-ratio: 16 / 9; width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-hover); overflow: hidden; }
  .ds-slideview[data-state="loading"] .ds-slideview-frame { animation: ds-rail-pulse 1.4s ease-in-out infinite; }
  .ds-slideview-status { position: absolute; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: var(--fs-body); text-align: center; padding: var(--space-3); }
  .ds-slideview-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
  .ds-slideview[data-state="loading"] .ds-slideview-img { opacity: 0; }
  .ds-slideview[data-state="loading"][data-stale] .ds-slideview-img { opacity: .45; }
  .ds-slideview[data-state="ready"] .ds-slideview-status, .ds-slideview[data-state="fallback"] .ds-slideview-status, .ds-slideview[data-state="none"] .ds-slideview-status { display: none; }
  .ds-slideview[data-state="fallback"] .ds-slideview-img { display: none; }
  .ds-slideview-fallback { position: absolute; inset: 0; display: none; flex-direction: column; gap: var(--space-3); padding: 4% 5%; overflow: auto; background: var(--surface); color: var(--text-primary); box-sizing: border-box; }
  .ds-slideview[data-state="fallback"] .ds-slideview-fallback, .ds-slideview[data-state="none"] .ds-slideview-fallback { display: flex; }
  .ds-slideview-fallback:focus-visible { outline: var(--space-half) solid var(--focus); outline-offset: calc(-1 * var(--space-half)); }
  .ds-slideview-title { margin: 0; font-size: clamp(1rem, 2.4vw, 1.5rem); overflow-wrap: anywhere; }
  .ds-slideview-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); }
  .ds-slideview-part { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); min-width: 0; }
  .ds-slideview-part h4 { margin: 0 0 var(--space-1); font-size: var(--fs-small); }
  .ds-slideview-part p, .ds-slideview-part ul { margin: 0; font-size: var(--fs-small); overflow-wrap: anywhere; }
  .ds-slideview-part ul { padding-left: 1.1em; }
  .ds-slideview-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
  .ds-slideview-bars li { display: grid; grid-template-columns: minmax(80px, 28%) 1fr auto; gap: var(--space-2); align-items: center; font-size: var(--fs-small); }
  .ds-slideview-meter { width: 100%; height: 14px; }
  .ds-slideview-notice { margin-top: var(--space-2); }
  .ds-slideview-notice[hidden], .ds-slideview-error[hidden] { display: none; }
  .ds-slideview-error { border: 1px solid var(--warning); background: var(--warning-soft); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
  .ds-slideview-error p { margin: 0; }
  .ds-slideview-error-title { font-weight: 700; }
  .ds-slideview-error-text { color: var(--text-secondary); font-size: var(--fs-small); }
  .ds-slideview-error-actions { margin-top: var(--space-2) !important; display: flex; gap: var(--space-2); flex-wrap: wrap; }
  .ds-slideview-caption { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-2); color: var(--text-secondary); font-size: var(--fs-small); }
  .ds-slideview-caption .ds-slideview-nav { display: inline-flex; gap: var(--space-2); }

  /* Proposal card (components/proposal-card.tsx). Tokens only. */
  .ds-proposal { gap: 0; }
  .ds-proposal-body { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4); min-width: 0; }
  .ds-proposal-lists { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--space-2); align-items: start; }
  .ds-proposal-list h4 { margin: 0 0 var(--space-1); font-size: var(--fs-label); font-weight: 700; color: var(--text-secondary); }
  .ds-proposal-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); font-size: var(--fs-small); overflow-wrap: anywhere; }
  .ds-proposal-n { display: inline-block; min-width: 2.6em; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
  .ds-proposal-arrow { padding-top: var(--card-pad); color: var(--text-secondary); }
  .ds-proposal-result { margin: 0; font-size: var(--fs-body); }
  .ds-proposal[data-status="stale"] .ds-proposal-result { color: var(--warning); }
  .ds-proposal-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0 var(--space-3) var(--space-3); }
  .ds-proposal-form { margin: 0; display: inline-flex; }
  @media (max-width: 520px) {
    .ds-proposal-lists { grid-template-columns: minmax(0, 1fr); }
    .ds-proposal-arrow { display: none; }
    .ds-proposal-actions { flex-direction: column; }
    .ds-proposal-actions .btn, .ds-proposal-form { width: 100%; justify-content: center; }
    .ds-proposal-form .btn { width: 100%; justify-content: center; }
  }

  /* Title field (components/title-field.tsx). Tokens only. */
  .ds-title-field { margin: 0; min-width: 0; flex: 1 1 240px; }
  .ds-title-heading { margin: 0; font-size: var(--fs-h1); line-height: 1.25; }
  .ds-title-input {
    width: 100%; box-sizing: border-box; font: inherit; font-weight: 700; color: var(--text-primary);
    padding: var(--space-1) var(--space-2); margin-left: calc(var(--space-2) * -1); border: 1px solid transparent; border-radius: var(--radius); background: transparent; text-overflow: ellipsis;
  }
  .ds-title-input:hover { border-color: var(--border-strong); }
  .ds-title-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--border-strong); background: var(--surface); }
  .ds-title-field .field-error { margin: var(--space-1) 0 0; }
  .ds-title-field .field-error[hidden] { display: none; }

  /* Counted fields and grid inputs (components/counted-field.tsx). Tokens only. */
  .ds-counted textarea { width: 100%; box-sizing: border-box; font: inherit; resize: vertical; min-height: 4.5em; }
  .ds-count { margin: var(--space-half) 0 0; font-size: var(--fs-label); color: var(--text-secondary); font-variant-numeric: tabular-nums; text-align: right; }
  .ds-count[data-full] { color: var(--danger); font-weight: 700; }
  .ds-grid-input { width: 100%; min-width: 4.5rem; box-sizing: border-box; font: inherit; padding: var(--space-1) var(--space-2); }


  .share-wrap { padding-bottom: var(--space-12); display: flex; flex-direction: column; gap: var(--space-5); }
  .share-way { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); background: var(--surface); display: flex; flex-direction: column; gap: var(--space-3); }
  .share-way h2 { margin: 0; font-size: var(--fs-title); }
  .share-way fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
  .share-way legend { font-weight: 600; margin-bottom: var(--space-2); padding: 0; }
  .share-way fieldset > .ds-check + .ds-check { margin-top: 0; }
  .share-way .row { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--control-lg); }
  .share-colleagues { display: flex; flex-direction: column; gap: var(--space-half); max-height: 18rem; overflow-y: auto; }
  .share-receives { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
  .staff-code-card { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin: 0; align-items: baseline; }
  .staff-code-card dt { color: var(--text-secondary); }
  .staff-code-card dd { margin: 0; min-width: 0; }
  .staff-code { font-size: var(--fs-title); font-weight: 700; letter-spacing: .08em; }
  .staff-link { overflow-wrap: anywhere; }
  .staff-code-actions, .staff-copy-hint { margin: 0; }
  .staff-code-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
  .staff-code-actions [data-copy-status]:empty { display: none; }
  .mp-text { white-space: pre-wrap; overflow-wrap: anywhere; }
  .share-code-box { display: flex; justify-content: center; padding: var(--space-5) var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-hover); }
  .share-code { margin: 0; font-size: var(--fs-display); font-weight: 700; letter-spacing: .08em; font-variant-numeric: tabular-nums; font-family: var(--font-mono, ui-monospace, monospace); color: var(--text-primary); }
  .share-facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0; }
  .share-facts dt { color: var(--text-secondary); }
  .share-facts dd { margin: 0; }
  .share-offers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
  .share-offer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--space-2); }
  .share-offer:first-child { border-top: 0; }
  .share-offer h3, .share-card h2 { margin: 0; font-size: var(--fs-prose); line-height: var(--lh-body); }
  .share-offer p { margin: 0; }
  .share-offer-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
  .share-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
  .share-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); background: var(--surface); display: flex; flex-direction: column; gap: var(--space-2); }
  .share-card-head { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; }
  .share-card-line { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; color: var(--text-secondary); }
  .share-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  .share-card .ds-progress { min-width: 12rem; }
  @media (max-width: 640px) {
    .share-code { font-size: var(--fs-h1); }
    .share-card-actions .btn, .share-offer-actions .btn, .share-offer-actions form { width: 100%; min-height: var(--control-lg); }
  }



  /* Spacing steps. mt/mb set one margin, as the style did. mrb/mrt RESET the margin first (a paragraph's default top margin is gone), as the shorthand did. */
  .m-0 { margin: 0; }
  .mt-2 { margin-top: var(--space-2); }
  .mt-3 { margin-top: var(--space-3); }
  .mt-4 { margin-top: var(--space-4); }
  .mt-5 { margin-top: var(--space-5); }
  .mb-3 { margin-bottom: var(--space-3); }
  .mb-5 { margin-bottom: var(--space-5); }
  .mrb-2 { margin: 0 0 var(--space-2); }
  .mrt-2 { margin: var(--space-2) 0 0; }
  .my-half { margin: var(--space-half) 0; }
  .my-1 { margin: var(--space-1) 0; }
  .my-2 { margin: var(--space-2) 0; }
  /* Flow and alignment. */
  .cluster { display: flex; gap: var(--space-2); flex-wrap: wrap; }
  .cluster-3 { gap: var(--space-3); }
  .cluster-center { align-items: center; }
  .cluster-nowrap { flex-wrap: nowrap; }
  .split-line { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
  .contents { display: contents; }
  .inline-form { display: inline; }
  .inner-scroll { overflow-x: auto; }
  .wrap-anywhere { overflow-wrap: anywhere; }
  .break-token { overflow-wrap: anywhere; word-break: break-all; }
  .num-tabular { font-variant-numeric: tabular-nums; }
  .text-tertiary, .menu .item.text-tertiary { color: var(--text-tertiary); }
  .fs-title { font-size: var(--fs-title); }
  .min-control-lg { min-height: var(--control-lg); }
  .btn.btn-inline-lg { display: inline-block; min-height: var(--control-lg); }
  .list-plain-flush { padding: 0; }
  .list-plain-bare { padding: 0; margin: 0; }
  .segmented.segmented-inline { display: inline-flex; }
  /* A setting row whose control is a group (the display mode's choices and its Gem): the row wraps, the group wraps inside itself (ds-v2 S13). */
  .setting-row.setting-row-wrap { flex-wrap: wrap; }
  .setting-row-wrap > .grow { flex: 1 1 14rem; min-width: 0; }
  .setting-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-width: 0; max-width: 100%; }
  .setting-controls > fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
  /* The wide search is 18.75rem where there is room and shrinks to the line where there is not (e2e 08, Samtaler at 320 px in Stor): a head's actions may be narrower
     than their content, and they wrap. */
  .head-actions { min-width: 0; max-width: 100%; }
  .rail-search.rail-search-wide { margin: 0; flex: 1 1 18.75rem; min-width: 0; max-width: 100%; }
  /* A row header in a data table, as the style set it. It is a body cell, so it pads and centres as a td does and the last row has no rule (the column head's
     0-top padding put the label above its row's figures, and its border showed under the card's last row). */
  table.data th.row-head { font-weight: 600; text-align: left; padding: var(--space-4) var(--space-3); vertical-align: middle; }
  table.data tbody tr:last-child th.row-head { border-bottom: 0; }
  table.data th.th-left { text-align: left; }
  /* Icon buttons that carry a state colour. The hover keeps it, as the inline colour did. */
  .icon-btn.icon-btn-pinned, .icon-btn.icon-btn-pinned:hover { color: var(--accent-fill); }
  .icon-btn.icon-btn-danger, .icon-btn.icon-btn-danger:hover { color: var(--danger); }
  .list-empty-line { padding: var(--space-6) var(--card-pad); color: var(--text-tertiary); }
  /* The health badge of the operator's school list. */
  .health-badge { white-space: nowrap; }
  .health-ok { color: var(--text-tertiary); }
  .health-warn { color: var(--warning); }
  .health-danger { color: var(--danger); }
  /* The tag marks of the rail and the chat head: one class per subject token. */
  .tag-item, .list-plain > li.tag-item { display: block; padding: 0; border: 0; }
  .fag-mark-kemi { background: var(--fag-kemi-soft); color: var(--fag-kemi); }
  .fag-mark-mat { background: var(--fag-mat-soft); color: var(--fag-mat); }
  .fag-mark-dansk { background: var(--fag-dansk-soft); color: var(--fag-dansk); }
  .fag-mark-tysk { background: var(--fag-tysk-soft); color: var(--fag-tysk); }
  .fag-mark-samf { background: var(--fag-samf-soft); color: var(--fag-samf); }
  .fag-mark-bio { background: var(--fag-bio-soft); color: var(--fag-bio); }
  .fag-mark.fag-dashed { border: calc(var(--space-half) * .75) dashed var(--border-strong); }
  .chat-quiz-progress-static > span { width: 55%; }
  /* Provisioning. */
  .provision-value { user-select: all; word-break: break-all; max-width: 22rem; }
  .provision-steps { margin: 0; padding-left: 1.4rem; line-height: 1.7; }
  /* Hukommelse (F-20): the rows, cards and bars that were styled inline. */
  .memory-row, .list-plain > li.memory-row, .panel-body-flush .list-plain > li.memory-row { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
  .memory-scan-line { list-style: none; }
  .memory-meta { margin: var(--space-half) 0 var(--space-2); }
  .panel.memory-card { padding: var(--space-4) var(--space-5); margin: var(--space-2) 0; }
  .panel.memory-loading-card { padding: var(--space-3) var(--space-4); margin-top: var(--space-3); }
  .panel.memory-saved-card { padding: var(--space-3) var(--space-4); }
  .memory-sticky-form { position: sticky; bottom: var(--space-2); margin: var(--space-2) 0; }
  .memory-sticky-bar { position: sticky; bottom: 0; background: var(--surface); padding: var(--space-2) 0; margin: 0; }

