/*
 * Clinics («العيادات», owner 2026-11-19; plans/clinics canvas): the student's
 * Clinics section (templates/clinics/home.html), the step flows' frame and
 * shared summary (_step_frame.html, _summary.html; owner R20) and the session
 * picker's options. Tokens from docs/design/visual-design.md; logical
 * properties only; no inline styles (CSP).
 */
@layer components {
  /* Layout B (owner 2026-11-20; canvas C-LandingB): the full-width segmented
     control of links "Sessions · Requests (n) · For me (n)", the current one
     a surface pill as Board's; Take a slot and Find an assistant side by side. */
  .segmented.clinics-seg {
    display: grid;
    max-width: none;
    margin-block: var(--space-2) var(--space-4);
  }

  .clinics-seg .segmented__option {
    min-height: var(--touch);
    padding-inline: var(--space-2);
    text-decoration: none;
  }

  .clinics-seg .segmented__option[aria-current="page"] {
    background: var(--attend-surface);
    color: var(--attend-text-strong);
    box-shadow: var(--attend-shadow-card);
    outline: 1px solid var(--attend-border-strong);
  }

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

  :root[data-theme="dark"] .clinics-seg .segmented__option[aria-current="page"] {
    background: var(--attend-raised);
  }

  @media (prefers-color-scheme: dark) {
    :root[data-theme="system"] .clinics-seg .segmented__option[aria-current="page"] {
      background: var(--attend-raised);
    }
  }

  .actions.clinics-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  }

  .clinics-actions .btn {
    padding-inline: var(--space-3);
  }

  .clinics-actions:empty {
    display: none;
  }

  .clinics-sessions {
    margin-block-start: var(--space-6);
  }

  /* A session's page: what each step says about it, with its actions. */
  .clinic-session__where {
    margin-block: 0 var(--space-4);
  }

  .clinic-session-card .agenda-row__meta,
  .clinic-session-card .agenda-row__marks {
    margin: 0;
  }

  /* The step frame: Back on the start, "Step N of 3" on the end, then a thin bar. */
  .flow-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .flow-top .page-back {
    margin-block-end: 0;
  }

  .round-progress.flow-progress {
    max-inline-size: none;
    block-size: 6px;
    margin-block: var(--space-2) var(--space-4);
  }

  /* A session or classmate option in a step's radio list. */
  .ts-opt {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-inline-size: 0;
    padding-block: var(--space-2);
  }

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

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

  .ts-opt__clash {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);
    color: var(--attend-warning-text);
    font-size: var(--text-small);
  }

  .ts-opt__clash .icon {
    flex: none;
    inline-size: 14px;
    block-size: 14px;
    margin-block-start: 2px;
  }

  .ts-opt--off .ts-opt__when {
    color: var(--attend-text-muted);
  }

  .ts-who {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-inline-size: 0;
  }

  /* The shared "Check and send" summary: a Change link per row, 44 px tall. */
  .ts-change {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    font-weight: var(--weight-medium);
  }

  .ts-line {
    display: block;
  }

  .flow-notes {
    margin-block: var(--space-4) 0;
  }

  .pick-group__name {
    margin: 0;
    padding-block: var(--space-3) var(--space-1);
  }
}

/* --- clinics step 2 --- */
/* Take a slot (canvas C-TakeSlot1-3, C-RequestStatus, C-AskedA, C-Decline,
 * C-OfficeReview): a busy option, the search above step 2's list, a swap's
 * steps, the "Waiting for you" cards and the decline sheet, the office's two
 * students side by side. */
@layer components {
  .ts-help {
    margin-block-start: 0;
  }

  .ts-label--off {
    cursor: not-allowed;
  }

  .ts-search {
    margin-block-end: var(--space-3);
  }

  .ts-count {
    margin: 0 0 var(--space-2);
  }

  .rs-sub {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    vertical-align: middle;
  }

  .rs-status {
    margin: var(--space-3) 0 0;
  }

  .rs-step__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-inline-size: 0;
  }

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

  .rs-actions {
    margin-block-start: var(--space-6);
  }

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

  .clinics-waiting {
    margin-block-end: var(--space-4);
  }

  .ask-card {
    gap: var(--space-3);
  }

  .ask-card p,
  .ask-card h3,
  .decline-sheet p {
    margin: 0;
  }

  .ask-line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .ask-line .icon {
    flex: none;
    margin-block-start: 2px;
  }

  .ask-card__more {
    margin-inline-start: auto;
  }

  .decline-sheet__help {
    padding-inline-start: calc(1.25rem + var(--space-3));
  }

  .clinic-swap-line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);
  }

  .clinic-swap-status {
    margin: var(--space-1) 0 0;
  }

  .swap-parties {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    align-items: center;
  }

  .swap-parties__arrow {
    display: grid;
    place-items: center;
    justify-self: center;
    inline-size: 40px;
    block-size: 40px;
    border-radius: var(--r-pill);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
  }

  .swap-parties__name {
    margin-block-start: var(--space-1);
  }

  .swap-background {
    max-inline-size: 640px;
  }

  @media (min-width: 768px) {
    .swap-parties {
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    }
  }
}

