/* ==========================================================================
   IlmOS · components.css
   Buttons, fields, cards, tables, badges, stats, callouts, toasts, sheets.
   ========================================================================== */

/* ----------------------------------------------------------------- icons */
.icon {
  flex: 0 0 auto;
  display: block;
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: transform 0.08s ease, background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--pine);
  background-image: var(--grad-brand);
  border-color: transparent;
  color: var(--pine-fg);
  box-shadow: var(--glow);
}

.btn--primary:hover {
  background: var(--pine-2);
  background-image: var(--grad-brand);
  border-color: transparent;
  color: var(--pine-fg);
  box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--pine) 70%, transparent);
  transform: translateY(-1px);
}

.btn--brass {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-signal);
}

.btn--brass:hover {
  background: var(--brass-2);
  color: var(--on-signal);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--rule-2);
  color: var(--ink-2);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
  color: var(--ink);
}

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.btn--quiet:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.btn--danger {
  background: var(--bad-wash);
  border-color: var(--bad-line);
  color: var(--bad);
}

.btn--danger:hover {
  background: var(--bad);
  border-color: var(--bad);
  color: var(--on-signal);
}

.btn--sm {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: var(--r-xs);
}

.btn--lg {
  min-height: 50px;
  padding: 0 22px;
  font-size: 15.5px;
}

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

.btn.is-disabled,
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------------------------------------------------------------- fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field__label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.field__req {
  color: var(--bad);
  margin-left: 3px;
}

.field__hint {
  font-size: 12px;
  color: var(--ink-3);
}

.field__error {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--bad);
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--rule-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(19, 21, 43, 0.03);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.input:hover {
  border-color: var(--ink-3);
}

.input::placeholder {
  color: var(--ink-3);
}

.input:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pine) 20%, transparent);
  outline: none;
}

.field--bad .input {
  border-color: var(--bad);
  background: var(--bad-wash);
}

.input--select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234e5450' stroke-width='1.8' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

:root[data-theme="dark"] .input--select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa0c0' stroke-width='1.8' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
}

.input--area {
  min-height: 88px;
  line-height: 1.5;
  resize: vertical;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}

.check__box {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--pine);
  flex: 0 0 22px;
}

.check__text {
  font-size: 14px;
  font-weight: 550;
  display: flex;
  flex-direction: column;
}

.check__hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-3);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-section {
  padding: 14px 0 4px;
  border-top: 1px solid var(--rule);
}

.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.form-section__title {
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--pine);
  margin-bottom: 4px;
}

.form-section__note {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 12px;
}

.submit-bar {
  position: sticky;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--glass);
  backdrop-filter: blur(8px);
  box-shadow: var(--lift-2);
}

/* The bar floats above the tab bar, so the page must reserve room for both:
   bar height (~74px with buttons), the tab bar it parks above, and a few px
   of air. Without this the last field hint ("For the record only.") stayed
   half-hidden behind the bar once the page was scrolled to its end. */
.main:has(.submit-bar) {
  padding-bottom: calc(var(--tabs-h) + 175px + env(safe-area-inset-bottom));
}

/* One press, one save. The moment a POST is on its way the button stops
   looking pressable, so the second tap of an impatient double-tap lands on
   nothing at all instead of writing the record twice. A filter form (a GET)
   is never marked this way — it is meant to re-send when a select changes. */
form.is-sent button[type='submit'] {
  opacity: 0.55;
  pointer-events: none;
}

.submit-bar__note {
  display: none;
  font-size: 12.5px;
  color: var(--ink-3);
  /* A long note must wrap and shrink instead of pushing the buttons off the
     right edge: without min-width the flex item refuses to go below its
     longest word, and the whole bar used to scroll the page sideways. */
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.submit-bar__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  width: 100%;
  /* The buttons keep their size; the note beside them is what shrinks. */
  flex: 0 0 auto;
}

.submit-bar__actions .btn {
  flex: 1;
}

