/* The pieces the approved layout is made of. Design system 2.0.
 *
 * 2.0 keeps every 1.x class and its look. Changes to existing rules are
 * marked "2.0:"; the new components start at the "2.0 — new components"
 * divider further down. Page structure lives in layouts.css, movement in
 * motion.css.
 *
 * Plain CSS on purpose: the package stays usable outside React, and both
 * applications become thin wrappers over the same classes instead of two
 * separate interpretations of the same drawing.
 *
 * Measurements come from docs/design-canvas/Main.dc.html — the approved screen —
 * not from taste.
 */

/* ── The page ─────────────────────────────────────────────────────────── */

.aida-page {
  max-width: var(--container);
  margin: 0 auto;
  padding: 32px var(--gutter);
  box-sizing: border-box;
}

@media (max-width: 720px) {
  .aida-page { padding: 20px var(--gutter-phone); }
}

/* ── Top bar: mark left, sections in a line, person right ─────────────── */

.aida-topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
}
.aida-topbar__nav {
  display: flex;
  gap: 28px;
  font-size: var(--text-m);
  align-items: baseline;
}
.aida-topbar__link {
  color: var(--ink-2);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 3px solid transparent;
}
.aida-topbar__link:hover { color: var(--ink); }
.aida-topbar__link[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--sun);
}

/* ── Page head: one big title, one sentence, the tiles ────────────────── */

.aida-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  padding-bottom: 26px;
  border-bottom: 2px solid var(--ink);
}
.aida-head__title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: var(--tracking-hero);
  line-height: var(--leading-hero);
  margin: 0;
}
.aida-head__lead {
  font-size: var(--text-l);
  color: var(--ink-2);
  margin: 14px 0 0;
  max-width: 52ch;
}
.aida-head__tiles { display: flex; gap: 10px; align-items: stretch; }

@media (max-width: 860px) {
  .aida-head { grid-template-columns: 1fr; gap: 22px; align-items: start; }
  .aida-head__title { font-size: 34px; letter-spacing: -0.035em; line-height: 1.02; }
  .aida-head__tiles { flex-wrap: wrap; }
}

/* ── The numeric tile. Square, no shadow, no radius ───────────────────── */

.aida-tile {
  padding: 14px 20px 12px;
  min-width: 92px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid transparent;
}
.aida-tile__n {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1;
}
.aida-tile__label { font-size: var(--text-xs); margin-top: 6px; }

/* The sun at full strength with dark text on it — 9.7:1. */
.aida-tile--sun { background: var(--sun); color: var(--ink); }
.aida-tile--ink { background: var(--ink); color: var(--on-dark); }
.aida-tile--quiet { border-color: var(--rule); color: var(--ink-2); }

@media (max-width: 860px) {
  .aida-tile { min-width: 0; flex: 1; padding: 12px 14px 10px; }
  .aida-tile__n { font-size: 30px; }
}

/* ── The list. A row, not a card ──────────────────────────────────────── */

.aida-list { display: flex; flex-direction: column; }

.aida-row {
  display: grid;
  grid-template-columns: 62px 1fr minmax(120px, auto);
  gap: 24px;
  align-items: center;
  padding: 19px 0;
  border-top: 1px solid var(--rule);
  text-align: left;
  width: 100%;
  background: none;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  color: inherit;
  font: inherit;
}
.aida-list > .aida-row:first-child { border-top: none; }
a.aida-row, button.aida-row { cursor: pointer; text-decoration: none; }
a.aida-row:hover .aida-row__title,
button.aida-row:hover .aida-row__title { text-decoration: underline; }

.aida-row__mark { width: 46px; height: 46px; display: block; }
.aida-row__title {
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: 400;
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-title);
}
.aida-row__sub {
  font-size: var(--text-s);
  color: var(--ink-3);
  margin-top: 7px;
}
.aida-row--done .aida-row__title { color: var(--ink-2); }