/* --- clinics step 3 --- */
/* Ask for an assistant (canvas C-AskAssist1-3). The "Waiting for you" cards
 * (.ask-card, .ask-line) are shared with step 2's block above. */
@layer components {
  /* Step 1: the swap's status chip under a slot asked by swap (canvas C-AskAssist1). */
  .flow-chip {
    margin-block-start: var(--space-2);
  }

  .flow-chip__help {
    margin-block-start: var(--space-1);
  }

  .assist-choice {
    margin-block-start: 0;
  }

  /* Step 2: the search above the step's form, the results, "Or ask everyone free". */
  .assist-search {
    margin-block-end: var(--space-2);
  }

  .assist-results__list {
    margin-block-start: var(--space-2);
  }

  .assist-free {
    margin-block-start: var(--space-5);
  }

  .assist-clash {
    margin-block: var(--space-3);
  }
}

/* --- clinics step 4 --- */
/* "Is anyone free?" (canvas C-Free1-3, C-AnswerCall, C-CallAnswers, Main). */
@layer components {
  .call-show-days {
    align-self: flex-start;
    margin-block-start: var(--space-1);
  }

  .call-session-line,
  .call-cap,
  .call-state {
    margin: 0;
  }

  .banner.call-who {
    margin: 0;
    background: var(--attend-inactive-bg);
  }

  .call-answer__body {
    flex: 1;
    min-inline-size: 0;
  }

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

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

  .call-note {
    margin-block: var(--space-3);
    padding-inline-start: var(--space-3);
    border-inline-start: 3px solid var(--attend-border-strong);
  }

  .call-note p {
    margin: 0;
  }

  .call-note__text {
    color: var(--attend-text-strong);
    overflow-wrap: anywhere;
  }

  .call-opt--off .ts-opt__when {
    color: var(--attend-text-muted);
  }

  .link-row.call-row {
    cursor: default;
  }
}

/* --- clinics step 5 --- */
/* Today's "Clinic requests" card and the class card's settled line (canvas
   C-Today); the settled line under a session on the Clinics page (Main);
   "Clinic changes" for the office (C-ClinicChanges), its paper
   (C-PrintChanges, on the exam sheet of static/css/exams.css) and a clinic's
   lecturer (C-SupervisorPhone). */
@layer components {
  .impcard--clinic .impcard__link {
    border-inline-start-color: var(--attend-brand);
  }

  .clinic-card__line,
  .clinic-line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .clinic-card__line .icon,
  .clinic-line .icon {
    flex: none;
    margin-block-start: 0.2em;
  }

  .clinic-card-line {
    margin-block-start: var(--space-4);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--attend-hero-border);
  }

  .clinic-card-line .course-card__state {
    min-block-size: 0;
  }

  .clinics-blocks-link {
    margin-block-start: var(--space-4);
  }

  .cc-day-nav {
    max-inline-size: 440px;
  }

  .cc-session__when {
    margin: 2px 0 0;
  }

  .cc-table col:first-child {
    inline-size: 15%;
  }

  .cc-kind {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--attend-text-strong);
  }

  .cc-by {
    display: block;
    margin-block-start: 2px;
  }

  .cc-other {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-6);
  }

  .cc-row {
    align-items: flex-start;
  }

  .cc-row__body {
    flex: 1 1 0;
    min-inline-size: 0;
  }

  .cc-row__line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-block-start: 2px;
  }

  .cc-row__line .icon {
    flex: none;
    margin-block-start: 3px;
  }

  /* The paper (C-PrintChanges): sizes fixed for paper, as the exam sheets. */
  .exam-sheet__facts.cc-facts {
    grid-template-columns: 1.3fr 1fr 0.8fr 0.8fr 1.4fr;
  }

  .cc-block {
    break-inside: avoid;
  }

  .cc-block + .cc-block {
    margin-block-start: 6mm;
  }

  .cc-block__head {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding-block-end: var(--space-1);
    color: var(--attend-text-muted);
    font-size: 11px;
    line-height: 14px;
  }

  .cc-pt {
    inline-size: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 12px;
    line-height: 16px;
  }

  .cc-pt__c-subject {
    inline-size: 15%;
  }

  .cc-pt__c-group {
    inline-size: 7%;
  }

  .cc-pt__c-time {
    inline-size: 12%;
  }

  .cc-pt__c-room {
    inline-size: 13%;
  }

  .cc-pt__c-person {
    inline-size: 17.66%;
  }

  .cc-pt th {
    block-size: 26px;
    padding: 0 4px 4px;
    border-block-end: 2px solid var(--attend-text-strong);
    color: var(--attend-text-strong);
    font-size: 10px;
    font-weight: var(--weight-label);
    line-height: 12px;
    text-align: start;
    vertical-align: bottom;
  }

  .cc-pt td {
    padding: 5px 4px;
    border-block-end: 1px solid var(--attend-border);
    color: var(--attend-text-strong);
    vertical-align: top;
    overflow-wrap: anywhere;
  }

  .cc-pt td.cc-pt__session {
    border-block-end-color: var(--attend-border-strong);
    font-weight: var(--weight-bold);
  }

  .cc-pt td bdi {
    font-weight: var(--weight-bold);
  }

  .cc-pt__g {
    display: block;
    color: var(--attend-text);
    font-size: 11px;
    font-weight: var(--weight-label);
  }

  .cc-pt .cc-pt__none {
    color: var(--attend-text-muted);
  }

  .cc-note {
    padding-block-start: 6mm;
  }

  .cc-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10mm;
    margin-block-start: 10mm;
    color: var(--attend-text);
    font-size: 12px;
    line-height: 16px;
  }

  .cc-sign p {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
  }

  .cc-sign__line {
    flex: 1;
    block-size: 16px;
    border-block-end: 1px solid var(--attend-border-strong);
  }
}

