/*
 * Kulliyati -- the components layer: shared components first (icon, buttons,
 * page header, lists and rows, cards, navigation, dialogs, status chips,
 * states, banners, forms, segmented control, tables), then the screens.
 *
 * static/css/app.css declares the layer order and holds the tokens; this file
 * only adds rules to `@layer components`, with colours as var(--attend-*)
 * tokens, no gradients, blur or filters, and shadows only as the light theme's
 * elevation tokens (tests/test_css_rules.py). Look: docs/design/visual-design.md
 * (tests/ui/test_components_look.py, tests/ui/test_status_families.py).
 *
 * Linked after app.css (templates/base.html), so screen stylesheets linked
 * after this one override a shared component at equal specificity.
 */
@layer components {
  /* Icon (Lucide sprite via {% icon %}) */
  .icon {
    inline-size: 16px;
    block-size: 16px;
    flex-shrink: 0;
  }

  /* Arabic reads right to left: an icon that points along the line turns
     round (apps/ui/templatetags/ui.py MIRRORED_ICONS). */
  :root[dir="rtl"] .icon[data-mirror] {
    transform: scaleX(-1);
  }

  /* A plain link with a leading icon ("All groups" back links): the icon on
     the link's line (svg is a block in the reset), the link a 44px target. */
  p > a:not([class]):has(> .icon:first-child) {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--touch);
  }

  .icon--lg {
    inline-size: 20px;
    block-size: 20px;
  }

  .icon--xl {
    inline-size: 28px;
    block-size: 28px;
  }

  /* Wordmark */
  .brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 var(--space-3);
    color: var(--attend-text-strong);
    text-decoration: none;
  }

  .brand__mark {
    font-size: 23px;
    font-weight: var(--weight-bold);
    letter-spacing: -1.2px;
    line-height: 1.2;
    color: var(--attend-text-strong);
  }

  .brand__org {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--text-meta);
    color: var(--attend-text-secondary);
  }

  /* Buttons (visual-design.md §7): pills in Figtree 650, icon 16-20px, gap 8.
     .btn is the secondary button (brand tint), .btn--primary the one primary
     of a view, .btn--plain the ghost, .btn--danger the rose outline of a
     destructive confirmation (never a bright fill). Heights: phone 56 for the
     primary and 48 for the others; from 768px 44 / 40, ghost 36. */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 48px;
    min-width: var(--touch);
    padding: var(--space-2) var(--space-6);
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-button);
    font-weight: var(--weight-button);
    line-height: var(--leading-button);
    text-decoration: none;
    /* Labels stay on one line while they fit; with enlarged text a button
       wraps its label instead of pushing the page sideways. */
    max-width: 100%;
    text-align: center;
    overflow-wrap: anywhere;
    transition:
      transform 120ms ease-out,
      background-color 150ms ease,
      color 150ms ease,
      border-color 150ms ease;
    /* A long press on a phone neither selects the label nor opens the callout. */
    -webkit-touch-callout: none;
    user-select: none;
  }

  /* Hover only with a mouse (design review AD3): on a touch screen the
     outline or fill would stay after the tap. Presses answer everywhere. */
  @media (hover: hover) and (pointer: fine) {
    .btn:hover {
      border-color: currentColor;
      color: var(--attend-link-hover);
    }

    .btn--primary:hover {
      border-color: transparent;
      background: var(--attend-brand-hover);
      color: var(--attend-on-brand);
    }

    .btn--plain:hover {
      border-color: transparent;
      background: var(--attend-row-hover);
      color: var(--attend-brand-text);
    }

    .btn--danger:hover {
      border-color: var(--attend-danger-text);
      background: var(--attend-danger-bg);
      color: var(--attend-danger-text);
    }
  }

  .btn:active:not(:disabled) {
    transform: scale(0.97);
  }

  .btn--primary {
    min-height: 56px;
    background: var(--attend-brand);
    color: var(--attend-on-brand);
    box-shadow: var(--attend-shadow-primary);
  }

  /* brand-hover is a darker fill than brand in both themes, so the fill shows
     the hover and the press (white on it 7.20 / 6.11). */
  .btn--primary:active:not(:disabled) {
    background: var(--attend-brand-hover);
  }

  /* The ghost: brand-text with its icon, so a quiet action still reads as an
     action, not as plain text (design review 2026-11-09, BI8; owner: yes). */
  .btn--plain {
    background: transparent;
    color: var(--attend-brand-text);
  }

  .btn--plain:active:not(:disabled) {
    background: var(--attend-row-hover);
  }

  .btn--danger {
    border-color: var(--attend-danger-text);
    background: transparent;
    color: var(--attend-danger-text);
  }

  .btn--danger:active:not(:disabled) {
    background: var(--attend-danger-bg);
  }

  .btn--icon {
    padding: 0;
    inline-size: 48px;
  }

  .btn--block {
    width: 100%;
  }

  .btn:disabled,
  .btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.4;
    box-shadow: none;
    transform: none;
  }

  .btn[aria-busy="true"] {
    cursor: progress;
  }

  /* Compact for a mouse only: a touched tablet keeps 44px targets
     (tests/test_css_touch.py). */
  @media (min-width: 768px) and (pointer: fine) {
    .btn {
      min-height: 40px;
      padding: var(--space-1) var(--space-5);
    }

    .btn--primary {
      min-height: 44px;
    }

    .btn--plain {
      min-height: 36px;
    }

    /* Square and round: .btn's 44px min-width would stretch it. */
    .btn--icon {
      inline-size: 40px;
      min-width: 0;
      min-height: 40px;
      padding: 0;
    }
  }

  .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }

  /* Page header: breadcrumbs or an eyebrow label, the title, a muted line;
     the page's actions on the right. */
  .page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
  }

  /* A one-word title ("Administration") still fits a 360px screen with
     enlarged text: it breaks inside the word rather than scrolling sideways. */
  .page-header > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .page-header__eyebrow {
    margin-bottom: var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    line-height: var(--leading-label);
  }

  .page-header__sub {
    max-width: var(--measure);
    margin-top: var(--space-2);
    font-size: var(--text-small);
    color: var(--attend-text-muted);
  }

  /* Refresh in the header of a page whose data changes while it is open
     (components/refresh_button.html; owner, 2026-11-11). On a phone only its
     icon shows, at the title's end (its name stays for screen readers). */
  @media (max-width: 767px) {
    .page-header:has(> .actions > .refresh-page:only-child) {
      flex-wrap: nowrap;
      align-items: flex-start;
    }

    /* Never shrinks beside a long title and meta line (the live page at 360px
       pushed the button past the screen's edge and scrolled sideways). */
    .page-header > .actions:has(> .refresh-page:only-child) {
      flex: none;
    }

    .page-header .refresh-page {
      inline-size: var(--touch);
      padding: 0;
      justify-content: center;
    }

    .refresh-page__label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }

  /* Breadcrumbs: small muted links with "/" between them; the current page
     in body text. */
  .breadcrumbs {
    margin-bottom: var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    line-height: var(--leading-small);
  }

  .breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .breadcrumbs li + li::before {
    content: "/";
    content: "/" / "";
    margin-inline: var(--space-2);
  }

  .breadcrumbs a {
    color: var(--attend-text-muted);
    text-decoration: none;
  }

  .breadcrumbs a:focus-visible {
    color: var(--attend-text-strong);
    text-decoration: underline;
  }

  @media (hover: hover) and (pointer: fine) {
    .breadcrumbs a:hover {
      color: var(--attend-text-strong);
      text-decoration: underline;
    }
  }

  .breadcrumbs [aria-current="page"] {
    color: var(--attend-text);
    font-weight: var(--weight-bold);
  }

  /* A breadcrumb is the whole list item, so on phones it is a 44px target. */
  @media (max-width: 767px) {
    .breadcrumbs a {
      display: inline-flex;
      align-items: center;
      min-height: var(--touch);
      min-inline-size: var(--touch);
    }
  }

  /* Sections and lists */
  .section {
    margin-top: var(--space-8);
  }

  .section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--attend-border);
  }

  .section__head h2 {
    font-size: var(--text-body);
  }

  .section > h3:not(:first-child) {
    margin-block-start: var(--space-6);
  }

  /* The eyebrow label above a section ("Later today", "Needs attention"). */
  .section-label {
    margin: var(--space-6) 0 var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    line-height: var(--leading-label);
  }

  .row-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  /* List rows (§7): a card of 64px rows, 12x16 padding, dividers inset 16px. */
  .row-list:has(> .row) {
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

  .row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 64px;
    padding: var(--space-3) var(--space-4);
  }

  .row + .row::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: var(--space-4);
    border-top: 1px solid var(--attend-border);
  }

  /* Inside a card or a dialog's sheet the list keeps only its dividers (no
     card in a card, at most two levels at once: §6). */
  .panel .row-list,
  .card .row-list,
  .dialog .row-list {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .panel .row,
  .card .row,
  .dialog .row {
    padding-inline: 0;
  }

  .panel .row + .row::before,
  .card .row + .row::before,
  .dialog .row + .row::before {
    inset-inline: 0;
  }

  .row__title {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  /* Names that open a record (row titles, a table's first cell) read as plain
     bold names, as in the reference; the underline comes back on hover and
     focus. Action links in other cells keep the link colour. */
  .row__title a,
  .table td:first-child a:not(.btn),
  .table th[scope="row"] a {
    color: inherit;
    text-decoration: none;
  }

  a.row__title {
    text-decoration: none;
  }

  a.row__title:focus-visible,
  .row__title a:focus-visible,
  .table td:first-child a:not(.btn):focus-visible,
  .table th[scope="row"] a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  @media (hover: hover) and (pointer: fine) {
    a.row__title:hover,
    .row__title a:hover,
    .table td:first-child a:not(.btn):hover,
    .table th[scope="row"] a:hover {
      text-decoration: underline;
      text-underline-offset: 2px;
    }
  }

  /* The whole row is the target (§7 "List rows"; design review #8, AD4): a
     row whose title is a link stretches that link over the row (.row is
     position: relative), ends in a chevron and answers a press. Other
     controls in the row stay above the stretched link. */
  .row__title a::after,
  a.row__title::after {
    content: "";
    position: absolute;
    inset: 0;
  }

  .row:has(.row__title a, a.row__title) {
    padding-inline-end: calc(var(--space-4) + 24px);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background-color 150ms ease;
  }

  .row:has(.row__title a, a.row__title)::after {
    content: "";
    position: absolute;
    inset-inline-end: var(--space-4);
    inset-block-start: 50%;
    inline-size: 16px;
    block-size: 16px;
    margin-block-start: -8px;
    background-image: var(--attend-icon-row-chevron);
    background-position: center;
    background-size: 16px;
    background-repeat: no-repeat;
    pointer-events: none;
  }

  .row:has(.row__title a, a.row__title) :is(a, button, input, select, textarea, summary, label):not(.row__title a, a.row__title) {
    position: relative;
    z-index: 1;
  }

  .row:has(.row__title a, a.row__title):active {
    background: var(--attend-row-hover);
  }

  @media (hover: hover) and (pointer: fine) {
    .row:has(.row__title a, a.row__title):hover {
      background: var(--attend-row-hover);
    }
  }

  /* Rows inside a card or a sheet have no side padding: the chevron sits at
     the edge and the pressed colour reaches a little past the text. */
  :is(.panel, .card, .dialog) .row:has(.row__title a, a.row__title) {
    padding-inline-end: 24px;
  }

  :is(.panel, .card, .dialog) .row:has(.row__title a, a.row__title)::after {
    inset-inline-end: 0;
  }

  :is(.panel, .card, .dialog) .row:has(.row__title a, a.row__title):active {
    outline: var(--space-2) solid var(--attend-row-hover);
  }

  /* Right to left (Arabic, later): the chevron points the other way. */
  [dir="rtl"] .row:has(.row__title a, a.row__title)::after {
    scale: -1 1;
  }

  /* Administration overview: "Needs attention" rows keep "Review" beside the
     text on phones too (the reference's review-row); "Quick access" sits a
     section further down. */
  .attention-list .row {
    flex-wrap: nowrap;
  }

  .attention-list .row > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .attention-list .btn {
    flex-shrink: 0;
  }

  .overview-section + .overview-section {
    margin-top: var(--space-8);
  }

  .overview-section > .actions {
    margin-top: var(--space-4);
  }

  .row__meta {
    margin-top: 2px;
    font-size: var(--text-small);
    color: var(--attend-text-muted);
  }

  /* Leading items of a row: a time tile or a person's initials (no photos). */
  .time-tile {
    display: inline-grid;
    place-items: center;
    flex: none;
    min-inline-size: 40px;
    block-size: 40px;
    padding-inline: var(--space-05);
    border-radius: var(--r-sm);
    white-space: nowrap;
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: 13px;
    font-weight: var(--weight-label);
    font-variant-numeric: tabular-nums;
  }

  /* Arabic "10:30 ص" is 56px at 13px (owner's phone, 2026-11-11): one width for
     every tile, on one line; it grows past this only with larger text. */
  :lang(ar) .time-tile {
    min-inline-size: 4rem;
  }

  .initials {
    display: inline-grid;
    place-items: center;
    flex: none;
    inline-size: 40px;
    block-size: 40px;
    border: 1px solid var(--attend-border);
    border-radius: 50%;
    background: var(--attend-ground);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .initials--sm {
    inline-size: 28px;
    block-size: 28px;
    font-size: var(--text-label);
  }

  /* Cards (§7): surface, 22px corners, the light theme's card shadow. The
     edge is card-edge: a hairline in light, nearly invisible in dark, where
     the tone step from the page separates the card (2026-11-11). */
  .card,
  .panel {
    padding: var(--space-5);
    border: 1px solid var(--attend-card-edge);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

  @media (min-width: 768px) {
    .card,
    .panel {
      padding: var(--space-6);
    }
  }

  /* A disclosure card (details.panel) is a compact row until it is opened;
     its chevron sits at the end. */
  details.panel:not([open]) {
    padding-block: var(--space-2);
  }

  details.panel > summary::after {
    margin-inline-start: auto;
  }

  /* Hero card base (the current class): the soft tinted card, dark text, no
     glow. Screens place its content; blobs, if any, are clipped by it. */
  .hero {
    position: relative;
    overflow: hidden;
    padding: var(--space-6);
    border: 1px solid var(--attend-hero-border);
    border-radius: var(--r-xl);
    background: var(--attend-hero);
    color: var(--attend-text);
  }

  .definition-list {
    display: grid;
    grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
    gap: var(--space-3) var(--space-6);
    margin: 0;
  }

  .definition-list dt {
    font-size: var(--text-small);
    color: var(--attend-text-muted);
  }

  .definition-list dd {
    margin: 0;
    overflow-wrap: anywhere;
  }

  @media (max-width: 479px) {
    .definition-list {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-1);
    }

    .definition-list dd + dt {
      margin-top: var(--space-3);
    }
  }

  /* The lecture page's Groups row (templates/timetable/lectures/_groups_row.html):
     the groups beside "Add a group", then a line per group added for this
     lecture only, with Undo. */
  .lecture-groups,
  .lecture-merge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
  }

  .lecture-merge {
    gap: var(--space-1) var(--space-3);
    margin-block-start: var(--space-2);
  }

  /* Key/value block (design review AL16): an inset grouped list, the same on
     every width. The label is muted on the start, the value text-strong on the
     end; 44px rows, hairline dividers between rows, inside a surface container.
     A long value wraps under its own column.
     Squeeze fix (owner, 2026-11-10; a 412px phone with large text showed "Approved
     phone" as three thin columns, "approved" broken mid-word): the label column
     takes what its words need up to 40% and wraps beyond that, so the value keeps
     the rest; the cells are blocks, so a value's pieces (<bdi>, text, date) flow
     as one run of text; words only break when one cannot fit a line on its own.
     Review follow-up (same day): a date and a hyphenated word ("SM-S938B",
     "check-in") are .kv__keep spans that never wrap inside, and a " · " separator
     is tied to the word before it (apps/ui/templatetags/kv.py). A block narrower
     than 13em (a phone with Android's largest text: 412px at 200% is 11.6em)
     puts each label above its value, so neither column breaks its words. */
  .kv {
    container: kv / inline-size;
    display: grid;
    grid-template-columns: fit-content(40%) minmax(0, 1fr);
    margin: 0;
    padding-inline: var(--space-4);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-md);
    background: var(--attend-surface);
  }

  .kv > dt,
  .kv > dd {
    display: block;
    /* Block-level vertical centring (one-line rows sit in the middle of 44px). */
    align-content: center;
    min-height: 44px;
    padding-block: var(--space-2);
    border-top: 1px solid var(--attend-border);
    overflow-wrap: break-word;
  }

  .kv > dt:first-of-type,
  .kv > dt:first-of-type + dd {
    border-top: 0;
  }

  .kv > dt {
    color: var(--attend-text-muted);
  }

  /* No column gap: a row's hairline runs unbroken under the label and the value. */
  .kv > dd {
    margin: 0;
    padding-inline-start: var(--space-4);
    color: var(--attend-text-strong);
    text-align: end;
  }

  .kv .kv__keep {
    white-space: nowrap;
  }

  @container kv (max-width: 13em) {
    .kv > dt,
    .kv > dd {
      grid-column: 1 / -1;
    }

    .kv > dd {
      border-top: 0;
      padding-inline-start: 0;
      text-align: start;
    }
  }

  /* Navigation: sidebar / rail */
  .nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .nav__section {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .nav__title {
    padding: 0 var(--space-3) var(--space-1);
    font-size: var(--text-meta);
    font-weight: var(--weight-medium);
    color: var(--attend-text-secondary);
  }

  .nav__link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch);
    padding: 0 var(--space-3);
    border-radius: var(--radius-control);
    color: var(--attend-text-secondary);
    font-size: var(--text-small);
    font-weight: var(--weight-book);
    text-decoration: none;
  }

  /* One line; the link's title shows a label cut short (enlarged text). */
  .nav__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  @media (hover: hover) and (pointer: fine) {
    .nav__link:hover {
      background: var(--attend-surface-hover);
      color: var(--attend-text-strong);
    }
  }

  .nav__link:active {
    background: var(--attend-surface-hover);
  }

  .nav__link[aria-current="page"] {
    background: var(--attend-surface-hover);
    color: var(--attend-text-strong);
    font-weight: var(--weight-semi);
  }

  /* Notices (apps.ui.notices): the shell's link with its unread count */
  .notices-link {
    position: relative;
  }

  .count-badge {
    display: inline-grid;
    place-items: center;
    min-inline-size: 18px;
    block-size: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--attend-action);
    color: var(--attend-action-text);
    font-size: var(--text-meta);
    font-weight: var(--weight-semi);
    line-height: 1;
  }

  .btn--icon.notices-link .count-badge {
    position: absolute;
    inset-block-start: 2px;
    inset-inline-end: 0;
  }

  .notice--unread .row__title {
    font-weight: var(--weight-semi);
    color: var(--attend-text-strong);
  }

  .notice--unread {
    border-inline-start: 3px solid var(--attend-action);
    padding-inline-start: var(--space-3);
  }

  .notice__body {
    white-space: normal;
  }

  /* The list sits a step below "Mark all as read", and the card clips an unread
     row's start marker to its rounded corners (owner, 2026-11-19). */
  .notices-read + .notices {
    margin-top: var(--space-4);
  }

  .row-list.notices {
    overflow: hidden;
  }

  /* The foot is quieter than the navigation (reference: a small, muted profile). */
  .sidebar__foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  .sidebar__credit {
    padding: 0 var(--space-3);
  }

  .nav-toggle {
    display: none;
  }

  /* Rail: 768-1023px always, and >=1024px when collapsed. Labels stay in the
     accessibility tree (visually hidden), so links keep their names. */
  @media (min-width: 768px) and (max-width: 1023px) {
    .sidebar .brand__org,
    .sidebar .brand__full,
    .sidebar .nav__title,
    .sidebar .sidebar__credit,
    .sidebar .user-menu__text {
      display: none;
    }

    .sidebar .nav__label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }

    .sidebar .nav__link,
    .sidebar .brand {
      justify-content: center;
      align-items: center;
      padding: 0;
    }
  }

  @media (min-width: 1024px) {
    .nav-toggle {
      display: inline-flex;
    }

    .shell[data-nav="collapsed"] .sidebar .brand__org,
    .shell[data-nav="collapsed"] .sidebar .brand__full,
    .shell[data-nav="collapsed"] .sidebar .nav__title,
    .shell[data-nav="collapsed"] .sidebar .sidebar__credit,
    .shell[data-nav="collapsed"] .sidebar .user-menu__text {
      display: none;
    }

    .shell[data-nav="collapsed"] .sidebar .nav__label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }

    .shell[data-nav="collapsed"] .sidebar .nav__link,
    .shell[data-nav="collapsed"] .sidebar .brand {
      justify-content: center;
      align-items: center;
      padding: 0;
    }

    .shell[data-nav="collapsed"] .nav-toggle .icon {
      transform: scaleX(-1);
    }

    /* In Arabic the panel icon is mirrored already (data-mirror): collapsed,
       the two flips cancel. */
    :root[dir="rtl"] .shell[data-nav="collapsed"] .nav-toggle .icon {
      transform: none;
    }
  }

  /* Mobile top bar */
  .topbar__brand {
    font-size: 19px;
    font-weight: var(--weight-bold);
    letter-spacing: -0.05em;
    color: var(--attend-text-strong);
    text-decoration: none;
  }

  .topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }

  /* Mobile bottom navigation (students and lecturers): the bar itself is
     shell.css's (the C1a floating pill). */
  .bottom-nav__list {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    list-style: none;
    margin: 0;
    padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); /* physical: the screen's own sides */
  }

  .bottom-nav__link .icon {
    inline-size: 20px;
    block-size: 20px;
  }

  .bottom-nav__link[aria-current="page"] {
    color: var(--attend-text-strong);
  }

  /* Dialogs (§6-7): a bordered, raised sheet; on phones it rises from the
     bottom with 28px top corners. Destructive confirmations put the rose
     outlined .btn--danger in it. */
  .dialog {
    width: min(480px, calc(100vw - 2 * var(--space-4)));
    max-height: calc(100dvh - 2 * var(--space-4));
    padding: 0;
    border: 1px solid var(--attend-card-edge);
    border-radius: var(--r-lg);
    background: var(--attend-raised);
    color: var(--attend-text);
    box-shadow: var(--attend-shadow-raised);
    /* The dialog scrolls, the page behind it never does. */
    overscroll-behavior: contain;
  }

  .dialog::backdrop,
  .drawer::backdrop {
    background: color-mix(in srgb, var(--attend-ground) 72%, transparent);
    transition:
      opacity var(--motion-dialog) ease,
      overlay var(--motion-dialog) allow-discrete,
      display var(--motion-dialog) allow-discrete;
  }

  /* Motion (design review 2026-11-09, owner): a dialog scales and fades in
     over 200ms and fades out; on phones it is a sheet that rises in 280ms and
     leaves in 200ms (below); the drawer slides in from its edge. The closed
     state is where it leaves to, @starting-style where it comes from.
     Reduced motion: a 150ms fade only (app.css reset). */
  .dialog,
  .drawer {
    transition:
      opacity var(--motion-dialog) var(--ease-sheet),
      transform var(--motion-dialog) var(--ease-sheet),
      overlay var(--motion-dialog) allow-discrete,
      display var(--motion-dialog) allow-discrete;
  }

  .dialog:not([open]) {
    opacity: 0;
    transform: scale(0.96);
  }

  .dialog:not([open])::backdrop,
  .drawer:not([open])::backdrop {
    opacity: 0;
  }

  @starting-style {
    .dialog[open] {
      opacity: 0;
      transform: scale(0.96);
    }

    .dialog[open]::backdrop,
    .drawer[open]::backdrop {
      opacity: 0;
    }

    .drawer[open] {
      opacity: 0;
      transform: translateX(-100%); /* physical: from the left edge; the rtl mirror below */
    }

    :root[dir="rtl"] .drawer[open] {
      transform: translateX(100%); /* physical: the rtl mirror (the drawer is on the right) */
    }
  }

  /* The drawer fades as it slides, so with reduced motion (the fade only)
     it fades in and out instead of snapping. */
  .drawer:not([open]) {
    opacity: 0;
    transform: translateX(-100%); /* physical: to the left edge; the rtl mirror below */
  }

  :root[dir="rtl"] .drawer:not([open]) {
    transform: translateX(100%); /* physical: the rtl mirror (the drawer is on the right) */
  }

  .drawer[open] {
    transition-duration: var(--motion-sheet);
  }

  .drawer:not([open]) {
    transition-duration: var(--motion-exit);
  }

  /* An open modal holds the page still. A page that scrolls keeps its
     scrollbar's room, so nothing shifts sideways; a short page has no
     scrollbar to keep, and a reserved one would push it left (batch 1
     review). static/js/dialogs.js marks html[data-scrolls]. */
  html:has(dialog:modal) {
    overflow: hidden;
  }

  html[data-scrolls]:has(dialog:modal) {
    scrollbar-gutter: stable;
  }

  /* The title and Close stay in place while a long dialog scrolls. */
  .dialog__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3) var(--space-2);
    padding-inline-start: var(--space-6);
    background: var(--attend-raised);
  }

  .dialog__head h2 {
    font-size: var(--text-h2);
  }

  .dialog__body {
    padding: var(--space-2) var(--space-6) var(--space-6);
  }

  .dialog__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: 0 var(--space-6) var(--space-6);
  }

  @media (max-width: 767px) {
    .dialog {
      width: 100%;
      max-width: 100%;
      margin: auto 0 0;
      border-radius: var(--r-xl) var(--r-xl) 0 0;
      padding-bottom: env(safe-area-inset-bottom);
    }

    /* The phone sheet rises from the bottom edge and goes back down. */
    .dialog[open] {
      transition-duration: var(--motion-sheet);
    }

    .dialog:not([open]) {
      transform: translateY(100%);
      transition-duration: var(--motion-exit);
    }

    @starting-style {
      .dialog[open] {
        transform: translateY(100%);
      }
    }
  }

  .drawer {
    width: min(320px, 86vw);
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: var(--space-3);
    padding-top: max(var(--space-3), env(safe-area-inset-top));
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
    border: 0;
    border-inline-end: 1px solid var(--attend-edge);
    background: var(--attend-surface-subtle);
    color: var(--attend-text-strong);
  }

  .drawer[open] {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .drawer__foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  /* User menu and avatar */
  .avatar {
    display: inline-grid;
    place-items: center;
    inline-size: 30px;
    block-size: 30px;
    flex-shrink: 0;
    border: 1px solid var(--attend-edge);
    border-radius: 50%;
    background: var(--attend-avatar-bg);
    color: var(--attend-text-strong);
    font-size: var(--text-meta);
    font-weight: var(--weight-bold);
    text-decoration: none;
  }

  /* The person's photo (owner, 2026-11-18), over the initials: a photo that
     does not load leaves them showing. */
  .avatar:has(.avatar__photo) {
    position: relative;
    overflow: hidden;
  }

  .avatar__photo {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    border-radius: 50%;
    object-fit: cover;
  }

  .user-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  .user-menu__who {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch);
    padding: 0 var(--space-3);
    border-radius: var(--radius-control);
    color: var(--attend-text-strong);
    text-decoration: none;
  }

  @media (hover: hover) and (pointer: fine) {
    .user-menu__who:hover {
      background: var(--attend-surface-hover);
    }
  }

  .user-menu__who:active {
    background: var(--attend-surface-hover);
  }

  .user-menu__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--attend-text-secondary);
    font-size: var(--text-meta);
    line-height: 1.35;
  }

  /* The name is a row holding its <bdi> (owner, 2026-11-18): the <bdi> takes
     its direction from the name itself (dir=auto) and, as a flex item, is its
     own paragraph. So a name in the other script than the page's (an Arabic
     name on an English page, a Latin one on an Arabic page) shortened with an
     ellipsis shows its beginning, the ellipsis at its own end, and a short one
     still starts on the page's start edge, where the line under it starts. */
  .user-menu__name {
    display: flex;
    min-width: 0;
    font-weight: var(--weight-medium);
  }

  /* The line under the name, the same way: one line (owner, 2026-11-18: "one
     line, ellipsis"; the full text is its title), so every account row is the
     same two lines high. */
  .user-menu__name > bdi,
  .user-menu__role > bdi {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-menu__role {
    display: flex;
    min-width: 0;
    color: var(--attend-text-secondary);
    font-size: var(--text-meta);
  }

  .user-menu form {
    display: contents;
  }

  .user-menu .btn {
    justify-content: flex-start;
    padding: 0 var(--space-3);
    font-size: var(--text-small);
    font-weight: var(--weight-book);
  }

  @media (min-width: 768px) and (max-width: 1023px) {
    .sidebar .user-menu__who,
    .sidebar .user-menu .btn {
      justify-content: center;
      padding: 0;
    }

    .sidebar .user-menu .btn .nav__label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }

  @media (min-width: 1024px) {
    .shell[data-nav="collapsed"] .sidebar .user-menu__who,
    .shell[data-nav="collapsed"] .sidebar .user-menu .btn {
      justify-content: center;
      padding: 0;
    }
  }

  /* Credit line */
  .credit {
    font-size: var(--text-meta);
    color: var(--attend-text-secondary);
  }

  /* "Savant" opens savant-dev.iq in a new tab (owner, 2026-11-26) and reads
     as the credit around it, in every place (the foot, the ink sidebar, the
     sign-in card, the loading and bare pages): its colour, no underline at
     rest; the underline comes back with a mouse over it and on keyboard
     focus, with the focus ring (the sidebar's accent on ink: shell.css).
     A link inside a line of text: WCAG 2.5.8's inline exception, as the
     other links in small text. */
  .credit a {
    color: inherit;
    text-decoration: none;
  }

  .credit a:focus-visible {
    text-decoration: underline;
  }

  @media (hover: hover) and (pointer: fine) {
    .credit a:hover {
      text-decoration: underline;
    }
  }

  /* Status chips ("Status colours", §7): always icon + word, never colour
     alone. A pill, softly filled with the family's tint on phones and in
     cards; outlined (the tint cleared, the edge in the text colour) in dense
     desktop tables. The text colour is also the icon's and the outline's.
     A tone class alone (.status--danger on a notice line, policies/confirm.html)
     only colours the text: the tint belongs to the chip. */
  .status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding-block: 0;
    padding-inline: var(--space-2) 10px;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    font-size: 13px;
    font-weight: var(--weight-strong);
    line-height: 18px;
    vertical-align: middle;
    /* One line where it fits; wraps rather than widening the page (200% text). */
    white-space: nowrap;
    max-width: 100%;
  }

  .status .icon {
    inline-size: 14px;
    block-size: 14px;
  }

  /* The word wraps between words only: break-word splits a word only when
     it is longer than the whole line, without shrinking a table column to a
     letter or two ("anywhere" did: "Prese / nt"). */
  .status > span {
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .status--positive {
    color: var(--attend-positive-text);
  }

  .status.status--positive {
    background: var(--attend-positive-bg);
  }

  .status--warning {
    color: var(--attend-warning-text);
  }

  .status.status--warning {
    background: var(--attend-warning-bg);
  }

  .status--info {
    color: var(--attend-info-text);
  }

  .status.status--info {
    background: var(--attend-info-bg);
  }

  .status--inactive {
    color: var(--attend-inactive-text);
  }

  .status.status--inactive {
    background: var(--attend-inactive-bg);
  }

  .status--danger {
    color: var(--attend-danger-text);
  }

  .status.status--danger {
    background: var(--attend-danger-bg);
  }

  /* No pill for the inactive family in tables and lists (design review iOS
     (e), owner: yes): "Not yet recorded" keeps its icon and word, so the
     statuses that matter stand out. After the desktop table's outline below
     by specificity, not order. The student's course list (Attendance) and
     recent attendance (Today) are lists too (design integration review). */
  :is(.table, .row-list, .row, .course-list, .recent-list) .status.status--inactive {
    border-color: transparent;
    background: transparent;
    padding-inline: 0;
  }

  /* Live (an open check-in only): a 6px dot before the icon, pulsing. */
  .status--live .status__dot {
    flex: none;
    inline-size: 6px;
    block-size: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: attend-pulse 1.6s ease-in-out infinite alternate;
  }

  @keyframes attend-pulse {
    from {
      opacity: 1;
    }

    to {
      opacity: 0.35;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .status--live .status__dot {
      animation: none;
    }
  }

  /* A detail beside a chip ("code mismatch", "10:09"), outside the pill. */
  .status-detail {
    margin-inline-start: var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    vertical-align: middle;
  }

  @media (min-width: 768px) {
    .status {
      min-height: 24px;
    }

    .table .status {
      min-height: 24px;
      border-color: currentColor;
      background: transparent;
    }

    /* A chip, an ID or a time stays on one line in a desktop table; a table
       too wide for the page scrolls in its frame instead. */
    .table .status > span {
      white-space: nowrap;
    }

    .table .tabular {
      white-space: nowrap;
    }
  }

  /* Empty, error and loading states: the icon in a 48px circle, a title and
     what to do next. */
  .state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-8) 0;
    color: var(--attend-text-muted);
  }

  .state__icon {
    display: inline-grid;
    place-items: center;
    inline-size: 48px;
    block-size: 48px;
    margin-bottom: var(--space-1);
    border-radius: 50%;
    background: var(--attend-inactive-bg);
    color: var(--attend-inactive-text);
  }

  .state__icon .icon {
    inline-size: 24px;
    block-size: 24px;
  }

  .state__title {
    font-size: var(--text-body);
    font-weight: var(--weight-strong);
    color: var(--attend-text-strong);
  }

  .state__body {
    max-width: 52ch;
    font-size: var(--text-small);
  }

  .state--error .state__icon {
    background: var(--attend-warning-bg);
    color: var(--attend-warning-text);
  }

  .state .actions {
    margin-top: var(--space-2);
  }

  .loading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--attend-text-secondary);
    font-size: var(--text-support);
  }

  .spin {
    animation: attend-spin 0.9s linear infinite;
  }

  @keyframes attend-spin {
    to {
      transform: rotate(1turn);
    }
  }

  /* htmx request indicator (htmx's own indicator styles are disabled). It
     shows only after 300ms (design review AD8), so a quick answer flashes
     nothing; it fades out at once when the answer is in. */
  .htmx-indicator {
    visibility: hidden;
    opacity: 0;
    transition: opacity 120ms ease, visibility 0s linear 120ms;
  }

  .htmx-request .htmx-indicator,
  .htmx-request.htmx-indicator {
    visibility: visible;
    opacity: 1;
    transition: opacity 120ms ease 300ms, visibility 0s linear 300ms;
  }

  /* The results being replaced dim while a search or filter loads (when the
     form names its region in hx-indicator, as scoped_search does). */
  [data-region] > .htmx-request {
    opacity: 0.6;
    transition: opacity 150ms ease 150ms;
  }

  /* With scripting on, filters apply on change and search as you type
     (htmx), so the Apply button goes from the first paint (no jump; a plain
     GET form keeps it), and the "Loading…" slot sits under the row's end
     instead of taking a place in it (batch 1 review). If htmx is missing,
     the page script marks html[data-no-htmx] and Apply comes back. Enter in
     a field still submits the form either way. */
  @media (scripting: enabled) {
    .filters[hx-get] [type="submit"] {
      display: none;
    }

    .filters[hx-get] > .actions {
      position: absolute;
      inset-block-start: 100%;
      inset-inline-end: 0;
      /* The list may start right under the row (the administration lists'
         tabs, chips and tables): the line stays above it, on a raised pill,
         over the dimmed results (design integration review 2026-11-10). */
      z-index: 2;
    }

    .filters[hx-get] > .actions .loading {
      padding: var(--space-1) var(--space-3);
      border: 1px solid var(--attend-border);
      border-radius: var(--r-pill);
      background: var(--attend-raised);
    }
  }

  html[data-no-htmx] .filters[hx-get] [type="submit"] {
    display: inline-flex;
  }

  .app-loading {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-4);
    text-align: center;
  }

  /* Banners: a soft tint of the status family with its icon; the message in
     body text. */
  .banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-md);
    background: var(--attend-warning-bg);
    color: var(--attend-text);
    font-size: var(--text-small);
  }

  .banner .icon {
    margin-top: 2px;
    color: var(--attend-warning-text);
  }

  .banner--info {
    background: var(--attend-info-bg);
  }

  .banner--info .icon {
    color: var(--attend-info-text);
  }

  .banner--danger {
    background: var(--attend-danger-bg);
  }

  .banner--danger .icon {
    color: var(--attend-danger-text);
  }

  .banner__title {
    font-weight: var(--weight-strong);
    color: var(--attend-text-strong);
  }

  /* What to do next, under a banner's words (the finalized banner: Next
     lecture waiting, Back to Today). */
  .banner__actions {
    margin-block-start: var(--space-3);
  }

  /* The old Android app's update banner (templates/ui/_app_update_banner.html)
     and the Google Play banner (templates/ui/_play_store_banner.html): the words
     take the room, Close sits at the end. */
  .app-update__body,
  .play-store__body {
    flex: 1;
    min-width: 0;
  }

  /* U2 final: the APK's address for a phone where Chrome does not open, whole
     and selectable, left to right in Arabic too, with Copy beside it. */
  .app-update__fallback {
    margin-block-start: var(--space-3);
  }

  .app-update__copy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-1);
  }

  .app-update__address {
    min-width: 0;
    overflow-wrap: anywhere;
    user-select: all;
    unicode-bidi: isolate;
    direction: ltr;
  }

  .app-update > .btn--icon,
  .play-store > .btn--icon {
    margin-block: calc(-1 * var(--space-2));
    margin-inline-end: calc(-1 * var(--space-2));
  }

  .app-update > .btn--icon .icon,
  .play-store > .btn--icon .icon {
    margin-top: 0;
    color: currentColor;
  }

  /* A button's arrow in its own text colour, not the banner's icon tint (owner F4:
     faint on the blue Next lecture ready in the light theme). */
  .banner .banner__actions .icon {
    margin-top: 0;
    color: currentColor;
  }

  /* A count beside a button's words ("Finalize attendance [3 to decide]", owner F4):
     an outline in the button's text colour; when both do not fit, the badge wraps
     whole onto its own line instead of the words breaking around a dot. */
  .btn:has(.btn__badge) {
    flex-wrap: wrap;
    row-gap: var(--space-1);
  }

  .btn__badge {
    padding: 0 var(--space-2);
    border: 1px solid currentColor;
    border-radius: var(--r-pill);
    font-size: var(--text-small);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  /* Items with a "·" between them where no dot may start or end a line (owner F4:
     Today's date line, a decision row's rounds). Each item draws its dot before it;
     the list is pulled back by one dot's width inside a box that clips sideways, so
     the dot of a line's first item falls outside and is not drawn. Items wrap inside
     themselves rather than overflow (nothing is clipped at the far end). */
  .dot-items {
    --dot-items-gap: 1.1em;
    overflow-x: clip;
  }

  .dot-items__list {
    display: flex;
    flex-wrap: wrap;
    row-gap: var(--space-1);
    margin-inline-start: calc(-1 * var(--dot-items-gap));
  }

  .dot-items__list > * {
    min-inline-size: 0;
    overflow-wrap: anywhere;
  }

  .dot-items__list > *::before {
    content: "·";
    content: "·" / "";
    display: inline-block;
    inline-size: var(--dot-items-gap);
    text-align: center;
  }

  /* Forms: labels above fields; help in muted small text; errors are a
     circle-alert icon plus danger text, never colour alone. */
  .form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .field__label {
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    color: var(--attend-text-strong);
  }

  .field__help {
    font-size: var(--text-small);
    color: var(--attend-text-muted);
  }

  .field__error,
  .form-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: var(--text-small);
    color: var(--attend-danger-text);
  }

  .form-error {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-md);
    background: var(--attend-danger-bg);
  }

  .form-error .icon,
  .field__error .icon {
    margin-top: 2px;
  }

  /* A date field's date in words under it (static/js/forms/date-words.js):
     the native field shows the browser's own order (design review BI14). */
  .date-words {
    margin-block-start: var(--space-1);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  /* A file input's button is the secondary pill (brand tint, brand text). */
  input[type="file"]::file-selector-button {
    margin-inline-end: var(--space-3);
    padding: var(--space-1) var(--space-4);
    border: 0;
    border-radius: var(--r-pill);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font: inherit;
    font-size: var(--text-small);
    font-weight: var(--weight-button);
    cursor: pointer;
  }

  /* "Install the app" (components/install_card.html): a card with the phone
     icon in a soft circle, a line of text and, where the browser offers it,
     the Install button. Shown by static/js/pwa/install-card.js only. */
  .install-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
    margin-block: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

  .install-card[hidden] {
    display: none;
  }

  .install-card .install-card__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    inline-size: 44px;
    block-size: 44px;
    border-radius: 50%;
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .install-card .install-card__body {
    flex: 1 1 200px;
    min-width: 0;
  }

  .install-card .install-card__title {
    margin: 0;
    color: var(--attend-text-strong);
    font-size: var(--text-body);
    font-weight: var(--weight-bold);
  }

  .install-card .install-card__text {
    margin: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  /* Search (ScopedSearch and screens): the pill box with a leading icon. */
  .search-field {
    position: relative;
    display: block;
  }

  .search-field > .icon {
    position: absolute;
    inset-inline-start: var(--space-4);
    inset-block-start: 50%;
    inline-size: 18px;
    block-size: 18px;
    translate: 0 -50%;
    color: var(--attend-text-muted);
    pointer-events: none;
  }

  .search-field > input[type="search"] {
    padding-inline-start: 40px;
  }

  /* A search box's x (owner 2026-11-20, every search box; templates/ui/
     _search_clear.html): a 44px target at the box's end, hidden while the box
     shows its placeholder; the browser's own x steps aside for it. */
  .search-field--clear > input[type="search"] {
    padding-inline-end: 48px;
  }

  .search-field--clear > input[type="search"]::-webkit-search-cancel-button {
    display: none;
  }

  .search-field__clear {
    position: absolute;
    inset-inline-end: 0;
    inset-block-start: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 44px;
    min-block-size: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--r-pill);
    background: none;
    color: var(--attend-text-muted);
    font: inherit;
    cursor: pointer;
    translate: 0 -50%;
  }

  @media (hover: hover) and (pointer: fine) {
    .search-field__clear:hover {
      color: var(--attend-text-strong);
    }
  }

  .search-field__clear .icon {
    inline-size: 16px;
    block-size: 16px;
  }

  input:placeholder-shown ~ .search-field__clear {
    display: none;
  }

  /* Theme switcher (a plain form; app.js saves on change) */
  .theme-switcher {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .theme-switcher legend {
    margin-bottom: var(--space-2);
    font-size: var(--text-support);
    font-weight: var(--weight-medium);
  }

  /* Segmented control (§7 "Tabs / segmented"): a pill track on the ground,
     4px inset; the selected segment is a surface pill with the card shadow
     and a 3:1 edge (also in the dark theme, which has no shadows). */
  .segmented {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 2px;
    max-width: 360px;
    padding: var(--space-1);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-pill);
    background: var(--attend-ground);
  }

  .segmented__option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--touch);
    padding: 0 var(--space-4);
    border-radius: var(--r-pill);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    cursor: pointer;
  }

  .segmented__option:has(input:checked) {
    background: var(--attend-surface);
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
    box-shadow: var(--attend-shadow-card);
    outline: 1px solid var(--attend-border-strong);
  }

  .segmented__option:has(input:focus-visible) {
    outline: 2px solid var(--attend-focus);
    outline-offset: 1px;
  }

  /* Dark (§7): the track one step up on the surface, the selected segment
     on raised, so it stands apart without a shadow. */
  :root[data-theme="dark"] .segmented {
    background: var(--attend-surface);
  }

  :root[data-theme="dark"] .segmented__option:has(input:checked) {
    background: var(--attend-raised);
  }

  @media (prefers-color-scheme: dark) {
    :root[data-theme="system"] .segmented {
      background: var(--attend-surface);
    }

    :root[data-theme="system"] .segmented__option:has(input:checked) {
      background: var(--attend-raised);
    }
  }

  /* The radio stays in the accessibility tree; the label is the target. */
  .segmented__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  @media (min-width: 768px) and (pointer: fine) {
    .segmented__option {
      min-height: 36px;
    }
  }

  /* ------------------------------------------------- Link rows
     A card of full-width links, one a row: an icon tile, the name with one
     line under it, then a count or chip and the chevron (owner, 2026-11-18:
     the Subjects page's shortcuts, design A; Account's rows, plans/account-tabs).
     A <button class="link-row"> in a <form class="link-rows"> is a row too
     (Account's Sign out). */
  .link-rows {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
    overflow: hidden;
    container: link-rows / inline-size;
  }

  .link-rows > li + li {
    border-block-start: 1px solid var(--attend-border);
  }

  .link-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    inline-size: 100%;
    min-block-size: 60px;
    margin: 0;
    padding: var(--space-3) var(--space-4);
    border: 0;
    background: none;
    color: var(--attend-text-strong);
    font: inherit;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  @media (hover: hover) and (pointer: fine) {
    .link-row:hover {
      background: var(--attend-row-hover);
    }
  }

  .link-row:active {
    background: var(--attend-row-hover);
  }

  .link-row:focus-visible {
    outline-offset: -2px;
  }

  .link-row__icon {
    display: grid;
    flex: none;
    place-items: center;
    inline-size: 36px;
    block-size: 36px;
    border-radius: var(--r-sm);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .link-row__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
  }

  .link-row__name {
    font-weight: var(--weight-strong);
  }

  .link-row__line {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  /* The end gives way before the name: it shrinks first (down to its
     chip's longest word), its chip wrapping onto more lines, so a long
     chip (Arabic "إذنان للسماح بهما") never squeezes the name or leaves
     the card. */
  .link-row__end {
    display: flex;
    flex: 0 1000 auto;
    align-items: center;
    gap: var(--space-2);
  }

  .link-row__end .count-pill {
    block-size: auto;
    min-block-size: 20px;
    padding-block: 2px;
    border-radius: var(--r-sm); /* over half a line's height: a pill on one line, rounded corners on more */
    line-height: var(--leading-label);
    text-align: center;
  }

  /* Large text on a narrow phone (150% and more at 320px): the name's and
     the chip's longest words no longer fit side by side, so the chip moves
     under the line, the chevron staying at the end. */
  @container link-rows (max-width: 12em) {
    .link-row:has(> .link-row__end) {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: var(--space-2) var(--space-3);
    }

    .link-row:has(> .link-row__end) > .link-row__icon {
      grid-area: 1 / 1 / span 2;
    }

    .link-row__end {
      display: contents;
    }

    .link-row__end .count-pill {
      grid-area: 2 / 2;
      justify-self: start;
    }

    .link-row__end .link-row__chevron {
      grid-area: 1 / 3 / span 2;
    }
  }

  .link-row__count,
  .link-row__chevron {
    flex: none;
  }

  .link-row__chevron {
    color: var(--attend-text-muted);
  }

  /* Count pills: the number on a count tab ("All 57 · Present 41 · Review 3"),
     in the tint of what it counts. */
  .count-pill {
    display: inline-grid;
    place-items: center;
    min-inline-size: 20px;
    block-size: 20px;
    padding: 0 6px;
    border-radius: var(--r-pill);
    background: var(--attend-inactive-bg);
    color: var(--attend-inactive-text);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .count-pill--positive {
    background: var(--attend-positive-bg);
    color: var(--attend-positive-text);
  }

  .count-pill--warning {
    background: var(--attend-warning-bg);
    color: var(--attend-warning-text);
  }

  .count-pill--info {
    background: var(--attend-info-bg);
    color: var(--attend-info-text);
  }

  .count-pill--inactive {
    background: var(--attend-inactive-bg);
    color: var(--attend-inactive-text);
  }

  .count-pill--danger {
    background: var(--attend-danger-bg);
    color: var(--attend-danger-text);
  }

  /* Pagination */
  .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-5);
    font-size: var(--text-small);
    color: var(--attend-text-muted);
  }

  /* Tables (§7 "Table rows"): a bordered surface container with 16px
     corners, never elevated; the header band (table-head) in the label
     style, its labels start-aligned like the cells; 44px rows from 768px,
     1px dividers, row actions as ghost buttons; a selected row is tinted and
     carries a 3px brand marker at its start (2026-11-11). */
  /* position: relative makes the frame the containing block of absolutely
     placed children (visually-hidden text in row actions), so its overflow
     clips them; otherwise they escape it and widen the page. */
  .table-wrap {
    position: relative;
    overflow-x: auto;
    border: 1px solid var(--attend-card-edge);
    border-radius: var(--r-md);
    background: var(--attend-surface);
  }

  .table {
    width: 100%;
    text-align: start;
    font-size: var(--text-small);
  }

  .table th,
  .table td {
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--attend-border);
    vertical-align: middle;
  }

  /* Browsers centre a th; zero specificity, so a column's own alignment
     (.attendance-table .num) still wins. */
  :where(.table) th {
    text-align: start;
  }

  .table thead th {
    block-size: 36px;
    border-top: 0;
    background: var(--attend-table-head);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    line-height: var(--leading-label);
  }

  @media (hover: hover) and (pointer: fine) {
    .table tbody tr:hover {
      background: var(--attend-row-hover);
    }
  }

  /* A row that opens something answers a press on touch screens too. */
  .table tbody tr:has(a):active {
    background: var(--attend-row-hover);
  }

  /* A selected row (a checked row picker, data-row-select, or .is-selected):
     the row-selected tint and a 3px brand marker at its start (3:1 on the
     tint); it stays selected under the mouse. The marker takes its 3px from
     the cell's padding, so selecting a row never widens the first column. */
  .table tbody tr:is(.is-selected, :has(input[data-row-select]:checked)) {
    background: var(--attend-row-selected);
  }

  .table tbody tr:is(.is-selected, :has(input[data-row-select]:checked)) > :first-child {
    border-inline-start: 3px solid var(--attend-brand);
  }

  /* Low specificity (0,2,0): above `.table td`, below the phone layouts that
     zero a cell's padding (`.table.table--rows td`). */
  .table :where(tbody tr:is(.is-selected, :has(input[data-row-select]:checked))) > :first-child {
    padding-inline-start: calc(var(--space-4) - 3px);
  }

  /* A row that needs review: a thin plum marker and the review icon, no tint. */
  .table tr.is-review > :first-child {
    border-inline-start: 3px solid var(--attend-warning-text);
  }

  @media (min-width: 768px) {
    .table td,
    .table tbody th {
      block-size: 44px;
    }
  }

  @media (min-width: 768px) and (pointer: fine) {
    .table .btn {
      min-height: 36px;
    }

    /* Square: .btn's 44px min-width would make it an oval. */
    .table .btn--icon {
      inline-size: 36px;
      min-width: 0;
    }
  }

  /* Filter links that act as tabs: the selected one is a surface pill with a
     3:1 edge (the segmented style without the track). */
  .btn--plain[aria-current="true"] {
    border-color: var(--attend-border-strong);
    background: var(--attend-surface);
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
    text-decoration: none;
  }

  /* The options not chosen are muted text, so the brand colour (active
     state) is not on them (batch 1 review: brand ghosts had inverted the
     emphasis); as the roster tabs. */
  :where(nav, .actions):has(> .btn[aria-current]) > .btn--plain:not([aria-current]) {
    color: var(--attend-text-muted);
  }

  @media (hover: hover) and (pointer: fine) {
    :where(nav, .actions):has(> .btn[aria-current]) > .btn--plain:not([aria-current]):hover {
      color: var(--attend-text-strong);
    }
  }

  /* Import preview: per-row errors, changes and values */
  .import-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-wrap: anywhere;
  }

  /* Tables that become one card per row on narrow screens (UI_UX §2:
     "responsive cards when columns cannot fit"). Each cell carries
     data-label; the first cell is the card's title. */
  @media (max-width: 767px) {
    /* Block boxes, so each card's padding sits inside the container's width
       and a long value (an id, a UUID) wraps instead of overflowing. */
    .table--cards,
    .table--cards tbody {
      display: block;
    }

    .table--cards thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }

    .table--cards tr {
      display: block;
      padding: var(--space-3) var(--space-4);
      border-top: 1px solid var(--attend-border);
    }

    .table--cards tbody tr:first-child {
      border-top: 0;
    }

    /* A shown caption is a line above the cards, not a narrow column. */
    .table--cards caption:not(.visually-hidden) {
      display: block;
      padding: var(--space-3) var(--space-4) 0;
      text-align: start;
    }

    /* The label keeps its width at the start; the values sit at the end,
       on the next line when they do not fit beside it. */
    .table--cards td {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: var(--space-1) var(--space-3);
      min-width: 0;
      overflow-wrap: anywhere;
      padding: var(--space-1) 0;
      border-top: 0;
      text-align: end;
    }

    .table--cards td:first-child {
      display: block;
      text-align: start;
      font-weight: var(--weight-strong);
    }

    .table--cards td[data-label]:not(:first-child)::before {
      content: attr(data-label);
      flex: none;
      margin-inline-end: auto;
      color: var(--attend-text-muted);
      font-size: var(--text-small);
      text-align: start;
    }

    /* The whole card is the target when its first cell links to a record
       (design review #8): that link stretches over the card, a chevron ends
       the title line, other controls stay above it. */
    .table--cards tbody tr:has(td:first-child a:not(.btn)) {
      position: relative;
    }

    /* The title line leaves room for the chevron; the values keep the edge. */
    .table--cards tbody tr:has(td:first-child a:not(.btn)) td:first-child {
      padding-inline-end: 24px;
    }

    .table--cards td:first-child a:not(.btn)::after {
      content: "";
      position: absolute;
      inset: 0;
    }

    .table--cards tbody tr:has(td:first-child a:not(.btn))::after {
      content: "";
      position: absolute;
      inset-inline-end: var(--space-4);
      inset-block-start: var(--space-4);
      inline-size: 16px;
      block-size: 16px;
      background-image: var(--attend-icon-row-chevron);
      background-position: center;
      background-size: 16px;
      background-repeat: no-repeat;
      pointer-events: none;
    }

    .table--cards tbody tr:has(td:first-child a:not(.btn)) :is(a, button, input, select, textarea, summary, label):not(td:first-child a) {
      position: relative;
      z-index: 1;
    }
  }

  /* Phone list rows (design review Top 15 #13, AL1): on a phone a table of
     people or records becomes 64px rows, not label/value cards: initials, the
     title, one muted line, one status chip and a chevron; the row opens the
     record's page, which holds the rest. Cells name their place with
     data-row="title", "meta" (one) and "status"; data-initials on the row
     draws the initials; other cells are left out on a phone, so use it only
     where the record's page has them. On a computer it is the plain table. */
  @media (max-width: 767px) {
    .table--rows,
    .table--rows tbody {
      display: block;
    }

    .table--rows thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }

    .table--rows caption:not(.visually-hidden) {
      display: block;
      padding: var(--space-3) var(--space-4) 0;
      text-align: start;
    }

    .table--rows tbody tr {
      position: relative;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas: "title end" "meta end";
      align-items: center;
      align-content: center;
      column-gap: var(--space-3);
      min-height: 64px;
      padding: var(--space-3) var(--space-4);
    }

    .table--rows tbody tr[data-initials] {
      grid-template-columns: 40px minmax(0, 1fr) auto;
      grid-template-areas: "lead title end" "lead meta end";
    }

    .table--rows tbody tr[data-initials]::before {
      content: attr(data-initials);
      grid-area: lead;
      display: grid;
      place-items: center;
      inline-size: 40px;
      block-size: 40px;
      border: 1px solid var(--attend-border);
      border-radius: 50%;
      background: var(--attend-ground);
      color: var(--attend-text-strong);
      font-size: var(--text-small);
      font-weight: var(--weight-strong);
    }

    .table--rows :is(td, th) {
      display: none;
      padding: 0;
      border: 0;
      text-align: start;
    }

    .table--rows [data-row="title"] {
      grid-area: title;
      display: block;
      overflow: hidden;
      color: var(--attend-text-strong);
      font-weight: var(--weight-strong);
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .table--rows [data-row="meta"] {
      grid-area: meta;
      display: block;
      overflow: hidden;
      margin-block-start: 2px;
      color: var(--attend-text-muted);
      font-size: var(--text-small);
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .table--rows [data-row="status"] {
      grid-area: end;
      display: flex;
      justify-content: flex-end;
    }

    /* Dividers start at the text, past the initials (iOS inset); drawn by
       the title cell, since the row's own pseudo-elements are the initials
       and the chevron. */
    .table--rows tbody tr + tr > [data-row="title"]::before {
      content: "";
      position: absolute;
      inset-block-start: 0;
      inset-inline: var(--space-4) 0;
      border-top: 1px solid var(--attend-border);
    }

    .table--rows tbody tr[data-initials] + tr[data-initials] > [data-row="title"]::before {
      inset-inline-start: calc(var(--space-4) + 40px + var(--space-3));
    }

    /* The whole row opens its record: the title's link stretches over it,
       a chevron ends it, and it answers a press. */
    .table--rows [data-row="title"] a:not(.btn)::after {
      content: "";
      position: absolute;
      inset: 0;
    }

    .table--rows tbody tr:has([data-row="title"] a:not(.btn)) {
      padding-inline-end: calc(var(--space-4) + 24px);
      cursor: pointer;
      transition: background-color 150ms ease;
    }

    .table--rows tbody tr:has([data-row="title"] a:not(.btn)) [data-row="status"] {
      position: relative;
      z-index: 1;
    }

    .table--rows tbody tr:has([data-row="title"] a:not(.btn))::after {
      content: "";
      position: absolute;
      inset-inline-end: var(--space-4);
      inset-block-start: 50%;
      inline-size: 16px;
      block-size: 16px;
      margin-block-start: -8px;
      background-image: var(--attend-icon-row-chevron);
      background-position: center;
      background-size: 16px;
      background-repeat: no-repeat;
      pointer-events: none;
    }

    .table--rows tbody tr:has([data-row="title"] a:not(.btn)):active {
      background: var(--attend-row-hover);
    }

    [dir="rtl"] .table--rows tbody tr:has([data-row="title"] a:not(.btn))::after {
      scale: -1 1;
    }
  }

  /* Phone list rows, the "phone-only cells" form (design batch 4: the
     administration lists). Where the phone's line is not a desktop cell, the
     row adds cells only a phone shows: rows-lead (an initials circle or a time
     tile), rows-meta (the muted line), rows-chev (the chevron); rows-title is
     the record's link, stretched over the row; rows-status (the chip, under
     the line), rows-value (a figure that ends the row) and rows-action (one
     action where the row has no page) are desktop cells a phone keeps. Every
     other cell is hidden on a phone, because the line repeats it. A row of
     this form is a row with a rows-title cell, so the two forms never meet. */

  .table--rows .rows-lead,
  .table--rows .rows-meta,
  .table--rows .rows-chev {
    display: none;
  }

  @media (max-width: 767px) {
    .table--rows tbody tr:has(> .rows-title) {
      position: relative;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto auto;
      grid-template-areas:
        "lead title value chev"
        "lead meta value chev"
        "lead status value chev";
      align-items: center;
      column-gap: 0;
      min-height: 64px;
      padding: var(--space-3) var(--space-4);
      transition: background-color 150ms ease;
    }

    .table--rows tbody tr:has(> .rows-title) + tr::before {
      content: "";
      position: absolute;
      inset-block-start: 0;
      inset-inline: var(--space-4);
      border-top: 1px solid var(--attend-border);
    }

    .table.table--rows td,
    .table.table--rows tbody th {
      display: none;
      block-size: auto;
      padding: 0;
      border: 0;
    }

    /* Spaced by margins, not a column gap: a row without a leading cell or a
       chip leaves no empty gap. */
    .table.table--rows .rows-lead {
      display: block;
      grid-area: lead;
      margin-inline-end: var(--space-3);
    }

    .table.table--rows .rows-title {
      display: block;
      grid-area: title;
      min-width: 0;
      color: var(--attend-text-strong);
      font-size: var(--text-body);
      font-weight: var(--weight-strong);
      overflow-wrap: anywhere;
    }

    .table--rows .rows-title .small {
      display: none;
    }

    .table.table--rows .rows-meta {
      display: block;
      grid-area: meta;
      min-width: 0;
      margin-top: var(--space-05);
      color: var(--attend-text-muted);
      font-size: var(--text-small);
      overflow-wrap: anywhere;
    }

    /* The chip sits under the line, so the name keeps the row's width. */
    .table.table--rows .rows-status {
      display: block;
      grid-area: status;
      justify-self: start;
      /* Its word lines up with the name and the line above it. */
      margin-top: var(--space-1);
      margin-inline-start: calc(-1 * var(--space-6));
      white-space: nowrap;
    }

    .table--rows .rows-status .small {
      display: none;
    }

    /* A figure that ends the row (a report's attendance), 20/700 tabular. */
    .table.table--rows .rows-value {
      display: block;
      grid-area: value;
      margin-inline-start: var(--space-3);
      color: var(--attend-text-strong);
      font-size: var(--text-num-m);
      font-weight: var(--weight-display);
      text-align: end;
      white-space: nowrap;
    }

    .table--rows .rows-value .na {
      font-size: var(--text-small);
      font-weight: var(--weight-strong);
    }

    /* A row's one action where it has no page to open (Roles & delegation:
       Revoke), under the line, so the name and the line keep the row's width
       (review L11). */
    .table.table--rows .rows-action {
      display: block;
      grid-area: status;
      justify-self: start;
      /* Its word lines up with the name and the line above it. */
      margin-top: var(--space-1);
      margin-inline-start: calc(-1 * var(--space-6));
      white-space: nowrap;
    }

    /* In a row whose name is a link stretched over it (Students & staff: Print a
       card, owner 2026-11-11), the action stays above that link. */
    .table--rows .rows-action :is(a, button) {
      position: relative;
      z-index: 1;
    }

    .table.table--rows .rows-chev {
      display: flex;
      grid-area: chev;
      margin-inline-start: var(--space-3);
      color: var(--attend-text-muted);
    }

    .table--rows .rows-chev .icon {
      inline-size: 16px;
      block-size: 16px;
    }

    /* The whole row is the target (§7): the name's link covers it. */
    .table--rows .rows-title a::after {
      content: "";
      position: absolute;
      inset: 0;
    }

    .table--rows tbody tr:has(> .rows-title):active {
      background: var(--attend-row-hover);
    }
  }

  /* Live wall (design review SF15; design integration 2026-11-10): one tile per
     student, a dashed circle until they check in, then a filled brand circle
     -- the state shows by shape and fill, not colour alone. The lecturer's live
     page (attendance/_live_wall.html, .live-wall__tile) and the administration
     overview (ui/_live_wall.html, .wall__tile) share it; each screen sets its
     layout and size. Hidden from assistive technology: the count says it. */
  .live-wall__tile,
  .wall__tile {
    display: inline-grid;
    place-items: center;
    border: 1.5px dashed var(--attend-border-strong);
    border-radius: 50%;
    color: var(--attend-text-muted);
    font-size: 11px;
    font-weight: var(--weight-bold);
    line-height: 1;
  }

  .live-wall__tile--in,
  .wall__tile--in {
    border-style: solid;
    border-color: var(--attend-brand);
    background: var(--attend-brand);
    color: var(--attend-on-brand);
  }

  /* ScopedSearch: search box plus scope filters above a list. Labels share
     one line and the inputs another: help text and a date's words sit under
     the input (AL9; batch 1 review: a date's words pushed its row out of
     line). Apply, when shown, lines up with the inputs. */
  .filters {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
  }

  .filters .field {
    flex: 1 1 180px;
    min-width: 0;
  }

  .filters .field--search {
    flex: 2 1 240px;
  }

  .filters > .actions {
    margin-block-start: calc(var(--leading-body) + var(--space-2));
  }

  /* On a computer every filter shows; the phone's toggle and chips do not. */
  .filters__more {
    display: contents;
  }

  .filters__toggle,
  .filter-chips {
    display: none;
  }

  @media (min-width: 768px) {
    .filters .field:not(.field--search) {
      flex: 0 1 200px;
    }

    /* A list keeps room for its choice ("All rounds (lecture outcomes)"). */
    .filters .field:has(select) {
      flex-basis: 14rem;
      min-inline-size: 14rem;
    }
  }

  /* A phone (Top 15 #14, AL9): the search stays in view, the other filters
     sit behind "Filters · 2" (a details toggle, no script needed), and the
     filters in use show as chips under it (static/js/forms/filter-chips.js);
     a chip's x clears its filter. */
  @media (max-width: 767px) {
    .filters .field--search {
      flex: 1 1 160px;
    }

    .filters__toggle {
      display: block;
      flex: none;
      align-self: flex-end;
    }

    .filters__toggle > summary {
      padding-inline: var(--space-4);
    }

    .filters__toggle:not([open]) ~ .filters__more {
      display: none;
    }

    .filters__toggle:not([open]) ~ .filter-chips {
      display: flex;
      flex: 1 1 100%;
      flex-wrap: wrap;
      gap: var(--space-2);
    }
  }

  .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--touch);
    padding-block: 0;
    padding-inline: var(--space-4) var(--space-2);
    border: 1px solid var(--attend-border-strong);
    border-radius: var(--r-pill);
    background: var(--attend-surface);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
  }

  .filter-chip .icon {
    inline-size: 16px;
    block-size: 16px;
    color: var(--attend-text-muted);
  }

  .filter-chip:active {
    background: var(--attend-row-hover);
  }

  @media (hover: hover) and (pointer: fine) {
    .filter-chip:hover {
      background: var(--attend-row-hover);
    }
  }

  /* A data region loaded by htmx: results plus its error states */
  .region {
    min-height: var(--touch);
  }

  /* Checkbox and radio lists (fieldset fields) */
  .field--choices > div {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
  }

  .field--choices label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch);
    font-size: var(--text-support);
  }

  /* One choice per line (the "Add a group" dialog): the options stack. */
  .field--stacked > div {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
  }

  /* While a form is being sent by htmx its choices hold still: a change then
     would start a preview that takes the request's place (the "Add a group"
     dialog). */
  .form.htmx-request .field--choices {
    pointer-events: none;
  }

  /* A warning among a form's fields keeps the form's own gap. */
  .form > .banner {
    margin-block-end: 0;
  }

  /* Two columns of fields on wide screens */
  .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
  }

  /* Conflicts, impacts and other short warnings inside a section */
  .notice-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: var(--space-3) 0;
    padding: 0;
    list-style: none;
  }

  .notice-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: var(--text-support);
  }

  /* A single confirmation checkbox with its sentence beside it */
  .field--check label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    min-height: var(--touch);
    padding-top: var(--space-2);
  }

  .field--check input {
    flex: none;
    margin-top: 2px;
  }

  /* Numbered instructions (install guidance) */
  .steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding-inline-start: var(--space-6);
  }

  /* Official identity: photo beside the record (device approval, manual attendance) */
  .identity {
    display: flex;
    align-items: flex-start;
    gap: var(--space-5);
  }

  .identity__photo {
    flex: none;
    width: 120px;
    height: 150px;
    border: 1px solid var(--attend-edge);
    border-radius: var(--radius-panel);
    background: var(--attend-surface-subtle);
    object-fit: cover;
  }

  .identity__photo--none {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--attend-text-secondary);
  }

  @media (max-width: 479px) {
    .identity {
      flex-direction: column;
    }
  }

  /* Row headers (a table whose first cell names the row) */
  .table tbody th[scope="row"] {
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
  }

  @media (max-width: 767px) {
    .table--cards th[scope="row"] {
      display: block;
      padding: var(--space-1) 0;
      border-top: 0;
    }
  }

  /* Settings change review: changed rows stand out by weight and the
     "Changed" status text, never by colour alone */
  .diff-table__changed td {
    font-weight: var(--weight-medium);
  }

  /* Policy preview timeline: one bar per code on a shared time scale. The
     table holds the data; the bars (aria-hidden SVG) repeat it visually. */
  .timeline-table__bar {
    inline-size: 40%;
    min-inline-size: 120px;
  }

  .timeline-bar {
    display: block;
    inline-size: 100%;
    block-size: 12px;
  }

  .timeline-bar__track {
    fill: var(--attend-progress-track);
  }

  .timeline-bar__shown {
    fill: var(--attend-accent);
  }

  .timeline-bar__grace {
    fill: var(--attend-accent-soft);
    stroke: var(--attend-accent-line);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
  }

  .timeline-scale {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--attend-text-secondary);
    font-size: var(--text-small);
  }

  .timeline-legend li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
  }

  .timeline-swatch {
    inline-size: 12px;
    block-size: 12px;
  }

  @media (max-width: 767px) {
    .table--cards td.timeline-table__bar {
      display: block;
      inline-size: auto;
    }
  }

  /* Backup codes and other monospace lists */
  .code-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2) var(--space-4);
    list-style: none;
    margin: 0;
    padding: var(--space-4);
    border: 1px solid var(--attend-edge);
    border-radius: var(--radius-panel);
    background: var(--attend-raised);
    font-family: var(--font-mono);
  }

  .otp-qr {
    inline-size: 200px;
    padding: var(--space-3);
    border-radius: var(--radius-panel);
    /* Always dark-on-light so authenticator apps can read it in dark mode. */
    background: var(--attend-projection-bg);
    color: var(--attend-projection-fg);
  }

  .otp-qr svg {
    inline-size: 100%;
    block-size: auto;
  }

  .secret {
    overflow-wrap: anywhere;
    font-family: var(--font-mono);
    font-size: var(--text-support);
  }

  /* An activation code, shown once to the Super Admin who hands it over */
  .activation-code {
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
    letter-spacing: 0.04em;
    color: var(--attend-text-strong);
  }

  /* New attendance round: the derived timing shown before submitting */
  .round-preview {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--attend-edge);
    border-inline-start: 2px solid var(--attend-accent-line);
    border-radius: var(--radius-control);
    font-size: var(--text-support);
  }

  .round-preview__line {
    color: var(--attend-text-strong);
  }

  .field--group {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .field--group[hidden] {
    display: none;
  }

  .round-setup__policy {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  /* ScannerView, ZoomControl, VerifiedProgress, ReceiptView (UI_UX §3 Scanner) */
  .scanner {
    /* The digital zoom factor; static/js/scanner/index.js sets it on the video. */
    --scanner-zoom: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .scanner__title {
    font-size: var(--text-section);
    font-weight: var(--weight-semi);
    color: var(--attend-text-strong);
  }

  .scanner__body {
    max-width: 60ch;
    margin-top: var(--space-1);
    color: var(--attend-text-secondary);
  }

  .scanner__body[hidden] {
    display: none;
  }

  .scanner .banner {
    margin-bottom: 0;
  }

  .scanner__camera {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .scanner__camera[hidden] {
    display: none;
  }

  .scanner__viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 52vh;
    max-height: 52dvh;
    border: 1px solid var(--attend-edge);
    border-radius: var(--radius-panel);
    background: var(--attend-surface-subtle);
  }

  @media (min-width: 600px) {
    .scanner__viewport {
      aspect-ratio: 4 / 3;
    }
  }

  /* Digital zoom scales the preview by exactly the factor the decoder crops by
     (static/js/scanner/zoom.js); hardware zoom leaves it at 1. */
  .scanner__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(var(--scanner-zoom));
    transform-origin: center;
  }

  /* Hidden until the camera's first frame (static/js/scanner/camera.js sets data-live):
     Android's webview paints a grey "play" poster on an empty video. */
  .scanner__video:not([data-live]) {
    visibility: hidden;
  }

  .scanner__frame {
    position: absolute;
    inset: 18%;
    border: 2px solid var(--attend-accent-line);
    border-radius: var(--radius-panel);
    pointer-events: none;
  }

  .zoom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
  }

  .zoom__label {
    font-size: var(--text-support);
    font-weight: var(--weight-medium);
    color: var(--attend-text-strong);
  }

  .zoom__value {
    min-width: 4ch;
    text-align: center;
    font-weight: var(--weight-semi);
  }

  .zoom__note {
    flex-basis: 100%;
    font-size: var(--text-small);
    color: var(--attend-text-secondary);
  }

  .zoom__note[hidden] {
    display: none;
  }

  .verified-progress {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .verified-progress[hidden] {
    display: none;
  }

  .verified-progress__text {
    font-size: var(--text-body);
    font-weight: var(--weight-semi);
    color: var(--attend-text-strong);
    font-variant-numeric: tabular-nums;
  }

  .verified-progress__bar {
    width: 100%;
    height: 8px;
    border: 1px solid var(--attend-edge);
    border-radius: var(--radius-control);
    background: var(--attend-surface-subtle);
    appearance: none;
  }

  .verified-progress__bar::-webkit-progress-bar {
    border-radius: var(--radius-control);
    background: var(--attend-progress-track);
  }

  .verified-progress__bar::-webkit-progress-value {
    border-radius: var(--radius-control);
    background: var(--attend-accent);
  }

  .verified-progress__bar::-moz-progress-bar {
    border-radius: var(--radius-control);
    background: var(--attend-accent);
  }

  .scanner__guidance {
    font-size: var(--text-body);
    color: var(--attend-text-strong);
  }

  .scanner__guidance[hidden],
  .scanner__notice[hidden],
  .scanner__head[hidden],
  .scanner__actions[hidden] {
    display: none;
  }

  .scanner__notice {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-support);
    color: var(--attend-warning);
  }

  .receipt {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5);
    border: 1px solid var(--attend-edge);
    border-inline-start: 2px solid var(--attend-positive);
    border-radius: var(--radius-panel);
    background: var(--attend-raised);
  }

  .receipt[hidden] {
    display: none;
  }

  .receipt:focus-visible {
    outline: 2px solid var(--attend-accent-line);
    outline-offset: 2px;
  }

  .receipt__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-section);
    font-weight: var(--weight-semi);
    color: var(--attend-text-strong);
  }

  .receipt__title .icon {
    color: var(--attend-positive);
  }

  /* Round history on the student's attendance page (UI_UX §3 History) */
  .round-history {
    margin-top: var(--space-2);
  }

  .round-history summary {
    min-height: var(--touch);
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--text-support);
    color: var(--attend-text-secondary);
  }

  .round-history__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-2) 0 var(--space-1);
  }

  .round-history__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    font-size: var(--text-support);
  }

  /* A list row whose details sit below its headline (student history) */
  .row--stacked {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .row__main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .row__status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-1);
  }

  /* The student's requests about one lecture record */
  .request-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: 0;
    list-style: none;
  }

  .request-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    min-height: var(--touch);
    font-size: var(--text-support);
  }

  /* Evidence files: name, type, size, actions; image previews for reviewers */
  .evidence-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 0;
    list-style: none;
  }

  .evidence-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--attend-edge);
    border-radius: var(--radius-panel);
  }

  .evidence-list__name {
    overflow-wrap: anywhere;
    font-weight: var(--weight-medium);
  }

  .evidence-preview {
    flex-basis: 100%;
  }

  .evidence-preview img {
    display: block;
    max-width: 100%;
    max-height: 480px;
    height: auto;
    border: 1px solid var(--attend-edge);
    border-radius: var(--radius-control);
  }

  /* AuditTimeline (UI_UX §7): who did what, when and why, oldest first */
  .audit-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 0;
    padding-inline-start: var(--space-4);
    list-style: none;
    border-inline-start: 2px solid var(--attend-edge);
  }

  .audit-timeline__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: var(--text-support);
  }

  .audit-timeline__what {
    font-weight: var(--weight-medium);
    color: var(--attend-text-strong);
  }

  .audit-timeline__meta {
    font-size: var(--text-small);
    color: var(--attend-text-secondary);
  }

  /* Audit screen: an event's recorded before/after/context, on request */
  .audit-details {
    margin-top: var(--space-1);
    font-size: var(--text-small);
  }

  .audit-details summary {
    cursor: pointer;
    color: var(--attend-text-secondary);
  }

  .audit-details pre {
    max-width: 100%;
    margin: 0 0 var(--space-2);
    padding: var(--space-2);
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--attend-surface-subtle);
    border-radius: var(--radius-control);
  }

  /* AttendanceTable (reports): counts right-aligned, the row's explanation
     under its title, "Not applicable" in words (never 0%) */
  .attendance-table .num {
    text-align: end;
    white-space: nowrap;
  }

  .attendance-table__title {
    display: block;
    font-weight: var(--weight-medium);
    color: var(--attend-text-strong);
  }

  .attendance-table__why {
    display: block;
    max-width: 48ch;
    overflow-wrap: anywhere;
  }

  .na {
    color: var(--attend-text-secondary);
    font-style: italic;
  }

  @media (max-width: 767px) {
    .attendance-table .num {
      white-space: normal;
    }
  }

  /* A wide report table scrolls in its frame rather than squeezing a column
     to a word per line: the headers may wrap, the name column and the chips
     keep their width. */
  @media (min-width: 768px) {
    .attendance-table thead th {
      white-space: normal;
    }

    /* .attendance-table .num keeps counts on one line; their headers wrap. */
    .attendance-table thead th.num {
      white-space: normal;
    }

    .attendance-table td:first-child {
      min-width: 24ch;
    }

    .attendance-table .status,
    .attendance-table .status > span {
      white-space: nowrap;
    }
  }

  /* A report export's status (polled while it is being prepared) */
  .export-job {
    margin-top: var(--space-3);
  }

  .export-job__line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin: 0 0 var(--space-1);
  }

  /* Timetable sheet (design A "College sheet"; templates/timetable/sheet/):
     the Stage timetable and a student's My timetable. Days and times down,
     rooms across; one tbody per day. The frame scrolls sideways on a phone,
     the page never does. A faded session (other groups) turns muted, not
     transparent, so it stays readable. Group tags: sections in the brand
     tint, practical groups in the info tint. */
  .sheet-wrap {
    overflow-x: auto;
    max-inline-size: 100%;
  }

  .sheet-wrap + .sheet-wrap {
    margin-top: var(--space-6);
  }

  .sheet {
    min-inline-size: 640px;
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-small);
    text-align: start;
  }

  .sheet.sheet--compact {
    min-inline-size: 0;
  }

  .sheet caption {
    caption-side: top;
    padding: var(--space-3) var(--space-4);
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
    text-align: start;
  }

  .sheet th,
  .sheet td {
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--attend-border);
    text-align: start;
    vertical-align: top;
  }

  .sheet thead th {
    background: var(--attend-table-head);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    line-height: var(--leading-label);
  }

  .sheet .sheet__day {
    background: var(--attend-ground);
    color: var(--attend-text-strong);
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
  }

  /* "Add lecture" under the day's name (the stage timetable), in the body face. */
  .sheet .sheet__day .day-link {
    display: flex;
    font-family: var(--font-body);
    white-space: nowrap;
  }

  .sheet .sheet__time {
    color: var(--attend-text-secondary);
    font-weight: var(--weight-body);
    white-space: nowrap;
  }

  .sheet .sheet__cell {
    min-inline-size: 140px;
  }

  .sheet.sheet--compact .sheet__cell {
    min-inline-size: 0;
  }

  .sheet.sheet--practical:not(.sheet--compact) .sheet__cell {
    text-align: center;
  }

  .session {
    display: grid;
    justify-items: start;
    gap: var(--space-1);
    color: var(--attend-text);
  }

  .sheet--practical:not(.sheet--compact) .session {
    justify-items: center;
  }

  .session + .session {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--attend-border);
  }

  .session__course {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .session__groups {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .session__meta {
    color: var(--attend-text-muted);
    font-size: var(--text-meta);
  }

  .group-tag {
    padding: var(--space-05) var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--r-xs);
    font-size: var(--text-label);
    font-weight: var(--weight-bold);
    line-height: var(--leading-label);
  }

  .group-tag--theory {
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .group-tag--practical {
    background: var(--attend-info-bg);
    color: var(--attend-info-text);
  }

  .session--faded {
    color: var(--attend-text-muted);
  }

  .session--faded .session__course {
    color: var(--attend-text-muted);
    font-weight: var(--weight-body);
  }

  .session--faded .group-tag {
    border-color: var(--attend-border);
    background: var(--attend-surface);
    color: var(--attend-text-muted);
  }

  /* The real week (owner, 2026-11-13; board L1-StageWeek): the day's date under
     its name, and a lecture that is not held struck through, with its reason
     and its chip. */
  .sheet .sheet__day .sheet-day__date {
    display: block;
    margin-block-start: var(--space-05);
    color: var(--attend-text-muted);
    font-family: var(--font-body);
    font-size: var(--text-small);
    font-weight: var(--weight-body);
  }

  .session--cancelled {
    color: var(--attend-text-muted);
  }

  .session--cancelled .session__course {
    color: var(--attend-text-muted);
    font-weight: var(--weight-body);
    text-decoration: line-through;
  }

  .session--cancelled .group-tag {
    border-color: var(--attend-border);
    background: var(--attend-surface);
    color: var(--attend-text-muted);
  }

  /* The week a page shows and the links to the weeks around it (the Stage
     timetable, the lecturer's Schedule). */
  .week-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-block-end: var(--space-4);
  }

  .week-head__title {
    margin: 0;
    font-size: var(--text-h2);
    line-height: var(--leading-h2);
  }

  .week-head__name {
    color: var(--attend-text-muted);
    font-family: var(--font-body);
    font-size: var(--text-small);
    font-weight: var(--weight-body);
  }

  .week-empty {
    margin-block: var(--space-5);
  }

  /* A list row of a lecture that is not held (the Schedule), and a row's chips
     when it has more than one. */
  .row--off .row__title,
  .row--off .row__title a {
    color: var(--attend-text-muted);
    font-weight: var(--weight-body);
    text-decoration: line-through;
  }

  .row__marks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    margin: 0;
  }

  .sheet-groups {
    margin: 0 0 var(--space-4);
    color: var(--attend-text-secondary);
    font-weight: var(--weight-semi);
  }

  /* The student's own stage leads the line (owner, 2026-11-23). */
  .sheet-groups__stage {
    color: var(--attend-brand-text);
  }

  /* The group filter: chips are links (the selection is the query string). */
  .group-filter {
    margin-bottom: var(--space-5);
  }

  .group-filter__label {
    margin: 0 0 var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
  }

  .group-filter__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .group-filter__note {
    margin: var(--space-2) 0 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  .group-chip {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch);
    min-width: var(--touch);
    justify-content: center;
    padding: 0 var(--space-4);
    border: 1px solid var(--attend-border-strong);
    border-radius: var(--r-pill);
    background: var(--attend-surface);
    color: var(--attend-text);
    font-size: var(--text-small);
    font-weight: var(--weight-semi);
    text-decoration: none;
  }

  .group-chip.is-selected {
    border-color: var(--attend-brand);
    background: var(--attend-brand);
    color: var(--attend-on-brand);
  }

  @media (pointer: fine) {
    .group-chip {
      min-height: 36px;
    }
  }

  /* Both languages at once ({% bilingual %}, apps/ui/templatetags/bilingual.py): the
     presenter and the printed cards. The halves sit side by side and wrap under
     each other when the line is full; each keeps its own direction. */
  .bilingual {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: inherit;
    column-gap: var(--space-2);
    row-gap: 0;
  }

  /* A half that wraps on its own lines lines up with the rest of the block,
     not with its own direction. */
  .bilingual > [lang] {
    text-align: match-parent;
  }
}