@media (max-width: 720px) {
  .aida-row {
    grid-template-columns: 40px 1fr;
    grid-template-areas: 'mark body' '. state';
    gap: 6px 14px;
    padding: 16px 0;
  }
  .aida-row__mark { grid-area: mark; width: 40px; height: 40px; }
  .aida-row__body { grid-area: body; }
  .aida-row__state { grid-area: state; text-align: left; }
  .aida-row__title { font-size: 19px; }
}

/* ── State: a word, always. Colour is never on its own ────────────────── */

.aida-state {
  text-align: right;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-2);
}
.aida-state--alarm { color: var(--alarm); }
.aida-state--quiet { color: var(--ink-3); }

/* ── Buttons ──────────────────────────────────────────────────────────── */

.aida-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-min);
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  /* 2.0: without this a <button class="aida-btn aida-btn--quiet"> kept the
     browser's grey button face; only <a> buttons were really transparent. */
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-m);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--motion-fast) var(--ease),
              border-color var(--motion-fast) var(--ease);
}
.aida-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.aida-btn[disabled], .aida-btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* The main action: the sun at full strength, dark letters on it. */
.aida-btn--sun { background: var(--sun); color: var(--ink); }
.aida-btn--sun:hover:not([disabled]) { background: var(--mane); }

.aida-btn--ink { background: var(--ink); color: var(--on-dark); }
/* 2.0: the hover shade is a named token now, not a number typed here. */
.aida-btn--ink:hover:not([disabled]) { background: var(--ink-hover); }

.aida-btn--quiet { border-color: var(--rule); color: var(--ink); }
.aida-btn--quiet:hover:not([disabled]) { border-color: var(--ink); }

.aida-btn--danger { border-color: var(--alarm); color: var(--alarm); }
.aida-btn--danger:hover:not([disabled]) { background: var(--alarm); color: var(--on-dark); }

@media (prefers-reduced-motion: reduce) {
  .aida-btn { transition: none; }
}

/* ── Links: ink with an underline. No coloured link text ──────────────── */

.aida-link {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.aida-link:hover { text-decoration-thickness: 2px; }

/* ── Fields ───────────────────────────────────────────────────────────── */

.aida-field { display: block; }
.aida-field__label {
  display: block;
  font-size: var(--text-s);
  font-weight: 600;
  margin-bottom: 6px;
}
.aida-field__input,
.aida-field__area {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--touch-min);
  padding: 10px 12px;
  /* 2.0: was --rule (1.3:1). The edge of an empty field is how anyone finds
     it; WCAG 1.4.11 asks 3:1 of that edge, --line-control is 3.1:1. */
  border: 1px solid var(--line-control);
  border-radius: var(--radius-s);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-m);
}
.aida-field__area { min-height: 96px; resize: vertical; line-height: var(--leading-text); }
.aida-field__input::placeholder,
.aida-field__area::placeholder { color: var(--ink-3); }
.aida-field__input:focus-visible,
.aida-field__area:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  border-color: var(--ink);
}
.aida-field__hint { font-size: var(--text-s); color: var(--ink-3); margin-top: 6px; }
.aida-field__error { font-size: var(--text-s); color: var(--alarm); margin-top: 6px; }
.aida-field--invalid .aida-field__input,
.aida-field--invalid .aida-field__area { border-color: var(--alarm); }

/* ── Caption / section label ──────────────────────────────────────────── */