/* --- clinics integration --- */
/* "More → Don't take asks from this student" on the "Waiting for you" cards
 * (canvas C-AskedA): the panel opens below the button, on its end side. */
@layer components {
  .ask-card .actions {
    align-items: center;
  }

  .ask-card__menu {
    margin-inline-start: auto;
  }

  .ask-card__more + .ask-card__menu {
    margin-inline-start: 0;
  }

  .ask-card__menu .tools-more__panel {
    inset-block: calc(100% + var(--space-1)) auto;
    inset-inline: auto 0;
  }

  .ask-card__menu form {
    display: contents;
  }

  /* The flow's name above a step's question (canvas C-AskAssist1-3). */
  .flow-name {
    margin: 0 0 var(--space-1);
  }
}

/* --- clinics steps hotfix (2026-11-20) --- */
/* The earlier choices under a step's question, each with a × that clears it;
 * a search box's × (owner "clear buttons"); the clinic and day cards. */
@layer components {
  .flow-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-2) 0 0;
    padding: 0;
    list-style: none;
  }

  .flow-chip-choice {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    max-inline-size: 100%;
    padding-inline: var(--space-3) 0;
    border: 1px solid var(--attend-edge);
    border-radius: var(--r-pill);
    background: var(--attend-surface);
    color: var(--attend-text-strong);
    font-size: var(--text-small);
  }

  .flow-chip-choice__label {
    min-inline-size: 0;
    overflow-wrap: anywhere;
  }

  .flow-chip-choice__clear {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    min-inline-size: 44px;
    min-block-size: 44px;
    border-radius: var(--r-pill);
    color: var(--attend-text-muted);
  }

  @media (hover: hover) and (pointer: fine) {
    .flow-chip-choice__clear:hover {
      color: var(--attend-text-strong);
    }
  }

  .flow-chip-choice__clear .icon {
    inline-size: 16px;
    block-size: 16px;
  }

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

  .pick-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-block-size: 56px;
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--attend-edge);
    border-radius: var(--r-md);
    background: var(--attend-surface);
    cursor: pointer;
  }

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

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

  .pick-card:has(input:disabled) {
    cursor: not-allowed;
  }

  .pick-card--everyone {
    border-style: dashed;
  }

  .pick-card input {
    flex: none;
  }

  /* A request's one-tap "Cancel request" on its session row (owner "clear buttons"). */
  .clinic-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }

  .clinic-row-actions form {
    margin: 0;
  }
}

/* --- clinics "Clear finished" (2026-11-20) --- */
@layer components {
  .clinics-clear {
    justify-content: flex-end;
    margin-block: 0 var(--space-2);
  }
}

/* --- clinics approval slip (F3, 2026-11-20; canvas C-ApprovalSlipAr,
   C-ApprovalSlipPrint, C-ApprovalVerify) --- */
