/* ══════════════════════════════════════════════════════════════════
   WARNINGS — advisory, never blocking. Loud enough to notice,
   quiet enough to ignore on purpose.
   ══════════════════════════════════════════════════════════════════ */

.warnbox {
  background: var(--warn-bg);
  border: 1px solid var(--warn-ring);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-md);
  color: var(--ink-2);
}
.warnbox h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--warn-strong);
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.warnbox ul {
  display: grid;
  gap: var(--sp-1);
}
.warnbox li {
  margin-left: var(--sp-5);
  padding-left: var(--sp-1);
}
.warnbox li::marker {
  color: var(--warn);
}
.warnbox .note {
  color: var(--warn);
  font-size: var(--fs-sm);
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--warn-ring);
}

/* ══════════════════════════════════════════════════════════════════
   SCHEDULE GRID
   ══════════════════════════════════════════════════════════════════ */

.gridwrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
table.sched {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
table.sched th,
table.sched td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-2);
  vertical-align: top;
}
table.sched th:last-child,
table.sched td:last-child {
  border-right: none;
}
table.sched tbody tr:last-child th,
table.sched tbody tr:last-child td {
  border-bottom: none;
}
table.sched thead th {
  background: var(--surface-2);
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--muted);
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  white-space: nowrap;
}
/* Session column headers: a small "SECTION N" label above the time.
   All four look identical on purpose — colour in this app means language,
   so tinting the sessions would send a false signal. */
.section-title_1,
.section-title_2,
.section-title_3,
.section-title_4 {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.section-time {
  display: block;
  margin-top: 3px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
}

/* The room column stays put while the sessions scroll sideways. */
th.roomcol {
  position: sticky;
  left: 0;
  z-index: var(--z-sticky);
  text-align: left;
  padding-left: var(--sp-3);
  width: 168px;
  min-width: 168px;
  background: var(--surface-2);
  border-right: 1px solid var(--line-strong);
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  vertical-align: middle;
}
thead th.roomcol {
  z-index: calc(var(--z-sticky) + 1);
  color: var(--muted);
}
th.roomcol .cap {
  display: block;
  font-weight: 400;
  font-size: var(--fs-sm);
  color: var(--muted);
}
/* Chair icon before the seat count. */
.cap-icon {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 4px;
  color: var(--muted);
}
th.roomcol .online {
  display: block;
  color: var(--eng-meta);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Section header row that separates Onsite rooms from Online rooms. The
   label cell reuses .roomcol so it stays pinned on horizontal scroll; the
   rest of the band is filled with tinted cells. */
tr.room-group th.room-group-label {
  background: var(--surface-3);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}
tr.room-group .room-group-fill {
  background: var(--surface-3);
  border-bottom: 1px solid var(--line-strong);
}
.rg-icon {
  width: 15px;
  height: 15px;
  vertical-align: -3px;
  margin-right: var(--sp-2);
}
.rg-count {
  margin-left: var(--sp-2);
  color: var(--muted);
  font-weight: 600;
}
.rg-onsite th.room-group-label .rg-icon {
  color: var(--muted);
}
.rg-online th.room-group-label .rg-icon {
  color: var(--eng-meta);
}

/* The grid is read-only (2026-07-16): no pointer cursor, no "clickable"
   hover on empty slots — booking happens on the Roster page. */
td.slot {
  min-width: 200px;
  height: 64px;
  background: var(--surface);
  transition: background-color var(--dur-1) var(--ease-out);
}
/* When the Dashboard is filtered to ONE language, a slot occupied by another
   language's class shows this red "Booked" marker instead of looking empty —
   so staff instantly see WHY they can't book here. (The "All languages"
   filter shows the real cards, so it never renders these.) */
.slot-booked {
  border: 1.5px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-base);
  line-height: 1.4;
  cursor: not-allowed;
  text-align: center;
}
.slot-booked-title {
  display: block;
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* A clashing slot is tinted and outlined — colour is never the only cue,
   the class cards inside also carry a ROOM CLASH tag. */
td.clash {
  background: var(--warn-bg);
  box-shadow: inset 0 0 0 2px var(--warn-solid);
}

/* ── Class card ──────────────────────────────────────────────────
   Full border + tint + a solid dot. No side stripes: a 4px left
   border reads as an accident of CSS, not a decision. */
.class-card {
  border: 1px solid;
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3);
  font-size: var(--fs-base);
  line-height: 1.4;
  cursor: help; /* hover = tooltip with details; the card is not clickable */
  box-shadow: var(--sh-1);
  transition:
    transform var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out);
}
.class-card + .class-card {
  margin-top: var(--sp-1);
}
.class-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--sh-2);
}
.class-card:active {
  transform: translateY(0);
}

