/* ============================================================================
   EduCore Mockups — Component utilities
   Class names mirror tên Tailwind/component production để mockup ↔ code 1-1.
   Mobile-first. Breakpoints: sm 640 · md 768 · lg 1024 · xl 1280.
   ============================================================================ */

/* ============================================================================
   Layout primitives
   ============================================================================ */

.app-shell {
  min-height: 100dvh;
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .app-shell { flex-direction: row; }
}

.app-shell__sidebar {
  display: none;
}

@media (min-width: 768px) {
  .app-shell__sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 248px;
    height: 100dvh;
    flex-shrink: 0;
    border-right: 1px solid var(--c-border);
    background: var(--c-bg);
  }
}

.app-shell__main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.app-shell__topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--c-border);
  background: color-mix(in oklch, var(--c-bg) 85%, transparent);
  backdrop-filter: blur(12px);
}

.app-shell__content {
  flex: 1;
  padding: var(--space-5) var(--space-4) 96px; /* mobile reserves bottom-nav (64) + FAB lift */
}
@media (min-width: 768px) {
  .app-shell__content { padding: var(--space-5) var(--space-5) var(--space-7); }
}
@media (min-width: 1024px) {
  .app-shell__content { padding: var(--space-5) var(--space-6) var(--space-7); }
}

/* ============================================================================
   Sidebar nav (desktop)
   ============================================================================ */

.sidebar-nav {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 12px;
}

.sidebar-nav__brand { padding: 4px 8px 8px; }

.sidebar-nav__groups {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-nav__group { display: flex; flex-direction: column; gap: 2px; }

.sidebar-nav__group-title {
  padding: 4px 12px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-fg-subtle);
}

.sidebar-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--c-fg-muted);
  transition: color 120ms, background 120ms;
  cursor: pointer;
}
.sidebar-nav__item:hover { background: var(--c-muted); color: var(--c-fg); }
.sidebar-nav__item--active {
  background: var(--c-muted);
  color: var(--c-fg);
  /* No font-weight bump — rely on color contrast. Weight changes shift item width and break vertical rhythm. */
}
.sidebar-nav__item--active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  height: 16px;
  width: 3px;
  border-radius: 999px;
  background: var(--c-primary);
}
.sidebar-nav__item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-nav__item-count {
  margin-left: auto;
  display: grid;
  place-items: center;
  height: 18px;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-fg-muted);
  font-family: "Geist Mono", monospace;
  font-size: 10px;
}
/* Variant kept as no-op: warning-tinted nav counts created a constant
   "yellow blob" in the sidebar and trained the eye to ignore it. */
.sidebar-nav__item-count--warning,
.sidebar-nav__item-count--primary { /* same as default */ }

.sidebar-nav__footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
}

/* ============================================================================
   Bottom nav (mobile only)
   ============================================================================ */

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--c-border);
  background: color-mix(in oklch, var(--c-bg) 85%, transparent);
  backdrop-filter: blur(20px);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }

.bottom-nav__item {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--c-fg-subtle);
  cursor: pointer;
}
.bottom-nav__item svg { width: 22px; height: 22px; }
.bottom-nav__item--active { color: var(--c-primary); }
.bottom-nav__item--active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  border-radius: 0 0 999px 999px;
  background: var(--c-primary);
}
.bottom-nav__fab {
  position: relative;
  top: -12px;
  display: grid;
  place-items: center;
}
.bottom-nav__fab span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--c-primary);
  color: var(--c-primary-fg);
  box-shadow: 0 8px 20px -4px color-mix(in oklch, var(--c-primary) 30%, transparent);
}
.bottom-nav__fab svg { width: 22px; height: 22px; }

/* ============================================================================
   Topbar
   ============================================================================ */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
}
@media (min-width: 768px) { .topbar { padding: 0 24px; } }

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
@media (min-width: 768px) { .topbar__brand { display: none; } }

.topbar__spacer { flex: 1; }

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================================
   Buttons (mirror Button.tsx variants)
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms,
    box-shadow 120ms;
  user-select: none;
}
.btn:focus-visible {
  outline: none;
  border-color: var(--c-ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--c-ring) 50%, transparent);
}
.btn:disabled { pointer-events: none; opacity: 0.5; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--primary {
  background: var(--c-primary);
  color: var(--c-primary-fg);
  box-shadow: 0 1px 2px color-mix(in oklch, black 8%, transparent);
}
.btn--primary:hover { background: var(--c-primary-hover); }

.btn--outline {
  border-color: var(--c-border);
  background: var(--c-bg);
  color: var(--c-fg);
}
.btn--outline:hover { background: var(--c-muted); }

.btn--ghost { color: var(--c-fg); }
.btn--ghost:hover { background: var(--c-muted); }

.btn--destructive {
  background: color-mix(in oklch, var(--c-destructive) 12%, transparent);
  color: var(--c-destructive);
}
.btn--destructive:hover {
  background: color-mix(in oklch, var(--c-destructive) 20%, transparent);
}

.btn--sm { height: 28px; padding: 0 10px; font-size: 12.8px; border-radius: 8px; }
.btn--lg { height: 36px; padding: 0 12px; }
.btn--xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn--icon { width: 32px; padding: 0; }
.btn--icon-sm { width: 28px; height: 28px; padding: 0; border-radius: 8px; }

/* ============================================================================
   Cards
   ============================================================================ */

.card {
  background: var(--c-card);
  color: var(--c-card-fg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  /* No shadow at rest. Shadow is reserved for overlays (modal, popover, toast)
     so it carries meaning instead of decorating every list row. */
}
.card--sunken { background: var(--c-bg-sunken); box-shadow: none; }
.card--accent {
  border-color: color-mix(in oklch, var(--c-primary) 40%, var(--c-border));
  background: var(--c-primary-soft);
  color: var(--c-primary-fg-on-soft);
}
.card--padded { padding: 16px; }
@media (min-width: 768px) { .card--padded { padding: 20px; } }
.card--rounded-2xl { border-radius: var(--radius-2xl); }

/* Hover-lift card (used for list rows) */
.card-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-2xl);
  transition: border-color 120ms, box-shadow 120ms;
  cursor: pointer;
}
.card-row:hover {
  border-color: var(--c-border-strong);
  box-shadow: 0 1px 2px color-mix(in oklch, black 6%, transparent);
}
.card-row--accent {
  border-left: 4px solid var(--c-primary);
}