@layer components {
  .slip {
    display: grid;
    gap: var(--space-4);
  }

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

  .slip__text {
    margin: 0;
    color: var(--attend-text-strong);
    font-size: var(--text-section);
    line-height: 1.9;
  }

  .slip__text bdi,
  .sp-text bdi {
    font-weight: var(--weight-strong);
  }

  .slip__by {
    margin: 0;
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--attend-border);
    color: var(--attend-text);
    font-size: var(--text-support);
  }

  .slip__by bdi,
  .sp-by bdi {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .slip-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    margin-block-start: var(--space-6);
    text-align: center;
  }

  /* The code's 4-module quiet zone is inside the SVG: the box only frames it. */
  /* segno draws black modules: white in both themes (as .phone-qr__svg), so the
     supervisor's camera reads it in dark mode too. */
  .slip-qr__box {
    padding: var(--space-2);
    border: 1px solid var(--attend-border-strong);
    border-radius: var(--r-md);
    background: var(--attend-projection-bg);
    color: var(--attend-projection-fg);
    line-height: 0;
  }

  .slip-qr__svg {
    display: block;
    inline-size: 168px;
    block-size: 168px;
  }

  .slip-qr__label {
    margin: 0;
    color: var(--attend-text);
    font-size: var(--text-small);
  }

  /* The short code a supervisor can read out when the camera fails. */
  .slip-qr__code {
    margin: 0;
    color: var(--attend-text-strong);
    font-size: var(--text-section);
    font-weight: var(--weight-strong);
    letter-spacing: 0.08em;
  }

  .slip-qr + .actions {
    margin-block-start: var(--space-6);
  }

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

  .av-code {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
    letter-spacing: 0.06em;
  }

  /* The paper. */
  .exam-sheet__facts.sp-facts {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .sp-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-8);
    align-items: start;
    margin-block-start: var(--space-8);
  }

  .sp-text {
    margin: 0;
    color: var(--attend-text-strong);
    font-size: var(--text-section);
    line-height: 2;
  }

  .sp-by {
    margin: var(--space-6) 0 0;
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--attend-border-strong);
    color: var(--attend-text);
  }

  .sp-qr {
    margin: 0;
  }

  .sp-qr .slip-qr__box {
    border-color: var(--attend-text-strong);
    border-radius: 0;
  }

  .sp-note {
    padding-block-start: var(--space-8);
  }

  /* Clinic booking rules (plans/clinic-booking §13; the approved Rules board):
     cards in one column, "Who can book" and "When" side by side when there is
     room; the clinics table scrolls inside its card (a card per clinic on a
     phone, table--cards); one form, no script. */
  .bk-rules-stages {
    margin-block: 0 var(--space-4);
  }

  .bk-rules-stages .segmented__option {
    text-decoration: none;
  }

  .bk-rules-stages .segmented__option[aria-current="page"] {
    background: var(--attend-brand);
    color: var(--attend-on-brand);
  }

  .bk-rules,
  .bk-rules__all {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .bk-rules h2 {
    margin: 0;
    font-size: var(--text-section);
  }

  .bk-rules .card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
  }

  .bk-rules .bk-rules__switch {
    flex-flow: row wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4) var(--space-6);
  }

  .bk-rules__switch-text {
    flex: 1 1 260px;
  }

  .bk-rules__switch-text p {
    margin: var(--space-1) 0 0;
  }

  .bk-rules__switch-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
  }

  .bk-rules__onoff {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .bk-rules__history {
    flex-basis: 100%;
    margin: 0;
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--attend-border);
  }

  .bk-rules__pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: var(--space-4);
  }

  .bk-rules__options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    border: 0;
  }

  /* One choice: its radio, its name, then its help and its own numbers. */
  .bk-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-1) var(--space-3);
    align-items: start;
    padding: var(--space-3);
    border-radius: var(--r-sm);
  }

  .bk-option:has(> input:checked) {
    background: var(--attend-row-selected);
  }

  .bk-option > input {
    margin-block-start: 3px;
  }

  /* Under 44px only for a mouse (tests/test_css_touch.py). On a touch screen
     the radio keeps app.css's 18px box, and its label (for=) takes the tap. */
  @media (pointer: fine) {
    .bk-option > input {
      min-width: 18px;
      min-height: 18px;
    }
  }

  .bk-option > label {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .bk-option > :not(input, label) {
    grid-column: 2;
  }

  .bk-option__help {
    margin: 0;
  }

  .bk-option__more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-small);
  }

  .bk-num {
    inline-size: 5em;
    text-align: end;
  }

  /* A Max's "No cap" tick under its number (owner D3 a); the label row is the
     44px target. */
  .bk-nocap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-1);
    min-height: var(--touch);
    white-space: nowrap;
  }

  /* The dean's office's clinic booking pages (plans/clinic-booking §13
     "Session", "Week"): the figures, a session's rows and forms, the clinic x
     day grid. Phone first: the rows are cards (table--cards), the grid scrolls
     sideways inside table-wrap, the forms wrap. */
  .bk-office__when {
    margin: 0 0 var(--space-4);
  }

  .bk-office__summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-block-end: var(--space-4);
  }

  .bk-office__tiles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-6);
    margin: 0;
  }

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

  .bk-office__tiles dd {
    margin: 0;
  }

  .bk-office__tiles dd:first-of-type {
    font-size: var(--text-section);
    font-weight: var(--weight-strong);
  }

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

  .bk-office__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .bk-office__marks {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .bk-office__reason form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-block-start: var(--space-2);
  }

  .bk-office__reason .field {
    margin: 0;
  }

  .bk-office__ended,
  .bk-office__cells {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bk-office__ended li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    min-height: var(--touch);
    border-block-end: 1px solid var(--attend-border);
  }

  /* Excuse late cancel (D118): opened, its form takes the whole row. */
  .bk-office__ended .bk-office__reason[open] {
    flex-basis: 100%;
    padding-block-end: var(--space-2);
  }

  .bk-office__forms {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-block-start: var(--space-4);
  }

  .bk-office__forms > .card {
    flex: 1 1 18rem;
    min-width: 0;
  }

  .bk-office__form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .bk-office__form .field,
  .bk-office__form textarea {
    inline-size: 100%;
    margin: 0;
  }

  .bk-office__grid th[scope="row"] {
    white-space: nowrap;
  }

  .bk-office__cells a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: var(--touch);
  }

  .bk-rules__approval {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--attend-border);
  }

  .bk-rules__approval p {
    margin: 0;
  }

  .bk-rules__table th.num,
  .bk-rules__table td.num {
    text-align: end;
  }

  .bk-rules__table td .field__error {
    margin: var(--space-1) 0 0;
    text-align: start;
  }

  .bk-rules__overall {
    border-block-start: 2px solid var(--attend-border-strong);
    background: var(--attend-row-selected);
  }

  .bk-rules__note {
    margin: 0;
  }

  .bk-rules__ticks {
    display: flex;
    flex-direction: column;
  }

  .bk-rules__block {
    padding-inline: 0;
  }

  .bk-rules__actions {
    justify-content: flex-end;
  }
}

