/* ══════════════════════════════════════════════════════════════════
   LOGIN & NO-ACCESS
   ══════════════════════════════════════════════════════════════════ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--sp-6);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--sp-10) var(--sp-8) var(--sp-8);
  width: 400px;
  text-align: center;
  box-shadow: var(--sh-2);
}
/* Same assets/logo.svg as the header, just larger. */
.login-mark {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto var(--sp-4);
  border-radius: var(--r-lg);
  object-fit: contain;
}
.login-card .logo {
  justify-content: center;
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-2);
}
.login-card p.tagline {
  color: var(--muted);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-6);
}
.google-btn {
  width: 100%;
  padding: var(--sp-3);
  font-size: var(--fs-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: var(--sp-5) 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.login-card input[type="email"] {
  width: 100%;
  padding: var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-3);
  transition: border-color var(--dur-1) var(--ease-out);
}
.login-card input[type="email"]:hover {
  border-color: var(--muted);
}
.primary-btn {
  width: 100%;
  padding: var(--sp-3);
}
.login-msg {
  font-size: var(--fs-sm);
  margin-top: var(--sp-3);
  min-height: 18px;
}
.login-msg.ok {
  color: var(--ok);
}
.login-msg.err {
  color: var(--danger);
}
.noaccess-msg {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: var(--sp-3);
  color: var(--ink);
  word-break: break-all;
}

/* ══════════════════════════════════════════════════════════════════
   EMPTY & LOADING STATES — teach the interface, don't say "nothing".
   ══════════════════════════════════════════════════════════════════ */

.loading-note {
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
}
.empty-state {
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
}
.empty-state h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}
.empty-state p {
  color: var(--muted);
  font-size: var(--fs-md);
  max-width: 46ch;
  margin: 0 auto;
  text-wrap: pretty;
}

/* Skeleton placeholder — a calm shimmer while data loads. */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 37%,
    var(--surface-2) 63%
  );
  background-size: 400% 100%;
  border-radius: var(--r-sm);
  animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
.roster-skeleton {
  padding: var(--sp-2) 0;
}
.sk-title {
  height: 22px;
  width: 46%;
  margin-bottom: var(--sp-4);
}
.sk-row {
  height: 40px;
  margin-bottom: var(--sp-2);
}
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* Visible to screen readers only — announces state without showing text. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-backdrop);
  padding: var(--sp-6);
}
.modal-backdrop.open {
  display: flex;
  animation: backdrop-in var(--dur-2) var(--ease-out);
}
.modal-card {
  position: relative;
  z-index: var(--z-modal);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  padding: var(--sp-6) var(--sp-6) var(--sp-5);
  width: 460px;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--sh-3);
  animation: modal-in var(--dur-3) var(--ease-out);
}
.modal-card h3 {
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-5);
}
.modal-field {
  margin-bottom: var(--sp-4);
}
.modal-field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}
/* Rounded pill-ish fields with a Term-style custom chevron + focus ring,
   instead of the boxy native control. The open list is still OS-drawn. */
/* Text fields only. A checkbox is an input too, and this rule used to hit it —
   width:100% plus text-field padding turned every tick inside a modal into a
   full-width white bar on its own line. The global `input[type="checkbox"]`
   in controls.css could not save it: (0,1,1) loses to this rule's (0,2,0), and
   dialogs.css loads last. Excluding them here fixes it at the source (per Big,
   2026-07-22, who spotted it on the Add-students picker). */
.modal-field select,
.modal-field input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  padding: 11px var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  font-size: var(--fs-md);
  color: var(--ink-2);
  background: var(--surface);
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out);
}
.modal-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.modal-field select:hover,
.modal-field input:not([type="checkbox"]):not([type="radio"]):hover {
  border-color: var(--muted);
  background: var(--surface-2);
}
.modal-field select:focus,
.modal-field input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.09);
}

/* Custom dropdown (cselectHtml) — a styled, rounded replacement for the
   native <select> so the OPEN list is rounded too, not just the field. */
.cselect {
  position: relative;
}
.cselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  padding: 11px var(--sp-4);
  font: inherit;
  font-size: var(--fs-md);
  color: var(--ink-2);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out);
}
.cselect-trigger:hover {
  border-color: var(--muted);
  background: var(--surface-2);
}
.cselect-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.09);
}
.cselect-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Placeholder prompts (before a real choice) are bold to draw the eye:
   the closed field's "(Please select…)" label, its list option, and the
   text-input placeholders. Applies to every custom dropdown (Add class too). */