/* ============================================================================
   Form
   ============================================================================ */

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  padding: 0 12px;
  height: 40px;
  font-size: 14px;
  background: var(--c-bg);
  color: var(--c-fg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  transition: border-color 120ms, box-shadow 120ms;
}
.textarea { padding: 8px 12px; min-height: 80px; height: auto; resize: vertical; }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--c-ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--c-ring) 30%, transparent);
}
.input::placeholder,
.textarea::placeholder { color: var(--c-fg-subtle); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-fg);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-error { font-size: 12px; color: var(--c-destructive); }
.field-hint { font-size: 12px; color: var(--c-fg-subtle); }

/* ============================================================================
   Badge
   ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge--primary { background: var(--c-primary); color: var(--c-primary-fg); }
.badge--success {
  background: var(--c-success-soft);
  color: var(--c-success);
}
.badge--warning {
  background: var(--c-warning-soft);
  color: var(--c-warning-fg-on-soft);
}
.badge--destructive {
  background: var(--c-destructive-soft);
  color: var(--c-destructive);
}
.badge--info { background: var(--c-info-soft); color: var(--c-info); }
.badge--muted { background: var(--c-muted); color: var(--c-fg-muted); }
.badge--outline { border-color: var(--c-border); color: var(--c-fg); }

/* Detail page header — used on batch-detail, student-detail.
   Pattern: breadcrumb + actions on top row; avatar + title block (TOP-aligned)
   on second row. Avoids the L-shape bug where title wraps and avatar floats
   to mid-height of the title block. */
.detail-header__crumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.detail-header__crumb-link { font-size: 12px; color: var(--c-fg-muted); }
.detail-header__crumb-link a { color: var(--c-fg); }
.detail-header__actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

.detail-header__identity {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.detail-header__title-block { flex: 1; min-width: 0; }
.detail-header__title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.detail-header__title-row h1 { line-height: 1.2; }
.detail-header__meta {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--c-fg-muted);
  margin-top: var(--space-2);
}

/* Session row — date inline with class number + badge in one row, meta below.
   Used on batch-detail upcoming sessions, student-detail upcoming sessions. */
.session-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--c-border);
  transition: background 80ms;
}
.session-row:last-child { border-bottom: 0; }
.session-row:hover { background: var(--c-bg-sunken); }
.session-row__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.session-row__date {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-fg-muted);
  letter-spacing: 0.02em;
}
.session-row__num { font-size: 14px; font-weight: 600; color: var(--c-fg); }
.session-row__badge { margin-left: auto; }
.session-row__meta {
  font-size: 12px;
  color: var(--c-fg-muted);
  line-height: 1.45;
}

/* Branch chip — small mono tag identifying which branch a row/entity belongs to.
   Always visible in list rows + detail headers. Subtle in single-branch mode,
   becomes a navigation aid in all-branches mode. Mono font keeps short codes
   ("Q.7", "Q.1", "TĐ") visually consistent across rows. */
.branch-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 6px;
  background: var(--c-bg-sunken);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--c-fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.branch-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--c-fg-subtle);
  flex-shrink: 0;
}
.branch-chip--lg { height: 22px; padding: 0 8px; font-size: 11px; }

/* ============================================================================
   Eyebrow + Page header
   ============================================================================ */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-fg-subtle);
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
@media (min-width: 768px) { .page-header { margin-bottom: 24px; } }

.page-header__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.page-header h1 { margin-top: 4px; }
.page-header__description {
  max-width: 68ch;
  font-size: 14px;
  color: var(--c-fg-muted);
}

/* ============================================================================
   Stat cards
   ============================================================================ */

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 88px;
  padding: var(--space-4);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-2xl);
}
@media (min-width: 768px) { .stat-card { min-height: 112px; padding: var(--space-5); } }
.stat-card__label { font-size: 12px; font-weight: 500; color: var(--c-fg-muted); }
.stat-card__value {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 768px) { .stat-card__value { font-size: 1.75rem; } }
.stat-card__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}
.stat-card__delta--up { color: var(--c-success); }
.stat-card__delta--down { color: var(--c-destructive); }

/* Metric strip — for dashboards and detail pages with ≥3 metrics shown together.
   No cards, no shadows. Numbers separated by whitespace + a single rule above/below.
   Saves ~120px vertical vs four stat-cards and removes 4 box-shadows from the page. */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-block: 1px solid var(--c-border);
}
@media (min-width: 768px) {
  .metric-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
    padding: var(--space-5) 0;
  }
}
.metric-strip__cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.metric-strip__cell + .metric-strip__cell {
  position: relative;
}
@media (min-width: 768px) {
  .metric-strip__cell + .metric-strip__cell::before {
    content: "";
    position: absolute;
    left: calc(var(--space-6) * -0.5);
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--c-border);
  }
}
.metric-strip__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-fg-muted);
}
.metric-strip__value {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--c-fg);
}
@media (min-width: 768px) { .metric-strip__value { font-size: 1.625rem; } }
.metric-strip__delta {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-fg-muted);
}
.metric-strip__delta--up { color: var(--c-success); }
.metric-strip__delta--down { color: var(--c-destructive); }

/* ============================================================================
   Empty state
   ============================================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  text-align: center;
  color: var(--c-fg-muted);
}
.empty-state__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-2xl);
  background: var(--c-muted);
  color: var(--c-fg-subtle);
}
.empty-state__icon svg { width: 32px; height: 32px; }
.empty-state h3 { color: var(--c-fg); }
.empty-state p { max-width: 40ch; font-size: 14px; }

/* ============================================================================
   List item / List group
   ============================================================================ */

.list-group {
  overflow: hidden;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-2xl);
  background: var(--c-card);
}
.list-group__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
}
/* Two-child rows: collapse the empty trailing column so the second child
   doesn't stretch into 1fr. Common case: title block + status badge. */
.list-group__item:not(:has(> :nth-child(3))) {
  grid-template-columns: 1fr auto;
}
.list-group__item:last-child { border-bottom: 0; }
.list-group__item--interactive { cursor: pointer; transition: background 120ms; }
.list-group__item--interactive:hover { background: var(--c-muted); }

/* ============================================================================
   Avatar
   ============================================================================ */

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background: var(--c-primary-soft);
  color: var(--c-primary-fg-on-soft);
  font-size: 13px;
  font-weight: 600;
}
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--lg { width: 48px; height: 48px; font-size: 16px; }
.avatar--xl { width: 48px; height: 48px; font-size: 16px; border-radius: var(--radius-md); }
@media (min-width: 768px) {
  .avatar--xl { width: 64px; height: 64px; font-size: 22px; border-radius: var(--radius-xl); }
}