@layer components {
  /* The student's clinic booking (plans/clinic-booking §13; the Main, Booked,
     Limit and Mine boards): THIS WEEK and its chips, the day strip, the rows of
     a day, the sheets (Booked, Limit, the cancel's confirm step) and My
     appointments' tiles and lists. */
  .bk-week,
  .bk-limits {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-block-end: var(--space-4);
  }

  .bk-week__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .bk-week__head .section-label {
    margin: 0;
  }

  .bk-week__count {
    margin: 0;
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .round-progress.bk-week__bar {
    margin: 0;
  }

  .bk-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-small);
  }

  .bk-chip {
    padding: 3px var(--space-3);
    border-radius: var(--r-pill);
    background: var(--attend-inactive-bg);
    color: var(--attend-inactive-text);
  }

  .bk-chip--reached {
    background: var(--attend-warning-bg);
    color: var(--attend-warning-text);
    font-weight: var(--weight-strong);
  }

  .bk-days {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: var(--space-2);
    margin-block-end: var(--space-4);
  }

  .bk-days__day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-block-size: var(--touch);
    padding-block: var(--space-2);
    border: 1px solid var(--attend-card-edge);
    border-radius: var(--r-sm);
    background: var(--attend-surface);
    color: var(--attend-text);
    font-size: var(--text-small);
    text-decoration: none;
  }

  .bk-days__day[aria-current="true"] {
    border-color: var(--attend-brand);
    background: var(--attend-brand);
    color: var(--attend-on-brand);
    font-weight: var(--weight-strong);
  }

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

  .bk-day,
  .card.bk-mine {
    padding: 0;
  }

  .bk-rows,
  .bk-mine {
    --time-tile: 48px;

    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* As the agenda's time tile: "10:30 ص" needs 4.5rem (student.css). */
  :lang(ar) :is(.bk-rows, .bk-mine) {
    --time-tile: 4.5rem;
  }

  .bk-row,
  .bk-mine__row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .bk-row + .bk-row,
  .bk-mine__row + .bk-mine__row {
    border-block-start: 1px solid var(--attend-border);
  }

  /* The whole entry is the target (visual-design.md §7 "List rows", as .row):
     a My appointments entry whose title is a link (Coming up, Assisting)
     stretches it over the entry; its Cancel, Accept and Decline and its QR
     stay above the stretched link. */
  .bk-mine__row {
    position: relative;
  }

  .bk-mine__row .bk-row__title a::after {
    content: "";
    position: absolute;
    inset: 0;
  }

  .bk-mine__row :is(.bk-mine__cancel, form, .bk-qr) {
    position: relative;
    z-index: 1;
  }

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

  .bk-row__title,
  .bk-row__meta,
  .bk-row__note {
    margin: 0;
  }

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

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

  .round-progress.bk-row__bar {
    max-inline-size: none;
    block-size: 4px;
    margin: 0;
  }

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

  .bk-row__note--limit {
    color: var(--attend-warning-text);
    font-weight: var(--weight-strong);
  }

  .bk-row__book {
    min-block-size: var(--touch);
    border-radius: var(--r-pill);
  }

  .bk-opening {
    margin-block: var(--space-4) 0;
  }

  /* Booked, Limit and the cancel's confirm step: one sheet of the board. */
  .bk-sheet {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    max-inline-size: 560px;
    margin-inline: auto;
  }

  .bk-sheet h1 {
    margin: 0;
  }

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

  .bk-sheet__mark,
  .bk-sheet__warn {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }

  .bk-sheet__mark {
    inline-size: 64px;
    block-size: 64px;
    background: var(--attend-positive-solid);
    color: var(--attend-on-brand);
  }

  /* Waiting for the assistant (Part D, D59): not approved yet, so not green. */
  .bk-sheet__mark--wait {
    background: var(--attend-info-bg);
    color: var(--attend-info-text);
  }

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

  .bk-sheet__warn {
    inline-size: 44px;
    block-size: 44px;
    background: var(--attend-warning-bg);
    color: var(--attend-warning-text);
  }

  .bk-sheet__why,
  .bk-sheet .banner,
  .bk-sheet__facts {
    margin: 0;
  }

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

  .bk-counters {
    margin: 0;
    padding: 0;
    border: 1px solid var(--attend-card-edge);
    border-radius: var(--r-md);
    list-style: none;
  }

  .bk-counters li {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .bk-counters li + li {
    border-block-start: 1px solid var(--attend-border);
  }

  .bk-counters strong {
    color: var(--attend-text-strong);
    white-space: nowrap;
  }

  .bk-counters .bk-counters__reached {
    color: var(--attend-warning-text);
  }

  /* My appointments. */
  .bk-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .bk-tile .section-label,
  .bk-tile__value {
    margin: 0;
  }

  .bk-tile__value {
    color: var(--attend-text-strong);
    font-size: 20px;
    font-weight: var(--weight-strong);
  }

  .bk-tile__cap {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: normal;
  }

  .round-progress.bk-tile__bar {
    max-inline-size: none;
    block-size: 4px;
    margin-block: var(--space-2) 0;
  }

  .bk-clinics summary {
    min-block-size: var(--touch);
    padding-block: var(--space-2);
    color: var(--attend-brand-text);
    font-weight: var(--weight-strong);
    cursor: pointer;
  }

  .bk-clinics__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bk-clinics__list p {
    margin: 0;
  }

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

  .bk-mine__day {
    min-inline-size: var(--time-tile);
    padding: var(--space-2);
    border-radius: var(--r-sm);
    background: var(--attend-brand-tint);
    color: var(--attend-brand-text);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
    line-height: 1.2;
    text-align: center;
  }

  .bk-mine__cancel {
    min-block-size: var(--touch);
    border: 1px solid var(--attend-border-strong);
    border-radius: var(--r-pill);
  }
  /* Clinic halls (plans/clinic-booking Part D, P1): a card per hall, in one
     column; the chairs and a senior's University ID are short forms that wrap
     under their label on a phone; each senior is a row with Remove at the end. */
  .bk-halls__intro {
    margin: 0 0 var(--space-4);
  }

  .bk-halls {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bk-hall {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
  }

  .bk-hall h2 {
    margin: 0;
    font-size: var(--text-section);
  }

  .bk-hall .section__head p,
  .bk-hall__count {
    margin: 0;
  }

  .bk-hall__form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2) var(--space-3);
  }

  .bk-hall__form .field {
    margin: 0;
  }

  .bk-hall__seniors {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .bk-hall__seniors li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-block-size: var(--touch);
    border-block-end: 1px solid var(--attend-border);
  }

  /* Adding a senior (owner D66): the staff the field matches, under it, in the
     seniors' row style, each with Add. */
  .bk-hall__found:not(:empty) {
    margin-block-start: var(--space-2);
  }

  .bk-hall__found p {
    margin: 0;
  }
  /* The student's code for the senior (clinic booking Part D, P4): big and on
     white in both themes (segno draws black modules, as .slip-qr__box), the
     4-module quiet zone inside the SVG; it scales with the box, never a sized
     drawing forced into one. */
  .bk-qr {
    display: flex;
    flex-basis: 100%;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin-block: var(--space-3) 0;
    text-align: center;
  }

  .bk-qr__box {
    inline-size: min(100%, 288px);
    padding: var(--space-2);
    border: 1px solid var(--attend-border-strong);
    border-radius: var(--r-md);
    background: var(--attend-projection-bg);
    color: var(--attend-projection-fg);
    line-height: 0;
  }

  .bk-qr__svg {
    display: block;
    inline-size: 100%;
    block-size: auto;
  }

  .bk-qr__chair {
    margin: 0;
    color: var(--attend-text-strong);
    font-size: var(--text-section);
    font-weight: var(--weight-strong);
  }

  .bk-qr__label {
    margin: 0;
    color: var(--attend-text);
    font-size: var(--text-small);
  }

  /* The senior's screens (clinic booking Part D, P3): phone first, every
     control 44px and up, logical properties only. My clinic today: one link
     per session. */
  .sr-list,
  .sr-rows {
    margin: 0;
    padding: 0;
    list-style: none;
  }

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

  .sr-list__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-block-size: var(--touch);
    padding: var(--space-3) var(--space-4);
    color: inherit;
    text-decoration: none;
  }

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

  .sr-list__time {
    flex-shrink: 0;
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

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

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

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

  /* A session's page: Scan first, then the live part. */
  .sr-scan {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-block-end: var(--space-4);
  }

  .sr-scan__start {
    min-block-size: var(--touch);
  }

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

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

  .sr-head__count {
    margin: 0;
  }

  .sr-head__all {
    min-block-size: var(--touch);
  }

  .sr-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .sr-row__main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-inline-size: 0;
  }

  .sr-row__who {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    min-inline-size: 0;
  }

  .sr-row__chair,
  .sr-row__name,
  .sr-row__id {
    margin: 0;
  }

  .sr-row__chair {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

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

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

  .sr-photo {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    inline-size: 56px;
    block-size: 56px;
    border-radius: var(--r-sm);
    background: var(--attend-raised);
    color: var(--attend-text-muted);
    object-fit: cover;
  }

  .sr-photo--small {
    inline-size: 40px;
    block-size: 40px;
  }

  .sr-photo--large {
    inline-size: 96px;
    block-size: 96px;
  }

  .sr-photo--none {
    border: 1px solid var(--attend-border);
  }

  .sr-marks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }

  .sr-marks form {
    display: flex;
  }

  .btn.sr-mark {
    flex: 1;
    min-block-size: var(--touch);
  }

  /* Undo under a marked pair (owner D76): the whole row's width. */
  .sr-marks__undo {
    grid-column: 1 / -1;
  }

  .btn.sr-mark--present[aria-pressed="true"] {
    border-color: var(--attend-positive-solid);
    background: var(--attend-positive-solid);
    color: var(--attend-on-brand);
  }

  .btn.sr-mark--absent[aria-pressed="true"] {
    border-color: var(--attend-danger-solid);
    background: var(--attend-danger-solid);
    color: var(--attend-on-brand);
  }

  /* The assistant, under the booker, marked on their own. */
  .sr-assist {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-inline-start: var(--space-4);
    border-inline-start: 2px solid var(--attend-border);
  }

  /* A scan's result: the photo to match, the name, the chair, the role, Undo. */
  .sr-result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .sr-result:focus-visible,
  .sr-refused:focus-visible {
    outline: 2px solid var(--attend-focus);
    outline-offset: 2px;
  }

  .sr-result__who {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    min-inline-size: 0;
  }

  .sr-result__name,
  .sr-result__chair,
  .sr-result__role {
    margin: 0;
  }

  .sr-result__name {
    color: var(--attend-text-strong);
    font-size: var(--text-section);
    font-weight: var(--weight-strong);
    overflow-wrap: anywhere;
  }

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

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

  .sr-result__undo {
    display: flex;
    flex-basis: 100%;
  }

  .sr-result__undo .btn {
    flex: 1;
    min-block-size: var(--touch);
  }
}