.aida-caps {
  font-size: var(--text-caps);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── Bar: the one place sun-mid appears ───────────────────────────────── */

.aida-bar { height: 4px; background: var(--rule); overflow: hidden; }
.aida-bar__fill { height: 100%; background: var(--sun-mid); }

/* On a phone the state word sits under the title, so it reads left like
   everything else in the row. This comes after .aida-state on purpose — it has
   to win over the right alignment above. */
@media (max-width: 720px) {
  .aida-row__state { text-align: left; }
}

/* ── Table: the same list, with a header ──────────────────────────────── */
/* A table here is a list that happens to have columns. Hairlines between
   rows, nothing between columns, no zebra, no fill on the header. */

.aida-table { width: 100%; border-collapse: collapse; text-align: left; }
.aida-table th {
  font-size: var(--text-caps);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 0 16px 10px 0;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}
.aida-table td {
  padding: 14px 16px 14px 0;
  border-top: 1px solid var(--rule);
  vertical-align: middle;
  font-size: var(--text-m);
}
.aida-table tbody tr:first-child td { border-top: none; }
.aida-table th:last-child, .aida-table td:last-child { padding-right: 0; }
.aida-table__num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Row actions: a word, not a mystery glyph ─────────────────────────── */
/* Five identical icons with no labels used to sit in a row here, with delete
   pressed against duplicate. Actions are words now, and the destructive one is
   pushed away from the rest. */
.aida-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  justify-content: flex-end;
}
.aida-actions__danger { margin-left: 8px; padding-left: 16px; border-left: 1px solid var(--rule); }

@media (max-width: 720px) {
  /* On a phone the actions live under the title, so they read left to right
     like the rest of the row instead of hugging an edge that is not there. */
  .aida-actions { justify-content: flex-start; }
  .aida-actions__danger { margin-left: 0; padding-left: 0; border-left: 0; }
}

/* ── Modal: paper on a dimmed page ────────────────────────────────────── */

.aida-modal__scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);   /* 2.0: token, was a typed value */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  z-index: 50;
}
.aida-modal {
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  max-width: 560px;
  margin: auto;
  padding: 28px 32px 32px;
  border: 1px solid var(--rule);
}
.aida-modal__title {
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: 800;
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-title);
  margin: 0 0 4px;
}
.aida-modal__lead { color: var(--ink-2); font-size: var(--text-s); margin: 0 0 20px; }
.aida-modal__foot {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

@media (max-width: 720px) {
  .aida-modal { padding: 20px 16px 24px; }
  .aida-modal__scrim { padding: 0; }
}

/* ── Tabs: an underline, not a filled pill ────────────────────────────── */

.aida-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--rule); }
.aida-tab {
  min-height: var(--touch-min);
  padding: 0 0 10px;
  /* 2.0: a <button class="aida-tab"> kept the browser's button frame on the
     other three sides; only the bottom edge was ever set. */
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: var(--font);
  margin-bottom: -1px;
  font-size: var(--text-m);
  color: var(--ink-2);
  background: none;
  cursor: pointer;
}
.aida-tab[aria-selected='true'] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--sun);
}

/* A <dialog> in the top layer is centred by the browser, so it needs its own
   width rule instead of the scrim's flex centring. Both spellings exist because
   some dialogs are native and some are plain overlays. */
dialog.aida-modal {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
}
dialog.aida-modal::backdrop { background: var(--scrim); }

/* ── Pagination: numbers in a line ────────────────────────────────────── */

.aida-pager { display: flex; align-items: center; gap: 4px; }
.aida-pager__btn {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-m);
  color: var(--ink-2);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.aida-pager__btn:hover:not([disabled]) { color: var(--ink); }
.aida-pager__btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.aida-pager__btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.aida-pager__btn[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
  border-color: var(--ink);
}
.aida-pager__gap {
  min-width: 24px;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--text-m);
}

/* ── Skeleton: a grey bar where the text will land ────────────────────── */

.aida-skel { background: var(--rule); display: block; }
@media (prefers-reduced-motion: no-preference) {
  .aida-skel { animation: aida-skel-pulse 1.6s ease-in-out infinite; }
}
@keyframes aida-skel-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ── Head variants the admin needs ───────────────────────────────────── */
/* The HR pages put actions where the learner pages put numbers. */
.aida-head__act { display: flex; gap: 12px; align-items: center; }