.cselect-value.is-placeholder,
.cselect-option[data-value=""] {
  font-weight: 700;
}
.modal-field input::placeholder {
  font-weight: 600;
}
/* In the Add reservation form, bold EVERY dropdown value (not only the
   placeholders). Scoped to .modal-reservation so the Add class modal is
   unaffected. */
.modal-reservation .cselect-value {
  font-weight: 700;
}
/* Locked dropdown — Room/Session fixed by the grid slot the user clicked.
   Greyed, not clickable, and the chevron is hidden so it doesn't look
   openable. */
.cselect-locked .cselect-trigger,
.cselect-trigger:disabled {
  cursor: not-allowed;
  background: var(--surface-2);
  color: var(--muted);
}
.cselect-locked .cselect-trigger:hover {
  border-color: var(--line-strong);
}
.cselect-locked .cselect-chevron {
  display: none;
}
.cselect-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform var(--dur-2) var(--ease-out);
}
.cselect-trigger[aria-expanded="true"] .cselect-chevron {
  transform: rotate(180deg);
}
.cselect-menu {
  position: fixed;
  margin: 0;
  inset: auto;
  padding: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  max-height: 46vh; /* fallback — JS clamps it to the real space on screen */
  overflow-y: auto;
  min-width: 200px;
  /* Reaching the end of the list must NOT hand the leftover scroll to the
     page behind (scroll chaining) — that outside scroll would instantly
     close the menu. */
  overscroll-behavior: contain;
}
.cselect-menu:popover-open {
  animation: term-menu-in var(--dur-2) var(--ease-out);
}

/* Search box on long lists (per Big, 2026-07-23). Sticky, so it stays put
   while the options scroll underneath — and it has to paint over them, hence
   the solid background and the z-index. The negative margins cancel the
   menu's own padding so the divider runs the full width. */
.cselect-search {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: calc(var(--sp-1) * -1) calc(var(--sp-1) * -1) var(--sp-1);
  padding: var(--sp-2);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.cselect-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px var(--sp-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-base);
}
.cselect-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.cselect-search-input::placeholder {
  color: var(--muted);
  font-weight: 500;
}
/* Shown only when the search matches nothing — an empty menu with no
   explanation reads as broken. */
.cselect-empty {
  margin: 0;
  padding: var(--sp-3);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
/* The search box hides non-matching options with the `hidden` attribute, but
   an author `display: flex` beats the browser's own `[hidden] { display:none }`
   every time — without this the filter would set the flag and nothing would
   visibly change. */
.cselect-option[hidden] {
  display: none;
}
.cselect-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: var(--fs-md);
  color: var(--ink-2);
  background: none;
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out);
}
.cselect-option:hover,
.cselect-option:focus-visible {
  background: var(--surface-2);
}
.cselect-option:focus-visible {
  outline-offset: -2px;
}
/* Not choosable — a term that has already finished (see js/format.js
   isPastTerm). Dimmed and struck through so it reads as "gone", not as
   "loading"; the hover highlight is cancelled so nothing invites the click. */
.cselect-option.is-disabled {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: not-allowed;
  opacity: 0.65;
}
.cselect-option.is-disabled:hover {
  background: none;
}
.cselect-check {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--accent);
  opacity: 0;
}
.cselect-option[aria-selected="true"] {
  background: var(--surface-3);
  font-weight: 600;
  color: var(--ink);
}
.cselect-option[aria-selected="true"] .cselect-check {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .cselect-menu:popover-open {
    animation: none;
  }
}

.modal-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}
.modal-actions button {
  padding: 10px var(--sp-5);
  font-size: var(--fs-md);
  border-radius: var(--r-lg);
}
.modal-actions .delete {
  margin-right: auto;
}
.modal-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-ring);
  color: var(--warn-strong);
  font-size: var(--fs-base);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
}
/* Red (blocking) variant — a room clash stops the save, unlike the yellow
   advisory warnings. */
.modal-warn.modal-warn-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}

/* A required field left empty gets a red ring; typing/choosing clears it. */
.field-invalid,
.cselect-trigger.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.14) !important;
}

/* Shake — draws the eye to a blocked action. Restarted from JS (shakeEl). */
@keyframes pop-shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}
.shake {
  animation: pop-shake 0.5s var(--ease-out);
}

/* The megaphone's unread shake (js/announce.js). A quick bell-wobble in the
   first ~12% of the cycle, then still for the rest — so it draws the eye every
   few seconds instead of buzzing nonstop. Reduced-motion (motion.css) forces
   iteration-count to 1, so it settles after one wobble. */