/* The Clinics settings page's "Rules per clinic" (plans/clinic-swap-operative
   Part 1, 2; canvas board 18): a block of the settings form under the clinic
   subjects, a table with a row per ticked clinic subject, by stage. */
@layer components {
  .cl-rules {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--attend-border);
  }

  .cl-rules__title {
    margin: 0;
    color: var(--attend-text-strong);
    font-size: var(--text-section);
    font-weight: var(--weight-strong);
  }

  .cl-rules__clinic,
  .cl-rules__chairs {
    color: var(--attend-text-strong);
    font-weight: var(--weight-strong);
  }

  .cl-rules__stage th {
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-bold);
    text-align: start;
  }

  .cl-rules__table td .field__error {
    margin: var(--space-1) 0 0;
  }

  .cl-rules__note {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }
}

/* The swap limit on Take a slot and the office's review
   (plans/clinic-swap-operative Part 1; canvas TakeSlotSession, TakeSlotCheck,
   OfficeSwapReview): the counter strip, an info banner with a dot per swap the
   dean allows (filled for each one used), and the taker's count past the limit. */
@layer components {
  .sl-strip {
    align-items: center;
  }

  .sl-strip .icon {
    flex: none;
    margin-block-start: 0;
  }

  .sl-strip__words {
    flex: 1;
    margin: 0;
  }

  .sl-strip__words strong {
    color: var(--attend-text-strong);
    font-weight: var(--weight-bold);
  }

  .sl-strip__dots {
    display: flex;
    flex: none;
    gap: var(--space-1);
  }

  .sl-strip__dot {
    inline-size: 14px;
    block-size: 6px;
    border-radius: var(--r-pill);
    background: var(--attend-progress-track);
  }

  .sl-strip__dot--on {
    background: var(--attend-brand);
  }

  .kv + .sl-strip {
    margin-block: var(--space-4) 0;
  }

  .sl-over {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--attend-danger-text);
    font-weight: var(--weight-strong);
  }
}