/* A row with no mark. The admin lists people, tags and reports; none of them
   carry one of the six course symbols. */
.aida-row--plain { grid-template-columns: 1fr minmax(120px, auto); }
@media (max-width: 720px) {
  .aida-row--plain { grid-template-columns: 1fr; grid-template-areas: 'body' 'state'; }
}

/* ── Empty state: the sentence, and nothing else ──────────────────────── */
/* There used to be a teal drawing here. A drawing that says "no data" says
   less than the words do. */
.aida-empty {
  padding: 56px 0;
  text-align: center;
  color: var(--ink-2);
  font-size: var(--text-m);
}
.aida-empty__act { margin-top: 20px; }

/* ── Toolbar: the filters above a list ───────────────────────────────── */
.aida-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 20px 0;
}
.aida-toolbar__grow { flex: 1 1 240px; min-width: 0; }

/* A row that can be picked: a checkbox, the body, then state over actions. */
.aida-row--pick { grid-template-columns: 22px 1fr minmax(200px, auto); }
@media (max-width: 720px) {
  .aida-row--pick {
    grid-template-columns: 22px 1fr;
    grid-template-areas: 'pick body' '. state';
  }
  .aida-row__pick { grid-area: pick; }
}
.aida-row__pick { align-self: start; margin-top: 3px; }

.aida-check {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
  cursor: pointer;
}

/* ── Bulk bar: what happens to everything ticked ──────────────────────── */
.aida-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: var(--sun);
  color: var(--ink);
  padding: 12px 16px;
  font-size: var(--text-m);
}
.aida-bulk__act {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: var(--touch-min);
  background: none;
  border: 0;          /* 2.0: same button-frame fix as .aida-tab */
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* The one escalation. A tile that has to be noticed keeps the paper and takes
   the alarm outline — it never becomes a red block. */
.aida-tile--alarm { border-color: var(--alarm); color: var(--alarm); }

/* ── Section: a heading and a rule, not a card on grey ────────────────── */

.aida-panel { padding-top: 30px; }
.aida-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.aida-panel__title {
  font-family: var(--font-display);
  font-size: var(--text-l);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
.aida-panel__note { font-size: var(--text-s); color: var(--ink-3); }
.aida-panel__link { margin-left: auto; }

/* ── Breadcrumb: where this page hangs ────────────────────────────────── */
.aida-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: var(--text-s);
  color: var(--ink-3);
  padding-bottom: 14px;
}

/* No number yet. The tile keeps its shape but does not shout a dash the size
   of a headline. */
.aida-tile__n--none { font-size: var(--text-l); color: var(--ink-3); line-height: 1.4; }

/* ════════════════════════════════════════════════════════════════════════
   2.0 — the top bar on a phone
   ════════════════════════════════════════════════════════════════════════ */
/* In 1.x the sections sat in one line that never wrapped: at 390px with
   three sections the bar ran 64px off the screen. On a phone the sections
   now take their own line under the mark and scroll sideways if they must. */
@media (max-width: 720px) {
  .aida-topbar { flex-wrap: wrap; row-gap: 12px; }
  .aida-topbar__nav {
    order: 3;
    width: 100%;
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .aida-topbar__link { white-space: nowrap; }
}

/* ════════════════════════════════════════════════════════════════════════
   2.0 — focus everywhere
   ════════════════════════════════════════════════════════════════════════ */
/* 1.x drew a focus ring on buttons, fields and the pager only. Tabs, rows,
   links and the top bar fell back to whatever the browser draws — a
   different ring on every browser. One ring now, the one buttons had. */
.aida-tab:focus-visible,
.aida-link:focus-visible,
.aida-topbar__link:focus-visible,
.aida-bulk__act:focus-visible,
.aida-crumbs a:focus-visible,
.aida-panel__link:focus-visible,
.aida-nav__link:focus-visible,
.aida-seg__opt:focus-visible,
.aida-menu__item:focus-visible,
.aida-disclosure > summary:focus-visible,
.aida-switch:focus-visible,
.aida-choice__box:focus-visible,
.aida-drop:focus-within {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}
/* A row is as wide as the page: the ring goes inside it, not over the rows
   above and below. */
a.aida-row:focus-visible,
button.aida-row:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: calc(-1 * var(--focus-width));
}

/* ════════════════════════════════════════════════════════════════════════
   2.0 — new components
   Each one exists because a screen in LAYOUTS.md needs it. Same language as
   everything above: square, a line for depth, colour only as a fill, a word
   next to every state.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Select: the native one, dressed like a field ─────────────────────── */
/* Native on purpose: keyboard, screen readers and the phone's own picker
   come for free. The chevron is the icon font's expand_more.
   <span class="aida-select"><select class="aida-field__input">…</select>
   <span class="material-symbols-outlined" aria-hidden="true">expand_more</span></span> */
.aida-select { position: relative; display: block; }
.aida-select > select {
  appearance: none;
  padding-right: 40px;
  cursor: pointer;
}
.aida-select > .material-symbols-outlined {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--ink-2);
  pointer-events: none;
}