@keyframes ann-shake {
  0%,
  12%,
  100% {
    transform: rotate(0);
  }
  2% {
    transform: rotate(-11deg);
  }
  4% {
    transform: rotate(9deg);
  }
  6% {
    transform: rotate(-7deg);
  }
  8% {
    transform: rotate(5deg);
  }
  10% {
    transform: rotate(-2deg);
  }
}

/* ── Announcement feed (📢, js/announce.js) ──────────────────────────
   The FiveM-style notice: a dimmed backdrop with the panel near the TOP of the
   screen (per Big, 2026-07-30), not modal-centred — a glance, not a task. */
.ann-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: rgba(15, 23, 42, 0.38);
  animation: backdrop-in var(--dur-2) var(--ease-out);
}
.ann-pop {
  position: fixed;
  z-index: var(--z-modal);
  top: 84px; /* up near the top, under the header */
  left: 50%;
  transform: translateX(-50%);
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-3);
  overflow: hidden;
  animation: ann-pop-in var(--dur-3) var(--ease-out);
}
@keyframes ann-pop-in {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}
.ann-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
}
.ann-head-icon {
  display: inline-flex;
}
.ann-head-icon .ann-ico {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}
.ann-close {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-md);
  line-height: 1;
}
.ann-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}
/* Filter bar (per Big, 2026-07-30): narrow the feed to Dashboard launches or
   expired students. Sits under the head and never scrolls with the list. Each
   chip carries a live count. */
.ann-filter {
  flex-shrink: 0;
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.ann-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 3px var(--sp-3);
  cursor: pointer;
  transition:
    background-color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out);
}
.ann-chip:hover {
  border-color: var(--muted);
  color: var(--ink);
}
.ann-chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
/* The count that rides each chip. Dims on the unselected chips, inverts on the
   selected (accent) one so it stays legible. */
.ann-chip-n {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
}
.ann-chip.on .ann-chip-n {
  color: var(--accent-ink);
  opacity: 0.85;
}
/* "Clear this feed for me" — a quiet text action pushed to the far right of the
   filter bar, deliberately lighter than the kind chips since it's a personal
   dismiss, not a filter. */
.ann-clear {
  margin-left: auto;
  align-self: center;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 3px var(--sp-3);
  cursor: pointer;
  transition:
    background-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out);
}
.ann-clear:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.ann-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Each notice reads like a Change Log line (per Big, 2026-07-30): a clear
   timestamp above, the text below. */
.ann-entry {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.ann-entry:last-child {
  border-bottom: none;
}
.ann-entry .log-when {
  display: block;
  margin-bottom: 3px;
}
.ann-entry-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--ink);
}
/* The speaker riding each notice's heading (per Big, 2026-07-30). Small — it
   is a bullet on the title, not the big header icon. */
.ann-entry-ico {
  display: inline-flex;
  flex-shrink: 0;
}
.ann-entry-ico .ann-ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}
/* Expired-student notices carry the same flag icon as the Roster/Waiting List,
   in danger red, so the two kinds of notice are told apart at a glance. */
.ann-flag {
  display: inline-flex;
  color: var(--danger);
}
.ann-flag .fl {
  width: 16px;
  height: 16px;
  display: block;
}
.ann-entry-expired .ann-entry-title {
  color: var(--danger);
}
.ann-entry-text {
  color: var(--ink-2);
  line-height: 1.45;
}
.ann-empty {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--muted);
}
.ann-empty h3 {
  font-size: var(--fs-md);
  color: var(--ink-2);
  margin-bottom: var(--sp-1);
}

/* ── App popup (alertPopup / confirmPopup) — floats above any modal ──
   A [popover] element sits in the browser's top layer, so no z-index war.
   The default popover UA style centers it; we only style the card. */
.app-popup {
  /* Centre it. The browser centres popovers with margin:auto by default, but
     our global `* { margin: 0 }` reset wipes that out — leaving inset:0 to pin
     the popup in the top-left corner. Re-assert the centring here (height must
     shrink to content so the vertical auto-margins can split the leftover). */
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: 400px;
  max-width: calc(100vw - 40px);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-3);
}
.app-popup::backdrop {
  background: rgba(15, 23, 42, 0.4);
}
.app-popup.tone-danger {
  border-top: 4px solid var(--danger);
}
.app-popup-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.app-popup-head svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.tone-danger .app-popup-head {
  color: var(--danger);
}
.app-popup-head h4 {
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}
.app-popup p {
  color: var(--ink-2);
  font-size: var(--fs-md);
  line-height: 1.55;
}
.app-popup-actions {
  margin-top: var(--sp-5);
}
/* In the popup the danger button sits on the RIGHT next to Cancel (unlike a
   modal's Delete, which .modal-actions pushes to the far left). */