@media (min-width: 720px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field--wide {
    grid-column: 1 / -1;
  }

  .submit-bar__note {
    display: block;
  }

  .submit-bar__actions {
    width: auto;
  }

  .submit-bar__actions .btn {
    flex: 0 0 auto;
  }
}

@media (min-width: 1024px) {
  .submit-bar {
    bottom: 12px;
  }
}

/* ----------------------------------------------------------------- cards */
.card {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--lift-2);
  overflow: hidden;
}

.card + .card,
.card + .section-title,
.section-title + .card {
  margin-top: 16px;
}

/* A table sitting straight inside a card must scroll inside the card. The card
   clips its overflow to keep its rounded corners, which used to slice the last
   columns off on a narrow screen with no way to reach them. */
.card:has(> table),
.card:has(> .card__body > table),
.card__body:has(> table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Long unbroken values (roll codes, phone numbers, emails, URLs) wrap inside
   their cell instead of spilling out and being cut by the container. */
.table td,
.sheet-table td,
.paper-table td,
.meta-pair__value,
.meta__row dd {
  overflow-wrap: anywhere;
}

.card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.card__title {
  font-size: 16px;
  font-weight: 750;
}

.card__note {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 3px;
}

.card__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card__body {
  padding: 16px;
}

.card--entry {
  border-top: 3px solid var(--pine);
}

.card--paper {
  background: var(--surface);
}

/* A sticky submit-bar inside a clipped card cannot stick: `overflow: hidden`
   becomes its containing block, so at the end of the page the bar just sat on
   top of the last field hint instead of parking above it. Cards holding a
   submit-bar stay unclipped; their tables still scroll inside .table-wrap. */
.card:has(.submit-bar) {
  overflow: visible;
}

/* ------------------------------------------------------------- page head */
.page-head {
  margin-bottom: 16px;
}

.page-head__back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
}

.page-head__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.page-head__title {
  font-size: clamp(22px, 5.6vw, 30px);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.page-head__note {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 2px;
}

.page-head__sub {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--ink-2);
  max-width: 62ch;
}

.page-head__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (min-width: 720px) {
  .page-head__actions {
    margin-left: auto;
  }
}

/* zone strip: the "you are here" colour band ----------------------------- */
.zone-strip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.zone-strip strong {
  font-weight: 700;
  letter-spacing: 0.12em;
}

.zone-strip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.zone-strip__note {
  padding-left: 8px;
  border-left: 1px solid var(--rule);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-3);
}

.zone-strip--entry {
  border-color: var(--ok-line);
  background: var(--pine-wash);
  color: var(--pine-ink);
}

.zone-strip--entry .zone-strip__dot {
  background: var(--pine);
}

.zone-strip--entry .zone-strip__note {
  color: var(--ok);
}

.zone-strip--records {
  border-color: color-mix(in srgb, var(--hue-records) 35%, var(--rule));
  background: var(--hue-records-wash);
  color: var(--ink);
}

.zone-strip--records .zone-strip__dot {
  background: var(--hue-records);
}

.zone-strip--reports {
  border-color: var(--brass-line);
  background: var(--brass-wash);
  color: var(--brass-ink);
}

.zone-strip--reports .zone-strip__dot {
  background: var(--brass);
}

.zone-strip--reports .zone-strip__note {
  color: var(--brass);
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* a flex/grid parent must be allowed to shrink this below its content width,
     otherwise the scroller itself overflows and text is cut instead of scrolled */
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  position: sticky;
  top: 0;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  white-space: nowrap;
}

/* A column's heading belongs on the same side as its values. `.table th` is
   class+element, which outranks a bare `.t-right`, so without these rules a
   right-aligned money or marks column printed its header on the left — the
   header and the figures looked like they belonged to different columns. */
.table th.t-right,
.table td.t-right {
  text-align: right;
}

.table th.t-center,
.table td.t-center {
  text-align: center;
}

.table th.t-left,
.table td.t-left {
  text-align: left;
}