/* A clinic in pairs: the student's card on Today, in Clinics and on Operate in
   pairs, and Choose your assistant (plans/clinic-swap-operative step 3b; canvas
   Main, ConfirmPick, ConfirmCheck, ConfirmWaiting, AssistantInvite, NotComing).
   The card is the app's .card; its lines stack, the status is a chip, the
   buttons are full width under it (Accept and Decline side by side). */
@layer components {
  .pr-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-block-end: var(--space-6);
  }

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

  .pr-card__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
  }

  .pr-card__title .icon,
  .pr-card__eyebrow .icon {
    flex: none;
    color: var(--attend-brand-text);
  }

  .pr-card__eyebrow {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-small);
  }

  .pr-card__when {
    margin: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-small);
  }

  .pr-card__lead {
    margin: var(--space-2) 0 0;
    color: var(--attend-text-strong);
    font-weight: var(--weight-bold);
  }

  .pr-card__meta,
  .pr-card__note,
  .pr-note {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-small);
  }

  .pr-card__meta .icon,
  .pr-card__note .icon,
  .pr-note .icon {
    flex: none;
    margin-block-start: 0.15em;
  }

  .pr-card__status,
  .pr-card__text {
    margin: 0;
  }

  .pr-card__facts {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin: var(--space-2) 0 0;
    padding: 0;
    list-style: none;
  }

  .pr-card__facts li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .pr-card__facts .icon {
    flex: none;
    margin-block-start: 0.2em;
    color: var(--attend-text-muted);
  }

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

  .pr-card__actions--two {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pr-card__actions form {
    margin: 0;
  }

  /* Choose your assistant: the quick picks and the group, one pick card each. */
  .pr-picks .section-label,
  .pr-group .section-label {
    margin-block-start: 0;
  }

  .pr-group {
    margin-block-start: var(--space-6);
  }

  .pr-search {
    margin-block-end: var(--space-2);
  }

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

  .pr-count {
    margin-block: 0 var(--space-2);
  }

  .pr-option__avatar {
    inline-size: 36px;
    block-size: 36px;
  }

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

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

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

  .pr-option--off .pr-option__name,
  .pr-option--off .pr-option__avatar {
    color: var(--attend-text-muted);
  }

  .pr-option--off {
    background: transparent;
  }

  .pr-note {
    margin-block-start: var(--space-3);
  }
}