/* Subject avatar — neutral monogram. Subject identity is the WC/PE/OI/DI letters,
   not a color. Categorical color across rows competed with status color and inflated
   the page hue count past the "single accent" budget. */
.subject-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--c-bg-sunken);
  border: 1px solid var(--c-border);
  color: var(--c-fg);
  font-family: "Geist", sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.subject-avatar--lg { width: 48px; height: 48px; font-size: 14px; border-radius: var(--radius-md); }
@media (min-width: 768px) {
  .subject-avatar--lg { width: 64px; height: 64px; font-size: 18px; border-radius: var(--radius-xl); }
}
/* Variant classes kept as no-ops to avoid breaking existing markup. */
.subject-avatar--pencil,
.subject-avatar--watercolor,
.subject-avatar--oil,
.subject-avatar--color,
.subject-avatar--charcoal { /* identity now via monogram + optional inline subject chip */ }

/* ============================================================================
   Toolbar (sticky filters bar)
   ============================================================================ */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
}
/* Sticky on desktop only. On mobile the toolbar would freeze 88px under topbar
   and eat 12% of viewport — drop sticky entirely under 768px. */
@media (min-width: 768px) {
  .toolbar {
    position: sticky;
    top: 56px;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
}

.toolbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px;
  background: var(--c-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  flex: 1;
}
.toolbar__search:focus-within {
  border-color: var(--c-primary);
  background: var(--c-card);
}
.toolbar__search svg { width: 14px; height: 14px; color: var(--c-fg-muted); flex-shrink: 0; }
.toolbar__search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 14px;
  outline: none;
  color: var(--c-fg);
}

.toolbar__chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.toolbar__chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: transparent;
  color: var(--c-fg-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 120ms;
}
.chip:hover { color: var(--c-fg); border-color: var(--c-border-strong); }
.chip--active {
  background: var(--c-primary);
  color: var(--c-primary-fg);
  border-color: transparent;
}

/* ============================================================================
   Tabs
   ============================================================================ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--c-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 8px 12px;
  margin-bottom: -1px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-fg-muted);
  cursor: pointer;
  background: transparent;
  border: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab:hover { color: var(--c-fg); }
.tab--active { color: var(--c-fg); }
.tab--active::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 2px;
  background: var(--c-primary);
}

/* ============================================================================
   Branch switcher
   ============================================================================ */

.branch-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  width: 100%;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.branch-switcher:hover {
  background: var(--c-muted);
  border-color: var(--c-border-strong);
}
.branch-switcher__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--c-success-soft);
  color: var(--c-success);
  flex-shrink: 0;
}
.branch-switcher__icon svg { width: 14px; height: 14px; }
.branch-switcher__name { font-size: 13px; font-weight: 600; }
.branch-switcher__meta { font-size: 10px; color: var(--c-fg-subtle); }

/* ============================================================================
   Schedule grid (week view)
   ============================================================================ */

.schedule-grid {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  background: var(--c-card);
}
.schedule-grid__row {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(120px, 1fr));
  border-bottom: 1px solid var(--c-border);
}
.schedule-grid__row:last-child { border-bottom: 0; }
.schedule-grid__cell {
  padding: 8px;
  border-right: 1px solid var(--c-border);
  font-size: 12px;
  min-height: 96px;
}
.schedule-grid__cell:last-child { border-right: 0; }
.schedule-grid__head {
  background: var(--c-bg-sunken);
  font-weight: 600;
  color: var(--c-fg-muted);
  text-align: center;
  min-height: 48px;
  padding: 12px 8px;
}
.schedule-grid__head--today { color: var(--c-primary); }
.schedule-grid__time {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--c-fg-subtle);
}

/* Lesson pill — two states only:
   - default: neutral surface, used for every lesson on the grid
   - active:  primary-tinted, used for "today / mine / focused"
   Subject is identified by the title text (WC K06), not by hue. */
.lesson-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: 11px;
  margin-bottom: 4px;
  cursor: pointer;
  background: var(--c-card);
  color: var(--c-fg);
  transition: border-color 120ms, background 120ms;
}
.lesson-pill:hover { border-color: var(--c-border-strong); }
.lesson-pill__time { font-family: "Geist Mono", monospace; font-weight: 600; }
.lesson-pill__room { color: var(--c-fg-subtle); }

.lesson-pill--active {
  background: var(--c-primary-soft);
  border-color: color-mix(in oklch, var(--c-primary) 35%, var(--c-border));
  color: var(--c-primary-fg-on-soft);
}

/* Legacy categorical variants — collapse to default. Kept as no-ops to avoid
   breaking existing mockup markup that still uses --sky / --emerald / etc. */
.lesson-pill--sky,
.lesson-pill--emerald,
.lesson-pill--violet,
.lesson-pill--amber,
.lesson-pill--rose { /* no decorative color */ }

/* ============================================================================
   Calendar week view — proportional time-grid.
   Replaces .schedule-grid (fixed-cell). Events positioned absolutely by start-time
   (top) and duration (height). Continuous time-axis on the left.
   Math: 1 hour = 60px. Day height = HOURS_VISIBLE × 60.
   To position an event at 09:30 lasting 90 min in a calendar that starts 08:00:
     top    = (9.5 - 8) * 60 = 90px
     height = 90 (minutes) * (60/60) = 90px
   ============================================================================ */
.calendar-week {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  background: var(--c-card);
  overflow: hidden;
}
.calendar-week__head {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  background: var(--c-bg-sunken);
  border-bottom: 1px solid var(--c-border);
}
.calendar-week__head-spacer { border-right: 1px solid var(--c-border); }
.calendar-week__head-day {
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--c-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-right: 1px solid var(--c-border);
}
.calendar-week__head-day:last-child { border-right: 0; }
.calendar-week__head-day strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  text-transform: none;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--c-fg);
}
.calendar-week__head-day--today { color: var(--c-primary); }
.calendar-week__head-day--today strong { color: var(--c-primary); }

.calendar-week__body {
  position: relative;
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  height: 720px; /* 12 hours × 60px = 8:00 to 20:00 */
}
.calendar-week__time-axis {
  position: relative;
  border-right: 1px solid var(--c-border);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 59px,
      var(--c-border) 59px,
      var(--c-border) 60px
    );
}
.calendar-week__time-mark {
  position: absolute;
  right: 8px;
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--c-fg-subtle);
  transform: translateY(-50%);
  white-space: nowrap;
}
.calendar-week__day-col {
  position: relative;
  border-right: 1px solid var(--c-border);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 59px,
      var(--c-border) 59px,
      var(--c-border) 60px
    );
}
.calendar-week__day-col:last-child { border-right: 0; }
.calendar-week__day-col--today {
  background-color: color-mix(in oklch, var(--c-primary) 8%, var(--c-card));
}