/* A header for a numeric column keeps the figures' tabular figures too, so the
   heading and the digits under it line up to the same edge. */
.table th.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr[data-href] {
  cursor: pointer;
}

.table tbody tr:nth-child(even) {
  background: var(--surface-2);
}

.table tbody tr:hover {
  background: color-mix(in srgb, var(--pine) 8%, var(--surface));
}

.table .row--warn {
  background: var(--warn-wash);
}

.table .row--bad {
  background: var(--bad-wash);
}

.table .row--ok {
  background: var(--ok-wash);
}

.table .row--muted {
  color: var(--ink-3);
}

.table .row--day {
  background: var(--paper-2);
  font-weight: 600;
}

.table .row--fail {
  background: var(--bad-wash);
  color: var(--bad);
}

.table tbody tr[hidden] {
  display: none;
}

/* ------------------------------------------------------------- timetable */
/* A box in the weekly grid. The whole cell is one link, so a teacher can tap
   anywhere in it to open that period in the form below. */

/* An empty box: a quiet plus that becomes obvious on hover. */

/* ----------------------------------------------------------------- meta */
.meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
}

.meta__row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
}

.meta__row:last-child {
  border-bottom: 0;
}

.meta__row dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  flex: 0 0 auto;
}

.meta__row dd {
  margin: 0;
  font-size: 14px;
  font-weight: 550;
  text-align: right;
}

.meta__row--wide {
  flex-direction: column;
  gap: 3px;
}

.meta__row--wide dd {
  text-align: left;
  font-weight: 500;
}

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--ok {
  border-color: var(--ok-line);
  background: var(--ok-wash);
  color: var(--ok);
}

.badge--warn {
  border-color: var(--warn-line);
  background: var(--warn-wash);
  color: var(--warn);
}

.badge--bad {
  border-color: var(--bad-line);
  background: var(--bad-wash);
  color: var(--bad);
}

.badge--info {
  border-color: var(--ok-line);
  background: var(--pine-wash);
  color: var(--pine-ink);
}

/* ----------------------------------------------------------------- stats */
.stat {
  --stat-hue: var(--pine);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 15px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120px 90px at 100% 0%, color-mix(in srgb, var(--stat-hue) 14%, transparent), transparent 70%),
    var(--surface);
  box-shadow: var(--lift-2);
  color: var(--ink);
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.stat--link:hover {
  transform: translateY(-2px);
  box-shadow: var(--lift-3);
}

.stat__top .icon {
  color: var(--stat-hue);
}

.stat--link:active {
  transform: translateY(1px);
}

.stat__top {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
}

.stat__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat__value {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat__hint {
  font-size: 11.5px;
  color: var(--ink-3);
}

.stat--pine {
  --stat-hue: var(--pine);
}

.stat--brass {
  --stat-hue: var(--brass);
}

.stat--ink {
  --stat-hue: var(--hue-records);
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--stat-hue);
  opacity: 0.9;
}

/* --------------------------------------------------------------- callout */
.callout {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--rule-2);
  border-left-width: 4px;
  border-radius: var(--r);
  background: var(--surface);
  font-size: 13.5px;
}

.callout__title {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.callout--info {
  border-color: color-mix(in srgb, var(--pine) 30%, var(--rule));
  border-left-color: var(--pine);
  background: var(--pine-wash);
  color: var(--pine-ink);
}

.callout--ok {
  border-color: var(--ok-line);
  border-left-color: var(--ok);
  background: var(--ok-wash);
}

.callout--warn {
  border-color: var(--warn-line);
  border-left-color: var(--warn);
  background: var(--warn-wash);
}

.callout--bad {
  border-color: var(--bad-line);
  border-left-color: var(--bad);
  background: var(--bad-wash);
}

/* ----------------------------------------------------------- empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 16px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  text-align: center;
}

.empty__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 2px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-3);
}

.empty__title {
  font-family: var(--font-serif);
  font-size: 16px;
}

.empty__hint {
  font-size: 13px;
  color: var(--ink-3);
  max-width: 46ch;
  margin-bottom: 6px;
}

/* -------------------------------------------------------------- toolbar */

.search-input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-sm);
  background: var(--surface)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2379746a' stroke-width='1.7' stroke-linecap='round'><circle cx='10.5' cy='10.5' r='6.5'/><path d='M15.5 15.5 20 20'/></svg>")
    no-repeat 11px center;
  font-size: 15px;
}