/* What's New (templates/whatsnew/_dialog.html, page.html; docs/dev/whats-new.md):
   the shared dialog, paged. The body keeps one height while it is open, so a
   shorter page never makes the sheet jump; a long one scrolls inside it. Pages
   change with the fade token only (reduced motion: app.css). */
@layer components {
  .dialog--paged .dialog__body {
    block-size: min(22rem, 56dvh);
    overflow-y: auto;
  }

  .whats-new__heading {
    display: grid;
    gap: var(--space-05);
  }

  /* Targets of programmatic focus only (tabindex="-1", static/js/whats-new.js):
     the dialog when it opens, the heading when paging hides the focused link.
     No ring on either (owner, 2026-11-11); the first Tab rings Close. */
  .whats-new:focus,
  .whats-new__heading > h2:focus {
    outline: none;
  }

  .whats-new__count {
    margin-inline-start: auto;
  }

  .whats-new__page {
    display: grid;
    align-content: start;
    gap: var(--space-3);
    transition:
      opacity var(--motion-fade) ease,
      display var(--motion-fade) allow-discrete;
  }

  .whats-new__page[hidden] {
    display: none;
    opacity: 0;
  }

  @starting-style {
    .whats-new__page:not([hidden]) {
      opacity: 0;
    }
  }

  .whats-new__page h3 {
    font-size: var(--text-h2);
  }

  .whats-new__tile {
    display: inline-grid;
    place-items: center;
    inline-size: var(--space-10);
    block-size: var(--space-10);
    border-radius: var(--r-md);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .whats-new__tile--small {
    inline-size: var(--space-8);
    block-size: var(--space-8);
    flex: none;
  }

  .whats-new__also {
    display: grid;
    gap: var(--space-3);
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .whats-new__also > li + li {
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--attend-border);
  }

  .whats-new__also-title {
    font-weight: 650;
    color: var(--attend-text-strong);
  }

  /* Back at the start, the dots in the middle, the primary at the end. */
  .whats-new__foot {
    align-items: center;
    justify-content: flex-end;
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--attend-border);
  }

  .whats-new__foot [data-whats-new-back] {
    margin-inline-end: auto;
  }

  .whats-new__dots {
    display: inline-flex;
    gap: var(--space-1);
    margin-inline-end: auto;
  }

  .whats-new__dot {
    inline-size: var(--space-2);
    block-size: var(--space-2);
    border-radius: var(--r-pill);
    background: var(--attend-inactive-text);
  }

  .whats-new__dot[data-current="true"] {
    background: var(--attend-brand);
  }

  .whats-new-release .row {
    align-items: flex-start;
    gap: var(--space-3);
  }
}