.calendar-event {
  position: absolute;
  inset-inline: 4px;
  padding: 4px 8px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-fg-subtle);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}
.calendar-event:hover {
  border-color: var(--c-border-strong);
  box-shadow: 0 4px 12px -4px rgba(0,0,0,0.12);
  z-index: 5;
}
.calendar-event--active {
  border-left-color: var(--c-primary);
  background: var(--c-primary-soft);
}
.calendar-event--active .calendar-event__title { color: var(--c-primary-fg-on-soft); }
.calendar-event--past { opacity: 0.55; }

.calendar-event__time {
  font-family: "Geist Mono", monospace;
  font-weight: 600;
  font-size: 10px;
  color: var(--c-fg);
  letter-spacing: 0.02em;
}
.calendar-event__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-fg);
  margin-top: 2px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event__meta {
  font-size: 10px;
  color: var(--c-fg-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Current-time indicator. Positioned by inline `top:` from JS or static for mockup.
   Crosses all 7 day columns. Pure decoration — no interaction. */
.calendar-week__now {
  position: absolute;
  left: 56px;
  right: 0;
  height: 0;
  z-index: 3;
  pointer-events: none;
  border-top: 1.5px solid var(--c-destructive);
}
.calendar-week__now::before {
  content: "";
  position: absolute;
  left: -7px;
  top: -7px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--c-destructive);
  border: 2px solid var(--c-bg);
}
.calendar-week__now-label {
  position: absolute;
  left: -54px;
  top: -8px;
  height: 16px;
  padding: 0 4px;
  background: var(--c-destructive);
  color: white;
  font-family: "Geist Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  border-radius: 3px;
  display: grid;
  place-items: center;
  letter-spacing: 0.04em;
}

/* View toggle — Day / Week / Month segmented control. */
.calendar-view-switch {
  display: inline-flex;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 3px;
  background: var(--c-bg-sunken);
  height: 32px;
}
.calendar-view-switch button {
  height: 26px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-fg-muted);
  cursor: pointer;
  white-space: nowrap;
}
.calendar-view-switch button:hover { color: var(--c-fg); }
.calendar-view-switch button.is-active {
  background: var(--c-card);
  color: var(--c-fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ============================================================================
   Utilities (mobile-first)
   ============================================================================ */

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; grid-template-columns: 1fr; }
/* Default to single-column. Without this, a child with `grid-column: span 2`
   would force the grid to auto-create 2 implicit columns on mobile, breaking
   layouts that expect to be 1-col under <lg. */
.block { display: block; }
.inline { display: inline; }
.hidden { display: none; }

.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-shrink-0 { flex-shrink: 0; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.px-2 { padding-inline: 8px; }
.px-3 { padding-inline: 12px; }
.px-4 { padding-inline: 16px; }
.py-2 { padding-block: 8px; }
.py-3 { padding-block: 12px; }
.py-4 { padding-block: 16px; }
.py-6 { padding-block: 24px; }
.py-8 { padding-block: 32px; }
.pt-1 { padding-top: 4px; }
.pt-2 { padding-top: 8px; }
.pt-4 { padding-top: 16px; }
.pb-2 { padding-bottom: 8px; }
.pb-4 { padding-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; line-height: 1.2; }
.text-3xl { font-size: 28px; line-height: 1.15; letter-spacing: -0.025em; }
.text-4xl { font-size: 34px; line-height: 1.05; letter-spacing: -0.035em; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: "Geist Mono", monospace; }

.text-fg { color: var(--c-fg); }
.text-muted { color: var(--c-fg-muted); }
.text-subtle { color: var(--c-fg-subtle); }
.text-primary { color: var(--c-primary); }
.text-success { color: var(--c-success); }
.text-warning { color: var(--c-warning-fg-on-soft); }
.text-destructive { color: var(--c-destructive); }

.bg-card { background: var(--c-card); }
.bg-muted { background: var(--c-muted); }
.bg-sunken { background: var(--c-bg-sunken); }

.border { border: 1px solid var(--c-border); }
.border-t { border-top: 1px solid var(--c-border); }
.border-b { border-bottom: 1px solid var(--c-border); }
.border-strong { border-color: var(--c-border-strong); }
.border-dashed { border-style: dashed; }

.rounded { border-radius: var(--radius-md); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: 999px; }

.w-full { width: 100%; }
.max-w-sm { max-width: 384px; }
.max-w-md { max-width: 448px; }
.max-w-lg { max-width: 512px; }
.max-w-2xl { max-width: 672px; }
.max-w-3xl { max-width: 768px; }
.max-w-4xl { max-width: 896px; }
.mx-auto { margin-inline: auto; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (min-width: 768px) {
  .md\:hidden { display: none; }
  .md\:flex { display: flex; }
  .md\:inline { display: inline; }
  .md\:inline-flex { display: inline-flex; }
  .md\:grid { display: grid; }
  .md\:block { display: block; }
  .md\:flex-row { flex-direction: row; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .md\:text-3xl { font-size: 28px; }
  .md\:p-5 { padding: 20px; }
  .md\:p-6 { padding: 24px; }
}

@media (min-width: 1024px) {
  .lg\:hidden { display: none; }
  .lg\:flex { display: flex; }
  .lg\:grid { display: grid; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================================
   Mockup-only viewport frames (preview mobile + desktop side-by-side)
   ============================================================================ */

.mockup-viewer {
  display: grid;
  gap: 24px;
  padding: 32px 16px;
  background: oklch(94% 0.005 260);
  min-height: 100dvh;
}
.dark .mockup-viewer { background: oklch(8% 0.008 260); }

@media (min-width: 1280px) {
  .mockup-viewer {
    grid-template-columns: 390px minmax(1024px, 1fr);
    align-items: start;
    padding: 32px;
  }
}

.mockup-frame {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px -20px color-mix(in oklch, black 30%, transparent);
}
.mockup-frame--mobile {
  width: 390px;
  max-width: 100%;
  height: 844px;
  margin-inline: auto;
  position: sticky;
  top: 32px;
}
.mockup-frame--mobile .app-shell__content {
  height: calc(844px - 56px - 64px);
  overflow-y: auto;
}
.mockup-frame--mobile > iframe { width: 100%; height: 100%; border: 0; display: block; }
.mockup-frame--desktop {
  min-height: 720px;
  overflow-x: auto;
}
.mockup-frame--desktop > iframe {
  width: 100%;
  min-width: 1024px;
  border: 0;
  display: block;
}

.mockup-meta {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--c-fg-muted);
}
.mockup-meta strong { color: var(--c-fg); font-weight: 600; }
.mockup-meta__chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-card);
  font-size: 11px;
  font-family: "Geist Mono", monospace;
}

/* Single-viewport mode (when ?solo) */
.mockup-viewer--solo {
  grid-template-columns: 1fr;
  padding: 0;
  background: var(--c-bg);
  min-height: 100dvh;
}
.mockup-viewer--solo .mockup-frame { border: 0; border-radius: 0; box-shadow: none; }
.mockup-viewer--solo .mockup-frame--desktop { min-height: 100dvh; }

/* Floating theme toggle (sun/moon) */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  color: var(--c-fg);
  font: 600 12px/1 "Geist", system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.theme-toggle:hover {
  background: var(--c-bg-sunken);
  border-color: var(--c-border-strong);
}
.theme-toggle:active { transform: scale(0.97); }
.theme-toggle:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
.theme-toggle svg { color: var(--c-fg-muted); }
.dark .theme-toggle {
  background: oklch(18% 0.012 260);
  border-color: oklch(28% 0.012 260);
}

/* ============================================================================
   Overlay components — modal, sheet, popover, toast, alert
   Inline mockup version (no JS open/close needed). To "show" any overlay in
   a static mockup, just leave it visible inside the page.
   ============================================================================ */

/* Backdrop wrapping any overlay */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(20% 0.012 260 / 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.dark .overlay-backdrop { background: oklch(8% 0.012 260 / 0.7); }

/* Centered modal/dialog */
.modal {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.modal--sm { max-width: 380px; }
.modal--lg { max-width: 640px; }
.modal--xl { max-width: 880px; }

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--c-border);
}
.modal__header--plain { border-bottom: 0; padding-bottom: 4px; }
.modal__title { font-size: 16px; font-weight: 600; color: var(--c-fg); }
.modal__description { font-size: 13px; color: var(--c-fg-muted); margin-top: 4px; }
.modal__close {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: var(--c-fg-muted);
  cursor: pointer;
  display: grid; place-items: center;
}
.modal__close:hover { background: var(--c-bg-sunken); color: var(--c-fg); }

.modal__body { padding: 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.modal__footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--c-border);
  background: var(--c-bg-sunken);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.modal__footer--plain { border-top: 0; background: transparent; padding-top: 4px; }

/* Bottom sheet (mobile) */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--c-card);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -16px 48px -12px rgba(0, 0, 0, 0.2);
  z-index: 100;
  display: flex; flex-direction: column;
  max-height: 92dvh;
}
.sheet::before {
  content: "";
  display: block;
  width: 36px; height: 4px;
  background: var(--c-border-strong);
  border-radius: 999px;
  margin: 8px auto 4px;
}
.sheet__header {
  padding: 8px 20px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sheet__title { font-size: 15px; font-weight: 600; }
.sheet__body { padding: 4px 20px 16px; overflow: auto; flex: 1; }
.sheet__footer {
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
  display: flex; gap: 8px;
  background: var(--c-bg-sunken);
}

/* Alert / inline banner (non-modal) */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border);
  background: var(--c-card);
  font-size: 13px;
  color: var(--c-fg);
}
.alert__icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 999px;
  margin-top: 1px;
}
.alert__title { font-weight: 600; line-height: 1.3; }
.alert__desc { color: var(--c-fg-muted); margin-top: 2px; line-height: 1.45; }
.alert__actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.alert--info { background: var(--c-info-soft); border-color: var(--c-info); }
.alert--info .alert__icon { background: var(--c-info); color: #fff; }
.alert--success { background: var(--c-success-soft); border-color: var(--c-success); }
.alert--success .alert__icon { background: var(--c-success); color: #fff; }
.alert--warning { background: var(--c-warning-soft); border-color: var(--c-warning); }
.alert--warning .alert__icon { background: var(--c-warning); color: #fff; }
.alert--destructive { background: var(--c-destructive-soft); border-color: var(--c-destructive); }
.alert--destructive .alert__icon { background: var(--c-destructive); color: #fff; }

/* Week navigator — compact pill-style date stepper used in schedule headers.
   Replaces the loose chevron+label+chevron group that read like a breadcrumb. */
.week-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-card);
}
.week-nav__label {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 0 8px;
  min-width: 80px;
  text-align: center;
  color: var(--c-fg);
}

/* Notifications panel — slide-in from the RIGHT (opposite of mobile nav drawer on left).
   Triggered by the bell icon in the topbar. Same panel for desktop + mobile. */
.notif-panel {
  position: fixed; inset: 0; z-index: 200;
  pointer-events: none; visibility: hidden;
  transition: visibility 0s linear 200ms;
}
.notif-panel[aria-hidden="false"] {
  pointer-events: auto; visibility: visible;
  transition: visibility 0s;
}
.notif-panel__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0; transition: opacity 200ms ease;
}
.notif-panel[aria-hidden="false"] .notif-panel__backdrop { opacity: 1; }
.notif-panel__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(400px, 92vw);
  background: var(--c-bg);
  border-left: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
.notif-panel[aria-hidden="false"] .notif-panel__panel { transform: translateX(0); }
.notif-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--c-border);
}
.notif-panel__tabs {
  display: flex; gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-border);
}
.notif-panel__tab {
  padding: 6px 12px; border-radius: var(--radius-md);
  font-size: 12px; font-weight: 500;
  color: var(--c-fg-muted); cursor: pointer;
  background: transparent; border: 1px solid transparent;
}
.notif-panel__tab--active {
  background: var(--c-muted);
  color: var(--c-fg);
}
.notif-panel__list {
  flex: 1; overflow-y: auto; padding: 8px;
}
.notif-panel__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
  text-align: center;
}
.notif-item {
  display: flex; gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  text-decoration: none; color: inherit;
  cursor: pointer; transition: background 80ms;
  position: relative;
}
.notif-item:hover { background: var(--c-bg-sunken); }
.notif-item--unread { background: color-mix(in oklch, var(--c-primary-soft) 30%, transparent); }
.notif-item--unread::before {
  content: ''; position: absolute; left: 4px; top: 18px;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--c-primary);
}
.notif-item__dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--c-fg-muted);
  margin-top: 6px; flex-shrink: 0;
}
.notif-item__dot--primary { background: var(--c-primary); }
.notif-item__dot--success { background: var(--c-success); }
.notif-item__dot--warning { background: var(--c-warning); }
.notif-item__dot--destructive { background: var(--c-destructive); }
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__title { font-size: 13px; font-weight: 600; }
.notif-item__desc { font-size: 12px; color: var(--c-fg-muted); margin-top: 2px; line-height: 1.45; }
.notif-item__time { font-size: 11px; color: var(--c-fg-subtle); margin-top: 4px; font-family: 'Geist Mono', monospace; }