/* --------------------------------------- student search results (counter) */
.search-list {
  display: flex;
  flex-direction: column;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--lift-1);
  overflow: hidden;
  list-style: none;
}

.search-list__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule-2);
}

.search-list__row:last-child {
  border-bottom: 0;
}

.search-list__row:nth-child(even) {
  background: var(--surface-2);
}

.search-list__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 220px;
}

.search-list__main strong {
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.search-list__main .muted {
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.search-list__side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* -------------------------------------------------------------- pagination */
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.pager__pos {
  font-size: 13px;
  font-weight: 650;
}

.pager__total {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
}

/* ------------------------------------------------------------ big actions */
.big-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--lift-1);
  color: var(--ink);
  min-height: 64px;
}

.big-action:active {
  transform: translateY(1px);
}

.big-action__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--ink-2);
}

.big-action__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.big-action__label {
  font-size: 15px;
  font-weight: 650;
}

.big-action__note {
  font-size: 12px;
  color: var(--ink-2);
}

.big-action__hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.big-action__chev {
  color: var(--ink-3);
}

.big-action--entry .big-action__mark {
  border-color: var(--ok-line);
  background: var(--pine-wash);
  color: var(--pine);
}

.big-action--records .big-action__mark {
  border-color: var(--rule-2);
  background: var(--surface-2);
  color: var(--ink-2);
}

.big-action--reports .big-action__mark {
  border-color: var(--brass-line);
  background: var(--brass-wash);
  color: var(--brass-2);
}

.big-action--setup .big-action__mark {
  background: var(--paper-2);
}

/* ------------------------------------------------------------- section */
.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 22px 0 10px;
  flex-wrap: wrap;
}

.section-title h2 {
  font-size: 17px;
}

.section-title p {
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------------------------------------------------------- status pages */
.status-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 4px 6px;
}

.status-page__code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 2px 8px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  color: var(--ink-3);
}

.status-page__title {
  font-size: 24px;
}

.status-page__note {
  color: var(--ink-3);
}

.status-page__body {
  margin: 6px 0 12px;
  color: var(--ink-2);
  font-size: 14px;
}

.error-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.error-card {
  max-width: 520px;
  padding: 22px;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--lift-2);
}

.error-card h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.error-card pre {
  margin: 12px 0;
  padding: 10px;
  overflow-x: auto;
  border-radius: var(--r-sm);
  background: var(--paper-2);
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
}

/* ==========================================================================
   Shared view primitives
   These class names were used by module views before they had any rules, so
   labels, values and rows collided ("OriginalRs 3,700"). They live here, not
   in a module file, because several screens depend on the same behaviour.
   ========================================================================== */

/* label/value pair used by fee collection and payroll slips ---------------- */
.meta-pair {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--rule);
}

.meta-pair:last-child {
  border-bottom: 0;
}