.app-popup-actions .delete {
  margin-right: 0;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

/* ══════════════════════════════════════════════════════════════════
   ROOM PICKER — "which room?" when moving a student off the Waiting
   List (js/roomPick.js). Pre-filtered to their level, so this list is
   short by construction; it scrolls anyway for the big levels.
   ══════════════════════════════════════════════════════════════════ */

.rp-intro {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}
.rp-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: min(52vh, 420px);
  overflow-y: auto;
  /* Room for the focus ring on the first and last rows. */
  padding: 2px;
  margin-bottom: var(--sp-4);
}
.rp-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  font: inherit;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition:
    background-color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out);
}
.rp-option:hover,
.rp-option:focus-visible {
  background: var(--surface-2);
  border-color: var(--ink);
}
.rp-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rp-group {
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--ink);
}
.rp-meta {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.rp-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.rp-seats {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
/* Full rooms stay CHOOSABLE — capacity warns here, it never blocks (same rule
   as js/warnings.js). The tag is the whole warning. */
.rp-tag {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.rp-tag-full {
  background: var(--danger-bg);
  color: var(--danger);
}
.rp-tag-quota {
  background: var(--warn-bg);
  color: var(--warn);
}

/* ══════════════════════════════════════════════════════════════════
   TOAST CARDS — bottom-right stack (js/toast.js).

   The card is WHITE; the level's colour is carried by the icon, the
   left edge and the timer bar. Colour is never the only signal — each
   level also has its own icon and its own title — so the four levels
   still read apart in greyscale.
   ══════════════════════════════════════════════════════════════════ */

.toast-stack {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: min(400px, calc(100vw - 2 * var(--sp-6)));
  /* The container spans the corner but must not swallow clicks on the page
     behind it — only the cards themselves are interactive. */
  pointer-events: none;
}

.toastc {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  /* The level's colour as a solid left edge — the one piece of colour big
     enough to identify the card from the corner of your eye. */
  border-left: 4px solid var(--tc);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--sh-3);
  overflow: hidden;
  pointer-events: auto;
  animation: toastc-in var(--dur-2) var(--ease-out);
}
.toastc.out {
  opacity: 0;
  transform: translateX(12px);
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
}
@keyframes toastc-in {
  from {
    opacity: 0;
    transform: translateX(16px) scale(0.98);
  }
}

/* Per-level colour. Everything else reads --tc, so a new level is one block. */
.toastc-ok {
  --tc: #15803d;
  --tc-bg: #dcfce7;
}
.toastc-info {
  --tc: #1d4ed8;
  --tc-bg: #dbeafe;
}
.toastc-warn {
  --tc: var(--warn-solid);
  --tc-bg: var(--warn-bg);
}
.toastc-err {
  --tc: var(--danger);
  --tc-bg: var(--danger-bg);
}

.toastc-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tc-bg);
  color: var(--tc);
  flex-shrink: 0;
}
.toastc-icon svg {
  width: 17px;
  height: 17px;
}

.toastc-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.toastc-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--tc);
  letter-spacing: 0.01em;
}
.toastc-msg {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  line-height: 1.45;
  /* Long messages wrap rather than stretch the card; database error text can
     be one unbroken string, so break it rather than let it overflow. */
  overflow-wrap: anywhere;
}

.toastc-x {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin: -2px -4px 0 0;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out);
}
.toastc-x svg {
  width: 13px;
  height: 13px;
}
.toastc-x:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* The timer, drawn as the card's bottom edge: it drains left-to-right so the
   time left to read is visible instead of guessed. Hovering pauses it, which
   is why it is an animation rather than a transition. */
.toastc-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--tc);
  opacity: 0.45;
  transform-origin: left center;
  animation-name: toastc-drain;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
.toastc.hold .toastc-bar {
  animation-play-state: paused;
}
@keyframes toastc-drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toastc {
    animation: none;
  }
  .toastc.out {
    transition: none;
  }
  /* Keep the bar as a static full-width rule rather than a moving one. */
  .toastc-bar {
    animation: none;
  }
}

/* A modal that carries a wide table rather than a stack of fields — the
   new-academic-year form fills all three language calendars side by side. */
.modal-card.modal-wide {
  width: 1020px;
}

/* ── New academic year modal ─────────────────────────────────────────
   A grid: term number down the left, then one column per language, each
   holding that team's start–end pair (per Big, 2026-07-22). Column headers
   reuse .term-lang-head from the Term dropdown so the three teams read the
   same colours everywhere in the app. */