/* Command palette (cmd+K) — centered modal with search input + results list */
.cmdk {
  position: fixed; inset: 0; z-index: 210;
  pointer-events: none; visibility: hidden;
  transition: visibility 0s linear 200ms;
  display: grid; place-items: start center;
  padding-top: 12vh;
}
.cmdk[aria-hidden="false"] {
  pointer-events: auto; visibility: visible;
  transition: visibility 0s;
}
.cmdk__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0; transition: opacity 200ms ease;
}
.cmdk[aria-hidden="false"] .cmdk__backdrop { opacity: 1; }
.cmdk__panel {
  position: relative;
  width: min(620px, 92vw);
  max-height: 70vh;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column;
  transform: translateY(-8px) scale(0.98);
  opacity: 0;
  transition: transform 200ms cubic-bezier(.32,.72,0,1), opacity 160ms ease;
  overflow: hidden;
}
.cmdk[aria-hidden="false"] .cmdk__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.cmdk__input-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
}
.cmdk__icon { color: var(--c-fg-muted); display: flex; }
.cmdk__icon svg { width: 18px; height: 18px; }
.cmdk__input {
  flex: 1; border: none; background: transparent;
  color: var(--c-fg); font-size: 16px; outline: none;
}
.cmdk__input::placeholder { color: var(--c-fg-subtle); }
.cmdk__list { flex: 1; overflow-y: auto; padding: 8px; }
.cmdk__group-title {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--c-fg-subtle);
  padding: 12px 12px 6px;
  font-family: 'Geist Mono', monospace;
}
.cmdk__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.cmdk__item:hover, .cmdk__item:focus { background: var(--c-bg-sunken); outline: none; }
.cmdk__item-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--c-muted);
  color: var(--c-fg-muted);
  flex-shrink: 0;
}
.cmdk__item-icon svg { width: 16px; height: 16px; }
.cmdk__item-text { flex: 1; min-width: 0; }
.cmdk__item-title { display: block; font-size: 13px; font-weight: 500; color: var(--c-fg); }
.cmdk__item-desc { display: block; font-size: 11px; color: var(--c-fg-muted); margin-top: 2px; }
.cmdk__footer {
  display: flex; gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--c-border);
  font-size: 11px; color: var(--c-fg-muted);
}
.cmdk__footer kbd {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--c-muted);
  border: 1px solid var(--c-border);
  color: var(--c-fg);
  margin-right: 4px;
}