/* Card text is centered (2026-07-15, per Big) — the head row, the
   teacher/count row, and the warning tags all line up mid-cell. */
.cc-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-width: 0;
}
.cc-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.cc-head b {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.005em;
}
.cc-course {
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.class-card .meta {
  font-size: var(--fs-sm);
  display: flex;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: 2px;
}
.cc-teacher {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-count {
  font-weight: 600;
  flex-shrink: 0;
}
.cc-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
}

/* Language is carried by tint + border + dot + text colour, so a
   colour-blind user still gets the border shape and the dot position. */
.lang-thai {
  background: var(--thai-bg);
  border-color: var(--thai-ring);
  color: var(--thai-meta);
}
.lang-thai .cc-head b,
.lang-thai .cc-course {
  color: var(--thai-title);
}
.lang-thai .cc-dot {
  background: var(--thai-solid);
}

.lang-eng {
  background: var(--eng-bg);
  border-color: var(--eng-ring);
  color: var(--eng-meta);
}
.lang-eng .cc-head b,
.lang-eng .cc-course {
  color: var(--eng-title);
}
.lang-eng .cc-dot {
  background: var(--eng-solid);
}

.lang-chi {
  background: var(--chi-bg);
  border-color: var(--chi-ring);
  color: var(--chi-meta);
}
.lang-chi .cc-head b,
.lang-chi .cc-course {
  color: var(--chi-title);
}
.lang-chi .cc-dot {
  background: var(--chi-solid);
}

.wtag {
  display: inline-block;
  background: var(--warn-solid);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 1px var(--sp-2);
  border-radius: var(--r-sm);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════
   ROOM AVAILABILITY
   ══════════════════════════════════════════════════════════════════ */

.avail td.slot {
  text-align: center;
  vertical-align: middle;
  font-size: var(--fs-base);
  font-weight: 600;
  height: 46px;
  cursor: default;
}
.avail td.free {
  background: var(--ok-bg);
  color: var(--ok);
}
.avail td.busy-thai {
  background: var(--thai-bg);
  color: var(--thai-title);
}
.avail td.busy-eng {
  background: var(--eng-bg);
  color: var(--eng-title);
}
.avail td.busy-chi {
  background: var(--chi-bg);
  color: var(--chi-title);
}

.legend {
  display: flex;
  gap: var(--sp-4);
  font-size: var(--fs-base);
  color: var(--muted);
  align-items: center;
}
.legend > span {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.dot-free {
  background: var(--ok);
}
.dot-thai {
  background: var(--thai-mark);
}
.dot-eng {
  background: var(--eng-mark);
}
.dot-chi {
  background: var(--chi-mark);
}

/* ══════════════════════════════════════════════════════════════════
   PANELS & DATA TABLES
   ══════════════════════════════════════════════════════════════════ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-1);
}
.panel h2 {
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-1);
}
.panel .sub {
  color: var(--muted);
  font-size: var(--fs-base);
  margin-bottom: var(--sp-4);
  max-width: 75ch;
}
.table-scroll {
  overflow-x: auto;
}

/* ── Roster ── */
table.roster {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: var(--fs-base);
}
table.roster th,
table.roster td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: var(--sp-2) var(--sp-3);
  text-align: center;
}
table.roster th:last-child,
table.roster td:last-child {
  border-right: none;
}
table.roster thead th {
  background: var(--surface-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border-top: 1px solid var(--line);
}
table.roster thead th:first-child {
  border-top-left-radius: var(--r-md);
}
table.roster thead th:last-child {
  border-top-right-radius: var(--r-md);
}
table.roster tbody tr {
  transition: background-color var(--dur-1) var(--ease-out);
}
table.roster tbody tr:hover {
  background: var(--surface-2);
}
/* Student names stay pinned to the left while the attendance days scroll. */
table.roster td.name,
table.roster thead th:first-child {
  position: sticky;
  left: 0;
  z-index: var(--z-sticky);
  text-align: left;
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface);
  border-right: 1px solid var(--line-strong);
}
table.roster thead th:first-child {
  background: var(--surface-2);
}
table.roster tbody tr:hover td.name {
  background: var(--surface-2);
}
table.roster tr.total td {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--ink);
  border-bottom: none;
}
table.roster tr.total td.name {
  background: var(--surface-2);
}
table.roster tr.total:hover {
  background: var(--surface-2);
}

/* ── Change Log — a compact audit feed, not a big table. Fixed time rail
      on the left, who + what on the right, dense scannable rows. ── */

/* Change Log + Access Log side by side; stacks when the window is narrow. */
.log-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
.logfeed {
  max-width: 880px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
/* Inside the split the two feeds share the row, so drop the standalone cap. */
.log-split .logfeed {
  max-width: none;
}

/* Access Log status marks: a coloured dot before the email. */
.access-entry .log-text {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}
.access-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  transform: translateY(-1px);
}
.access-entry.ev-ok .access-dot {
  background: var(--ok);
}
.access-entry.ev-deny .access-dot {
  background: var(--danger);
}
.access-entry.ev-deny .log-what {
  color: var(--danger);
}
.logfeed-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.logfeed-head h2 {
  font-size: var(--fs-md);
  font-weight: 700;
}
.logfeed-count {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.logfeed-note {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.logfeed-body {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.log-entry {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: var(--sp-3);
  align-items: baseline;
  padding: 7px var(--sp-4);
  font-size: var(--fs-base);
  border-bottom: 1px solid var(--line);
  transition: background-color var(--dur-1) var(--ease-out);
}
.log-entry:last-child {
  border-bottom: none;
}
.log-entry:hover {
  background: var(--surface-2);
}
.log-when {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 1px;
}
.log-text {
  line-height: 1.45;
  color: var(--ink-2);
}
.log-who {
  font-weight: 700;
  color: var(--ink);
}
/* Middot between who and what, so the eye separates actor from action. */
.log-who::after {
  content: "·";
  margin: 0 var(--sp-2);
  color: var(--line-strong);
  font-weight: 400;
}

/* ── Reservation table ── */
table.log {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--fs-base);
}
table.log th,
table.log td {
  border-bottom: 1px solid var(--line);
  padding: var(--sp-3);
  text-align: left;
  vertical-align: middle;
}
table.log thead th {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border-bottom-color: var(--line-strong);
}
table.log tbody tr {
  transition: background-color var(--dur-1) var(--ease-out);
}
table.log tbody tr:hover {
  background: var(--surface-2);
}
table.log tbody tr:last-child td {
  border-bottom: none;
}

/* ── Inline status marks ── */
.flag {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--warn-strong);
  background: var(--warn-bg);
  border: 1px solid var(--warn-ring);
  padding: 1px var(--sp-2);
  border-radius: var(--r-sm);
  margin-left: var(--sp-2);
  white-space: nowrap;
}

.pill {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 2px var(--sp-2);
  border-radius: var(--r-full);
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill.lang-thai {
  background: var(--thai-bg);
  border-color: var(--thai-ring);
  color: var(--thai-title);
}
.pill.lang-eng {
  background: var(--eng-bg);
  border-color: var(--eng-ring);
  color: var(--eng-title);
}
.pill.lang-chi {
  background: var(--chi-bg);
  border-color: var(--chi-ring);
  color: var(--chi-title);
}
.pill.st-waiting {
  background: var(--warn-bg);
  color: var(--warn-strong);
  border-color: var(--warn-ring);
}
.pill.st-assigned {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-ring);
}

/* ══════════════════════════════════════════════════════════════════
   MANAGE & SETTING
   ══════════════════════════════════════════════════════════════════ */

.headnote {
  font-size: var(--fs-base);
  color: var(--muted);
  margin-bottom: var(--sp-5);
  max-width: 75ch;
}
.headnote b {
  color: var(--ink-2);
}

.manage-group {
  margin-bottom: var(--sp-8);
}
/* A section heading, not a card. Cards inside cards are always wrong. */
.manage-group-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line-strong);
}
.mg-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  background: var(--accent);
}
.manage-thai .mg-dot {
  background: var(--thai-mark);
}
.manage-eng .mg-dot {
  background: var(--eng-mark);
}
.manage-chi .mg-dot {
  background: var(--chi-mark);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-4);
}
.mcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--sh-1);
  transition:
    box-shadow var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out);
}
.mcard:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-2);
}
.mcard h3 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: var(--sp-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
}
.mcard ul {
  list-style: none;
  font-size: var(--fs-base);
  max-height: 264px;
  overflow-y: auto;
  overflow-x: hidden;
}
.mcard li {
  padding: var(--sp-2) var(--sp-1);
  border-radius: var(--r-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-2);
  gap: var(--sp-2);
  min-height: 32px;
  transition: background-color var(--dur-1) var(--ease-out);
}
.mcard li + li {
  box-shadow: 0 -1px 0 var(--line);
}
.mcard li:hover {
  background: var(--surface-2);
}
.mcard li span {
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* Gender in the Reservation table: coloured glyph (blue ♂ / pink ♀) with
   the word beside it — glyph and word share the same colour. The glyph's
   stroke is thin, so it gets extra size + a text-shadow "bold". */
.g-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 600;
  white-space: nowrap;
}
.g-icon {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 0.6px currentColor;
}
.g-male {
  color: #2563eb;
}
.g-female {
  color: #ec4899;
}