/* Dates and numbers line up in columns. */
.aida-field__input[type='date'],
.aida-field__input[type='time'],
.aida-field__input[type='number'] { font-variant-numeric: tabular-nums; }

/* Search is a field with type="search" and a visible label. There is no
   magnifier: `search` is not in icons/icons.txt, and the label already says
   what the field is for. */

/* ── Fieldset: a group of fields with a name ──────────────────────────── */
.aida-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.aida-fieldset > legend {
  padding: 0;
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-l);
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── Choice: a checkbox or a radio with its words, 44px tall ──────────── */
.aida-choice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch-min);
  font-size: var(--text-m);
  cursor: pointer;
}
.aida-choice__box {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
  accent-color: var(--ink);
  cursor: pointer;
}
.aida-choice__hint { display: block; font-size: var(--text-s); color: var(--ink-3); }

/* ── Switch: on/off that takes effect at once ─────────────────────────── */
/* <input type="checkbox" role="switch" class="aida-switch">. Square, like
   the rest: the track is touched (radius-s), the knob is not a circle.
   The label next to it names what is switched; the position is the state. */
.aida-switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  margin: 0;
  border: 1px solid var(--line-control);
  border-radius: var(--radius-s);
  background: var(--paper);
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease),
              border-color var(--motion-fast) var(--ease);
}
.aida-switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: var(--ink-2);
  transition: transform var(--motion) var(--ease);
}
.aida-switch:checked { background: var(--ink); border-color: var(--ink); }
.aida-switch:checked::before { transform: translateX(16px); background: var(--sun); }
.aida-switch:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Drop zone: a file goes here ──────────────────────────────────────── */
/* <label class="aida-drop"><input type="file" class="aida-sr"> … </label> */
.aida-drop {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: var(--space-6);
  border: 1px dashed var(--line-control);
  border-radius: var(--radius-s);
  font-size: var(--text-m);
  cursor: pointer;
}
.aida-drop__act { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.aida-drop__hint { font-size: var(--text-s); color: var(--ink-3); }
.aida-drop[data-over='true'] {
  border-style: solid;
  border-color: var(--ink);
  background: color-mix(in oklch, var(--sun) 15%, var(--paper));
}
.aida-drop[data-over='true'] .aida-drop__hint { color: var(--ink-2); } /* ink-3 is paper-only */

/* ── Toast: it happened, and you can undo it ──────────────────────────── */
/* role="status". An ink plaque, not green: "Saved" is a word, not a colour.
   One at a time; the newest replaces the last. */
.aida-toast {
  position: fixed;
  left: var(--gutter);
  bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: min(480px, calc(100vw - 2 * var(--gutter-phone)));
  padding: 4px 8px 4px 16px;
  background: var(--ink);
  color: var(--on-dark);
  font-size: var(--text-m);
  box-shadow: var(--float-shadow);
}
.aida-toast__text { flex: 1; padding: 10px 0; }
.aida-toast__act {
  min-height: var(--touch-min);
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--on-dark);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.aida-toast--alarm { background: var(--alarm); }   /* white on it 5.6:1 */
.aida-toast :focus-visible { outline: var(--focus-width) solid var(--on-dark); outline-offset: 0; }
@media (max-width: 720px) {
  .aida-toast { left: var(--gutter-phone); right: var(--gutter-phone); max-width: none; }
}

/* ── Tooltip: a short fact about a control, never an instruction ──────── */
.aida-tip {
  max-width: 240px;
  padding: 6px 10px;
  background: var(--ink);
  color: var(--on-dark);
  font-size: var(--text-xs);
  line-height: 1.4;
  box-shadow: var(--float-shadow);
}

/* ── Menu: the actions behind a "More" button ─────────────────────────── */
.aida-menu {
  min-width: 200px;
  padding: 4px 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: var(--float-shadow);
}
.aida-menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-m);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.aida-menu__item:hover { background: color-mix(in oklch, var(--ink) 5%, var(--paper)); }
.aida-menu__item--danger { color: var(--alarm); }
.aida-menu__sep { height: 1px; margin: 4px 0; background: var(--rule); }