/* Mobile drawer — slide-in nav panel on mobile that mirrors the desktop sidebar.
   Triggered by the hamburger button in the topbar. Hidden on md+ since sidebar is visible. */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 200ms;
}
.mobile-drawer[aria-hidden="false"] {
  pointer-events: auto;
  visibility: visible;
  transition: visibility 0s;
}
.mobile-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 200ms ease;
}
.mobile-drawer[aria-hidden="false"] .mobile-drawer__backdrop { opacity: 1; }
.mobile-drawer__panel {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: min(320px, 88vw);
  background: var(--c-bg);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 240ms cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}
.mobile-drawer[aria-hidden="false"] .mobile-drawer__panel { transform: translateX(0); }
.mobile-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--c-border);
}
.mobile-drawer__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px;
  overflow-y: auto;
}
.mobile-drawer__footer {
  padding: 8px 12px;
  border-top: 1px solid var(--c-border);
}
@media (min-width: 768px) {
  .mobile-drawer { display: none; }
}

/* Pagination — used at the bottom of every list/table.
   Mobile (<480px): stack vertically (count on top, controls below).
   Tablet (480–767px): single row with simplified "Trang 1/25" indicator instead of numbered pages.
   Desktop (≥768px): full numbered pagination. */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid var(--c-border);
  font-size: 12px;
  color: var(--c-fg-muted);
}
.pagination__info { white-space: nowrap; }
.pagination__controls {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  flex-wrap: nowrap;
}
.pagination__numbers { display: none; }
.pagination__indicator {
  font-family: 'Geist Mono', monospace;
  padding: 0 var(--space-2);
  color: var(--c-fg);
  font-weight: 500;
}
@media (min-width: 768px) {
  .pagination__numbers { display: flex; gap: var(--space-1); }
  .pagination__indicator { display: none; }
}
@media (max-width: 479px) {
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }
  .pagination__info { text-align: center; }
  .pagination__controls { justify-content: space-between; }
}

/* Up-next banner — primary-tinted call-to-action highlighting the next/active session.
   Used at the top of teacher/schedule and student-facing equivalents. */
.now-up {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-primary);
  background: var(--c-primary-soft);
  color: var(--c-fg);
}
.now-up__dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--c-primary);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--c-primary) 25%, transparent);
  animation: now-up-pulse 2s ease-in-out infinite;
}
@keyframes now-up-pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in oklch, var(--c-primary) 25%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in oklch, var(--c-primary) 10%, transparent); }
}
.now-up__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-primary);
  font-family: 'Geist Mono', monospace;
}
.now-up__title { font-size: 14px; font-weight: 600; margin-top: 1px; }
.now-up__meta { font-size: 12px; color: var(--c-fg-muted); margin-top: 2px; }
@media (max-width: 639px) {
  .now-up { grid-template-columns: auto 1fr; row-gap: 10px; }
  .now-up > .btn { grid-column: 1 / -1; width: 100%; justify-content: center; }
}

