/*
 * Kulliyati -- the student screens in the Indigo design (docs/design/visual-design.md;
 * boards Main, A-student-desktop, A-checkin-scan, A-checkin-receipt, colours A3):
 * Today, the attendance page, the scanner and its receipt.
 *
 * Linked after components.css (templates/base.html) and added to
 * `@layer components`, so it overrides the shared rules at equal specificity
 * while app.css's reset ([hidden], reduced motion) and utilities still win.
 * Colours are var(--attend-*) tokens only; shadows only the light theme's
 * elevation tokens (none in dark); no gradients, blur or filters
 * (tests/test_css_rules.py). Decoration -- the hero's two faint blobs (light
 * theme only), the scan sweep, the receipt's pop and confetti -- never sits in
 * tables or near status chips, and moves only without prefers-reduced-motion.
 */
@layer components {
  /* ------------------------------------------------------------ Today */
  .student-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  @media (min-width: 1024px) {
    .student-grid {
      grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
      gap: var(--space-4);
      align-items: start;
    }
  }

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

  .student-day {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  .student-now .section-label,
  .student-day .section-label,
  .student-recent .section-label {
    margin: 0 0 var(--space-3);
  }

  /* The current-class hero: a soft tinted card, dark text, no glow. */
  .course-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    padding: var(--space-6);
    border: 1px solid var(--attend-hero-border);
    border-radius: var(--r-xl);
    background: var(--attend-hero);
    color: var(--attend-text-strong);
  }

  .course-card > :not(.course-card__blob) {
    position: relative;
  }

  /* Two faint circles clipped by the card's top-right corner, clear of the text lines. */
  .course-card__blob {
    position: absolute;
    z-index: -1;
    top: -96px;
    inset-inline-end: -92px;
    inline-size: 180px;
    block-size: 180px;
    border-radius: 50%;
    background: var(--attend-brand);
    opacity: 0.06;
    pointer-events: none;
  }

  .course-card__blob--small {
    top: -30px;
    inset-inline-end: -46px;
    inline-size: 96px;
    block-size: 96px;
    opacity: 0.05;
  }

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

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

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

  .course-card__eyebrow {
    display: none;
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    line-height: var(--leading-label);
  }

  /* "Check-in open": a pill on the hero with the live dot (the motif). */
  .course-card__live {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 32px;
    padding-block: 0;
    padding-inline: var(--space-3) 14px;
    border-radius: var(--r-pill);
    /* Raised: white on the light hero, a step above it in dark (14.27:1). */
    background: var(--attend-raised);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
    line-height: var(--leading-small);
  }

  .course-card__live::before {
    content: "";
    flex-shrink: 0;
    inline-size: 8px;
    block-size: 8px;
    border-radius: 50%;
    background: var(--attend-accent);
    outline: 3px solid var(--attend-brand-tint);
  }

  .course-card__state {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    min-height: 32px;
    color: var(--attend-text);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .course-card__code {
    margin-top: var(--space-5);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    letter-spacing: 0;
    line-height: var(--leading-small);
    text-transform: none;
  }

  .course-card__title {
    margin: var(--space-1) 0 0;
    color: var(--attend-text-strong);
    font-family: var(--font-display);
    font-size: var(--text-display);
    font-weight: var(--weight-display);
    letter-spacing: var(--tracking-display);
    line-height: var(--leading-display);
    overflow-wrap: anywhere;
  }

  .course-card__facts {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-top: var(--space-3);
  }

  .course-card__meta,
  .course-card__teacher {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    color: var(--attend-text);
    font-size: var(--text-body);
    line-height: var(--leading-body);
  }

  .course-card__meta span + span {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .course-card__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-6);
  }

  .course-card__actions .btn {
    min-height: 56px;
  }

  /* A secondary button ("View receipt") on the tinted hero: a surface pill,
     since the brand tint would vanish into the hero's own tint. */
  .course-card__actions .btn:not(.btn--primary) {
    background: var(--attend-surface);
  }

  .course-card__hint {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    line-height: var(--leading-small);
    text-align: center;
  }

  @media (min-width: 1024px) {
    .course-card {
      min-height: 100%;
      padding: var(--space-8);
    }

    .course-card__eyebrow {
      display: block;
    }

    .course-card__facts {
      flex-direction: row;
      flex-wrap: wrap;
      gap: var(--space-2) var(--space-6);
    }

    .course-card__actions {
      flex-direction: row;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--space-3) var(--space-5);
      margin-top: auto;
      padding-top: var(--space-8);
    }

    .course-card__actions .btn--block {
      width: auto;
      padding-inline: var(--space-8);
    }

    .course-card__hint {
      max-width: 300px;
      text-align: start;
    }
  }

  /* "Later today" / "Earlier today": rows with time tiles, inside a card. */
  .day-list,
  .recent-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

  /* The time tile's width (owner's phone, Arabic in production, 2026-11-11):
     "10:30" fits 48px, but Arabic "10:30 ص" is 61px at 14px (Figtree digits,
     Rubik letters) and its ص wrapped out of the tile. Arabic lists give every
     tile 4.5rem, one width for the whole list so the titles line up; the tile
     never wraps its time and grows past this when the text is larger. */
  .day-list,
  .agenda-list {
    --time-tile: 48px;
  }

  :lang(ar) :is(.day-list, .agenda-list) {
    --time-tile: 4.5rem;
  }

  .day-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(var(--time-tile), auto) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    min-height: 64px;
    padding: var(--space-3) var(--space-4);
    border-bottom: 0;
    font-size: var(--text-small);
  }

  .day-row:first-child {
    padding-top: var(--space-3);
  }

  /* Dividers inset past the time tile (recent rows have none: 48px, then their own start). */
  .day-row + .day-row::before,
  .recent-row + .recent-row::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: calc(var(--space-4) + var(--time-tile, 48px) + var(--space-3)) 0;
    border-top: 1px solid var(--attend-border);
  }

  .recent-row + .recent-row::before {
    inset-inline-start: var(--space-4);
  }

  .day-row__time {
    display: flex;
    align-items: center;
    justify-content: center;
    min-inline-size: var(--time-tile);
    block-size: 44px;
    padding-inline: var(--space-1);
    border-radius: var(--r-sm);
    white-space: nowrap;
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-num-m);
  }

  .day-list--past .day-row__time {
    background: var(--attend-ground);
    color: var(--attend-text);
  }

  /* A row's text and its status chip (§7 "Status chip": a chip never
     squeezes the title, the owner's fix request of 2026-11-10; this layout
     is proposed, pending his review of the screenshots). They share one
     wrapping line: the chip sits at the end while the text keeps 55% of the
     line, and otherwise moves under the text, where its own words may wrap.
     An `auto` column gave the chip its whole one-line width first: on a
     390px phone "Ended · awaiting finalization" left the course name four
     letters wide, on a computer during a class (Today's narrower column)
     none, and at 320px recent attendance, the course rows and the lecture
     rows were squeezed the same way (tests/e2e/test_row_chips.py). */
  .day-row__main,
  .recent-row,
  .course-row__main,
  .student-history .row__main {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
    min-width: 0;
  }

  .day-row__main,
  .recent-row,
  .course-row__main {
    align-items: center;
  }

  .day-row__body,
  .recent-row__body,
  .course-row__body,
  .student-history .row__main > div:first-child {
    flex: 1 1 55%;
    min-width: 0;
  }

  .day-row__title,
  .recent-row__title {
    color: var(--attend-text-strong);
    font-size: var(--text-body);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
    overflow-wrap: anywhere;
  }

  .day-row__meta,
  .recent-row__meta {
    margin-top: var(--space-05);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    line-height: var(--leading-small);
  }

  .day-none {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  /* The empty day's glyph (design review SF22): a 36px tile in the brand
     tint, as the time tiles beside it; decoration only. */
  .day-none__glyph {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    inline-size: 36px;
    block-size: 36px;
    border-radius: var(--r-md);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .day-none__glyph .icon {
    inline-size: 18px;
    block-size: 18px;
  }

  .day-none__body {
    min-width: 0;
  }

  .day-none__title {
    margin: 0;
  }

  .day-none .day-next {
    margin: var(--space-1) 0 0;
  }

  /* Recent attendance: course and date, its status chip at the end. */
  .student-recent {
    margin-top: var(--space-8);
  }

  /* Wraps under enlarged text (200%) rather than pushing the link off screen. */
  .student-recent__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
  }

  .student-recent__head .section-label {
    margin: 0;
  }

  .day-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-05);
    min-height: var(--touch);
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
    text-decoration: none;
  }

  .day-link:focus-visible {
    color: var(--attend-link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  /* Hover only for a mouse (design review AD3): a tapped link kept its underline. */
  @media (hover: hover) and (pointer: fine) {
    .day-link:hover {
      color: var(--attend-link-hover);
      text-decoration: underline;
      text-underline-offset: 3px;
    }
  }

  /* The course and its date, the status chip at the end (or under them:
     the shared rule above). */
  .recent-row {
    position: relative;
    padding: var(--space-3) var(--space-4);
  }

  .recent-row__status {
    max-width: 100%;
  }

  /* A computer: the date in a column of its own, between the course and the chip. */
  @media (min-width: 1024px) {
    .recent-row {
      min-height: 52px;
      padding-block: var(--space-2);
    }

    .recent-row__body {
      display: grid;
      grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
      align-items: center;
      column-gap: var(--space-3);
    }

    .recent-row__meta {
      margin-top: 0;
    }
  }

  /* The attendance page: the lecture list as one card; the rows' own 16px
     is the inset, as on Today (design review AL6). */
  .student-history {
    padding: 0;
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

  .student-history > .row:last-child {
    border-bottom: 0;
  }

  /* A lecture row (design review 2026-11-09, AL6, SF20, AD23; review fix
     M8): the day and time, a meta line ending in Final or Provisional, and
     only the status chip at the row's end, so the text keeps its width on a
     390px phone; under the text where it would not (the shared rule above). */
  .student-history .row__status {
    max-width: 100%;
  }

  /* The lectures grouped by course (BI9): the course above its card. */
  .history-course {
    margin: var(--space-5) 0 var(--space-2);
    color: var(--attend-text-strong);
    font-size: var(--text-body);
    font-weight: var(--weight-strong);
  }

  .history-course:first-of-type {
    margin-top: var(--space-2);
  }

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

  /* The explanation follows the list (AL11): a muted footnote. */
  .student-history__notes {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
  }

  .student-history__notes p {
    margin: 0;
    max-width: var(--measure);
  }

  /* ------------------------------------------- Attendance per course
     One row per course (top-15 #12, SF5; owner: attendance rings): a 48px
     ring in the progress colours (brand on brand-tint: progress, not a
     verdict), the course, "81% · 13 of 16 lectures", Provisional or Final. */
  .course-list {
    margin: 0;
    padding: 0 var(--space-4);
    list-style: none;
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

  .course-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 72px;
    padding-block: var(--space-3);
  }

  .course-row + .course-row {
    border-top: 1px solid var(--attend-border);
  }

  .ring {
    flex: none;
    inline-size: 48px;
    block-size: 48px;
  }

  .ring__track,
  .ring__value {
    fill: none;
    stroke-width: 6;
  }

  .ring__track {
    stroke: var(--attend-progress-track);
  }

  .ring__value {
    stroke: var(--attend-accent);
    stroke-linecap: round;
  }

  /* The course and its chip (the shared rule above) beside the ring. */
  .course-row__main {
    flex: 1 1 0;
  }

  .course-row__body p {
    margin: 0;
  }

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

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

  .course-row__amount {
    margin-top: var(--space-1);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .course-row__state {
    max-width: 100%;
  }

  /* --------------------------------------------------------- Scanner */
  /* The viewfinder is ink in both themes (the sidebar's colours, whose
     text pairs are checked in tests/test_contrast.py). */
  .scanner--indigo .scanner__viewport {
    border: 0;
    border-radius: var(--r-xl);
    background: var(--attend-sidebar);
  }

  /* One screen while scanning (owner feedback 2026-11-03): the camera gives
     way so the progress strip and Stop stay visible between the top bar and
     the bottom tab bar, on phones from 360x640 to 430x932
     (tests/e2e/test_scanner_layout.py). 304px is the rest of the column: the
     page header, the strip, Stop and the gaps between them. */
  .scanner--indigo .scanner__viewport {
    max-height: max(200px, calc(100vh - var(--topbar-h) - var(--bottom-nav-room) - 304px));
    max-height: max(200px, calc(100dvh - var(--topbar-h) - var(--bottom-nav-room) - 304px));
  }

  .scanner--indigo .scanner__camera {
    gap: 0;
  }

  /* While the camera runs, the page header keeps one line each for the
     course title and its details (the full words stay in the page for screen
     readers): a long title must not push Stop off a 360x640 screen.
     static/js/scanner/fit.js then fits the camera to what is left. */
  .main:has(.scanner [data-camera]:not([hidden])) .page-header h1,
  .main:has(.scanner [data-camera]:not([hidden])) .page-header__sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Zoom -/+ on the camera's top-right corner, in the chip's colours. */
  .scanner--indigo .zoom {
    position: absolute;
    top: var(--space-3);
    inset-inline-end: var(--space-3);
    flex-wrap: nowrap;
    gap: 0;
    padding-inline-start: var(--space-3);
    border-radius: var(--r-pill);
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
  }

  .scanner--indigo .zoom__label,
  .scanner--indigo .zoom__value {
    color: var(--attend-sidebar-strong);
    font-size: var(--text-small);
  }

  .scanner--indigo .zoom__value {
    min-width: 3ch;
  }

  .scanner--indigo .zoom .btn--icon {
    inline-size: var(--touch);
    min-width: var(--touch);
    block-size: var(--touch);
    min-height: var(--touch);
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--attend-sidebar-strong);
  }

  /* The note stays for screen readers; the label already says which zoom. */
  .scanner--indigo .zoom__note {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Square, sized by the viewfinder's height too, now that it can be short. */
  .scanner--indigo .scanner__frame {
    inset: auto;
    top: 50%;
    left: 50%; /* physical: centred with translate(-50%) */
    block-size: min(240px, 60%);
    aspect-ratio: 1;
    border: 0;
    border-radius: 0;
    transform: translate(-50%, -50%);
  }

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

  .scanner__corner--tl {
    top: 0;
    left: 0; /* physical: a shape the same seen from both sides */
    border-top-width: 6px;
    border-left-width: 6px; /* physical: a shape the same seen from both sides */
    border-top-left-radius: var(--r-md); /* physical: a shape the same seen from both sides */
  }

  .scanner__corner--tr {
    top: 0;
    right: 0; /* physical: a shape the same seen from both sides */
    border-top-width: 6px;
    border-right-width: 6px; /* physical: a shape the same seen from both sides */
    border-top-right-radius: var(--r-md); /* physical: a shape the same seen from both sides */
  }

  .scanner__corner--br {
    right: 0; /* physical: a shape the same seen from both sides */
    bottom: 0;
    border-right-width: 6px; /* physical: a shape the same seen from both sides */
    border-bottom-width: 6px;
    border-bottom-right-radius: var(--r-md); /* physical: a shape the same seen from both sides */
  }

  .scanner__corner--bl {
    bottom: 0;
    left: 0; /* physical: a shape the same seen from both sides */
    border-bottom-width: 6px;
    border-left-width: 6px; /* physical: a shape the same seen from both sides */
    border-bottom-left-radius: var(--r-md); /* physical: a shape the same seen from both sides */
  }

  /* The scan line is the top edge of a box that spans 12% to 88% of the
     frame; the box moves by its own height, so only transform animates
     (compositor-only while the camera decodes; design review AD19). Without
     motion it rests across the middle (review fix L6); the animation's
     keyframes take over the transform when motion is allowed. */
  .scanner__sweep {
    position: absolute;
    top: 12%;
    inset-inline: var(--space-3);
    block-size: 76%;
    border-top: 2px solid var(--attend-sidebar-accent);
    transform: translateY(50%);
    pointer-events: none;
  }

  /* The ready screen's still viewfinder (design review SF6): the camera's
     ink panel and corner brackets where the camera will open, decoration
     only (aria-hidden), in the app before the first tap. On a phone it takes
     the room above the actions, which stay at the foot. */
  .scanner__still {
    position: relative;
    flex: 1 1 0;
    min-block-size: 120px;
    max-block-size: 320px;
    border-radius: var(--r-xl);
    background: var(--attend-sidebar);
  }

  @media (min-width: 768px) {
    .scanner__still {
      flex: none;
      block-size: 240px;
      max-inline-size: 420px;
    }
  }

  /* A computer's code for the phone (design review SF10): dark on light in
     both themes, so any phone camera reads it (the two-step setup's pair). */
  .phone-qr {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: 0;
  }

  .phone-qr__svg {
    flex: none;
    inline-size: 112px;
    block-size: 112px;
    padding: var(--space-2);
    border-radius: var(--r-md);
    background: var(--attend-projection-bg);
    color: var(--attend-projection-fg);
  }

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

  /* The guidance line, repeated over the camera (presentation.js). */
  .scanner__chip {
    position: absolute;
    inset-inline: var(--space-4);
    bottom: var(--space-6);
    width: fit-content;
    max-width: calc(100% - var(--space-8));
    margin-inline: auto;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--r-pill);
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    line-height: var(--leading-small);
    text-align: center;
  }

  /* Switch camera, on the viewfinder's top-left corner (index.js shows it
     only with more than one camera). The chip's colour pair. */
  .scanner__switch {
    position: absolute;
    top: var(--space-3);
    inset-inline-start: var(--space-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: var(--touch);
    block-size: var(--touch);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--attend-sidebar-active);
    color: var(--attend-sidebar-strong);
    cursor: pointer;
  }

  .scanner__switch[hidden] {
    display: none;
  }

  /* While the chip says it over the camera, the line under the camera is
     hidden from sight only: screen readers still read it (the chip is
     aria-hidden). */
  .scanner--indigo:has([data-camera]:not([hidden]) .scanner__chip:not([hidden]))
    .scanner__guidance {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .scanner__stop {
    min-height: 48px;
  }

  /* Stop sits after the progress card (the board's order) and only while the
     camera runs. */
  .scanner:has([data-camera][hidden]) .scanner__stop {
    display: none;
  }

  /* Steps for a camera that did not open (static/js/scanner/camera-help.js). */
  .camera-help {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
  }

  .camera-help[hidden] {
    display: none;
  }

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

  .camera-help__steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding-inline-start: var(--space-5);
    color: var(--attend-text-secondary);
    list-style: decimal;
  }

  /* Progress strip under the camera: "k of N codes confirmed" and "Closes
     in" on one row, the step dots and the bar on the next. */
  .scanner--indigo .verified-progress {
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

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

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

  .scanner--indigo .verified-progress__text {
    font-weight: var(--weight-strong);
  }

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

  /* The bar takes what the dots and the close leave, down to nothing. */
  .verified-progress__track .verified-progress__bar {
    flex: 1 1 0;
    min-width: 0;
  }

  .verified-progress__track .scanner__window {
    margin-inline-start: auto;
  }

  /* The step dots: a row. components.css's .steps (the install page's
     numbered list) is a padded column; that rule matched the dots too and
     stacked them, so this one is scoped and overrides it. */
  .verified-progress .steps {
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
  }

  .steps__dot {
    position: relative;
    inline-size: 14px;
    block-size: 14px;
    border: 2px solid var(--attend-border-strong);
    border-radius: 50%;
  }

  .steps__dot--done {
    border-color: var(--attend-accent);
    background: var(--attend-accent);
  }

  /* A small check inside a done dot. */
  .steps__dot--done::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 3px; /* physical: a check mark, the same in both languages */
    inline-size: 3px;
    block-size: 6px;
    border: solid var(--attend-surface);
    border-width: 0 2px 2px 0; /* physical: a check mark */
    transform: rotate(45deg);
  }

  .steps__dot--current {
    border-color: var(--attend-accent);
    outline: 4px solid var(--attend-brand-tint);
  }

  .scanner--indigo .verified-progress__bar {
    block-size: 8px;
    border: 0;
    border-radius: var(--r-pill);
    background: var(--attend-brand-tint);
  }

  /* One rule per engine: a selector list with an unknown pseudo-element is dropped. */
  .scanner--indigo .verified-progress__bar::-webkit-progress-bar {
    border-radius: var(--r-pill);
  }

  .scanner--indigo .verified-progress__bar::-webkit-progress-value {
    border-radius: var(--r-pill);
  }

  .scanner--indigo .verified-progress__bar::-moz-progress-bar {
    border-radius: var(--r-pill);
  }

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

  .scanner__window-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  .scanner__closes {
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
    white-space: nowrap;
  }

  .scanner__countdown {
    display: inline-block;
    min-width: 4ch;
    text-align: end;
  }

  /* The ready screen: "Closes at 21:06 · 22 min left" under the help (design
     review 2026-11-09, top-15 #3 and #5), only before the camera starts. */
  .scanner__closes-at {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .scanner__closes-at .icon {
    flex: none;
    inline-size: 16px;
    block-size: 16px;
    color: var(--attend-text-muted);
  }

  .scanner:not([data-phase="idle"]) .scanner__closes-at {
    display: none;
  }

  /* One column of actions: Check in full width, Return to Today a quiet
     link under it (design review 2026-11-09, top-15 #3, AD5). */
  .scanner--indigo .scanner__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .scanner--indigo .scanner__return {
    align-self: center;
  }

  /* A phone: the ready screen fills the space between the top bar and the
     tab bar, and the first visible actions sit at its foot, in the thumb's
     reach (the main area's own padding is taken off: shell.css). */
  @media (max-width: 767px) {
    .content__body:has(> .scanner[data-phase="idle"]) {
      display: flex;
      flex-direction: column;
      min-block-size: calc(
        100dvh - var(--topbar-h) - var(--bottom-nav-room) - var(--space-4) - var(--space-6)
      );
    }

    .content__body:has(> .scanner[data-phase="idle"]) > .scanner {
      flex: 1 0 auto;
    }

    .scanner[data-phase="idle"] > .scanner__actions:not([hidden]) {
      margin-top: auto;
    }

    .scanner[data-phase="idle"] > .scanner__actions:not([hidden]) ~ .scanner__actions {
      margin-top: 0;
    }
  }

  @media (min-width: 768px) {
    .scanner--indigo .scanner__actions {
      align-items: flex-start;
    }

    /* Under a start-aligned Check in, not centred (review fix L2). */
    .scanner--indigo .scanner__return {
      align-self: flex-start;
    }

    .scanner--indigo .scanner__actions .btn--block {
      inline-size: auto;
      min-inline-size: 280px;
    }
  }

  /* --------------------------------------------------------- Receipt */
  .scanner--indigo .receipt {
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-5);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-xl);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
    text-align: center;
  }

  .scanner--indigo .receipt[hidden] {
    display: none;
  }

  .receipt__burst {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 100%;
    block-size: 168px;
  }

  .receipt__disc {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 120px;
    block-size: 120px;
    border-radius: 50%;
    background: var(--attend-positive-solid);
    color: var(--attend-on-brand);
  }

  .receipt__disc .icon {
    inline-size: 56px;
    block-size: 56px;
    stroke-width: 3.5;
  }

  /* Confetti: circles, short pills and rounded squares, settled around the disc. */
  .receipt__bit {
    --bit-x: 0px;
    --bit-y: 0px;
    --bit-r: 0deg;
    position: absolute;
    top: 50%;
    left: 50%; /* physical: centred with translate(-50%) */
    inline-size: 8px;
    block-size: 8px;
    border-radius: 50%;
    background: var(--attend-brand);
    transform: translate(-50%, -50%) translate(var(--bit-x), var(--bit-y)) rotate(var(--bit-r)); /* physical: confetti, either side */
  }

  .receipt__bit:nth-child(3n) {
    inline-size: 4px;
    block-size: 14px;
    border-radius: var(--r-pill);
  }

  .receipt__bit:nth-child(3n + 1) {
    inline-size: 12px;
    block-size: 12px;
    border-radius: var(--r-xs);
  }

  .receipt__bit:nth-child(4n + 1) {
    background: var(--attend-brand-tint);
  }

  .receipt__bit:nth-child(4n + 2) {
    background: var(--attend-positive-bg);
  }

  .receipt__bit:nth-child(4n + 3) {
    border: 1.5px solid var(--attend-brand-text);
    background: transparent;
  }

  .receipt__bit:nth-child(2) { --bit-x: -96px; --bit-y: -52px; --bit-r: 20deg; }
  .receipt__bit:nth-child(3) { --bit-x: -78px; --bit-y: 18px; --bit-r: -30deg; }
  .receipt__bit:nth-child(4) { --bit-x: -110px; --bit-y: 4px; --bit-r: 35deg; }
  .receipt__bit:nth-child(5) { --bit-x: -64px; --bit-y: -74px; --bit-r: 0deg; }
  .receipt__bit:nth-child(6) { --bit-x: -86px; --bit-y: 60px; --bit-r: 25deg; }
  .receipt__bit:nth-child(7) { --bit-x: -30px; --bit-y: -82px; --bit-r: 45deg; }
  .receipt__bit:nth-child(8) { --bit-x: 34px; --bit-y: -80px; --bit-r: -20deg; }
  .receipt__bit:nth-child(9) { --bit-x: 70px; --bit-y: -66px; --bit-r: 30deg; }
  .receipt__bit:nth-child(10) { --bit-x: 100px; --bit-y: -30px; --bit-r: 0deg; }
  .receipt__bit:nth-child(11) { --bit-x: 112px; --bit-y: 12px; --bit-r: -40deg; }
  .receipt__bit:nth-child(12) { --bit-x: 82px; --bit-y: 50px; --bit-r: 20deg; }
  .receipt__bit:nth-child(13) { --bit-x: 58px; --bit-y: 74px; --bit-r: 45deg; }
  .receipt__bit:nth-child(14) { --bit-x: -50px; --bit-y: 76px; --bit-r: -25deg; }
  .receipt__bit:nth-child(15) { --bit-x: 0px; --bit-y: 80px; --bit-r: 30deg; }

  .scanner--indigo .receipt__title {
    justify-content: center;
    margin-top: var(--space-2);
    color: var(--attend-text-strong);
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: var(--text-h1);
    font-weight: var(--weight-display);
    letter-spacing: var(--tracking-h1);
    line-height: var(--leading-h1);
  }

  .receipt__lead {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
    overflow-wrap: anywhere;
  }

  .receipt__meta,
  .receipt__note {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    line-height: var(--leading-small);
  }

  .receipt__ref {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-1) var(--space-2);
    max-width: 100%;
    margin-block: var(--space-3) var(--space-1);
    padding: var(--space-2) var(--space-4);
    border: 1.5px dashed var(--attend-border-strong);
    border-radius: var(--r-pill);
    color: var(--attend-text);
    font-size: var(--text-small);
  }

  .receipt__ref-id {
    color: var(--attend-text-strong);
    font-weight: var(--weight-num-m);
    overflow-wrap: anywhere;
    user-select: all;
  }

  /* The short code's Copy (design review 2026-11-09, top-15 #6): a 44px
     target inside the dashed pill; "Copied" for a moment (live-pass.js). */
  .receipt__ref {
    align-items: center;
    padding-inline-end: var(--space-1);
  }

  .receipt__copy {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    inline-size: auto;
    min-inline-size: var(--touch);
    min-block-size: var(--touch);
    padding-inline: var(--space-2);
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .receipt__copy .icon {
    inline-size: 18px;
    block-size: 18px;
  }

  /* The live pass (SF idea 1): "Live 21:06:33", the seconds ticking from
     the server's time, so a live receipt is told from a screenshot. */
  .receipt__live {
    position: relative;
    isolation: isolate; /* the sheen passes under the words (review fix L3) */
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: var(--space-1) var(--space-3);
    overflow: hidden;
    border-radius: var(--r-pill);
    background: var(--attend-positive-bg);
    color: var(--attend-positive-text);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .receipt__live-dot {
    inline-size: 8px;
    block-size: 8px;
    border-radius: 50%;
    background: var(--attend-positive-solid);
  }

  /* A slow sheen: a soft stripe crossing the pill (solid, at low opacity). */
  .receipt__live::after {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: -30%;
    inline-size: 24%;
    background: var(--attend-raised);
    opacity: 0;
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: -1;
  }

  .receipt__details-more {
    inline-size: 100%;
    margin-top: var(--space-1);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  .receipt__details-more summary {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--touch);
    cursor: pointer;
    color: var(--attend-brand-text);
    font-weight: var(--weight-strong);
  }

  .receipt__full {
    overflow-wrap: anywhere;
    user-select: all;
  }

  .receipt__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    inline-size: 100%;
    margin-top: var(--space-4);
  }

  .receipt__details {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch);
    color: var(--attend-brand-text);
    font-weight: var(--weight-strong);
  }

  @media (min-width: 768px) {
    .scanner--indigo .receipt {
      padding: var(--space-8);
    }

    .receipt__actions .btn--block {
      width: auto;
      min-width: 240px;
    }
  }

  /* ---------------------------------------------------------- Motion
     Only when the device allows it; otherwise everything above is the
     settled, static picture (the confetti stays where it landed). */
  @media (prefers-reduced-motion: no-preference) {
    .course-card__live::before,
    .steps__dot--current {
      animation: attend-student-pulse 1.6s ease-in-out infinite alternate;
    }

    .scanner__sweep {
      animation: attend-student-sweep 2s ease-in-out infinite alternate;
    }

    /* Only a live success celebrates (receipt.js sets data-celebrate); a
       receipt loaded again from the server stays still (design review AD11). */
    .receipt[data-celebrate]:not([hidden]) .receipt__disc {
      animation: attend-student-pop 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .receipt[data-celebrate]:not([hidden]) .receipt__bit {
      animation: attend-student-burst 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .receipt__live-dot {
      animation: attend-student-pulse 1.6s ease-in-out infinite alternate;
    }

    .receipt__live::after {
      animation: attend-student-sheen 6s ease-in-out infinite;
    }
  }

  @keyframes attend-student-pulse {
    to {
      opacity: 0.35;
    }
  }

  @keyframes attend-student-sweep {
    from {
      transform: translateY(0);
    }

    to {
      transform: translateY(100%);
    }
  }

  @keyframes attend-student-pop {
    0% {
      opacity: 0;
      transform: scale(0.6);
    }

    60% {
      opacity: 1;
    }

    100% {
      transform: scale(1);
    }
  }

  @keyframes attend-student-sheen {
    0%,
    55% {
      opacity: 0;
      transform: translateX(0) skewX(-20deg);
    }

    65% {
      opacity: 0.55;
    }

    100% {
      opacity: 0;
      transform: translateX(560%) skewX(-20deg); /* physical: a sheen, the same seen from both sides */
    }
  }

  @keyframes attend-student-burst {
    from {
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.4);
    }
  }

  /* ------------------------------------- Set up your phone, Account */
  /* ui/_permission_row.html: icon, title and state chip, the reason, the
     steps for a blocked permission, Allow / Check again. One column on
     phones; the chip wraps under the title when the line is short. */
  .permission-list {
    display: grid;
    gap: var(--space-3);
    margin-block: var(--space-4);
  }

  .permission-row {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-4);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-md);
    background: var(--attend-surface);
  }

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

  .permission-row__body {
    display: grid;
    flex: 1 1 auto;
    gap: var(--space-2);
    min-width: 0;
  }

  .permission-row__head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    justify-content: space-between;
  }

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

  .permission-row__text,
  .permission-row__intro {
    margin: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  .permission-row__text:empty {
    display: none;
  }

  .permission-row__intro {
    color: var(--attend-text);
  }

  .permission-row__steps {
    margin: var(--space-1) 0 0;
    padding-inline-start: var(--space-5);
    color: var(--attend-text);
    font-size: var(--text-small);
  }

  .permission-row__steps li + li {
    margin-block-start: var(--space-1);
  }

  .permission-row__actions:not(:has(> :not([hidden]))) {
    display: none;
  }

  .permission-setup__actions {
    margin-block: var(--space-6) var(--space-3);
  }

  /* ---------------------------------------------------------- Account
     Four bordered cards (owner, 2026-11-11; ui/account.html): Profile, This
     phone (students), Security, Preferences. 32px between cards, 16px inside
     (24px from 768px), the small card radius, no shadow. One h2 a card; its
     parts are h3s split by one hairline. The blocks a part holds (.kv, the
     permission rows, the install card) drop their own box: no card in a card. */
  .account {
    display: grid;
    gap: var(--space-8);
  }

  .account > * {
    min-width: 0;
    margin: 0;
  }

  /* Account as rows (owner, 2026-11-18; plans/account-tabs): the person, the
     rows (.link-rows, components.css), Sign out as its own row. Each part
     keeps the cards below on its own page. */
  .account--rows {
    gap: var(--space-5);
  }

  .account-who {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }

  :root .account-who__avatar {
    inline-size: 56px;
    block-size: 56px;
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-body);
  }

  .account-who__text {
    min-width: 0;
  }

  .account-who__text > p {
    margin: 0;
  }

  .account-who__name {
    color: var(--attend-text-strong);
    font-size: var(--text-h2);
    font-weight: var(--weight-bold);
  }

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

  /* The student's groups under "College · Stage" (owner, 2026-11-23). */
  .account-who__groups {
    justify-self: start;
    inline-size: fit-content;
    max-inline-size: 100%;
    margin-block-start: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--r-sm);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-small);
  }

  .account-group {
    display: grid;
    gap: var(--space-5);
    padding: var(--space-4);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-md);
    background: var(--attend-surface);
  }

  @media (min-width: 768px) {
    .account-group {
      padding: var(--space-6);
    }
  }

  .account-group__title {
    margin: 0;
    font-size: var(--text-h2);
    font-weight: var(--weight-bold);
  }

  .account-part {
    display: grid;
    gap: var(--space-3);
    min-width: 0;
  }

  .account-part > * {
    margin: 0;
  }

  .account-part + .account-part,
  .account-group > .install-card {
    padding-block-start: var(--space-5);
    border-block-start: 1px solid var(--attend-border);
  }

  .account-part h3 {
    margin: 0;
    font-size: var(--text-body);
    font-weight: var(--weight-strong);
  }

  .account-part__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
  }

  /* The fieldset's legend repeats the part's h3 ("Appearance" / "Theme"):
     kept for screen readers, not shown. */
  .account-part fieldset {
    position: relative;
  }

  .account-part legend {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .account-part .theme-switcher,
  .account-part .form {
    gap: var(--space-3);
  }

  .account-part .actions:not(:has(> :not([hidden], :empty))) {
    display: none;
  }

  /* The track a step below the card in both themes. Each option as wide as
     its label, kept on one line: equal columns broke "حسب النظام" in two at
     390px; three options fit a 360px phone in both languages. */
  :root .account-group .segmented {
    grid-auto-columns: auto;
    max-width: 100%;
    background: var(--attend-ground);
  }

  .account-group .segmented__option {
    padding-inline: var(--space-3);
    white-space: nowrap;
  }

  /* Keyboard shortcuts (owner, 2026-11-11): the name, the key, then Change and
     Reset to default, wrapping under the name on a narrow column. Not on
     phones: no keyboard there, and no search palette below 768px. */
  .shortcut-rows {
    display: grid;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
  }

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

  .shortcut-row__name {
    flex: 1 1 12rem;
    min-width: 0;
  }

  .shortcut-row__keys {
    min-inline-size: 4.5em;
    padding-block: var(--space-1);
    padding-inline: var(--space-2);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-xs);
    background: var(--attend-ground);
    color: var(--attend-text);
    text-align: center;
    white-space: nowrap;
  }

  .shortcut-row__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  @media (max-width: 767px) {
    .account-part--shortcuts {
      display: none;
    }
  }

  .account-group .kv {
    padding-inline: 0;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .account-group .permission-list {
    gap: 0;
    margin: 0;
  }

  .account-group .permission-row {
    padding: var(--space-3) 0;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .account-group .permission-row:not([hidden]) ~ .permission-row:not([hidden]) {
    border-block-start: 1px solid var(--attend-border);
  }

  .account-group .install-card {
    margin: 0;
    padding-inline: 0;
    padding-block-end: 0;
    border-radius: 0;
    border-inline: 0;
    border-block-end: 0;
    background: none;
    box-shadow: none;
  }

  /* A staff member's install card stands as a card of its own. */
  .account > .install-card {
    border-radius: var(--r-md);
    box-shadow: none;
  }

  /* ------------------------------------------ Desk code
     The waiting screen's six digits (devices/device.html; onboarding item 5),
     large enough to read across a desk, in two groups of three. */
  .desk-code {
    display: grid;
    gap: var(--space-1);
    justify-items: start;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--r-lg);
    background: var(--attend-brand-tint);
  }

  .desk-code[hidden] {
    display: none;
  }

  .desk-code p {
    margin: 0;
  }

  .desk-code__label {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
  }

  .desk-code__digits {
    color: var(--attend-text-strong);
    font-size: var(--text-num-xl);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-display);
    line-height: 1.1;
    unicode-bidi: isolate;
    direction: ltr;
  }

  /* ------------------------------------------ Getting started
     Today's one installation state (ui/_get_ready.html; onboarding item 4,
     design review 2026-11-09, top-15 #1 and #10, SF2): five steps with the
     scan's own dot style, then the message and action of the current step.
     static/js/pwa/get-ready.js marks each step (data-state). */
  .ready-card {
    display: grid;
    gap: var(--space-3);
    margin-block: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

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

  .ready-card__todo,
  .ready-card__now,
  .ready-card__setup {
    display: grid;
    gap: var(--space-3);
    justify-items: start;
  }

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

  .ready-card p {
    margin: 0;
  }

  /* Getting started (onboarding item 4): five steps, one per line, so each
     label reads whole at 360px and at large text sizes. */
  .ready-steps {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

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

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

  .ready-step[aria-current="step"] .ready-step__dot {
    border-color: var(--attend-accent);
  }

  .ready-step {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
  }

  .ready-step[data-state="done"] {
    color: var(--attend-text-strong);
  }

  .ready-step__dot {
    position: relative;
    flex: none;
    inline-size: 14px;
    block-size: 14px;
    border: 2px solid var(--attend-border-strong);
    border-radius: 50%;
  }

  .ready-step[data-state="done"] .ready-step__dot {
    border-color: var(--attend-accent);
    background: var(--attend-accent);
  }

  .ready-step[data-state="done"] .ready-step__dot::after {
    content: "";
    position: absolute;
    top: 1px;
    inset-inline-start: 3px; /* logical, ready for the Arabic layout (review fix L5) */
    inline-size: 3px;
    block-size: 6px;
    border: solid var(--attend-surface);
    border-width: 0 2px 2px 0; /* physical: a check mark */
    transform: rotate(45deg);
  }

  /* Waiting on an approver: a dashed ring, not a failure. */
  .ready-step[data-state="waiting"] .ready-step__dot {
    border-style: dashed;
    border-color: var(--attend-accent);
  }

  /* The ready moment (SF idea 4): a small check disc, the receipt's confetti. */
  .ready-card__done {
    display: grid;
    gap: var(--space-2);
    justify-items: center;
    text-align: center;
  }

  .ready-burst {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 100%;
    block-size: 104px;
  }

  .ready-burst__disc {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 64px;
    block-size: 64px;
    border-radius: 50%;
    background: var(--attend-positive-solid);
    color: var(--attend-on-brand);
  }

  .ready-burst__disc .icon {
    inline-size: 32px;
    block-size: 32px;
    stroke-width: 3.5;
  }

  .ready-burst__bit {
    --bit-x: 0px;
    --bit-y: 0px;
    --bit-r: 0deg;
    position: absolute;
    top: 50%;
    left: 50%; /* physical: centring */
    inline-size: 7px;
    block-size: 7px;
    border-radius: 50%;
    background: var(--attend-brand);
    transform: translate(-50%, -50%) translate(var(--bit-x), var(--bit-y)) rotate(var(--bit-r)); /* physical: centring; a burst */
  }

  .ready-burst__bit:nth-child(3n) {
    inline-size: 4px;
    block-size: 12px;
    border-radius: var(--r-pill);
  }

  .ready-burst__bit:nth-child(4n + 1) {
    background: var(--attend-brand-tint);
  }

  .ready-burst__bit:nth-child(4n + 3) {
    border: 1.5px solid var(--attend-brand-text);
    background: transparent;
  }

  .ready-burst__bit:nth-child(2) { --bit-x: -64px; --bit-y: -30px; --bit-r: 20deg; }
  .ready-burst__bit:nth-child(3) { --bit-x: -56px; --bit-y: 18px; --bit-r: -30deg; }
  .ready-burst__bit:nth-child(4) { --bit-x: -30px; --bit-y: -44px; --bit-r: 35deg; }
  .ready-burst__bit:nth-child(5) { --bit-x: 32px; --bit-y: -44px; --bit-r: 0deg; }
  .ready-burst__bit:nth-child(6) { --bit-x: 62px; --bit-y: -22px; --bit-r: 25deg; }
  .ready-burst__bit:nth-child(7) { --bit-x: 58px; --bit-y: 24px; --bit-r: 45deg; }
  .ready-burst__bit:nth-child(8) { --bit-x: -36px; --bit-y: 40px; --bit-r: -20deg; }
  .ready-burst__bit:nth-child(9) { --bit-x: 30px; --bit-y: 42px; --bit-r: 30deg; }

  @media (prefers-reduced-motion: no-preference) {
    .ready-card__done:not([hidden]) .ready-burst__disc {
      animation: attend-student-pop 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .ready-card__done:not([hidden]) .ready-burst__bit {
      animation: attend-student-burst 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }
  }

  /* ------------------------------------------------ Photo, your phone
     "Take photo" in place of the browser's "Choose File" (design review
     2026-11-09, AL23, BI25): the hidden input keeps the keyboard focus, and
     the button shows it; the chosen photo previews in a 64px circle. */
  .photo-pick__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
  }

  .photo-pick__preview {
    flex: none;
    inline-size: 64px;
    block-size: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--attend-ground);
  }

  .photo-pick__button {
    cursor: pointer;
  }

  .photo-pick__input:focus-visible + .photo-pick__row .photo-pick__button {
    outline: 2px solid var(--attend-focus);
    outline-offset: 3px;
  }

  .photo-pick__name {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* The device page's history: the last three, the rest folded (BI22, SF17). */
  .history-more summary {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--touch);
    cursor: pointer;
    color: var(--attend-brand-text);
    font-weight: var(--weight-strong);
  }

  /* ------------------------------------------------ My timetable, next
     A day agenda (design review 2026-11-09, AL21, SF21): each day a card of
     rows in Today's style (a time tile, the course, one muted line), today
     marked with the active dot; the next class first. Groups are words, not
     brand-coloured tags. */
  .agenda {
    display: grid;
    gap: var(--space-5);
  }

  .agenda-day__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
  }

  .agenda-day--today .agenda-day__title {
    color: var(--attend-brand-text);
  }

  .agenda-day--today .agenda-day__title::before {
    content: "";
    inline-size: 6px;
    block-size: 6px;
    border-radius: 50%;
    background: var(--attend-accent);
  }

  .agenda-list {
    margin: 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
    border: 1px solid var(--attend-border);
    border-radius: var(--r-lg);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-card);
  }

  .agenda-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(var(--time-tile), auto) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    min-height: 64px;
    padding: var(--space-3) var(--space-4);
  }

  .agenda-row + .agenda-row::before {
    content: "";
    position: absolute;
    top: 0;
    /* logical, ready for the Arabic layout (review fix L5); past the tile */
    inset-inline: calc(var(--space-4) + var(--time-tile) + var(--space-3)) 0;
    border-top: 1px solid var(--attend-border);
  }

  .agenda-row__title,
  .agenda-row__meta {
    margin: 0;
    overflow-wrap: anywhere;
  }

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

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

  /* The real week (owner, 2026-11-13; boards L1-WeekStudent, L1-WeekStudentAr).
     The week shown, between the links to the weeks around it; at the term's
     first or last week a spacer keeps the words in the middle. */
  .week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-block-end: var(--space-4);
  }

  .week-nav__label {
    margin: 0;
    text-align: center;
  }

  .week-nav__name,
  .week-nav__dates {
    display: block;
  }

  .week-nav__name,
  .week-nav__dates:only-child {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .week-nav__dates {
    color: var(--attend-text-muted);
  }

  .week-nav__end {
    flex: none;
    inline-size: var(--touch);
  }

  /* A lecture that is not held: the time and the course struck through and
     muted; the chip under the lines says "Cancelled" or "Postponed". */
  .agenda-row--off .day-row__time {
    background: var(--attend-ground);
    color: var(--attend-text-muted);
    text-decoration: line-through;
  }

  .agenda-row--off .agenda-row__title {
    color: var(--attend-text-muted);
    font-weight: var(--weight-body);
  }

  .agenda-row--off .agenda-row__title bdi,
  .agenda-row__struck {
    text-decoration: line-through;
  }

  /* The marks: chips with an icon and a word, under the two lines. */
  .agenda-row__marks {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin: var(--space-2) 0 0;
  }

  .agenda-next,
  .day-next {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-3) 0 var(--space-4);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
  }

  .agenda-next .icon,
  .day-next .icon,
  .view-only-line .icon {
    flex: none;
    inline-size: 16px;
    block-size: 16px;
    color: var(--attend-text-muted);
  }

  /* A device "without attendance" (owner, 2026-11-15, V2): one quiet line
     where Getting started was (templates/ui/student_today.html). Focused
     (tabindex -1) right after the choice, with the app's focus ring. */
  .view-only-line {
    display: flex;
    inline-size: fit-content;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
    color: var(--attend-text);
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
  }

  /* Its two sheets (templates/ui/_view_only_sheets.html): the words, then the buttons. */
  .view-only-sheet {
    display: grid;
    gap: var(--space-4);
  }

  .view-only-sheet > p {
    margin: 0;
  }

  /* ------------------------------------------------- Group change (2026-11-16) */
  /* The Today card and the status page: a hero with the time left and a title. */
  .group-change {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .group-change > p,
  .group-change__title {
    margin: 0;
  }

  .group-change__title {
    font-size: var(--text-section);
    line-height: 1.3;
  }

  .group-change__left,
  .group-choice__count {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .group-change__facts {
    margin-block-start: var(--space-2);
  }

  /* The choose page: one card per group; the card is its radio's label. */
  .group-choice {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: var(--space-4) 0 0;
    padding: 0;
    border: 0;
  }

  /* A clinic window: one fieldset per section; its legend is the section's heading. */
  .group-choice__section {
    padding: 0;
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .group-choice__option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--attend-edge);
    border-radius: var(--r-md);
    background: var(--attend-surface);
  }

  /* A clinic window's step 1 (owner, 2026-11-20): each section a card button. */
  .group-choice__pick {
    min-height: var(--touch);
    color: inherit;
    text-decoration: none;
  }

  .group-choice__pick .group-choice__text {
    flex: 1;
  }

  @media (hover: hover) and (pointer: fine) {
    .group-choice__pick:hover {
      border-color: var(--attend-brand);
    }
  }

  .group-choice__pick:focus-visible {
    outline: 2px solid var(--attend-focus);
    outline-offset: 2px;
  }

  .group-choice__chevron {
    flex-shrink: 0;
    color: var(--attend-text-muted);
  }

  .group-choice__option:has(input:checked) {
    border-color: var(--attend-brand);
    outline: 1px solid var(--attend-brand);
    background: var(--attend-row-selected);
  }

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

  .group-choice__option--full {
    color: var(--attend-text-muted);
  }

  .group-choice__label {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--touch);
    cursor: pointer;
  }

  .group-choice__option--full .group-choice__label {
    cursor: not-allowed;
  }

  /* The whole label is the touch target; the radio keeps the browser's size. */
  .group-choice__label > input {
    flex-shrink: 0;
    accent-color: var(--attend-brand);
  }

  .group-choice__text {
    display: flex;
    flex-direction: column;
  }

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

  .group-choice__option--full .group-choice__name {
    color: var(--attend-text-muted);
  }

  .group-choice__meta {
    color: var(--attend-text-muted);
    font-size: var(--text-support);
  }

  .group-choice__meta strong {
    color: var(--attend-text-strong);
  }

  .group-choice__week {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--touch);
    font-size: var(--text-support);
    font-weight: var(--weight-strong);
    white-space: nowrap;
  }

  /* New excuse → "Which lecture?" (owner, 2026-11-18): each row one link to the
     lecture's excuse form, pressed like the subject rows; one already excused is
     shown without a link. */
  .pick-group + .pick-group {
    margin-block-start: var(--space-5);
  }

  .pick-row {
    padding: 0;
  }

  .pick-row__link {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    gap: var(--space-3);
    min-block-size: 64px;
    padding: var(--space-3) var(--space-4);
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  a.pick-row__link:active {
    background: var(--attend-row-hover);
  }

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

  a.pick-row__link:focus-visible {
    outline-offset: -2px;
  }

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

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

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

  .pick-row__chevron {
    flex: none;
    color: var(--attend-text-muted);
  }

  .pick-row--sent .pick-row__body {
    opacity: 0.72;
  }

  /* Today's pull-to-refresh (Board D25; static/js/nav/today-refresh.js): the page
     keeps the browser's own pull from reloading it a second time; a round
     spinner follows the finger under the top, its arc filling as the pull nears
     the 72px that reloads, then spins while the page reloads. The content moves
     with the finger and settles back in 280ms when the pull is let go. */
  html:has([data-pull-refresh]) {
    overscroll-behavior-y: contain;
    --pull: 0px; /* the script writes both on the root while pulling */
    --pull-progress: 0;
  }

  .pull-refresh {
    position: fixed;
    inset-block-start: max(var(--space-2), env(safe-area-inset-top));
    inset-inline: 0;
    z-index: 30;
    margin-inline: auto;
    inline-size: 38px;
    block-size: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--attend-border);
    border-radius: var(--r-pill);
    background: var(--attend-surface);
    box-shadow: var(--attend-shadow-raised);
    translate: 0 calc(var(--pull, 0px) * 0.55 - 30px);
    rotate: calc(var(--pull-progress, 0) * 270deg);
    opacity: min(1, calc(var(--pull-progress, 0) * 1.6));
    pointer-events: none;
  }

  .pull-refresh:not([data-pull]) {
    transition:
      translate 280ms ease,
      opacity 280ms ease;
  }

  .pull-refresh svg {
    inline-size: 22px;
    block-size: 22px;
    fill: none;
    stroke: var(--attend-brand);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 44;
    stroke-dashoffset: calc(44 - 34 * var(--pull-progress, 0));
  }

  .pull-refresh[data-pull="refreshing"] .pull-refresh__spin {
    animation: attend-spin 0.9s linear infinite;
  }

  .pull-refresh__spin {
    display: grid;
    place-items: center;
  }

  :root:has([data-pull]) .content {
    translate: 0 var(--pull, 0px);
  }

  :root:not(:has([data-pull])) .content {
    transition: translate 280ms ease;
  }

  /* --------------------------------------------- Group exchange (student)
     Boards Main, Find, Offer, Confirm, Refused and Agreed (plans/group-exchange,
     approved 2026-11-25): the window card, the request rows, the "You give / You
     get" tiles, the week before agreeing and the offer form. The shared rows,
     buttons, banners and dialogs come from components.css. */
  .gx-window {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
    border: 1px solid var(--attend-hero-border);
    border-radius: var(--r-xl);
    background: var(--attend-hero);
  }

  .gx-window p {
    margin: 0;
  }

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

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

  .gx-window__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .gx-window__actions .btn {
    flex: 1 1 0;
    min-height: var(--touch);
  }

  /* The card on Today while a window is open (owner, 2026-11-26;
     templates/academics/group_exchange/_today_card.html). */
  .gx-today {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-sm);
    background: var(--attend-surface);
  }

  .gx-today__line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0;
    color: var(--attend-text-strong);
  }

  .gx-today__line .icon {
    flex: none;
    margin-block-start: 0.2em;
  }

  .gx-today .btn {
    min-height: var(--touch);
  }

  .gx-list__title {
    margin: var(--space-1) 0 var(--space-2);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .gx-row {
    flex-wrap: nowrap;
  }

  .gx-row__body {
    flex: 1;
    min-width: 0;
  }

  .gx-row__body p {
    margin: 0;
  }

  .gx-row .avatar,
  .gx-row__action {
    flex: none;
  }

  .gx-row__action {
    min-height: var(--touch);
    padding-inline: var(--space-4);
  }

  .gx-row__ended {
    flex: none;
    color: var(--attend-inactive-text);
    font-size: var(--text-small);
  }

  .gx-row__selected {
    flex: none;
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .gx-row--selected {
    background: var(--attend-row-selected);
    border-inline-start: 3px solid var(--attend-brand);
  }

  .gx-note {
    margin-block-start: var(--space-4);
  }

  .gx-agreed {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    border-radius: var(--r-xl);
  }

  .gx-agreed p,
  .gx-agreed__title {
    margin: 0;
  }

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

  .gx-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    align-self: stretch;
  }

  .gx-pair__tile {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--attend-card-edge);
    border-radius: var(--r-sm);
    background: var(--attend-surface);
  }

  .gx-pair__tile--new {
    border-color: transparent;
    background: var(--attend-brand-tint);
  }

  .gx-pair__label,
  .gx-pair__value {
    margin: 0;
  }

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

  .gx-pair__tile--new .gx-pair__label {
    color: var(--attend-brand-text);
  }

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

  .gx-sheet__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .gx-week__item {
    flex-wrap: nowrap;
  }

  .gx-week__day {
    flex: none;
    inline-size: var(--touch);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .gx-week__item--clash {
    border-inline-start: 3px solid var(--attend-danger-text);
  }

  .gx-new {
    flex: none;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--r-pill);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-label);
    font-weight: var(--weight-strong);
  }

  .gx-clear {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    color: var(--attend-positive-text);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .gx-neutral {
    background: var(--attend-inactive-bg);
    color: var(--attend-inactive-text);
  }

  .gx-answer {
    flex-direction: column;
    align-items: stretch;
  }

  .gx-answer form {
    display: contents;
  }

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

  .gx-offer p {
    margin: 0;
  }

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

  .gx-pick {
    display: flex;
    flex-direction: column;
  }

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

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

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

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

  .gx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .gx-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch);
    padding: 0 var(--space-4);
    border: 1px solid var(--attend-border-strong);
    border-radius: var(--r-pill);
    color: var(--attend-text);
    font-weight: var(--weight-strong);
    cursor: pointer;
  }

  .gx-chip:has(input:checked) {
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

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

  .gx-chip input {
    margin: 0;
  }

  /* The chosen kind shows its own groups; the server checks the pair. */
  .gx-offer:has(#gx-kind-practical:checked) .gx-offer__sections,
  .gx-offer:has(#gx-kind-section:checked) .gx-offer__practical {
    display: none;
  }

  .gx-status {
    margin-block: var(--space-3);
  }
}