/* ── Steps: where a course, a wizard or a check stands ────────────────── */
/* <ol class="aida-steps"><li class="aida-step" data-state="done|current|todo">
   <span class="aida-step__n">1</span><span class="aida-step__label">…</span></li>
   The current one also carries aria-current="step". */
.aida-steps {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.aida-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  min-width: 0;
}
.aida-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 36px;
  right: 8px;
  height: 1px;
  background: var(--line-control);
}
.aida-step[data-state='done']:not(:last-child)::after { height: 2px; top: 13px; background: var(--ink); }
.aida-step__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-control);
  font-family: var(--font-display);
  font-size: var(--text-s);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.aida-step[data-state='done'] .aida-step__n { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.aida-step[data-state='current'] .aida-step__n { background: var(--sun); border-color: var(--sun); color: var(--ink); }
.aida-step__label { font-size: var(--text-s); color: var(--ink-2); padding-right: 12px; }
.aida-step[data-state='current'] .aida-step__label { color: var(--ink); font-weight: 600; }
@media (max-width: 720px) {
  /* On a phone the steps stand in a column and the line runs down. */
  .aida-steps { flex-direction: column; gap: 16px; }
  .aida-step { flex-direction: row; align-items: center; gap: 12px; }
  .aida-step:not(:last-child)::after { top: 32px; bottom: -12px; left: 14px; right: auto; width: 1px; height: auto; }
  .aida-step[data-state='done']:not(:last-child)::after { width: 2px; left: 13px; height: auto; top: 32px; }
}

/* ── Disclosure: an answer under its question ─────────────────────────── */
/* Native <details class="aida-disclosure"><summary>…</summary>…</details>.
   Rows of them make an FAQ or a course's module list. */
.aida-disclosure { border-top: 1px solid var(--rule); }
.aida-disclosure:last-child { border-bottom: 1px solid var(--rule); }
.aida-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--touch-min);
  padding: 14px 0;
  font-size: var(--text-l);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.aida-disclosure > summary::-webkit-details-marker { display: none; }
.aida-disclosure > summary::after {
  content: 'expand_more';
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-2);
  font-feature-settings: 'liga';
  transition: transform var(--motion) var(--ease);
}
.aida-disclosure[open] > summary::after { transform: rotate(180deg); }
.aida-disclosure__body { padding: 0 0 20px; color: var(--ink-2); max-width: var(--measure); }

/* ── Count: how many are waiting ──────────────────────────────────────── */
/* Always with words for a screen reader: aria-label="2 непрочитанных". */
.aida-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--on-dark);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.aida-count--alarm { background: var(--alarm); }