/* Toast — fixed top-right stack */
.toast-stack {
  position: fixed;
  top: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 110;
  width: min(360px, calc(100vw - 32px));
}
.toast {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.18);
  animation: toastIn 240ms ease-out;
}
@keyframes toastIn { from { transform: translateX(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast__icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: 11px; }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-size: 13px; font-weight: 600; color: var(--c-fg); }
.toast__desc { font-size: 12px; color: var(--c-fg-muted); margin-top: 2px; }
.toast__close { background: transparent; border: 0; color: var(--c-fg-subtle); cursor: pointer; padding: 0; font-size: 16px; line-height: 1; }
.toast--success .toast__icon { background: var(--c-success); }
.toast--info .toast__icon { background: var(--c-info); }
.toast--warning .toast__icon { background: var(--c-warning); }
.toast--destructive .toast__icon { background: var(--c-destructive); }

/* Popover — small floating menu */
.popover {
  position: absolute;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.18);
  padding: 6px;
  min-width: 180px;
  z-index: 30;
}
.popover__item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
  color: var(--c-fg);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.popover__item:hover { background: var(--c-bg-sunken); }
.popover__item--destructive { color: var(--c-destructive); }
.popover__item--destructive:hover { background: var(--c-destructive-soft); }
.popover__sep { height: 1px; background: var(--c-border); margin: 4px 2px; }

/* Skeleton — loading placeholder */
.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--c-bg-sunken) 0%, var(--c-muted) 50%, var(--c-bg-sunken) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}
@keyframes skeletonShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton--text { height: 12px; width: 80%; }
.skeleton--title { height: 18px; width: 60%; }
.skeleton--avatar { height: 40px; width: 40px; border-radius: 999px; }
.skeleton--card { height: 120px; width: 100%; border-radius: var(--radius-xl); }
.skeleton--btn { height: 32px; width: 96px; }

/* Empty state (centered hero) */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--c-fg-muted);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-state__icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--c-bg-sunken);
  display: grid; place-items: center;
  color: var(--c-fg-subtle);
  margin-bottom: 4px;
}
.empty-state__title { font-size: 15px; font-weight: 600; color: var(--c-fg); }
.empty-state__desc { font-size: 13px; max-width: 360px; }
.empty-state__actions { margin-top: 12px; display: flex; gap: 8px; }


/* ============================================================================
   Dense data table
   ============================================================================ */
.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dt thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 500; color: var(--c-fg-muted);
  font-size: 12px;
  padding: 6px 12px; height: 36px;
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border-strong);
}
.dt tbody td { padding: 0 12px; height: 36px; border-bottom: 1px solid var(--c-border); vertical-align: middle; white-space: nowrap; }
.dt tbody tr { transition: background 80ms; }
.dt tbody tr:hover { background: var(--c-muted); cursor: pointer; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt__num { font-variant-numeric: tabular-nums; font-family: 'Geist Mono', ui-monospace, monospace; text-align: right; }
.dt__avatar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dt__avatar > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dt__check { width: 32px; padding: 0 0 0 12px !important; }
.dt-wrap { border: 1px solid var(--c-border); border-radius: var(--radius-lg); overflow: hidden; background: var(--c-card); }
.dt-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--c-border); background: var(--c-card); flex-wrap: wrap; }
.dt-toolbar__search { flex: 1; min-width: 200px; }
.dt-bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--c-primary-soft); color: var(--c-primary); border-bottom: 1px solid var(--c-border); font-size: 13px; font-weight: 500; flex-wrap: wrap; }
.dt-bulkbar > span:first-child { white-space: nowrap; }
@media (max-width: 767px) {
  /* Bulk-select is a desktop affordance; hide the action bar on mobile. */
  .dt-bulkbar { display: none; }
}

/* ============================================================================
   Kanban
   ============================================================================ */
.kanban { display: grid; gap: 12px; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory; }
@media (min-width: 1024px) { .kanban { overflow-x: visible; } }
.kanban__col { background: var(--c-muted); border-radius: var(--radius-lg); padding: 8px; min-height: 280px; display: flex; flex-direction: column; gap: 8px; scroll-snap-align: start; }
.kanban__col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.kanban__col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-fg-muted); display: flex; align-items: center; gap: 6px; }
.kanban__col-count { background: var(--c-card); border: 1px solid var(--c-border); border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 500; color: var(--c-fg-muted); }
.kanban__card { background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: 10px 12px; cursor: grab; transition: border-color 120ms, transform 120ms; }
.kanban__card:hover { border-color: var(--c-primary); }
.kanban__card:active { cursor: grabbing; }
.kanban__card__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.kanban__card__title { font-size: 13px; font-weight: 600; }
.kanban__card__meta { font-size: 11px; color: var(--c-fg-muted); display: flex; align-items: center; gap: 6px; }

/* ============================================================================
   Vertical tabs (settings)
   ============================================================================ */
.vtabs { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 768px) { .vtabs { grid-template-columns: 240px 1fr; gap: 24px; align-items: start; } }

/* Mobile: chip jump-nav at top — sticks below the topbar so users always know where they can navigate. */
.vtabs__nav {
  display: flex; flex-direction: row; gap: 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 6px 0 12px;
  position: sticky; top: 56px;
  background: color-mix(in oklch, var(--c-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  z-index: 4;
  margin: -6px 0 12px;
  border-bottom: 1px solid var(--c-border);
}
.vtabs__nav::-webkit-scrollbar { display: none; }
@media (min-width: 768px) {
  .vtabs__nav {
    flex-direction: column;
    overflow-x: visible; overflow-y: auto;
    padding: 0 12px 0 0;
    margin: 0;
    border-right: 1px solid var(--c-border);
    border-bottom: none;
    background: transparent;
    backdrop-filter: none;
    position: sticky; top: 80px;
    max-height: calc(100dvh - 96px);
  }
}
.vtabs__item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--c-fg-muted);
  border-radius: var(--radius-md);
  cursor: pointer; white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.vtabs__item:hover { background: var(--c-muted); color: var(--c-fg); }
.vtabs__item--active { background: var(--c-muted); color: var(--c-fg); }
@media (max-width: 767px) {
  .vtabs__item { border: 1px solid var(--c-border); padding: 6px 12px; }
  .vtabs__item--active { background: var(--c-primary); color: var(--c-primary-fg); border-color: transparent; }
}
@media (min-width: 768px) { .vtabs__item--active { background: var(--c-primary-soft); color: var(--c-primary); } }
.vtabs__panel { min-width: 0; }

/* Mobile: stack all panels vertically with section headers — no tab switching needed.
   Desktop: only the active panel is visible (existing .vpanel--active behavior). */
@media (max-width: 767px) {
  .vpanel { display: block !important; scroll-margin-top: 110px; }
  .vpanel + .vpanel { margin-top: 32px; padding-top: 24px; border-top: 4px solid var(--c-bg-sunken); }
}
.vtabs__panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 16px; flex-wrap: wrap; }