/* ══════════════════════════════════════════════════════════════════
   RESERVATION TOOLBAR — search + sort + filters above the table
   ══════════════════════════════════════════════════════════════════ */
.res-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
/* Search box with a magnifier icon inside its left edge. */
.res-search {
  position: relative;
}
.res-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.res-search input {
  width: 240px;
  padding: 8px var(--sp-3) 8px 34px;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out);
}
.res-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.09);
}
/* The dropdowns are the same cselect used in modals, just compact —
   and sized to their content instead of stretching full-width. */
.res-toolbar .cselect {
  width: auto;
}
.res-toolbar .cselect-trigger {
  width: auto;
  min-width: 130px;
  padding: 8px var(--sp-3);
  font-size: var(--fs-base);
}
.res-toolbar .hint {
  margin-left: auto;
  text-align: right;
}

/* ══════════════════════════════════════════════════════════════════
   ROSTER — room views: mini dashboard + one expandable card per class
   ══════════════════════════════════════════════════════════════════ */

/* Mini dashboard tiles (totals for the picked section). */
.roster-dash {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.dash-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-3) var(--sp-5);
  min-width: 130px;
}
.dash-label {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 2px;
}
.dash-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.dash-warn .dash-value {
  color: var(--danger);
}
.dash-hold {
  color: var(--muted);
  cursor: help; /* tooltip explains it waits for the Attendance program */
}
/* Status legend: colours match the per-student chips below. */
.dash-legend {
  align-self: center;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.st-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--r-full);
  display: inline-block;
}
.st-dot.st-PT {
  background: #f59e0b;
}
.st-dot.st-VT {
  background: #10b981;
}
.st-dot.st-V {
  background: #3b82f6;
}
.st-dot.st-P {
  background: #9ca3af;
}

