/*
 * Kulliyati -- the shell: wordmark, the deep-ink sidebar and rail, the phone top
 * bar and tab bar, the navigation drawer, the account block, the footer credit,
 * the bare, loading and offline pages, and the sign-in layout (the brand panel,
 * design review 2026-11-09). Look: docs/design/visual-design.md §8, §10 and
 * "Sidebar"; markup: templates/layouts/*, templates/components/nav_*.html,
 * user_menu, notices_link, wordmark, app_loading, templates/auth/*.
 *
 * Linked after app.css and components.css (templates/base.html), so these
 * rules override the shared ones at equal specificity; shell parts are scoped
 * under .sidebar, .drawer, .topbar and .bottom-nav. Colours only as
 * var(--attend-*) tokens from app.css, no gradients, blur or filters, shadows
 * only as the light theme's elevation tokens (tests/test_css_rules.py,
 * tests/ui/test_shell_indigo.py).
 */
@layer components {
  /* The ink sidebar and drawer: the menu fits a laptop window (below); on a
     very short one it still scrolls, without a visible bar (owner, 2026-11-02). */
  .sidebar,
  .drawer {
    scrollbar-width: none;
    scrollbar-color: var(--attend-sidebar-scrollbar) transparent;
  }

  .sidebar::-webkit-scrollbar,
  .drawer::-webkit-scrollbar {
    display: none;
  }

  /* ------------------------------------------------------- wordmark (§8) */
  /* The KY tile (an image in the logo colours) and the name (owner, 2026-11-09). */
  .wordmark {
    display: inline-flex;
    flex-wrap: wrap; /* at 200% text on a phone the word moves under the tile */
    align-items: center;
    gap: 0.28em;
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 24px;
    font-weight: var(--weight-display);
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--attend-text-strong);
    white-space: nowrap;
  }

  .wordmark--lg {
    font-size: 48px;
  }

  /* The bilingual lockup (wordmark with arabic=True: the sign-in, the presenter): the name, a
     muted dot and the Arabic outline on one baseline; the outline's own box and
     its tail are the sign-in's (.auth__name-ar below). */
  .wordmark__names {
    display: inline-flex;
    flex-wrap: wrap; /* at 200% text on a phone the Arabic name moves to its own line */
    align-items: baseline;
    gap: 0 0.22em;
  }

  .wordmark__sep {
    color: var(--attend-text-muted);
    font-weight: var(--weight-medium);
  }

  /* The tile carries its own corners and colours. Every logo surface draws the
     light theme's logo (tile C, navy mark) and the dark theme's (deep-ink tile,
     light mark; owner 2026-11-09); the theme shows one. Print is always light. */
  .wordmark__tile,
  .brand__tile {
    display: block;
    flex: none;
    inline-size: 1.1em;
    block-size: 1.1em;
  }

  .logo-dark {
    display: none;
  }

  :root[data-theme="dark"] .logo-light {
    display: none;
  }

  :root[data-theme="dark"] .logo-dark {
    display: block;
  }

  @media (prefers-color-scheme: dark) {
    :root[data-theme="system"] .logo-light {
      display: none;
    }

    :root[data-theme="system"] .logo-dark {
      display: block;
    }
  }

  @media print {
    .logo-light {
      display: block !important;
    }

    .logo-dark {
      display: none !important;
    }
  }

  /* ------------------------------------------------------------ shell */
  .shell {
    background: var(--attend-ground);
  }

  .nav__link {
    min-height: var(--touch);
  }

  /* Phone top app bar: the wordmark, then Notices (and the
     drawer button). Sticky on the ground colour, with no border until the page
     scrolls (§10; design review iOS (b)): static/js/nav.js marks the bar
     data-scrolled="false" at the top. Without the script the hairline stays. */
  .topbar {
    view-transition-name: topbar; /* held still while pages cross-fade (app.css) */
    min-height: var(--topbar-h);
    padding-block: var(--space-1);
    padding-inline: var(--space-5) var(--space-4);
    padding-top: max(var(--space-1), env(safe-area-inset-top));
    border-bottom: 1px solid var(--attend-border);
    background: var(--attend-ground);
    transition: border-color 150ms ease;
  }

  .topbar[data-scrolled="false"] {
    border-bottom-color: transparent;
    background: transparent; /* the page's wash shows through until it scrolls */
  }

  .topbar__brand {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch);
    border-radius: var(--r-sm);
    color: var(--attend-text-strong);
    text-decoration: none;
  }

  /* An inner page shows "‹ Back" where the wordmark sits (design review AL5;
     components/page_back.html since 2026-11-16): brand text, a 44px target,
     the pressed tint of the bar's buttons. */
  .topbar__back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--touch);
    margin-inline-start: calc(-1 * var(--space-2));
    padding-inline: var(--space-1) var(--space-3);
    border-radius: var(--r-pill);
    color: var(--attend-brand-text);
    font-size: 17px;
    font-weight: var(--weight-book);
    text-decoration: none;
    -webkit-touch-callout: none;
  }

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

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

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

  /* "‹ Back" above an inner page's title from 768px, where there is no top bar
     (owner, 2026-11-16; components/page_back.html). Under 768px the top bar
     carries it. A plain link: the arrow leads, at the start of the line. */
  .page-back {
    display: none;
    align-items: center;
    gap: var(--space-1);
    align-self: flex-start;
    min-height: 32px;
    margin-block-end: var(--space-2);
    margin-inline-start: calc(-1 * var(--space-2));
    padding-inline: var(--space-1) var(--space-3);
    border-radius: var(--r-pill);
    color: var(--attend-brand-text);
    font-weight: var(--weight-medium);
    text-decoration: none;
  }

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

  @media (min-width: 768px) {
    .page-back {
      display: inline-flex;
    }
  }

  /* From 768px a staff page with breadcrumbs keeps them as its way up (plan
     Q4); the phone top bar still shows Back. */
  .content__body:has(.breadcrumbs) > .page-back {
    display: none;
  }

  /* Outside the app shell (the privacy page, signed in) there is no top bar:
     the row shows at every width (plan Q11). */
  /* The privacy page (bare layout): no top bar, so a full touch target. */
  .page-back.page-back--bare {
    display: inline-flex;
    min-height: var(--touch);
  }

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

  /* On a phone the top bar's Back already leads the page, so the eyebrow
     above the title is dropped to keep the header short (design integration,
     2026-11-10; kept for every inner page with the Back, 2026-11-16). From
     768px there is no top bar and the eyebrow stays. */
  @media (max-width: 767px) {
    .shell:has(.topbar__back) .page-header__eyebrow {
      display: none;
    }
  }

  .topbar__actions {
    gap: var(--space-2);
  }

  /* Bar buttons are borderless glyphs in the brand colour (iOS (b)); the
     44px circle shows only while pressed or under a mouse. */
  .topbar__action {
    position: relative;
    inline-size: var(--touch);
    min-width: var(--touch);
    block-size: var(--touch);
    min-height: var(--touch);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--attend-brand-text);
  }

  @media (hover: hover) and (pointer: fine) {
    .topbar .topbar__action:hover {
      background: var(--attend-row-hover);
      color: var(--attend-brand-text);
    }
  }

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

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

  .topbar .notices-link .count-badge {
    position: absolute;
    inset-block-start: -3px;
    inset-inline-end: -4px;
    min-inline-size: 18px;
    block-size: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    outline: 2px solid var(--attend-ground);
    background: var(--attend-brand);
    color: var(--attend-on-brand);
    font-size: 11px;
    font-weight: var(--weight-label);
    line-height: 18px;
  }

  /* A tab's top row: a tab's own page on a phone (owner, 2026-11-18; plans/account-tabs,
     then Board D25): no top bar; the page header is the top row: the title
     large at the inline start, the bell (and the drawer's button) at the end,
     no bar and no logo. Refresh, when the page has it, sits between them. The
     eyebrow (Today's date) and the line under the title follow under the
     row; any other actions and the search get a row of their own. The title's
     div lends its children to the grid (display: contents, a plain div). */
  .page-header__end {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-inline-end: calc(-1 * var(--space-2)); /* the bell's circle, not its glyph, meets the gutter */
  }

  /* The bar's buttons as in the top bar (above). */
  .page-header__end .topbar__action:active {
    background: var(--attend-row-hover);
  }

  @media (hover: hover) and (pointer: fine) {
    .page-header__end .topbar__action:hover {
      background: var(--attend-row-hover);
      color: var(--attend-brand-text);
    }
  }

  .page-header__end .topbar__action .icon {
    inline-size: 24px;
    block-size: 24px;
  }

  .page-header__end .notices-link .count-badge {
    position: absolute;
    inset-block-start: -3px;
    inset-inline-end: -4px;
    min-inline-size: 18px;
    block-size: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    outline: 2px solid var(--attend-ground);
    background: var(--attend-brand);
    color: var(--attend-on-brand);
    font-size: 11px;
    font-weight: var(--weight-label);
    line-height: 18px;
  }

  /* Today's title on a phone is the product's name (Board D25), title-sized
     with the display weight; from 768px the sidebar has the name and the
     title reads "Today" (the media rules below and further down). */
  .page-header__name {
    font-weight: var(--weight-display);
    letter-spacing: -0.03em;
  }

  .page-header__name:lang(ar) {
    letter-spacing: 0;
  }

  @media (max-width: 767px) {
    .shell--tab .main {
      padding-top: max(var(--space-1), env(safe-area-inset-top));
    }

    .page-header__title-wide {
      display: none;
    }

    /* One flex row that wraps: the title, Refresh, the end group; the
       title's div lends its children to it and the rest (the eyebrow, the
       line under the title, the search, other actions) take whole lines
       under the row. The title takes what its words need, up to one line;
       the end group, at least the bell (the drawer's button too), grows
       into the rest, and the title wraps between its words. When even its longest
       word does not fit beside the end group (large text on a narrow
       phone), the end group moves to a line of its own under the title
       rather than breaking the word or covering a button. */
    .page-header:has(> .page-header__end) {
      --tab-end-least: var(--touch); /* the bell */
      justify-content: normal;
      gap: 0;
      margin-bottom: var(--space-5);
    }

    /* Refresh's own phone rule (components.css) keeps its header on one line. */
    .page-header:has(> .page-header__end),
    .page-header:has(> .page-header__end):has(> .actions > .refresh-page:only-child) {
      flex-wrap: wrap;
      align-items: center;
    }

    .page-header:has(> .page-header__end [data-dialog-open]) {
      --tab-end-least: calc(2 * var(--touch) + var(--space-1)); /* the drawer's button and the bell */
    }

    .page-header:has(> .page-header__end) > div:first-child {
      display: contents;
    }

    .page-header:has(> .page-header__end) > div:first-child > :not(h1),
    .page-header:has(> .page-header__end) > .header-search,
    .page-header:has(> .page-header__end) > .actions {
      flex: 0 0 100%;
      order: 2;
    }

    .page-header:has(> .page-header__end) h1 {
      flex: 1000 1 0%; /* from its longest word up to one line; the end group gets the rest */
      max-width: max-content;
      overflow-wrap: break-word; /* inside a word only when the word alone is wider than the screen */
    }

    .page-header:has(> .page-header__end) > .actions:has(> .refresh-page:only-child) {
      flex: none;
      order: 1;
      margin-inline-start: var(--space-2);
    }

    .page-header:has(> .page-header__end) > .page-header__end {
      flex: 1 0 var(--tab-end-least);
      order: 1;
      justify-content: flex-end;
      min-block-size: var(--topbar-h);
      margin-inline-start: var(--space-2);
    }

    .page-header:has(> .page-header__end) .page-header__eyebrow {
      margin-bottom: 0;
    }

    .page-header:has(> .page-header__end) .page-header__sub {
      margin-top: var(--space-1);
    }

    .page-header:has(> .page-header__end) > .header-search,
    .page-header:has(> .page-header__end) > .actions:not(:has(> .refresh-page:only-child)) {
      margin-top: var(--space-3);
    }
  }

  @media (min-width: 768px) {
    .page-header__end {
      display: none;
    }
  }

  /* From 768px Today's title reads "Today" (the sidebar has the name). */
  @media (min-width: 768px) {
    .page-header__name {
      display: none;
    }
  }

  /* Content: a 20px gutter on phones (app.css sets the wider screens'),
     the credit last and centred. */
  @media (max-width: 767px) {
    .main {
      padding: var(--space-4) var(--space-5) var(--space-6);
      padding-left: max(var(--space-5), env(safe-area-inset-left)); /* physical: the screen's own sides */
      padding-right: max(var(--space-5), env(safe-area-inset-right)); /* physical: the screen's own sides */
    }

    .shell--bottom-nav .main {
      padding-bottom: calc(
        var(--bottom-nav-h) + var(--bottom-nav-lift) + var(--space-6) +
          max(var(--space-4), env(safe-area-inset-bottom))
      );
    }
  }

  .main-foot {
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-8);
    padding-top: 0;
    border-top: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    line-height: var(--leading-label);
    text-align: center;
  }

  .main-foot .credit {
    color: var(--attend-text-muted);
  }

  /* Phone tab bar C1a (Board, owner 2026-11-18; D22, D24): a floating pill 16px
     from each side and above the home bar, 64px high; one 46px brand circle, its
     top 18px above the pill and a ring in the page's ground colour, sits over the
     open tab (a tapped tab's while its page loads) and slides there with a plain
     ease-out (no spring since 2026-11-25, owner); the open tab's filled glyph rises into it, white, its label stays
     under it in the brand colour (coloured, not bold: D33). The owner accepted
     the pill and its shadow over "no pills, no shadows". The circle's place is
     CSS alone (--tabs and --at below), so it is right without JavaScript;
     static/js/nav.js measures each icon's rise. Reduce-motion: the reset
     layer's global rule cuts every transition. */
  .bottom-nav {
    position: fixed;
    z-index: 20;
    inset-inline: var(--space-4);
    inset-block-end: max(var(--space-4), env(safe-area-inset-bottom));
    --tabs: 4;
    --at: 0;
    --bottom-nav-pad: 6px;
    padding: 0 var(--bottom-nav-pad);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-pill);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-raised);
    container-type: inline-size;
    view-transition-name: bottom-nav;
  }

  .bottom-nav:has(> .bottom-nav__list > :nth-child(1):last-child) {
    --tabs: 1;
  }

  .bottom-nav:has(> .bottom-nav__list > :nth-child(2):last-child) {
    --tabs: 2;
  }

  .bottom-nav:has(> .bottom-nav__list > :nth-child(3):last-child) {
    --tabs: 3;
  }

  .bottom-nav:has(> .bottom-nav__list > :nth-child(4):last-child) {
    --tabs: 4;
  }

  .bottom-nav:has(> .bottom-nav__list > :nth-child(5):last-child) {
    --tabs: 5;
  }

  /* The open tab, then the tapped one: same specificity, so a tapped tab (later)
     wins while its page loads. */
  .bottom-nav:has(.bottom-nav__list > :nth-child(1) > .bottom-nav__link[aria-current="page"]) {
    --at: 1;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(2) > .bottom-nav__link[aria-current="page"]) {
    --at: 2;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(3) > .bottom-nav__link[aria-current="page"]) {
    --at: 3;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(4) > .bottom-nav__link[aria-current="page"]) {
    --at: 4;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(5) > .bottom-nav__link[aria-current="page"]) {
    --at: 5;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(1) > .bottom-nav__link[data-going]) {
    --at: 1;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(2) > .bottom-nav__link[data-going]) {
    --at: 2;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(3) > .bottom-nav__link[data-going]) {
    --at: 3;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(4) > .bottom-nav__link[data-going]) {
    --at: 4;
  }

  .bottom-nav:has(.bottom-nav__list > :nth-child(5) > .bottom-nav__link[data-going]) {
    --at: 5;
  }

  .bottom-nav__list {
    position: relative;
    z-index: 1;
  }

  .bottom-nav__circle {
    position: absolute;
    z-index: 0;
    inset-block-start: calc(-1 * var(--bottom-nav-lift));
    inset-inline-start: calc(
      var(--bottom-nav-pad) + (var(--at) - 0.5) * 100cqi / var(--tabs) - 23px
    );
    inline-size: 46px;
    block-size: 46px;
    border-radius: var(--r-pill);
    background: var(--attend-brand);
    outline: 5px solid var(--attend-ground);
    box-shadow: var(--attend-shadow-primary);
    pointer-events: none;
  }

  /* Only a tap moves it (owner's phone, 2026-11-20): a page arrives with the
     circle already in place. Chrome on Android first placed it from a
     provisional bar width and slid it from there, a tab or more away. */
  .bottom-nav:has([data-going]) .bottom-nav__circle {
    transition: inset-inline-start 380ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .bottom-nav:not(:has([aria-current="page"], [data-going])) .bottom-nav__circle {
    display: none;
  }

  .bottom-nav__link {
    position: relative;
    /* Measured per tab by static/js/nav.js; this is the rise at normal text. */
    --bottom-nav-rise: -17px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    min-height: var(--bottom-nav-h);
    padding-inline: var(--space-1);
    container-type: inline-size;
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-button);
    line-height: var(--leading-label);
    text-decoration: none;
    -webkit-touch-callout: none;
    user-select: none;
  }

  /* A label never spills into the next tab (owner, 2026-11-10: large phone text
     read "AttendanceMy timetable"). Each tab keeps a small inner margin, and its
     label keeps the label size unless that is too big for the tab: then it
     shrinks to what the tab can hold (17cqi: "Attendance", the longest word,
     fits), so words never break and labels never touch (the tab's inline
     padding). A two-word label may wrap between its words.
     tests/e2e/test_tab_bar_labels.py. */
  .bottom-nav__label {
    max-inline-size: 100%;
    /* Never below 9px: five tabs on the C1a pill leave 17cqi at 8px on a 320px
       phone (Board, 2026-11-18); "Timetable" still fits at 9px. */
    font-size: min(var(--text-label), max(9px, 17cqi));
    line-height: min(var(--leading-label), 1.34em);
    text-align: center;
  }

  .bottom-nav__icon {
    display: grid;
    place-items: center;
    inline-size: 56px;
    block-size: 32px;
    transition:
      transform 120ms ease-out,
      color 200ms ease;
  }

  /* The rise moves only on a tap too: on arrival the measured rise
     (static/js/nav.js) replaces the default at once. */
  .bottom-nav__list:has([data-going]) .bottom-nav__icon {
    transition:
      transform 120ms ease-out,
      translate 320ms cubic-bezier(0.22, 1, 0.36, 1),
      color 200ms ease;
  }

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

  .bottom-nav__glyph--current {
    display: none;
  }

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

  .bottom-nav .bottom-nav__link[aria-current="page"],
  .bottom-nav .bottom-nav__link[data-going] {
    color: var(--attend-brand-text);
  }

  .bottom-nav__link[aria-current="page"] .bottom-nav__glyph,
  .bottom-nav__link[data-going] .bottom-nav__glyph {
    display: none;
  }

  .bottom-nav__link[aria-current="page"] .bottom-nav__glyph--current,
  .bottom-nav__link[data-going] .bottom-nav__glyph--current {
    display: block;
  }

  /* A tapped tab answers at once (static/js/nav.js marks it data-going while
     its page loads); the tab it leaves goes back to its outline. */
  .bottom-nav__list:has([data-going]) .bottom-nav__link[aria-current="page"]:not([data-going]) {
    color: var(--attend-text-muted);
  }

  .bottom-nav__list:has([data-going]) [aria-current="page"]:not([data-going]) .bottom-nav__glyph {
    display: block;
  }

  .bottom-nav__list:has([data-going])
    [aria-current="page"]:not([data-going])
    .bottom-nav__glyph--current {
    display: none;
  }

  /* The open tab's icon rises into the circle, white; the tab being left lets
     its icon down while the circle slides away. */
  .bottom-nav__link[aria-current="page"] .bottom-nav__icon,
  .bottom-nav__link[data-going] .bottom-nav__icon {
    translate: 0 var(--bottom-nav-rise);
    color: var(--attend-on-brand);
  }

  .bottom-nav__list:has([data-going]) [aria-current="page"]:not([data-going]) .bottom-nav__icon {
    translate: none;
    color: inherit;
  }

  .bottom-nav__link:active .bottom-nav__icon {
    transform: scale(0.92);
  }

  .bottom-nav .bottom-nav__link:focus-visible {
    outline-offset: -2px;
  }

  /* ------------------------------------- deep-ink sidebar and the drawer */
  .sidebar {
    view-transition-name: sidebar; /* held still while pages cross-fade (app.css) */
  }

  .sidebar,
  .drawer {
    color: var(--attend-sidebar-text);
  }

  .sidebar :focus-visible,
  .drawer :focus-visible {
    outline-color: var(--attend-sidebar-accent);
  }

  .sidebar .brand,
  .drawer .brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3) 0;
    border-radius: var(--r-sm);
    color: var(--attend-sidebar-strong);
    text-decoration: none;
  }

  .sidebar .wordmark,
  .drawer .wordmark {
    color: var(--attend-sidebar-strong);
  }

  /* The institution: two lines at most, the full name on hover (title). */
  .sidebar .brand__org {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    white-space: normal;
    color: var(--attend-sidebar-muted);
    font-size: var(--text-label);
    line-height: var(--leading-label);
  }

  .brand__short {
    display: none;
  }

  .sidebar .nav,
  .drawer .nav {
    gap: var(--space-4);
    margin-top: var(--space-6);
  }

  .sidebar .nav__title,
  .drawer .nav__title {
    padding: 0 var(--space-3) var(--space-2);
    color: var(--attend-sidebar-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    line-height: var(--leading-label);
  }

  /* A group's heading folds it away (owner, 2026-11-11; static/js/sidebar/groups.js):
     the label, then a chevron at the end that points down while the group is
     open and along the line (to the end) while it is folded. A finger gets a
     44px target; a mouse a 24px one (below). */
  .sidebar .nav__group,
  .drawer .nav__group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    inline-size: 100%;
    min-height: var(--touch);
    padding-block: 0;
    border: 0;
    border-radius: var(--r-xs);
    background: transparent;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
  }

  .nav__group-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav__group .nav__chevron {
    flex: none;
    inline-size: 16px;
    block-size: 16px;
    transition: transform 150ms ease-out;
  }

  .nav__section[data-closed] .nav__chevron {
    transform: rotate(-90deg);
  }

  :root[dir="rtl"] .nav__section[data-closed] .nav__chevron {
    transform: rotate(90deg);
  }

  @media (hover: hover) and (pointer: fine) {
    .sidebar .nav__group:hover,
    .drawer .nav__group:hover {
      color: var(--attend-sidebar-strong);
    }
  }

  .sidebar .nav__group:active,
  .drawer .nav__group:active {
    background: var(--attend-sidebar-hover);
  }

  /* A folded group's links take no room and leave the tab order; opening and
     folding slide (where the browser can size to auto, app.css), unless less
     motion is asked for. */
  .nav__section[data-closed] > .row-list {
    block-size: 0;
    overflow-y: clip;
    visibility: hidden;
  }

  @media (prefers-reduced-motion: no-preference) {
    .nav__section > .row-list {
      transition:
        block-size 150ms ease-out,
        visibility 150ms,
        overflow-y 0s linear 150ms allow-discrete;
    }

    .nav__section[data-closed] > .row-list {
      transition:
        block-size 150ms ease-out,
        visibility 150ms;
    }
  }

  .sidebar .nav__link,
  .drawer .nav__link {
    position: relative;
    gap: var(--space-3);
    min-height: var(--touch);
    padding: 0 var(--space-3);
    border-radius: var(--r-pill);
    color: var(--attend-sidebar-text);
    font-size: var(--text-body);
    font-weight: var(--weight-bold);
    text-decoration: none;
  }

  .sidebar .nav__link .icon,
  .drawer .nav__link .icon {
    inline-size: 20px;
    block-size: 20px;
  }

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

  .sidebar .nav__link:active,
  .drawer .nav__link:active {
    background: var(--attend-sidebar-hover);
  }

  .sidebar .nav__link[aria-current="page"],
  .drawer .nav__link[aria-current="page"] {
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
    font-weight: var(--weight-strong);
  }

  .sidebar .nav__link[aria-current="page"] .icon,
  .drawer .nav__link[aria-current="page"] .icon {
    color: var(--attend-sidebar-accent);
  }

  /* The motif: a 6px accent dot at the active item's right edge. */
  .sidebar .nav__link[aria-current="page"]::after,
  .drawer .nav__link[aria-current="page"]::after {
    content: "";
    flex: none;
    inline-size: 6px;
    block-size: 6px;
    margin-inline-start: auto;
    border-radius: 50%;
    background: var(--attend-sidebar-accent);
  }

  /* The bell's unread count in the account row (owner, 2026-11-18: it was a
     20px disc beside a 16px bell, covering it): a 16px badge on the bell's top
     end corner, its start edge on the bell's middle whatever the button's size,
     ringed in the sidebar's colour so it stands apart from the bell. The same
     in the rail. */
  .sidebar .user-menu__notices .count-badge {
    position: absolute;
    inset-block-start: calc(50% - 16px);
    inset-inline-start: 50%;
    inset-inline-end: auto;
    min-inline-size: 16px;
    block-size: 16px;
    margin: 0;
    padding: 0 4px;
    border-radius: var(--r-pill);
    outline: 2px solid var(--attend-sidebar);
    background: var(--attend-sidebar-accent);
    color: var(--attend-sidebar-on-accent);
    font-size: 10px;
    font-weight: var(--weight-label);
    line-height: 16px;
  }

  /* The account block stays in view (design review AL15, SF13): a long menu
     scrolls on its own between the wordmark and the account block, so nothing
     is drawn over its links. The sidebar itself still scrolls on a window too
     short for the wordmark and the account block together.
     No scrollbar is ever drawn (owner, 2026-11-11: "I don't want a scroll bar
     inside the sidebar, even on a small screen"): the menu still scrolls with
     a wheel, a finger or the keyboard (a focused link scrolls into view), and
     a hairline above the account block shows while more of it sits below
     (static/js/nav.js sets data-more). */
  .sidebar .nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }

  /* The scrolling menu clips anything drawn past its edges, so the focus ring
     sits just inside a link instead of 3px outside it (it was cut on both
     sides, most visibly in the rail). */
  .sidebar .nav :focus-visible {
    outline-offset: -2px;
  }

  .sidebar .sidebar__foot {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: auto;
    padding-top: var(--space-8);
    border-top: 1px solid transparent;
  }

  .sidebar .nav[data-more] + .sidebar__foot {
    border-top-color: var(--attend-sidebar-active);
  }

  /* The account row (owner, 2026-11-11: "the notices on the profile, the sign
     out button next to the profile, not below it"): initials circle, name and
     role, then Notices and Sign out as icon buttons on the same row. The rail
     stacks the three (below). */
  .sidebar .user-menu,
  .drawer .user-menu {
    flex-direction: row;
    align-items: center;
    gap: var(--space-1);
  }

  /* The credit, and the collapse button at its end. */
  .sidebar .sidebar__end {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--attend-sidebar-active);
  }

  .sidebar .sidebar__end .nav-toggle {
    flex: none;
    margin-inline-start: auto;
  }

  .sidebar .user-menu__who,
  .drawer .user-menu__who {
    flex: 1 1 auto;
    min-width: 0;
    gap: var(--space-3);
    min-height: var(--touch);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--r-md);
    color: var(--attend-sidebar-strong);
    text-decoration: none;
  }

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

  .sidebar .user-menu__who:active,
  .drawer .user-menu__who:active {
    background: var(--attend-sidebar-hover);
  }

  .sidebar .avatar,
  .drawer .avatar {
    inline-size: 32px;
    block-size: 32px;
    border: 1px solid var(--attend-sidebar-active);
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
  }

  .sidebar .user-menu__text,
  .drawer .user-menu__text {
    color: var(--attend-sidebar-muted);
  }

  .sidebar .user-menu__name,
  .drawer .user-menu__name {
    color: var(--attend-sidebar-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .sidebar .user-menu__role,
  .drawer .user-menu__role {
    color: var(--attend-sidebar-muted);
    font-size: var(--text-label);
  }

  /* Notices, Sign out and the collapse button: square icon buttons. */
  .sidebar .user-menu .btn,
  .drawer .user-menu .btn,
  .sidebar .nav-toggle {
    flex: none;
    justify-content: center;
    inline-size: var(--touch);
    min-height: var(--touch);
    padding: 0;
    border-color: transparent;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--attend-sidebar-text);
  }

  @media (hover: hover) and (pointer: fine) {
    .sidebar .user-menu .btn:hover,
    .drawer .user-menu .btn:hover,
    .sidebar .nav-toggle:hover {
      background: var(--attend-sidebar-hover);
      color: var(--attend-sidebar-strong);
    }
  }

  .sidebar .user-menu .btn:active,
  .drawer .user-menu .btn:active,
  .sidebar .nav-toggle:active {
    background: var(--attend-sidebar-hover);
  }

  .sidebar .user-menu .notices-link[aria-current="page"],
  .drawer .user-menu .notices-link[aria-current="page"] {
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-accent);
  }

  .sidebar .nav-toggle {
    color: var(--attend-sidebar-muted);
  }

  .sidebar .sidebar__credit {
    flex: 1 1 auto;
    min-width: 0;
    padding-inline-start: var(--space-3);
  }

  .sidebar .credit {
    color: var(--attend-sidebar-muted);
    font-size: var(--text-label);
    line-height: var(--leading-label);
  }

  /* The drawer (administrators on phones): the same ink panel. */
  .drawer {
    padding: var(--space-4) var(--space-3);
    padding-top: max(var(--space-4), env(safe-area-inset-top));
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    border-inline-end: 1px solid var(--attend-sidebar-border);
    background: var(--attend-sidebar);
  }

  .drawer .drawer__head {
    padding-inline-start: var(--space-3);
  }

  .drawer .drawer__head .btn {
    border-color: transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--attend-sidebar-text);
  }

  @media (hover: hover) and (pointer: fine) {
    .drawer .drawer__head .btn:hover {
      background: var(--attend-sidebar-hover);
      color: var(--attend-sidebar-strong);
    }
  }

  .drawer .drawer__head .btn:active {
    background: var(--attend-sidebar-hover);
  }

  @media (min-width: 768px) {
    .sidebar {
      gap: 0;
      padding: var(--space-5) var(--space-1) var(--space-4);
      border-inline-end: 1px solid var(--attend-sidebar-border);
      background: var(--attend-sidebar);
    }

    .main-foot {
      flex-direction: row;
      justify-content: space-between;
      align-items: baseline;
      padding-top: var(--space-4);
      border-top: 1px solid var(--attend-border);
      text-align: start;
    }
  }

  @media (min-width: 1024px) {
    .shell:not([data-nav="collapsed"]) .sidebar {
      padding-inline: var(--space-3);
    }
  }

  /* A mouse-driven desktop is dense (owner, 2026-11-11: "the spacing for the
     buttons is too big"; Carbon-like): 32px links and foot buttons, 24px
     group headings, 12px between groups (touch keeps 44px targets and 16px).
     A long menu scrolls (above). */
  @media (min-width: 1024px) and (pointer: fine) {
    .sidebar .nav__link {
      min-height: 32px;
    }

    .sidebar .nav {
      gap: var(--space-3);
      margin-top: var(--space-3);
    }

    .sidebar .nav__group {
      min-height: 24px;
    }

    .sidebar .user-menu .btn,
    .sidebar .nav-toggle {
      min-height: 32px;
      inline-size: 32px;
    }

    .sidebar .user-menu__who {
      padding-block: var(--space-1);
    }

    .sidebar .sidebar__foot {
      padding-top: var(--space-3);
    }
  }

  /* The credit shows once at every width: in the expanded sidebar's foot at
     >=1024px, in the footer under the content everywhere else. */
  @media (min-width: 1024px) {
    .shell:not([data-nav="collapsed"]) .main-foot .credit {
      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 .sidebar__credit,
    .sidebar .brand__org,
    .sidebar .nav__title,
    .sidebar .user-menu__text {
      display: none;
    }

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

    .sidebar .brand__short {
      display: inline-flex;
      font-size: 26px; /* the tile: 1.1em, about 28px */
    }

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

    .sidebar .brand {
      min-height: var(--touch);
    }

    .sidebar .nav__link[aria-current="page"]::after {
      content: none;
    }

    .sidebar .nav__section[data-closed] > .row-list {
      block-size: auto;
      overflow-y: visible;
      visibility: visible;
    }

    .sidebar .nav__section + .nav__section {
      padding-top: var(--space-2);
      border-top: 1px solid var(--attend-sidebar-active);
    }

    /* The account row stacks: profile, Notices, Sign out; then the collapse button. */
    .sidebar .user-menu,
    .sidebar .sidebar__end {
      flex-direction: column;
      align-items: center;
    }
  }

  @media (min-width: 1024px) {
    .shell[data-nav="collapsed"] .sidebar .sidebar__credit,
    .shell[data-nav="collapsed"] .sidebar .brand__org,
    .shell[data-nav="collapsed"] .sidebar .nav__title,
    .shell[data-nav="collapsed"] .sidebar .user-menu__text {
      display: none;
    }

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

    .shell[data-nav="collapsed"] .sidebar .brand__short {
      display: inline-flex;
      font-size: 26px; /* the tile: 1.1em, about 28px */
    }

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

    .shell[data-nav="collapsed"] .sidebar .brand {
      min-height: var(--touch);
    }

    .shell[data-nav="collapsed"] .sidebar .nav__link[aria-current="page"]::after {
      content: none;
    }

    .shell[data-nav="collapsed"] .sidebar .nav__section[data-closed] > .row-list {
      block-size: auto;
      overflow-y: visible;
      visibility: visible;
    }

    .shell[data-nav="collapsed"] .sidebar .nav__section + .nav__section {
      padding-top: var(--space-2);
      border-top: 1px solid var(--attend-sidebar-active);
    }

    .shell[data-nav="collapsed"] .sidebar .nav-toggle {
      align-self: center;
      margin-inline-start: 0;
    }

    .shell[data-nav="collapsed"] .sidebar .user-menu,
    .shell[data-nav="collapsed"] .sidebar .sidebar__end {
      flex-direction: column;
      align-items: center;
    }
  }

  /* ------------------------------------------- the sidebar's resizable edge */
  /* Owner, 2026-11-11 (static/js/sidebar/resize.js): 200-360px in 16px steps,
     remembered in attend_nav_w; the server writes data-nav-width (248px, the
     default, writes none). The width and the rail ease over 150ms, without
     motion when less is asked for; a drag follows the pointer at once. */
  @media (min-width: 1024px) {
    .shell[data-nav-width="200"] {
      --sidebar-w: 200px;
    }

    .shell[data-nav-width="216"] {
      --sidebar-w: 216px;
    }

    .shell[data-nav-width="232"] {
      --sidebar-w: 232px;
    }

    .shell[data-nav-width="264"] {
      --sidebar-w: 264px;
    }

    .shell[data-nav-width="280"] {
      --sidebar-w: 280px;
    }

    .shell[data-nav-width="296"] {
      --sidebar-w: 296px;
    }

    .shell[data-nav-width="312"] {
      --sidebar-w: 312px;
    }

    .shell[data-nav-width="328"] {
      --sidebar-w: 328px;
    }

    .shell[data-nav-width="344"] {
      --sidebar-w: 344px;
    }

    .shell[data-nav-width="360"] {
      --sidebar-w: 360px;
    }

    /* The shell wordmark is 182px wide at 24px: in the two narrowest widths it
       would wrap and leave the tile on a line of its own, so it scales down
       to stay one lockup (151px and 167px of room). */
    .shell[data-nav-width="200"] .sidebar .wordmark {
      font-size: 19px;
    }

    .shell[data-nav-width="216"] .sidebar .wordmark {
      font-size: 21px;
    }

    /* The edge: a 16px strip centred on the sidebar's inline-end border, the
       full height of the window, with the col-resize cursor all along it
       (wider than the 12px it was: owner, 2026-11-11, "I can't resize it").
       Hovered, focused or dragged, a 2px accent line runs its full height.
       Not in the rail (collapsed) or the phone drawer. */
    .shell:not([data-nav="collapsed"]) > .sidebar-resize {
      display: block;
      position: fixed;
      inset-block: 0;
      inset-inline-start: calc(var(--sidebar-w) - 8px);
      z-index: 21;
      inline-size: 16px;
      cursor: col-resize;
      touch-action: none;
      user-select: none;
    }

    .shell[data-resizing] {
      cursor: col-resize;
      user-select: none;
    }
  }

  .sidebar-resize {
    display: none;
  }

  .sidebar-resize::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 7px;
    inline-size: 2px;
    background: transparent;
    transition: background-color 150ms ease;
  }

  @media (hover: hover) and (pointer: fine) {
    .sidebar-resize:hover::before {
      background: var(--attend-sidebar-accent);
    }
  }

  .sidebar-resize:focus-visible::before,
  .shell[data-resizing] > .sidebar-resize::before {
    background: var(--attend-sidebar-accent);
  }

  .sidebar-resize:focus-visible {
    outline-offset: -2px;
  }

  @media (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
    .shell {
      transition: grid-template-columns 150ms ease-out;
    }

    .shell > .sidebar-resize {
      transition: inset-inline-start 150ms ease-out;
    }

    .shell[data-resizing],
    .shell[data-resizing] > .sidebar-resize {
      transition: none;
    }
  }

  /* -------------------------------------------- a rail icon's name (tooltip) */
  /* static/js/sidebar/tips.js: beside the rail, its arrow pointing at the
     icon (--tip-arrow: the icon's centre from the label's top); in Arabic the
     label sits left of the rail and the arrow points right (logical sides).
     Ink in both themes, like the sidebar; never under the pointer. */
  .nav-tip {
    --tip-arrow: 50%;
    position: fixed;
    z-index: 30;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--r-xs);
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    line-height: 20px;
    white-space: nowrap;
    pointer-events: none;
  }

  .nav-tip::before {
    content: "";
    position: absolute;
    inset-inline-end: 100%;
    inset-block-start: var(--tip-arrow);
    margin-block-start: -6px;
    border-block: 6px solid transparent;
    border-inline-end: 6px solid var(--attend-sidebar-active);
  }

  /* --------------------------------------- bare, loading and offline pages */
  .bare {
    padding: var(--space-8) var(--space-5) var(--space-6);
    background: var(--attend-ground);
  }

  .bare__inner {
    max-width: 440px;
    gap: var(--space-6);
  }

  /* The privacy policy (templates/ui/privacy.html): running text at the reading
     measure; a browser without :has() keeps the column above. */
  .bare__inner:has(> .policy) {
    max-width: var(--measure);
  }

  .bare .brand {
    align-self: flex-start;
    padding: 0;
    border-radius: var(--r-sm);
    color: var(--attend-text-strong);
    text-decoration: none;
  }

  .bare .credit,
  .app-loading .credit,
  .auth .credit,
  .signin .credit {
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    line-height: var(--leading-label);
  }

  .app-loading {
    gap: var(--space-6);
    background: var(--attend-ground);
  }

  .app-loading .credit {
    margin-top: var(--space-10);
  }

  /* ------------------------------------------- sign-in: the brand panel */
  /* templates/layouts/auth.html and templates/auth/_brand_panel.html (design
     review 2026-11-09, SF3 · SF16 · AL18): the lockup "Kulliyati · كليتي", the
     tagline and, from 1024px, three value lines in the pale indigo panel. */
  .auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--attend-ground);
  }

  /* Phone: a light header (40px tile, the names at 32px, the tagline), then
     the form, so Sign in sits near the middle of the screen. */
  .auth__hero {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    margin-inline: auto;
    /* viewport-fit=cover: the Android app and an installed iPhone app draw under
       the status bar, so the header starts below it (owner 2026-11-09). */
    padding: max(var(--space-5), env(safe-area-inset-top)) max(var(--space-5), env(safe-area-inset-right)) 0 max(var(--space-5), env(safe-area-inset-left)); /* physical: the screen's own sides */
  }

  .auth__lockup {
    display: inline-flex;
    flex-wrap: wrap; /* at 200% text the names move under the tile */
    align-items: center;
    gap: var(--space-3);
    min-height: var(--touch);
    border-radius: var(--r-sm);
    color: var(--attend-text-strong);
    text-decoration: none;
  }

  /* A flex item (blockified): no display here, so the theme's logo-light /
     logo-dark switch can hide one of a pair of tiles. */
  .auth__tile {
    flex: none;
    inline-size: 40px;
    block-size: auto;
  }

  .auth__names {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.22em;
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 32px;
    font-weight: var(--weight-display);
    letter-spacing: -0.04em;
    line-height: 1.15;
    white-space: nowrap;
  }

  .auth__sep {
    color: var(--attend-text-muted);
    font-weight: var(--weight-medium);
  }

  /* The outline is 1.224em tall at the name's size (templates/auth/_name_ar.html),
     drawn at 0.86 of it (1.05em), and its tail runs 0.384em below the baseline.
     A flex row aligns a box with no text by its bottom edge (a margin does not
     move it), so the outline sits in a line of its own, lowered by the tail: that
     line's baseline, the box's in this row, is the outline's (design review fix:
     it floated 0.38em high). The line grows to hold the tail, so nothing under
     the names is overdrawn. tests/e2e/test_sign_in_layout.py measures it. */
  .auth__name-ar {
    display: inline-block; /* the reset makes an svg a block */
    inline-size: auto;
    block-size: 1.05em;
    vertical-align: -0.384em;
  }

  .auth__tagline {
    margin-top: var(--space-2);
    color: var(--attend-text);
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
  }

  .auth__values {
    display: none;
  }

  .auth__side {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    /* The credit stays above the phone's navigation bar. */
    padding: 0 max(var(--space-5), env(safe-area-inset-right)) calc(var(--space-5) + env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left)); /* physical: the screen's own sides */
  }

  .auth__main {
    width: 100%;
    max-width: 440px;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding-top: var(--space-6);
  }


  .auth__intro .page-header__sub {
    margin-top: var(--space-1);
    color: var(--attend-text-muted);
    font-size: var(--text-body);
  }

  .auth__alt {
    text-align: center;
  }

  /* A refused sign-in: the alert, and for an activation code typed as the
     password "Activate your account" under it (templates/auth/login.html). */
  .login-alert {
    display: grid;
    gap: var(--space-3);
  }

  .auth__alt a {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch);
    padding: 0 var(--space-2);
    border-radius: var(--r-pill);
    font-weight: var(--weight-bold);
    text-underline-offset: 3px;
  }

  /* Activation inside the installed app (templates/auth/_card_scan.html and
     _open_app.html): the app state and the browser state, swapped by
     static/js/auth/in-app.js. The camera view reuses the scanner's viewport. */
  .auth__state {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  .auth__state[hidden],
  .card-scan[hidden],
  .card-scan__camera[hidden] {
    display: none;
  }

  .card-scan,
  .card-scan__actions,
  .card-scan__camera {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .card-scan__title,
  .open-app__title {
    font-size: var(--text-section);
  }

  .card-scan__text {
    margin-top: var(--space-1);
    color: var(--attend-text-muted);
  }

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

  .auth__foot {
    margin-top: auto;
    padding-top: var(--space-8);
    text-align: center;
  }

  /* Show/hide password: a real button inside the field. */
  .password-field {
    position: relative;
  }

  .password-field input {
    padding-inline-end: calc(var(--touch) + var(--space-5));
  }

  .password-toggle {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: 0;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: var(--touch);
    block-size: var(--touch);
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
  }

  /* Hover only for a mouse: on a phone a tapped toggle kept the fill (design
     review AD3); a press shows it on every pointer. */
  @media (hover: hover) and (pointer: fine) {
    .password-toggle:hover {
      background: var(--attend-row-hover);
    }
  }

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

  .password-toggle__show,
  .password-toggle__hide {
    display: inline-flex;
  }

  .password-toggle[aria-pressed="true"] .password-toggle__show,
  .password-toggle:not([aria-pressed="true"]) .password-toggle__hide {
    display: none;
  }

  .password-toggle:focus-visible {
    outline-offset: 0;
  }

  /* The brand panel's rotating code (templates/auth/_brand_panel.html; owner, 2026-11-10:
     the rotating-code animation, mint allowed on this panel): from 1280 px a soft mint
     area at the panel's end holds a QR code, dark on light in every theme as the
     presenter's, which changes every 4 s (a cross-fade). Without motion the first code
     stays, still. */
  .auth__code {
    display: none;
  }

  .auth__code-frame {
    display: grid;
    inline-size: 144px;
    aspect-ratio: 1;
    border-radius: var(--r-sm);
    background: var(--attend-code-light);
  }

  .auth__code-symbol {
    grid-area: 1 / 1;
    inline-size: 100%;
    block-size: 100%;
  }

  .auth__code-symbol path {
    fill: var(--attend-code-dark);
  }

  .auth__code-symbol + .auth__code-symbol {
    visibility: hidden;
  }

  @media (min-width: 1280px) {
    .auth__code {
      display: grid;
      position: absolute;
      inset-block-end: var(--space-10);
      inset-inline-end: var(--space-10);
      padding: var(--space-6);
      border-radius: var(--r-xl);
      background: var(--attend-hero-mint);
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .auth__code-symbol + .auth__code-symbol {
      visibility: visible;
    }

    .auth__code-symbol {
      opacity: 0;
      animation: attend-auth-code 12s linear infinite;
    }

    .auth__code-symbol:nth-child(2) {
      animation-delay: 4s;
    }

    .auth__code-symbol:nth-child(3) {
      animation-delay: 8s;
    }
  }

  @keyframes attend-auth-code {
    0% {
      opacity: 0;
    }

    3%,
    33% {
      opacity: 1;
    }

    36%,
    100% {
      opacity: 0;
    }
  }

  @media (min-width: 1024px) {
    .auth {
      flex-direction: row;
      align-items: stretch;
    }

    /* The panel: the tile, the lockup and the tagline, then the value lines,
       centred in the height of the window. */
    .auth__hero {
      flex: 1 1 560px;
      justify-content: center;
      gap: var(--space-10);
      max-width: none;
      margin: var(--space-4);
      padding: var(--space-10);
      overflow: hidden;
      border: 1px solid var(--attend-hero-border);
      border-radius: var(--r-xl);
      background: var(--attend-hero);
      position: relative; /* the rotating code's corner (.auth__code) */
    }

    .auth__lockup {
      flex-direction: column;
      align-items: flex-start;
      gap: var(--space-6);
    }

    .auth__tile {
      inline-size: 160px;
    }

    .auth__names {
      font-size: 48px;
    }

    .auth__tagline {
      margin-top: var(--space-3);
      font-size: var(--text-h2);
      line-height: var(--leading-h2);
    }

    .auth__values {
      display: grid;
      gap: var(--space-4);
      max-inline-size: 30rem;
    }

    .auth__values li {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      color: var(--attend-text-strong);
      font-size: var(--text-body);
      font-weight: var(--weight-bold);
    }

    /* A raised disc on the panel (the brand tint is the panel's own colour). Its
       fill is close to the panel (about 1.05:1 in dark), so it carries the
       panel's own edge (design review fix: the discs vanished in dark). */
    .auth__value-icon {
      display: inline-flex;
      flex: none;
      align-items: center;
      justify-content: center;
      inline-size: 40px;
      block-size: 40px;
      border: 1px solid var(--attend-hero-border);
      border-radius: 50%;
      background: var(--attend-raised);
      color: var(--attend-brand-text);
    }

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

    .auth__side {
      flex: 1 1 480px;
      padding: var(--space-10) var(--space-8) var(--space-6);
    }

    .auth__main {
      max-width: 380px;
      margin-block: auto;
      padding-top: 0;
    }


    .auth__foot {
      width: 100%;
      max-width: 380px;
      margin: 0 auto;
    }
  }

  /* ---------------- sign-in: the authentication card (owner, 2026-11-11)
     templates/layouts/signin.html, auth/login.html, _card_scan.html, _open_app.html,
     otp.html; the look: docs/design/visual-design.md "Sign-in page". One centred,
     softly rounded card on the page's own soft ground, the line art behind it;
     nothing fixed but the bands behind the phone's bars, so the page scrolls
     naturally when the keyboard opens. The same layout and sizes in both themes. */
  .signin-page {
    position: relative;
    background: var(--attend-signin-ground);
  }

  /* The background (_signin_backdrop.html): one layer behind the card, as tall
     as the page, clipped at its edges. The top drawing: an indigo wash and one
     outline of the mark, fading downwards, 40 px above the column's top whatever
     the status bar (the column starts at max(40 px, the bar); its band hides the
     part under it). The foot: two swells and a thin curve rising from the bottom
     edge. Inline SVG gradients whose stops take the brand tokens; the dark themes
     draw them stronger (deep navy with low-opacity indigo and lavender lines). */
  .signin-art {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
  }

  /* Behind the app pages too (owner, 2026-11-11; _signin_backdrop.html with
     app=True): the same layer as the first child of the page's wrapper, as tall
     as the page, so it scrolls with it: the wash at the top, the swells at the
     very bottom, no outline of the mark. Each wrapper is its own stacking
     context, so the art paints over the wrapper's ground and under everything
     else in it. The presenter and the printed cards have none. */
  .shell,
  .bare,
  .auth {
    position: relative;
    isolation: isolate;
  }

  .page-art {
    z-index: -1;
  }

  .signin-bg {
    --signin-wash-strong: 0.14;
    --signin-wash-soft: 0.05;
    --signin-stroke: 0.34;
    --signin-swell: 0.08;
    --signin-curve: 0.3;
    position: absolute;
    inset-block-start: calc(max(var(--space-10), env(safe-area-inset-top)) - var(--space-10));
    inset-inline-start: 0;
    inline-size: 100%;
    block-size: 380px;
    pointer-events: none;
  }

  .signin-bg--foot {
    inset-block-start: auto;
    inset-block-end: 0;
    block-size: 220px;
  }

  :root[data-theme="dark"] .signin-bg {
    --signin-wash-strong: 0.24;
    --signin-wash-soft: 0.09;
    --signin-stroke: 0.5;
    --signin-swell: 0.14;
    --signin-curve: 0.5;
  }

  @media (prefers-color-scheme: dark) {
    :root[data-theme="system"] .signin-bg {
      --signin-wash-strong: 0.24;
      --signin-wash-soft: 0.09;
      --signin-stroke: 0.5;
      --signin-swell: 0.14;
      --signin-curve: 0.5;
    }
  }

  /* Wider screens: the drawings grow, so the mark still frames the card. */
  @media (min-width: 768px) {
    .signin-bg {
      block-size: 560px;
    }

    .signin-bg--foot {
      block-size: 280px;
    }
  }

  .signin-bg__wash {
    stop-color: var(--attend-brand);
    stop-opacity: 0;
  }

  .signin-bg__wash--strong {
    stop-opacity: var(--signin-wash-strong);
  }

  .signin-bg__wash--soft {
    stop-opacity: var(--signin-wash-soft);
  }

  .signin-bg__fade {
    stop-color: var(--attend-accent);
    stop-opacity: 0;
  }

  .signin-bg__fade--top {
    stop-opacity: var(--signin-stroke);
  }

  .signin-bg__swell {
    stop-color: var(--attend-brand);
    stop-opacity: 0;
  }

  .signin-bg__swell--deep {
    stop-opacity: var(--signin-swell);
  }

  .signin-bg__curve {
    stroke: var(--attend-accent);
    stroke-opacity: var(--signin-curve);
  }

  /* Solid bands in the page colour behind the status bar and the navigation
     bar (viewport-fit=cover): content scrolls under them, never over. */
  .safe-band {
    position: fixed;
    inset-inline: 0;
    z-index: 2;
    background: var(--attend-signin-ground);
    pointer-events: none;
  }

  .safe-band--top {
    inset-block-start: 0;
    block-size: env(safe-area-inset-top);
  }

  .safe-band--bottom {
    inset-block-end: 0;
    block-size: env(safe-area-inset-bottom);
  }

  /* The column: the language chip's slot, then the card, centred in the height
     while the screen has room; 20 px at the sides on a phone (more on a wider
     phone, and where the phone has rounded corners). */
  .signin {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-block-size: 100vh;
    min-block-size: 100dvh;
    padding-block-start: max(var(--space-10), env(safe-area-inset-top));
    padding-block-end: calc(var(--space-8) + env(safe-area-inset-bottom));
    /* The phone's insets are physical; 20 px at least on each side. */
    padding-left: max(var(--space-5), env(safe-area-inset-left)); /* physical: the screen's own sides */
    padding-right: max(var(--space-5), env(safe-area-inset-right)); /* physical: the screen's own sides */
  }

  @media (min-width: 380px) {
    .signin {
      padding-left: max(var(--space-6), env(safe-area-inset-left)); /* physical: the screen's own sides */
      padding-right: max(var(--space-6), env(safe-area-inset-right)); /* physical: the screen's own sides */
    }
  }

  /* The language chip's place (inline end), outside the card; empty while the
     choice is off. */
  .signin__top {
    display: flex;
    justify-content: flex-end;
    inline-size: min(100%, max(296px, 76vw));
    max-inline-size: 430px;
    min-block-size: var(--touch);
    margin-inline: auto;
  }

  .signin__lang {
    margin: 0;
  }

  /* A pill: the other language's name in its own script (components/
     language_switch.html). The soft fill reads as a control on the backdrop. */
  .signin__lang-button {
    min-block-size: var(--touch);
    padding-inline: var(--space-4);
    border-radius: var(--r-pill);
    font-size: var(--text-small);
  }

  /* The card: a faintly lavender white with a soft, wide indigo-tinted shadow in
     light; a slightly lighter navy surface and a nearly invisible edge in dark (no
     shadows there). On a phone it is about three quarters of the screen (76 %, at
     least 296 px, never wider than the column), as in the references: about 47 px
     of page on each side at 390 px; at most 430 px on wider screens. */
  .signin__card {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    inline-size: min(100%, max(296px, 76vw));
    max-inline-size: 430px;
    margin: auto;
    padding: var(--space-6) var(--space-4);
    border: 1px solid var(--attend-signin-card-edge);
    border-radius: var(--r-xl);
    background: var(--attend-signin-card);
    box-shadow: var(--attend-shadow-signin);
    color: var(--attend-text-strong);
  }

  @media (min-width: 360px) {
    .signin__card {
      padding-inline: calc(var(--space-6) + var(--space-1)); /* 28 px */
    }
  }

  @media (min-width: 480px) {
    .signin__card {
      padding-inline: var(--space-8);
    }
  }

  .signin__brand {
    display: flex;
    justify-content: center;
  }

  /* The lockup at 24 px under a 52 px tile, as in the references. */
  .signin__title {
    margin: 0;
    font-size: 24px;
    line-height: 1;
  }

  .signin__title .wordmark {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: var(--space-3);
    font-size: 24px;
    letter-spacing: -0.02em;
    color: var(--attend-text-strong);
  }

  .signin__title .wordmark__tile {
    inline-size: 52px;
    block-size: 52px;
  }

  .signin__main {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  /* The credit: small, quiet, centred at the card's foot, apart from the form. */
  .signin__foot {
    margin-block-start: auto;
    padding-block-start: var(--space-2);
    text-align: center;
  }

  .signin__card .credit {
    color: var(--attend-text-muted);
  }

  /* The card's own text: headings and lines in the card's ink. */
  .signin__card h1,
  .signin__card h2 {
    color: var(--attend-text-strong);
  }

  /* Tabs: a segmented control. A soft filled track; the selected tab is one
     indigo mark that slides under it (the tablist's data-selected, set by the
     server and by signin-tabs.js). It moves along inset-inline-start, so it
     runs the other way in a right-to-left page; it moves only without
     prefers-reduced-motion. */
  .signin-tabs {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: var(--space-1);
    border-radius: var(--r-md);
    background: var(--attend-signin-track);
    border: 1px solid var(--attend-signin-card-edge);
  }

  .signin-tab {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch);
    padding: var(--space-1);
    border-radius: var(--r-sm);
    color: var(--attend-text-muted);
    font-size: 13px; /* the references' quieter tab names; 14 px crowded the track */
    font-weight: var(--weight-bold);
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
  }

  /* Below 360 px the two names stay on one line each in the narrower track. */
  @media (max-width: 359px) {
    .signin-tab {
      padding-inline: 0;
      font-size: var(--text-label);
    }
  }

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

    .signin-tab[aria-selected="true"]:hover {
      color: var(--attend-on-brand);
    }
  }

  .signin-tab[aria-selected="true"] {
    color: var(--attend-on-brand);
  }

  .signin-tab:focus-visible {
    outline-offset: 2px;
  }

  .signin-tabs__ink {
    position: absolute;
    inset-block: var(--space-1);
    inset-inline-start: var(--space-1);
    inline-size: calc(50% - var(--space-1));
    border-radius: var(--r-sm);
    background: var(--attend-brand);
    pointer-events: none;
  }

  .signin-tabs[data-selected="activate"] .signin-tabs__ink {
    inset-inline-start: 50%;
  }

  @media (prefers-reduced-motion: no-preference) {
    /* A soft settle, with no visible overshoot. */
    .signin-tabs__ink {
      transition: inset-inline-start 250ms cubic-bezier(0.2, 0.9, 0.3, 1);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    /* Not even the reset's 0.01ms (app.css): the mark is at its tab at once. */
    .signin-tabs__ink {
      transition: none;
    }
  }

  /* Forced colours paint backgrounds over: the selected tab's own edge instead. */
  @media (forced-colors: active) {
    .signin-tabs__ink {
      display: none;
    }

    .signin-tab[aria-selected="true"] {
      outline: 2px solid CanvasText;
    }
  }

  .signin-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .signin .btn {
    border-radius: var(--r-sm);
  }

  .signin .btn--primary {
    min-height: 48px;
  }

  /* The live button (sign-in addition 4): Sign in, then a spinner and "Signing
     in…", then a tick and "Signed in" (signin-submit.js), each part fading in.
     Under prefers-reduced-motion only the words change: no spinner, no fade. */
  /* On its way, the button is not unavailable-looking: it is working. */
  .live-button[aria-disabled="true"] {
    opacity: 1;
    cursor: progress;
  }

  .live-button__part {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
  }

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

  .live-button__spinner {
    inline-size: 18px;
    block-size: 18px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
  }

  @media (prefers-reduced-motion: no-preference) {
    .live-button__spinner {
      animation: attend-spin 0.8s linear infinite;
    }

    .live-button[data-state] .live-button__part {
      animation: attend-signin-fade 150ms ease-out;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .live-button__spinner {
      display: none;
    }
  }

  @keyframes attend-signin-fade {
    from {
      opacity: 0;
    }
  }

  /* Fields in the card: label above, a soft fill with no visible edge at rest,
     48 px (the primary button's height), 12 px corners, 16 px text; focused, the
     indigo edge and ring; with an error, the danger edge. Every field in the
     card (Sign in, activation, the two-step code) shares it. Low specificity, so
     a field's own rule (the code field's monospace) still applies. */
  .signin-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  /* The label close above its field, as in the references. */
  .signin__card .field {
    gap: var(--space-1);
  }

  .signin__card .field__label {
    color: var(--attend-text-strong);
  }

  .signin__card :where(.field input:not([type="checkbox"], [type="radio"])) {
    block-size: 48px;
    min-height: 48px;
    padding-block: 0;
    padding-inline: var(--space-4);
    border-color: transparent;
    background-color: var(--attend-signin-field);
    color: var(--attend-text-strong);
    font-size: var(--text-input-mobile);
    line-height: normal;
  }

  /* The hint is smaller than the typed text (which stays 16 px, so iOS does not
     zoom in on focus), so it fits the narrower fields beside the icon and the eye. */
  .signin__card :where(.field input)::placeholder {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  @media (hover: hover) and (pointer: fine) {
    .signin__card :where(.field input:not([type="checkbox"], [type="radio"])):hover {
      border-color: var(--attend-signin-card-edge);
    }
  }

  .signin__card :where(.field input[aria-invalid="true"]) {
    border-color: var(--attend-danger-text);
  }

  /* A clear, restrained indigo ring: the accent at 28 % (dark 32 %) on the card,
     as its own token; the indigo edge stays 3:1 against it. */
  .signin__card :where(.field input:not([type="checkbox"], [type="radio"])):focus-visible {
    border-color: var(--attend-focus);
    background-color: var(--attend-signin-field);
    outline: 3px solid var(--attend-signin-ring);
    outline-offset: 0;
  }

  /* One icon inside a field, at the inline start (user, lock): 20 px, the
     card's muted ink, centred in the height. The text keeps 48 px clear on the
     icon's side, and on the eye's side in a password field, in either page
     direction. */
  .icon-field {
    position: relative;
  }

  .icon-field__icon {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: var(--space-4);
    display: inline-flex;
    color: var(--attend-text-muted);
    transform: translateY(-50%);
    pointer-events: none;
  }

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

  .signin__card .icon-field input:not([type="checkbox"], [type="radio"]) {
    padding-inline: calc(var(--space-8) + var(--space-4)) var(--space-4);
  }

  .signin__card .password-field.icon-field input:not([type="checkbox"], [type="radio"]) {
    padding-inline-end: calc(var(--space-8) + var(--space-4));
  }

  /* IDs and passwords are typed left to right in every page (dir="ltr" on the
     input), so in an Arabic page, where the icon sits on the right and the eye
     on the left, the input's own start and end are the wrong sides. */
  :root[dir="rtl"] .signin__card .icon-field input:not([type="checkbox"], [type="radio"]) {
    padding-right: calc(var(--space-8) + var(--space-4)); /* physical: the icon's side in rtl */
    padding-left: var(--space-4); /* physical: the far side in rtl */
  }

  :root[dir="rtl"] .signin__card .password-field.icon-field input:not([type="checkbox"], [type="radio"]) {
    padding-left: calc(var(--space-8) + var(--space-4)); /* physical: the eye's side in rtl */
  }

  /* An Arabic page: the hint reads right to left beside the icon until the
     left-to-right ID or password is typed. */
  :root[dir="rtl"] .icon-field input:placeholder-shown {
    direction: rtl;
  }

  /* The welcome-back card (owner, 2026-11-10, sign-in addition 1): on an approved
     phone, in place of the University ID field. The photo (or the initial on a
     tint) at the inline start, "Welcome back" over the first name, "Not you?" at
     the inline end; it rises in once, only with motion allowed. In the card it is
     filled like the fields, with no edge. */
  .welcome-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-block-size: 72px;
    padding-block: var(--space-3);
    padding-inline: var(--space-4) var(--space-2);
    border-radius: var(--r-sm);
    background: var(--attend-signin-field);
  }

  .welcome-card__face {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 48px;
    block-size: 48px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-h2);
    font-weight: var(--weight-bold);
  }

  .welcome-card__photo {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
  }

  .welcome-card__words {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
  }

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

  .welcome-card__name {
    color: var(--attend-text-strong);
    font-size: var(--text-h2);
    font-weight: var(--weight-bold);
    overflow-wrap: anywhere;
  }

  .welcome-card__other {
    flex: none;
    min-block-size: var(--touch);
    min-inline-size: var(--touch);
    padding-inline: var(--space-2);
    border: 0;
    background: transparent;
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
  }

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

  @media (prefers-reduced-motion: no-preference) {
    .welcome-card:not([hidden]) {
      animation: attend-welcome-in 200ms ease-out;
    }
  }

  @keyframes attend-welcome-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }

  /* "Forgot password?" right under the password, at the inline end: a disclosure
     (owner, 2026-11-11) whose one note opens under it, full width. */
  .signin-password {
    display: flex;
    flex-direction: column;
  }

  .signin-forgot {
    display: flex;
    flex-direction: column;
  }

  .signin-forgot > .signin-forgot__toggle {
    display: inline-flex;
    align-self: flex-end;
    align-items: center;
    min-height: var(--touch);
    padding-inline: var(--space-1);
    border-radius: var(--r-xs);
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    cursor: pointer;
    list-style: none;
  }

  .signin-forgot > .signin-forgot__toggle::-webkit-details-marker {
    display: none;
  }

  /* No disclosure chevron (app.css draws one on every summary): it reads as a link. */
  .signin-forgot > .signin-forgot__toggle::after {
    content: none;
  }

  @media (hover: hover) and (pointer: fine) {
    .signin-forgot > .signin-forgot__toggle:hover {
      text-decoration: underline;
    }
  }

  .signin-forgot__note {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-sm);
    background: var(--attend-signin-track);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
  }

  .signin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--touch);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    text-align: center;
  }

  /* Activate account: the compact icon, the heading and its line. */
  .card-scan--signin,
  .activate-browser {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .activate-intro {
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  .activate-intro__icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 48px;
    block-size: 48px;
    border-radius: var(--r-md);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .activate-intro__icon svg {
    inline-size: 24px;
    block-size: 24px;
  }

  .activate-intro__words {
    min-inline-size: 0;
  }

  .activate-intro__text {
    margin-block-start: var(--space-1);
    color: var(--attend-text-muted);
  }

  /* The quieter pair under the primary: a soft fill and no border (owner,
     2026-11-10), side by side, stacking on a narrow screen. */
  .btn--soft {
    border-color: transparent;
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  @media (hover: hover) and (pointer: fine) {
    .btn--soft:hover {
      border-color: transparent;
      background: var(--attend-brand-tint);
      color: var(--attend-link-hover);
    }
  }

  .soft-pair {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  /* The canvas's quieter labels (15 px there): the small size keeps "Enter code
     manually" on one line beside its partner on a 390 px phone. */
  .soft-pair > .btn {
    flex: 1 1 140px;
    min-height: 48px;
    padding-inline: var(--space-3);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
  }

  .signin-help {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .signin-help ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-inline-start: var(--space-5);
  }

  /* The other pages in the card (/activate/, the two-step code): their muted
     lines in the card's muted ink; "Have your card?" without a box of its own
     (no card inside the card); the phone choices filled like the fields
     instead of outlined surfaces. */
  .signin__card .page-header__sub,
  .signin__card .card-scan__text,
  .signin__card .install__lead,
  .signin__card .install__note,
  .signin__card .install__file,
  .signin__card .install-choice__hint {
    color: var(--attend-text-muted);
  }

  .signin__card .card-scan.panel {
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .signin__card .install-choice {
    border-color: transparent;
    background: var(--attend-signin-field);
    color: var(--attend-text-strong);
  }

  .signin__card .install-choice.is-detected {
    border-color: var(--attend-brand);
  }

  @media (hover: hover) and (pointer: fine) {
    .signin__card .install-choice:hover {
      background: var(--attend-signin-track);
    }
  }

  /* /activate/ in a browser tab: install the app first (owner, 2026-11-10; the
     sign-in canvas, row "/activate/ in a browser"; templates/auth/_open_app.html).
     The phone choice, then one phone's steps (static/js/auth/install-choice.js
     shows one part at a time; without it all show, in order). */
  .install,
  .install__part {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .install__part[hidden] {
    display: none;
  }

  /* A target of programmatic focus only (tabindex="-1", install-choice.js). */
  .install__part:focus {
    outline: none;
  }

  .install__intro {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }

  .install__title {
    font-family: var(--font-display);
    font-size: var(--text-h2);
    font-weight: var(--weight-h2);
  }

  .install__lead,
  .install__note,
  .install__file {
    color: var(--attend-text-muted);
  }

  .install__ask {
    margin-block-start: var(--space-2);
    font-weight: var(--weight-bold);
    text-align: center;
  }

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

  .install-choice {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: 76px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--attend-edge);
    border-radius: var(--r-md);
    background: var(--attend-surface);
    color: var(--attend-text);
    text-decoration: none;
  }

  /* The phone the request names: the accent edge, 2 px, its padding 1 px less
     so the row does not move. */
  .install-choice.is-detected {
    padding: calc(var(--space-3) - 1px) calc(var(--space-4) - 1px);
    border: 2px solid var(--attend-brand);
  }

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

  .install-choice__icon,
  .install-steps__n {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .install-choice__icon {
    inline-size: 48px;
    block-size: 48px;
    border-radius: var(--r-md);
  }

  .install-choice__icon svg {
    inline-size: 26px;
    block-size: 26px;
  }

  .install-choice__words {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-05);
    min-inline-size: 0;
  }

  .install-choice__name {
    font-size: var(--text-section);
    font-weight: var(--weight-bold);
  }

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

  /* Under the phone's name (owner, 2026-11-11: the row is too narrow beside it). */
  .install-choice__mark {
    align-self: flex-start;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--r-pill);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-meta);
    font-weight: var(--weight-bold);
  }

  .install-choice__go {
    flex: none;
    color: var(--attend-text-muted);
  }

  .install__note,
  .install__file,
  .install__staff {
    font-size: var(--text-small);
    text-align: center;
  }

  .install__back {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--touch);
    font-weight: var(--weight-bold);
    text-decoration: none;
  }

  .install__warn {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-md);
    background: var(--attend-warning-bg);
    color: var(--attend-warning-text);
    font-size: var(--text-small);
  }

  .install__safari {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .install-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .install-steps li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .install-steps li > span:last-child {
    padding-block-start: var(--space-05);
  }

  .install-steps__n {
    inline-size: 28px;
    block-size: 28px;
    border-radius: 50%;
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
  }

  /* Safari's own button, drawn where the step names it. */
  .install-steps__key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 26px;
    block-size: 26px;
    margin-inline-start: var(--space-1);
    border-radius: var(--r-sm);
    background: var(--attend-surface-subtle);
    color: var(--attend-brand-text);
    vertical-align: -6px;
  }

  .install-steps__key svg {
    inline-size: 16px;
    block-size: 16px;
  }

  .install-more > summary {
    list-style: none;
    cursor: pointer;
  }

  .install-more > summary::-webkit-details-marker {
    display: none;
  }

  .install-more[open] > summary {
    margin-block-end: var(--space-4);
  }

  /* The activation code (owner, 2026-11-10, sign-in addition 3;
     templates/auth/_code_field.html): one input, read left to right in monospace
     with a little air between the symbols, and its count under it ("20 of 20"
     and a tick once complete; the warning colour for a character no code has). */
  .code-field input {
    font-family: var(--font-mono);
    font-size: var(--text-num-m);
    letter-spacing: 0.06em;
  }

  /* A 320 px phone: the whole printed code still fits in the field. */
  @media (max-width: 359px) {
    .code-field input {
      font-size: var(--text-input-mobile);
      letter-spacing: 0.02em;
    }
  }

  /* In the authentication card (owner, 2026-11-11) the fields are narrower: the
     16 px monospace keeps the whole printed code in view on a phone (278 px at
     390, 248 px at 320); a wider card keeps the larger figures. */
  .signin__card .code-field input {
    padding-inline: var(--space-3);
    font-size: var(--text-input-mobile);
    letter-spacing: 0.02em;
  }

  @media (max-width: 359px) {
    .signin__card .code-field input {
      letter-spacing: 0;
    }
  }

  @media (min-width: 480px) {
    .signin__card .code-field input {
      padding-inline: var(--space-4);
      font-size: var(--text-num-m);
      letter-spacing: 0.06em;
    }
  }

  .code-field__count {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--attend-text-muted);
    font-variant-numeric: tabular-nums;
  }

  .code-field__count[data-state="complete"] {
    color: var(--attend-positive-text);
    font-weight: var(--weight-bold);
  }

  .code-field__count[data-state="odd"],
  .code-field__count[data-state="over"] {
    color: var(--attend-warning-text);
    font-weight: var(--weight-bold);
  }

  .code-field__tick {
    display: inline-flex;
  }

  .code-field__tick .icon {
    inline-size: 16px;
    block-size: 16px;
  }

  /* --------------------------------------------- the scanner screen (Scan.dc)
     templates/auth/_card_scanner.html: a full-screen modal dialog, ink in both
     themes; the camera picture in a square frame with the corner marks and a
     still accent line, "Camera not working?" in a sheet at the bottom. */
  .card-scanner {
    position: fixed;
    inset: 0;
    z-index: 10;
    flex-direction: column;
    inline-size: 100%;
    block-size: 100%;
    max-inline-size: none;
    max-block-size: none;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); /* physical: the screen's own sides */
    overflow-y: auto;
    border: 0;
    background: var(--attend-sidebar);
    color: var(--attend-sidebar-text);
  }

  .card-scanner[open] {
    display: flex;
  }

  .card-scanner::backdrop {
    background: var(--attend-sidebar);
  }

  .card-scanner :focus-visible {
    outline-color: var(--attend-sidebar-accent);
  }

  .card-scanner .btn {
    border-radius: var(--r-sm);
  }

  .card-scanner__bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3) 0;
  }

  .card-scanner__close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: var(--touch);
    block-size: var(--touch);
    border: 0;
    border-radius: 50%;
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
  }

  /* Two classes: the screen opens inside the sign-in card, whose ".signin__card h2"
     (a class and an element) would otherwise give the title the card's dark text. */
  .card-scanner .card-scanner__title {
    flex: 1;
    margin-inline-end: calc(var(--touch) + var(--space-2));
    font-family: var(--font-body);
    font-size: var(--text-button);
    font-weight: var(--weight-bold);
    color: var(--attend-sidebar-strong);
    text-align: center;
  }

  .card-scanner__live {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
  }

  .card-scanner__stage {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-5);
    padding: var(--space-6);
    text-align: center;
  }

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

  .card-scanner__heading {
    font-family: var(--font-display);
    font-size: var(--text-h2);
    color: var(--attend-sidebar-strong);
  }

  .card-scanner__hint {
    color: var(--attend-sidebar-text);
  }

  .card-scanner__viewport {
    position: relative;
    inline-size: min(250px, 70vw);
    aspect-ratio: 1;
  }

  .card-scanner__video {
    position: absolute;
    inset: var(--space-4);
    inline-size: calc(100% - 2 * var(--space-4));
    block-size: calc(100% - 2 * var(--space-4));
    object-fit: cover;
    border-radius: var(--r-sm);
    background: var(--attend-sidebar-hover);
  }

  .card-scanner__frame {
    position: absolute;
    inset: 0;
  }

  .card-scanner__corner {
    position: absolute;
    inline-size: 46px;
    block-size: 46px;
    border: 0 solid var(--attend-sidebar-strong);
  }

  .card-scanner__corner--ss {
    inset-block-start: 0;
    inset-inline-start: 0;
    border-block-start-width: 5px;
    border-inline-start-width: 5px;
    border-start-start-radius: var(--r-md);
  }

  .card-scanner__corner--se {
    inset-block-start: 0;
    inset-inline-end: 0;
    border-block-start-width: 5px;
    border-inline-end-width: 5px;
    border-start-end-radius: var(--r-md);
  }

  .card-scanner__corner--es {
    inset-block-end: 0;
    inset-inline-start: 0;
    border-block-end-width: 5px;
    border-inline-start-width: 5px;
    border-end-start-radius: var(--r-md);
  }

  .card-scanner__corner--ee {
    inset-block-end: 0;
    inset-inline-end: 0;
    border-block-end-width: 5px;
    border-inline-end-width: 5px;
    border-end-end-radius: var(--r-md);
  }

  .card-scanner__line {
    position: absolute;
    inset-inline: 18px;
    inset-block-start: 50%;
    block-size: 3px;
    border-radius: var(--r-pill);
    background: var(--attend-sidebar-accent);
  }

  /* The guiding scanner (owner, 2026-11-10, sign-in addition 2; owner 2026-11-11:
     the corner brackets are the frame): the viewport's four brackets and the scan
     line alone frame the QR, with nothing drawn inside them. The card comes 8, 4
     or 1 per sheet, its QR placed and sized differently, so the frame draws no
     card: it is a hint only, any QR in view is read. The viewport is dir="ltr", so
     neither the picture nor the brackets ever mirror. data-state on the brackets:
     looking (a gentle pulse, with motion allowed), found (mint: "Card read") or
     refused (its own colour while a refusal shows). */
  .card-scanner[data-state="found"] .card-scanner__corner {
    border-color: var(--attend-sidebar-found);
  }

  .card-scanner[data-state="refused"] .card-scanner__corner {
    border-color: var(--attend-sidebar-refused);
  }

  .card-scanner__found {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--r-pill);
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-found);
    font-weight: var(--weight-bold);
  }

  @media (prefers-reduced-motion: no-preference) {
    .card-scanner[data-state="looking"] .card-scanner__corner {
      animation: attend-scan-look 1.4s ease-in-out infinite alternate;
    }

    .card-scanner__corner {
      transition: border-color 200ms ease-out;
    }
  }

  @keyframes attend-scan-look {
    to {
      opacity: 0.45;
    }
  }

  .card-scanner__error {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    max-inline-size: 360px;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-sm);
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
    font-size: var(--text-small);
    text-align: start;
  }

  .card-scanner__sheet {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom));
    border-start-start-radius: var(--r-lg);
    border-start-end-radius: var(--r-lg);
    background: var(--attend-sidebar-hover);
  }

  .card-scanner__sheet-title {
    color: var(--attend-sidebar-text);
    font-size: var(--text-small);
    text-align: center;
  }

  .btn--ink {
    border-color: transparent;
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
  }

  @media (hover: hover) and (pointer: fine) {
    .btn--ink:hover {
      border-color: var(--attend-sidebar-muted);
      background: var(--attend-sidebar-active);
      color: var(--attend-sidebar-strong);
    }
  }

  .btn--ink-strong {
    min-height: 54px;
    border-color: transparent;
    background: var(--attend-sidebar-accent);
    color: var(--attend-sidebar-on-accent);
  }

  @media (hover: hover) and (pointer: fine) {
    .btn--ink-strong:hover {
      border-color: transparent;
      background: var(--attend-sidebar-accent);
      color: var(--attend-sidebar-on-accent);
    }
  }

  /* Camera denied: what to do instead, and how to allow it again. */
  .card-scanner__denied {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-6) calc(var(--space-6) + env(safe-area-inset-bottom));
  }

  .card-scanner__denied-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 56px;
    block-size: 56px;
    border-radius: var(--r-md);
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
  }

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

  .card-scanner__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-block-start: var(--space-2);
  }

  .card-scanner__howto {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-block-start: var(--space-2);
    padding: var(--space-4);
    border-radius: var(--r-md);
    background: var(--attend-sidebar-hover);
  }

  .card-scanner__howto-title {
    color: var(--attend-sidebar-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
  }

  .card-scanner__steps {
    padding-inline-start: var(--space-5);
    color: var(--attend-sidebar-text);
    font-size: var(--text-small);
    list-style: decimal;
  }

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

  .card-scanner__howto .btn {
    align-self: flex-start;
  }

  /* The search palette (owner, 2026-11-11; templates/ui/_palette.html,
     static/js/palette/): a dialog near the top of the window, wider than the
     shared 480px, the field with its search icon, then the results in groups
     (Pages, Actions, People), the active one tinted and marked at its start.
     Opened from 768px only (no phone sheet); motion, backdrop and reduced
     motion are the shared dialog's. */
  .palette {
    width: min(640px, calc(100vw - 2 * var(--space-4)));
    max-height: min(560px, calc(100dvh - 24vh));
    margin-block: 12vh auto;
  }

  .palette[open] {
    display: flex;
    flex-direction: column;
  }

  .palette__field {
    position: relative;
    flex: none;
    padding: var(--space-3);
    border-block-end: 1px solid var(--attend-border);
  }

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

  .palette .palette__input {
    padding-inline: 44px 64px;
    font-size: var(--text-body);
  }

  .palette__esc {
    position: absolute;
    inset-inline-end: calc(var(--space-3) + var(--space-3));
    inset-block-start: 50%;
    translate: 0 -50%;
  }

  /* The x (templates/ui/_search_clear.html) takes the Esc hint's place once
     something is typed; Escape still closes. */
  .palette__field > .search-field__clear {
    inset-inline-end: calc(var(--space-3) + var(--space-1));
  }

  .palette__input:not(:placeholder-shown) ~ .palette__esc {
    display: none;
  }

  .palette__esc,
  .palette__keys {
    padding-inline: var(--space-2);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-xs);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    line-height: 1.6;
    white-space: nowrap;
  }

  .palette__list {
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--space-2);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .palette__list:empty,
  .palette__status:empty {
    display: none;
  }

  .palette__group + .palette__group {
    margin-block-start: var(--space-2);
  }

  .palette__group-title {
    padding: var(--space-2) var(--space-3) var(--space-1);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: 600;
  }

  .palette__option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 44px;
    padding-block: var(--space-2);
    padding-inline: var(--space-3);
    border-inline-start: 3px solid transparent;
    border-radius: var(--r-xs);
    color: var(--attend-text);
    cursor: pointer;
  }

  @media (pointer: fine) {
    .palette__option {
      min-height: 40px;
    }
  }

  .palette__option[aria-selected="true"] {
    border-inline-start-color: var(--attend-focus);
    background: var(--attend-row-selected);
    color: var(--attend-text-strong);
  }

  .palette__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .palette__context {
    flex: 0 1 auto;
    max-inline-size: 45%;
    overflow: hidden;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .palette__status {
    flex: none;
    padding: var(--space-2) var(--space-4) var(--space-3);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  /* Forced colours drop the tint: the active result keeps a visible edge. */
  @media (forced-colors: active) {
    .palette__option[aria-selected="true"] {
      outline: 2px solid Highlight;
    }
  }

  /* A key as printed on the keyboard: the header search's hint and the "?"
     dialog's keys (owner, 2026-11-11). Latin key names, isolated with
     dir="ltr" in the markup. */
  .keycap {
    display: inline-block;
    min-inline-size: 2.25em;
    padding-inline: var(--space-2);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-xs);
    background: var(--attend-ground);
    color: var(--attend-text);
    font-size: var(--text-label);
    line-height: 1.8;
    text-align: center;
    white-space: nowrap;
  }

  /* The search field at the top of the staff home pages
     (components/header_search.html): a button drawn as the search pill (the
     field's fill, a leading icon, an edge under a mouse, the field's focus
     halo) that opens the search palette. It sits at the header's end, before
     Refresh: it starts at 240px, so it shares the title's line with Refresh
     from 768px, then grows to 400px where there is room (min-inline-size 0:
     else its label's whole text would be its least width, and it wraps). */
  .page-header > .header-search {
    flex: 1 1 240px;
    min-inline-size: 0;
    max-inline-size: 400px;
    margin-inline-start: auto;
  }

  .header-search {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 48px;
    padding-block: var(--space-1);
    padding-inline: var(--space-4) var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    background-color: var(--attend-field);
    color: var(--attend-text-muted);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition:
      border-color 120ms ease,
      background-color 120ms ease;
  }

  .header-search > .icon {
    flex: none;
    inline-size: 18px;
    block-size: 18px;
  }

  .header-search__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-search__keys {
    flex: none;
  }

  @media (hover: hover) and (pointer: fine) {
    .header-search:hover {
      border-color: var(--attend-field-edge-hover);
    }
  }

  .header-search:focus-visible {
    border-color: var(--attend-focus);
    outline: 3px solid var(--attend-field-halo);
    outline-offset: 0;
  }

  /* Compact for a mouse, as the fields are. */
  @media (min-width: 768px) and (pointer: fine) {
    .header-search {
      min-height: 40px;
    }
  }

  /* No search palette on phones (below 768px). */
  @media (max-width: 767px) {
    .header-search {
      display: none;
    }
  }

  /* The "?" dialog (templates/ui/_shortcuts_help.html): each shortcut's name,
     its key at the line's end, a hairline between rows, then the link to
     Account. */
  .shortcut-list {
    margin: 0;
  }

  .shortcut-list__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 44px;
    padding-block: var(--space-2);
  }

  .shortcut-list__row + .shortcut-list__row {
    border-block-start: 1px solid var(--attend-border);
  }

  .shortcut-list dd {
    flex: none;
    margin: 0;
  }

  .shortcuts-help__more {
    margin-block-start: var(--space-4);
    font-size: var(--text-small);
  }
}