/* ============================================================================
   Print — clean output for invoices (and any page tagged .printable)
   ============================================================================ */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .app-shell__sidebar,
  .app-shell__topbar,
  .bottom-nav,
  .theme-toggle,
  .mockup-viewer,
  .mockup-meta,
  .mockup-frame--mobile,
  .toolbar,
  .dt-toolbar,
  .state-demo,
  .overlay-demo,
  [data-print-hide] { display: none !important; }
  .mockup-frame--desktop { border: 0 !important; box-shadow: none !important; }
  .mockup-frame--desktop > iframe { min-width: auto !important; }
  .app-shell__main, .app-shell__content { padding: 0 !important; }
  .card, .list-group, .dt-wrap { border-color: #ccc !important; box-shadow: none !important; }
  a { color: #000 !important; text-decoration: none !important; }
  h1, h2, h3 { color: #000 !important; }
  .text-muted, .text-subtle { color: #555 !important; }
  .badge { border: 1px solid #888 !important; color: #000 !important; background: transparent !important; }
}

/* ============================================================================
   State demo block (collapsible at end of page)
   ============================================================================ */
.state-demo { display: block; border-top: 1px dashed var(--c-border); padding-top: 24px; }
.state-demo__summary {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 600; color: var(--c-fg-muted);
  list-style: none;
}
.state-demo__summary::-webkit-details-marker { display: none; }
.state-demo__summary::before {
  content: '▸';
  display: inline-block; width: 12px; transition: transform 120ms;
  font-family: 'Geist Mono', monospace; color: var(--c-fg-subtle);
}
.state-demo[open] > .state-demo__summary::before { transform: rotate(90deg); }
.state-demo__grid {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  margin-top: 16px;
}
@media (min-width: 768px) {
  .state-demo__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .state-demo__grid { grid-template-columns: repeat(3, 1fr); }
}
.state-demo__grid figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.state-demo__grid figcaption {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--c-fg-subtle);
}

/* ============================================================================
   Overlay demo block (inline absolute overlay sample)
   ============================================================================ */
.overlay-demo { margin-top: 16px; }
.overlay-demo__label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--c-fg-subtle);
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
/* Demo stage — wraps an inline preview of a modal/sheet/popover/toast.
   Stage has its own dashed border + light tinted bg. Backdrop renders as a relatively-
   positioned flex container (NOT absolute) so the modal inside dictates the height,
   then the stage grows naturally to fit. Sheets/toasts are absolute-positioned children. */
.overlay-demo__stage {
  position: relative;
  padding: 16px;
  background: var(--c-bg-sunken);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-md);
}
.overlay-demo__stage .overlay-backdrop {
  position: relative;
  inset: auto;
  background: color-mix(in oklch, var(--c-fg) 6%, transparent);
  backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  border-radius: 6px;
  min-height: 200px;
}
.dark .overlay-demo__stage .overlay-backdrop {
  background: color-mix(in oklch, black 35%, transparent);
}
.overlay-demo__stage .modal {
  max-height: none;
  position: relative;
  margin: 0;
  max-width: min(460px, 100%);
  width: 100%;
}
.overlay-demo__stage .modal--sm { max-width: min(380px, 100%); }
.overlay-demo__stage .modal--lg { max-width: min(560px, 100%); }
/* Toast + sheet — sheet/toast variants need the stage to have a fixed height
   so the absolute child positions correctly. */
.overlay-demo__stage:has(.toast-stack),
.overlay-demo__stage:has(.sheet) { min-height: 380px; }
.overlay-demo__stage:has(.sheet) .overlay-backdrop { min-height: 340px; }
.overlay-demo__stage .toast-stack {
  position: absolute;
  top: 24px;
  right: 24px;
  width: min(320px, calc(100% - 48px));
}
.overlay-demo__stage .sheet {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  border-radius: 16px 16px 0 0;
}
@media (max-width: 767px) {
  .overlay-demo__stage { padding: 12px; }
  .overlay-demo__stage .overlay-backdrop { padding: 24px 12px; }
}

/* Smaller form variants & misc utilities used by dense tables */
.input--sm, .select--sm { height: 30px; padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.avatar--xs { width: 22px; height: 22px; font-size: 10px; border-radius: 6px; flex-shrink: 0; }
.text-link { color: var(--c-primary); text-decoration: none; font-weight: 500; }
.text-link:hover { text-decoration: underline; }

/* Segmented control — for mutually exclusive choices laid out as a strip.
   Replaces the 24px button trio in attendance flow (3 buttons under WCAG 44×44 minimum).
   Each segment is full-width on mobile (44px tall), 36px on desktop. */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  padding: 3px;
  background: var(--c-bg-sunken);
  border: 1px solid var(--c-border);
  border-radius: 9px;
}
.segmented__item {
  height: 38px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-fg-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms, box-shadow 120ms;
}
.segmented__item:hover { color: var(--c-fg); }
.segmented__item--active {
  background: var(--c-card);
  color: var(--c-fg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.segmented__item--success.segmented__item--active { color: var(--c-success); }
.segmented__item--warning.segmented__item--active { color: var(--c-warning-fg-on-soft); }
.segmented__item--destructive.segmented__item--active { color: var(--c-destructive); }
@media (max-width: 767px) {
  .segmented__item { height: 44px; }
}

/* Mobile filter trigger — replaces the sticky toolbar pattern under 768px.
   Tapping opens a bottom-sheet with all filter controls. Saves ~80px viewport. */
.filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-fg);
  cursor: pointer;
}
.filter-trigger:hover { border-color: var(--c-border-strong); }
.filter-trigger svg { width: 14px; height: 14px; color: var(--c-fg-muted); }

/* Mobile tap-target enforcement.
   WCAG 2.5.5 minimum 44×44 for primary touch targets. Apply to small button
   variants under 768px so they remain usable single-handed. */
@media (max-width: 767px) {
  .btn--xs { min-height: 36px; padding-inline: 12px; }
  .btn--sm { min-height: 40px; }
  .btn--icon-sm { min-height: 40px; min-width: 40px; }
  .input, .select { height: 44px; }
  .input--sm, .select--sm { height: 38px; }
  .label { font-size: 13px; }
}
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; font-weight: 500;
  background: var(--c-card); color: var(--c-fg-muted);
  border: 1px solid var(--c-border); border-bottom-width: 2px; border-radius: 4px;
  vertical-align: middle;
}