.meta-pair__label {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.meta-pair__value {
  flex: 0 0 auto;
  font-size: 14.5px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.meta-pair--strong {
  margin-top: 3px;
  border-top: 1px solid var(--rule-2);
  border-bottom: 0;
}

.meta-pair--strong .meta-pair__label {
  color: var(--ink-2);
}

.meta-pair--strong .meta-pair__value {
  font-size: 16.5px;
  color: var(--pine-ink);
}

/* a form that sits inside a table cell or a page-head action slot --------- */
.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.inline-form .input {
  width: auto;
  min-width: 9ch;
}

/* username + one-click action on the family logins card ------------------- */
.login-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* small buttons/forms lined up at the end of a table row ------------------ */
.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions form,
.row-actions .inline-form {
  margin: 0;
}

/* input variants ---------------------------------------------------------- */
.input--sm {
  min-height: 34px;
  padding: 4px 10px;
  font-size: 13px;
}

.input--figure {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.input--code {
  max-width: 96px;
  text-transform: uppercase;
}

/* money: credit reads as a plus, a due as a warning. Colour is never the only
   signal - the sign or the word next to it carries the meaning too. */
.pos {
  color: var(--pine);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.neg {
  color: var(--bad);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* student wallet ---------------------------------------------------------- */
.wallet-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.wallet-head__figure {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-2);
}

.wallet-head__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.wallet-head__value {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.wallet-head__value--credit {
  color: var(--pine);
}

.wallet-head__value--overdue {
  color: var(--bad);
}

.wallet-head__value--clear,
.wallet-head__value--settled {
  color: var(--ink-2);
}

.wallet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.wallet-actions .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  min-width: 0;
}

.wallet-actions .input {
  flex: 1 1 120px;
  min-width: 0;
}

.wallet-adjust {
  margin-top: 12px;
  border-top: 1px solid var(--rule);
  padding-top: 10px;
}

.wallet-adjust summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
}

.wallet-adjust .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  min-width: 0;
}

.wallet-adjust .input {
  flex: 1 1 130px;
  min-width: 0;
}

.input--file {
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.4;
}

.input--file::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.input--mark {
  width: 5.5ch;
  min-height: 34px;
  padding: 4px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* marks entry grid (exams -> enter marks) --------------------------------- */
.mark-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto 52px;
  grid-template-areas: "roll who box pct";
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--rule);
}

.mark-row > .reg__roll {
  grid-area: roll;
}

.mark-row > .reg__who {
  grid-area: who;
}

.mark-row > .mark-row__box {
  grid-area: box;
}

.mark-row > .mark-row__pct {
  grid-area: pct;
}

.mark-row:last-child {
  border-bottom: 0;
}

.mark-row:nth-child(even) {
  background: var(--surface-2);
}

.mark-row.is-fail {
  background: var(--bad-wash);
}

.mark-row__box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mark-row__of {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

.mark-row__pct {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-2);
  text-align: right;
}

.mark-row__pct.is-fail {
  color: var(--bad);
}

@media (max-width: 520px) {
  .mark-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas:
      "roll who pct"
      "box  box box";
    row-gap: 7px;
  }

  .mark-row > .mark-row__box {
    justify-self: start;
  }
}

/* segmented link tabs (setup -> form fields) ------------------------------ */
.seg__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-right: 1px solid var(--rule);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.seg__item:last-child {
  border-right: 0;
}

.seg__item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.seg__item.is-active {
  background: var(--pine);
  color: var(--pine-fg);
}

.seg__item.is-active:hover {
  background: var(--pine-2);
  color: var(--pine-fg);
}

/* neutral is the badge tone used when none is given ---------------------- */
.badge--neutral {
  border-color: var(--rule-2);
  background: var(--surface-2);
  color: var(--ink-3);
}

/* secondary button: quieter than primary, still a clear affordance -------- */
.btn--secondary {
  background: var(--surface-2);
  border-color: var(--rule-2);
  color: var(--ink);
}

.btn--secondary:hover {
  background: var(--paper-2);
  border-color: var(--ink-3);
}

/* callout body text ------------------------------------------------------- */
.callout__body {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}

/* the page title column must be able to shrink beside the actions --------- */
.page-head__text {
  flex: 1 1 260px;
  min-width: 0;
}

/* ---------------------------------------------------------------------------
 * A collapsible section (`<CollapsibleSection>`).
 *
 * The dashboard used to open with seventeen "Today's work" buttons and nine
 * report buttons: a wall of choices nobody reads. Now each section is one line
 * with a count, and one click opens it. Native <details>, so it works without
 * JavaScript; the nav.accordion script only closes the siblings.
 * ------------------------------------------------------------------------ */