/* ── Level frames: Journey (green) → Explore (orange) → Connect (blue) ──
   One big tinted frame per difficulty level; the room cards sit in a grid
   INSIDE each frame. Colours are the school's own level colours (per Big,
   2026-07-16) — unrelated to the language colours on the cards' dots. */
.rlevel {
  border: 2px solid;
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-4) var(--sp-4);
  margin-bottom: var(--sp-5);
}
.rlevel-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: var(--sp-3);
}
.rlevel-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: currentColor;
}
.rlevel-count {
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}
.rlevel-J {
  border-color: #86efac;
  background: #f0fdf4;
}
.rlevel-J .rlevel-title {
  color: #15803d;
}
.rlevel-E {
  border-color: #fdba74;
  background: #fff7ed;
}
.rlevel-E .rlevel-title {
  color: #c2410c;
}
.rlevel-C {
  border-color: #93c5fd;
  background: #eff6ff;
}
.rlevel-C .rlevel-title {
  color: #1d4ed8;
}
.rlevel-other {
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.rlevel-other .rlevel-title {
  color: var(--muted);
}
/* Course name on each room card, coloured by its level — same colours as
   the frames so the eye links them instantly. */
.course-lv {
  font-weight: 700;
}
/* The title dot follows the level colour too: the course-lv-* class sets its
   `color`, and currentColor paints the circle with it (overrides the default
   language tint from .lang-*). */
.rcard-title .cc-dot {
  background: currentColor;
}
.course-lv-J {
  color: #15803d;
}
.course-lv-E {
  color: #c2410c;
}
.course-lv-C {
  color: #1d4ed8;
}
.course-lv-other {
  color: var(--muted);
}

/* Room cards grid (inside each level frame). */
.rlevel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
.rcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
/* Plain header (cards no longer collapse — every panel is always open). */
.rcard-head {
  padding: var(--sp-4) var(--sp-5);
}
.rcard-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
}
.rcard-count {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.rcard-sub {
  margin-top: 2px;
  padding-left: calc(7px + var(--sp-2));
  font-size: var(--fs-sm);
  color: var(--muted);
}
/* Language tint on the dot only — the card stays neutral so a wall of 18
   cards doesn't turn into a colour test. */
.rcard .cc-dot {
  flex-shrink: 0;
}

/* Expanded student panel. */
.rcard-panel {
  border-top: 1px solid var(--line);
  padding: var(--sp-3) var(--sp-5) var(--sp-4);
}
/* The list shows 5 rows; longer classes scroll INSIDE the list (per Big,
   2026-07-16). overscroll-behavior keeps the leftover scroll from moving
   the page behind — same trick as the dropdown menus. */
.rstudents {
  list-style: none;
  margin: 0 0 var(--sp-3);
  padding: 0;
  max-height: 197px; /* ≈ 5 rows of 39px + a hint of the 6th */
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rstudent {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
}
.rstudent:last-child {
  border-bottom: none;
}
.rstudent-n {
  width: 22px;
  text-align: right;
  color: var(--muted);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.rstudent-name {
  flex: 1;
  min-width: 0;
}
.rstudent-empty {
  color: var(--muted);
}

/* Per-student status (PT/VT/V/P): the app-wide cselect DROPDOWN shrunk to a
   chip — same open menu as everywhere else, tinted by the current value.
   .st-chip (plain span) is the read-only fallback for other teams. */
.st-select {
  flex-shrink: 0;
}
.st-select .cselect-trigger {
  width: auto;
  min-width: 62px;
  padding: 2px 8px 2px 10px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: var(--r-full);
}
.st-select .cselect-chevron {
  width: 11px;
  height: 11px;
}
.st-select .cselect-value.is-placeholder {
  font-weight: 700; /* "—" needs no extra emphasis */
}
.st-chip {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 2px 10px;
  flex-shrink: 0;
}
.st-PT .cselect-trigger,
.st-chip.st-PT {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.st-VT .cselect-trigger,
.st-chip.st-VT {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}
.st-V .cselect-trigger,
.st-chip.st-V {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
.st-P .cselect-trigger,
.st-chip.st-P {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}
.st-none .cselect-trigger,
.st-chip.st-none {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
}

/* Panel footer: add-student picker + the destructive actions. */
.rcard-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}
/* Inside a normal-width card the picker takes its own full-width row and
   the buttons wrap underneath. */
.rcard-add {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1 1 100%;
  min-width: 0;
}
.rcard-add .cselect {
  flex: 1;
}
.rcard-add .cselect-trigger {
  padding: 8px var(--sp-3);
  font-size: var(--fs-base);
}
.rcard-spacer {
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════════
   CLASS PLAN TOOLTIP — hover a class card for its details
   ══════════════════════════════════════════════════════════════════ */
.sched-tooltip {
  display: none;
  position: fixed;
  z-index: var(--z-modal);
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-base);
  pointer-events: none; /* never steals the mouse from the card under it */
}
/* Header row: language dot + "group · room" + student count — mirrors the
   Roster card head so both read the same. */
.sched-tooltip .tt-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--line);
}
.sched-tooltip .tt-count {
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
/* Labeled facts: ครู / เวลา / คอร์ส. */
.sched-tooltip .tt-rows {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--line);
}
.sched-tooltip .tt-row {
  padding: 1px 0;
}
.sched-tooltip .tt-label {
  display: inline-block;
  min-width: 48px;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.sched-tooltip .tt-students {
  list-style: none;
  margin: var(--sp-1) 0 0;
  padding: 0;
  max-height: 40vh;
  overflow: hidden;
}
.sched-tooltip .tt-students li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px 0;
}
.sched-tooltip .tt-n {
  width: 16px;
  text-align: right;
  color: var(--muted);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.sched-tooltip .tt-empty {
  color: var(--muted);
  padding-top: var(--sp-2);
}

/* Under an ASSIGNED pill: which class group · room the student landed in. */
.res-assigned-to {
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
}