/* ── Avatar: initials, never a stock photo ────────────────────────────── */
.aida-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: color-mix(in oklch, var(--ink) 8%, var(--paper));
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow: hidden;
}
.aida-avatar--l { width: 56px; height: 56px; font-size: var(--text-l); }
.aida-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Notice: something about the whole page ───────────────────────────── */
/* A line box with a word in front. No stripe down one side, no tinted
   background: the word says what kind of notice it is. */
.aida-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  font-size: var(--text-m);
}
.aida-notice__word {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-2);
}
.aida-notice--alarm { border-color: var(--alarm); }
.aida-notice--alarm .aida-notice__word { color: var(--alarm); }
/* <span class="aida-notice__word">…</span><span class="aida-notice__text">…</span>
   <a class="aida-link">…</a> — the text takes the room, the link wraps under
   it when the box is narrow. */
.aida-notice__text { flex: 1 1 220px; }

/* ── Side navigation: the admin's sections ────────────────────────────── */
.aida-nav { display: flex; flex-direction: column; gap: 2px; }
.aida-nav__group { margin: var(--space-5) 0 var(--space-2); padding: 0 12px; }
.aida-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch-min);
  padding: 0 12px;
  color: var(--ink-2);
  font-size: var(--text-m);
  text-decoration: none;
}
.aida-nav__link:hover { color: var(--ink); background: color-mix(in oklch, var(--ink) 5%, var(--paper)); }
/* The page you are on: a sun wash (ink on it 17:1) and the weight. */
.aida-nav__link[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
  background: color-mix(in oklch, var(--sun) 15%, var(--paper));
}
.aida-nav__link .aida-count { margin-left: auto; }

/* ── Segmented: one of two to four views of the same thing ───────────── */
.aida-seg {
  display: inline-flex;
  border: 1px solid var(--line-control);
  border-radius: var(--radius-s);
  overflow: hidden;
}
.aida-seg__opt {
  min-height: var(--touch-min);
  padding: 0 16px;
  border: 0;
  border-left: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--text-m);
  cursor: pointer;
}
.aida-seg__opt:first-child { border-left: 0; }
.aida-seg__opt[aria-pressed='true'],
.aida-seg__opt[aria-checked='true'] { background: var(--ink); color: var(--on-dark); font-weight: 600; }

/* ── Facts: the key/value block of a course, a person, a dossier ──────── */
.aida-facts { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; margin: 0; }
.aida-facts > dt,
.aida-facts > dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--rule); }
.aida-facts > dt { font-size: var(--text-s); color: var(--ink-3); padding-right: 16px; }
.aida-facts > dd { font-size: var(--text-m); }
.aida-facts > dt:first-of-type,
.aida-facts > dt:first-of-type + dd { border-top: 0; }
@media (max-width: 720px) {
  .aida-facts { grid-template-columns: 1fr; }
  .aida-facts > dd { border-top: 0; padding-top: 0; }
}