.collapse {
  margin: 22px 0 10px;
  /* A section is a link target (the danger hub jumps back to the one being
     filtered), and the topbar is sticky, so the heading has to clear it. */
  scroll-margin-top: calc(var(--topbar-h) + 10px);
}

.collapse + .collapse {
  margin-top: 10px;
}

.collapse__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.collapse__head::-webkit-details-marker {
  display: none;
}

.collapse__head:hover {
  background: var(--surface-2);
}

.collapse__text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.collapse__title {
  font-size: 17px;
  font-weight: 650;
  color: var(--ink);
}

.collapse__note {
  font-size: 12.5px;
  color: var(--ink-3);
}

.collapse__count {
  flex: none;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.collapse__chevron {
  flex: none;
  color: var(--ink-3);
  transition: transform 160ms ease;
}

.collapse[open] .collapse__chevron {
  transform: rotate(180deg);
}

.collapse[open] > .collapse__head {
  border-color: var(--rule-2);
}

.collapse__body {
  padding-top: 12px;
}

/* ------------------------------------------------------- danger zone (0008) -- */
.card--danger {
  border-color: color-mix(in srgb, var(--bad) 45%, transparent);
}

/* ------------------------------------------- danger grant class list (0009) -- */
/* The class tick list only matters for "Only the classes ticked below", so it
   is dimmed in the other two modes — but still clickable, because ticking a
   class is how the mode gets switched to the ticked list. */
.field.is-inert .check-grid {
  opacity: 0.55;
}

.field.is-inert .check-grid:hover {
  opacity: 1;
}

.field > .check-grid {
  margin-top: 6px;
}

/* The grants table names the classes it reaches; a long list wraps inside its
   own cell rather than widening the table past the screen. */
.danger-classes {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* ------------------------------------------------ danger hub fix panels (0010) -- */
/* Each row's "Fix" opens a small drawer of inline forms (edit / status /
   delete). The summary looks like a small button so it reads as an action. */
.danger-fix {
  position: relative;
  display: inline-block;
}

.danger-fix > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.danger-fix > summary::-webkit-details-marker {
  display: none;
}

.danger-fix__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 240px;
  padding: 10px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--lift-3);
  display: grid;
  gap: 8px;
}

.danger-fix__form {
  display: grid;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--rule);
}

.danger-fix__form:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.danger-fix__form .input--sm {
  width: 100%;
  min-width: 0;
}

/* The last panel in a table can clip against the page edge; keep tables free
   to scroll horizontally without cutting the drawer. */
.table-wrap {
  position: relative;
}

/* Role × module matrix on Setup → Permissions. */
.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.matrix th,
.matrix td {
  border: 1px solid var(--rule);
  padding: 6px 8px;
  text-align: left;
}

.matrix thead th {
  background: var(--surface-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.matrix tbody th[scope='row'] {
  font-weight: 600;
  background: var(--surface);
}

@media (max-width: 480px) {
  /* On a phone the drawer leaves the table and becomes a sheet at the bottom
     of the screen - above the tab bar, never behind it. */
  .danger-fix__panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(var(--tabs-h) + 10px + env(safe-area-inset-bottom));
    min-width: 0;
    max-height: calc(100vh - var(--tabs-h) - 40px);
    overflow-y: auto;
    z-index: 60;
  }
}

/* ------------------------------------------------- school phone pairing */

/* A pairing code is read off the screen and typed into a phone, so it is the
   biggest thing in the card and set in the mono face, where a capital O and a
   zero cannot be told apart wrongly. */
.pairing-code {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--brass);
  border-radius: var(--r);
  background: var(--brass-wash);
  text-align: center;
}

.pairing-code__label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-2);
}

.pairing-code__code {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--pine-ink);
}