/* Senior attendance in every clinic (plans/clinic-swap-operative Part 3, step 5;
   canvas SeniorRoster, SeniorOperative): the marks-so-far strip, the note, the
   sections with their counts, a row's role line and its pair heading. Phone
   first, logical properties only; the rows and marks are the booked page's. */
@layer components {
  .sr-counts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0 0 var(--space-3);
    border: 1px solid var(--attend-border);
    border-radius: var(--r-md);
    background: var(--attend-surface);
  }

  .sr-counts__item {
    display: flex;
    flex-direction: column;
    gap: var(--space-05);
    padding: var(--space-3);
    min-inline-size: 0;
  }

  .sr-counts__item + .sr-counts__item {
    border-inline-start: 1px solid var(--attend-border);
  }

  .sr-counts dt {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--attend-text-muted);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
  }

  .sr-counts__item--present dt {
    color: var(--attend-positive-text);
  }

  .sr-counts__item--absent dt {
    color: var(--attend-danger-text);
  }

  .sr-counts dd {
    margin: 0;
    color: var(--attend-text-strong);
    font-size: var(--text-num-m);
    font-weight: var(--weight-strong);
  }

  .sr-note {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: var(--space-3) 0 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }

  .sr-section {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-block: var(--space-5) var(--space-2);
  }

  .sr-section__count {
    display: inline-grid;
    place-items: center;
    min-inline-size: 20px;
    padding-inline: var(--space-1);
    border-radius: var(--r-pill);
    background: var(--attend-inactive-bg);
    color: var(--attend-inactive-text);
  }

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

  .sr-row__line {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);
    margin: 0;
    color: var(--attend-text-muted);
    font-size: var(--text-small);
  }
}