.ny-grid-wrap {
  overflow-x: auto; /* narrow screens scroll the table, never the page */
}
.ny-grid {
  display: grid;
  grid-template-columns: 26px repeat(3, minmax(230px, 1fr));
  gap: 5px var(--sp-3);
  align-items: center;
  min-width: 0;
}
.ny-num {
  text-align: right;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ny-pair {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.ny-sep {
  color: var(--muted);
  flex: none;
}
.ny-date {
  flex: 1;
  min-width: 0;
  padding: 6px 10px !important;
  font-size: var(--fs-base) !important;
}
/* Stack to one language per block when there isn't room for three columns. */
@media (max-width: 1080px) {
  .ny-grid {
    grid-template-columns: 26px repeat(3, minmax(200px, 1fr));
  }
}

/* Footnote under the new-year grid — carries the "copy Thai across" shortcut. */
.ny-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.5;
}

/* One-line explainer under a modal heading (e.g. which language a term edit
   touches). */
.modal-sub {
  margin: calc(-1 * var(--sp-2)) 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* Why a field is locked, sitting directly under it. Reads as an explanation
   rather than a warning: nothing has gone wrong, the change just belongs on
   another page. */
.modal-hint {
  margin: var(--sp-1) 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* "+ Add room view" language picker — three cards, pick one. Each card is
   tinted with its language's own colour so the choice reads at a glance
   (per Big, 2026-07-22). */
.modal-card.modal-pick {
  width: 560px;
}
.langpick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.langpick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-2);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
}
.langpick-card:hover:not(:disabled),
.langpick-card:focus-visible:not(:disabled) {
  transform: translateY(-3px);
}
.langpick-card:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.langpick-card.c-thai:hover:not(:disabled),
.langpick-card.c-thai:focus-visible:not(:disabled) {
  border-color: var(--thai-solid);
  background: var(--thai-bg);
}
.langpick-card.c-eng:hover:not(:disabled),
.langpick-card.c-eng:focus-visible:not(:disabled) {
  border-color: var(--eng-solid);
  background: var(--eng-bg);
}
.langpick-card.c-chi:hover:not(:disabled),
.langpick-card.c-chi:focus-visible:not(:disabled) {
  border-color: var(--chi-solid);
  background: var(--chi-bg);
}
.langpick-flag img {
  width: 34px;
  height: auto;
  border-radius: var(--r-sm);
}
.langpick-name {
  font-weight: 700;
}
.langpick-card.c-thai .langpick-name {
  color: var(--thai-title);
}
.langpick-card.c-eng .langpick-name {
  color: var(--eng-title);
}
.langpick-card.c-chi .langpick-name {
  color: var(--chi-title);
}
.langpick-term,
.langpick-why {
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.4;
}
.langpick-why {
  font-weight: 600;
  color: var(--danger);
}

/* Small Edit button in the Manage/Setting cards (terms). */
.mcard-edit {
  /* Push every row's Edit button to the right so they all line up in a column
     next to the ✕, regardless of how long the label is — with a small gap kept
     before the ✕ (per Big, 2026-07-29). */
  margin-left: auto;
  margin-right: var(--sp-2);
  flex-shrink: 0;
  transition:
    background-color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out);
}
/* Soft yellow on hover/focus, so it's obvious which row you're about to edit. */
.mcard-edit:hover,
.mcard-edit:focus-visible {
  background: var(--thai-bg);
  border-color: var(--thai-ring);
  color: var(--thai-title);
}

/* New/Continuing quota inputs in the class modal — two labelled numbers
   on one row. */
/* New / Continuing quota — two knob columns side by side. */
.quota-knobs {
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
}
.quota-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}
.quota-col .quota-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}

/* ── Knob (js/knob.js) — a dial driving a hidden number input. Graphite only,
   never a language colour (tokens.css rule 1). ─────────────────────────── */
.knob-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.knob {
  position: relative;
  width: 104px;
  height: 104px;
  flex-shrink: 0;
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
  user-select: none;
  outline: none;
}
.knob:active {
  cursor: grabbing;
}
.knob:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.knob svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.knob .ktrack {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 12;
  stroke-linecap: round;
}
.knob .kprog {
  fill: none;
  stroke: var(--accent);
  stroke-width: 12;
  stroke-linecap: round;
}
.knob .khandle {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3.5;
  filter: drop-shadow(0 2px 3px rgba(15, 23, 42, 0.28));
}
.knob-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.knob-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
}
.knob-val.inf {
  font-size: 30px;
}
.knob.off {
  opacity: 0.5;
  pointer-events: none;
}
.knob.off .khandle {
  display: none;
}
.knob-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.knob-step {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background-color var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out);
}
.knob-step:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}
.knob-nolimit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--muted);
  cursor: pointer;
}
.knob-nolimit input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}