.pairing-code__note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* A phone's name in a table row, beside its icon. */
.device-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* A short numbered explanation beside a form: the numbers are drawn by CSS so
   the markup stays four plain list items. */
.howto {
  counter-reset: howto;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.howto__item {
  /* Block, not grid: a link inside the sentence would otherwise become its own
     grid cell and push the words into the 22px number column. */
  position: relative;
  display: block;
  min-height: 22px;
  padding-left: 32px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.howto__item::before {
  counter-increment: howto;
  content: counter(howto);
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pine-wash);
  color: var(--pine-ink);
  font-size: 11.5px;
  font-weight: 700;
}

/* ------------------------------------------------------- logins & users ---
 * The password column: a button until the super admin presses it. What is
 * shown is monospaced and selected as a whole, because a password is copied,
 * not read.
 */
.pw-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pw-cell__value,
.reveal__pw {
  font-family: var(--font-mono);
  font-size: 13.5px;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-sm);
  background: var(--warn-wash);
  color: var(--ink);
  word-break: break-all;
}

.reveal {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.reveal__who {
  font-weight: 650;
}

/* A very small button for a table cell: still a full tap target on a phone. */
.btn--xs {
  min-height: 30px;
  padding: 3px 9px;
  font-size: 12.5px;
  gap: 5px;
}

/* Two checkboxes side by side, wrapping on a narrow screen. */
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.check-row .check {
  flex: 1 1 240px;
}

/* Role counts as filter chips — one control for "how many" and "show me". */
.role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px;
}

.role-chips a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
}

.role-chips a:hover {
  border-color: var(--rule-2);
  color: var(--ink);
}

.role-chips a.is-active {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--pine-fg);
}

.role-chips__n {
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0.75;
}

/* Name over linked record in one table cell. */
.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.3;
}

.cell-stack .muted {
  font-size: 12px;
}

/* ----------------------------------------------------- password tool tiles ---
 * Pick one job, then only that form is on screen (progressive disclosure).
 */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.tool-tile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-2);
  text-decoration: none;
  min-width: 0;
  transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}

.tool-tile:hover {
  border-color: var(--rule-2);
  background: var(--surface-2);
  color: var(--ink);
}

.tool-tile.is-active {
  border-color: var(--pine);
  background: var(--pine-wash);
  color: var(--pine-ink);
  box-shadow: inset 0 0 0 1px var(--pine);
}

.tool-tile__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
}

.tool-tile.is-active .tool-tile__mark {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--pine-fg);
}

.tool-tile__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tool-tile__label {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
}

.tool-tile__hint {
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.85;
}

.tool-pane__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.tool-pane__aside {
  margin: 0;
  font-size: 12.5px;
}

/* Form + password rules side by side (shadcn-style teaching layout). */
.tool-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(200px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.rules-panel {
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface-2);
}

.rules-panel__title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.rules-panel__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rules-panel__list li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.35;
}

.rules-panel__list .icon {
  margin-top: 2px;
  color: var(--ok);
}

.rules-panel__note {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--rule-2);
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.4;
}

@media (max-width: 820px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-split {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------- branding ---
 * One line that shows the school what its own colour looks like before it is
 * saved: the crest, the four derived shades, and a real button on top of them.
 */
.brand-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface-2);
}

.brand-strip__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-strip__text strong {
  font-size: 15px;
}

.brand-strip__chips {
  display: inline-flex;
  gap: 4px;
  margin-top: 4px;
}

.brand-chip {
  width: 22px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--rule);
}

.brand-strip__actions {
  margin-left: auto;
}

.brand-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

/* A row of one-tap colours. A school that does not know hex codes still gets
   to pick a brand without guessing. */
.swatch-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.swatch-row--flush {
  margin-top: 0;
  margin-bottom: 8px;
  padding-top: 0;
  border-top: 0;
}

.swatch-row form {
  margin: 0;
}

.swatch {
  width: var(--tap);
  height: 34px;
  border-radius: var(--r-sm);
  border: 2px solid var(--rule-2);
  cursor: pointer;
}