/* ── Progress with its number ─────────────────────────────────────────── */
.aida-progress { display: flex; flex-direction: column; gap: 6px; }
.aida-progress__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--text-s);
  color: var(--ink-2);
}
.aida-progress__n { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

/* ── Level: low → critical, for risks and data ────────────────────────── */
/* A square from the data scale and a word. The word is the meaning; the
   square only lets a column be scanned. Critical is the alarm, nothing
   else is. <span class="aida-level" data-level="3">Средний</span> */
.aida-level {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.aida-level::before {
  content: '';
  width: 10px;
  height: 10px;
  flex: none;
  outline: 1px solid var(--line-control);
  outline-offset: -1px;
  background: var(--data-1);
}
.aida-level[data-level='2']::before { background: var(--data-2); }
.aida-level[data-level='3']::before { background: var(--data-3); }
.aida-level[data-level='4']::before { background: var(--data-4); outline: 0; }
.aida-level[data-level='5']::before { background: var(--data-5); outline: 0; }
.aida-level[data-level='critical'] { color: var(--alarm); }
.aida-level[data-level='critical']::before { background: var(--alarm); outline: 0; }

/* ── Charts and heat maps: the drawing rules ──────────────────────────── */
/* For SVG charts drawn by hand or by a library: give the root .aida-chart
   and the marks these classes. Axis text is ink-2 — at 12px ink-3 would be
   under its 13px floor. */
.aida-chart { font-family: var(--font); font-size: var(--text-xs); overflow: visible; }
.aida-chart text { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.aida-chart__grid { stroke: var(--rule); stroke-width: 1; }
.aida-chart__axis { stroke: var(--ink); stroke-width: 1; }
.aida-chart__s1 { fill: var(--series-1); stroke: var(--series-1); }
.aida-chart__s2 { fill: var(--series-2); stroke: var(--series-2); }
.aida-chart__s3 { fill: var(--series-3); stroke: var(--series-3); }
.aida-chart__s4 { fill: var(--series-4); stroke: var(--series-4); }
.aida-chart__line { fill: none; stroke-width: 2; }

/* Heat map cells: a table whose cells carry the level. The number stays
   in the cell, so the colour is never alone. */
.aida-heat { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.aida-heat td,
.aida-heat th { width: 56px; height: 44px; text-align: center; font-size: var(--text-s); }
.aida-heat th { font-weight: 600; color: var(--ink-2); }
.aida-heat td { border: 2px solid var(--paper); color: var(--ink); background: var(--data-1); }
.aida-heat td[data-level='2'] { background: var(--data-2); }
.aida-heat td[data-level='3'] { background: var(--data-3); }
.aida-heat td[data-level='4'] { background: var(--data-4); }
.aida-heat td[data-level='5'] { background: var(--data-5); color: var(--on-dark); }
.aida-heat td[data-level='critical'] { background: var(--alarm); color: var(--on-dark); font-weight: 600; }

/* ── Only for screen readers, and the skip link ───────────────────────── */
.aida-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.aida-skip {
  position: absolute;
  left: var(--space-4);
  top: calc(-1 * var(--space-16));
  z-index: var(--z-toast);
  padding: 12px 16px;
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 600;
  text-decoration: underline;
}
.aida-skip:focus { top: var(--space-4); outline: var(--focus-width) solid var(--sun); outline-offset: 0; }

/* ════════════════════════════════════════════════════════════════════════
   2.0 — Windows high-contrast (forced colours)
   ════════════════════════════════════════════════════════════════════════ */
/* In forced colours the system repaints backgrounds with its own Canvas.
   Everything here that means something by being filled would vanish: the
   sun tile, the bulk bar, the progress fill, the switch knob, the current
   step. Each gets an edge or keeps its fill in a system colour. */
@media (forced-colors: active) {
  .aida-tile--sun, .aida-tile--ink, .aida-bulk, .aida-toast, .aida-tip,
  .aida-count, .aida-step__n { border: 1px solid CanvasText; }
  .aida-bar { border: 1px solid CanvasText; }
  .aida-bar__fill, .aida-switch:checked::before {
    forced-color-adjust: none;
    background: CanvasText;
  }
  /* Data keeps its own greys: the scale is the information, and every cell
     and level also carries its number or word. */
  .aida-level::before, .aida-heat td { forced-color-adjust: none; }
  .aida-tab[aria-selected='true'],
  .aida-topbar__link[aria-current='page'] { border-bottom-color: Highlight; }
  .aida-nav__link[aria-current='page'],
  .aida-seg__opt[aria-pressed='true'],
  .aida-seg__opt[aria-checked='true'] { outline: 2px solid Highlight; outline-offset: -2px; }
  .aida-step[data-state='current'] .aida-step__n { border: 3px solid Highlight; }
}