.swatch.is-active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--surface) inset;
}

/* ------------------------------------------------------------- appearance ---
 * Theme cards + the mini rail proof next to them. Each card is a one-tap
 * form that posts a researched trio of colours; the preview only shows what
 * that theme will do to the chrome, not the whole product.
 */
.theme-grid__heading {
  margin: 18px 0 4px;
  font-size: 15px;
  font-weight: 750;
}

.theme-grid__lede {
  margin: 0 0 12px;
  font-size: 12.5px;
  max-width: 62ch;
}

.theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 560px) {
  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .theme-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.theme-grid__form {
  margin: 0;
}

.theme-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.theme-card:hover {
  border-color: var(--rule-2);
}

.theme-card.is-active {
  border-color: var(--pine);
  box-shadow: 0 0 0 2px var(--pine-wash);
}

.theme-card__mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  min-height: 74px;
}

.theme-card__mini-name {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
}

.theme-card__mini-row {
  display: flex;
  gap: 4px;
}

.theme-card__mini-row span {
  display: block;
  width: 18px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid transparent;
}

.theme-card__mini-active {
  align-self: flex-start;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  font-size: 10.5px;
  font-weight: 650;
}

.theme-card__label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.theme-card__note {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--ink-3);
}

.color-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.color-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Live sidebar sample beside the crest strip. Defaults are declared here so
   the stylesheet is self-contained; the view overrides them on the element. */
.rail-preview {
  --rail-preview-bg: #ffffff;
  --rail-preview-ink: #4e5450;
  --rail-preview-name: #1a1c1a;
  --rail-preview-active-bg: #e6efea;
  --rail-preview-active-ink: #06382a;
  --rail-preview-accent: #0b5d45;
  --rail-preview-rule: #e0dbd0;

  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 220px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--rail-preview-rule, var(--rule));
  border-radius: var(--r);
  background: var(--rail-preview-bg, #fff);
}

.rail-preview__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--rail-preview-ink, #1a1c1a) 14%, transparent);
}

.rail-preview__brand strong {
  font-family: var(--font-serif);
  font-size: 12.5px;
  color: var(--rail-preview-name, #1a1c1a);
}

.rail-preview__mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 700;
}

.rail-preview__link {
  padding: 5px 7px;
  border-radius: var(--r-xs);
  font-size: 12px;
  color: var(--rail-preview-ink, #4e5450);
}

.rail-preview__link.is-active {
  background: var(--rail-preview-active-bg, var(--pine-wash));
  color: var(--rail-preview-active-ink, var(--pine-ink));
  font-weight: 650;
  box-shadow: inset 2px 0 0 var(--rail-preview-accent, var(--pine));
}

/* The tick-all strip above a table of checkboxes. */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 10px;
}

/* ---------------------------------------------------- permissions hub ----- */
/* Phone-first tab strip: Roles · Login · Classes */

/* Panels swap with the role radio — CSS first, JS keeps badges in step. */
.perm-panel[hidden] {
  display: none !important;
}

/* ------------------------------------------------- notification prefs ----- */

.notif-group {
  border-bottom: 1px solid var(--rule);
}

.notif-group:last-of-type {
  border-bottom: 0;
}

/* --------------------------------------------------------- alert inbox ----- */
.inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.inbox-item {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rule-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 10px 12px;
}

.inbox-item.is-unread {
  background: var(--surface-2);
  border-left-color: var(--pine);
}

.inbox-item--warn {
  border-left-color: var(--brass);
}

.inbox-item--bad {
  border-left-color: var(--bad);
}

.inbox-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
}

.inbox-item__cat {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.inbox-item__title {
  display: block;
  margin-top: 4px;
  font-size: 14.5px;
  color: var(--ink);
}

.inbox-item__body {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-2);
}

.inbox-item__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12.5px;
}

.inbox-item__link {
  font-weight: 650;
  color: var(--pine);
}
