/* ==========================================================================
   AttendanceApp design system
   --------------------------------------------------------------------------
   Visual language ported from the Kaizen dashboard: navy sidebar, cyan
   accent, translucent "glass" cards on a soft slate/cyan gradient page.

   Plain CSS by design. The implementation plan specifies Django templates
   with plain CSS and no frontend build step, so tokens live here rather
   than in a utility framework config.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Brand */
  --navy: #0f172a;
  --navy-700: #1e293b;
  --cyan: #06b6d4;
  --cyan-dark: #0891b2;
  --gold: #fbbf24;

  /* Semantic status */
  --present: #10b981;
  --present-bg: #ecfdf5;
  --present-ink: #047857;

  --late: #f59e0b;
  --late-bg: #fffbeb;
  --late-ink: #b45309;

  --absent: #f43f5e;
  --absent-bg: #fff1f2;
  --absent-ink: #be123c;

  --excused: #8b5cf6;
  --excused-bg: #f5f3ff;
  --excused-ink: #6d28d9;

  --info-bg: #eff6ff;
  --info-ink: #1d4ed8;

  /* Text */
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;

  /* Lines and surfaces */
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --paper: #ffffff;
  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --sunken: #f8fafc;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(6, 182, 212, 0.15);
  --shadow-modal: 0 24px 64px rgba(15, 23, 42, 0.24);

  /* Layout */
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
  --gutter: 24px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --speed: 200ms;

  /* Typography */
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--sunken);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.125rem;
}
h3 {
  font-size: 0.9375rem;
}

p {
  margin: 0;
}

a {
  color: var(--cyan-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

svg {
  flex-shrink: 0;
}

/* Visible focus for every interactive element. Never remove without a
   replacement: this is the primary keyboard affordance. */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Screen-reader-only text that stays focusable. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--navy);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--speed) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   3. App shell
   -------------------------------------------------------------------------- */

.app {
  display: flex;
  min-height: 100vh;
}

.app__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0; /* allows children to shrink instead of overflowing */
  background:
    linear-gradient(
      160deg,
      rgba(248, 250, 252, 0.9) 0%,
      rgba(236, 254, 255, 0.5) 100%
    ),
    var(--sunken);
}

.app__content {
  flex: 1;
  padding: var(--gutter);
}

@media (max-width: 640px) {
  .app__content {
    padding: 16px;
  }
}

/* --------------------------------------------------------------------------
   4. Sidebar
   -------------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100vh;
  flex-shrink: 0;
  background: var(--navy);
  transition: width var(--speed) var(--ease);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: var(--topbar-h);
}

.sidebar__brand-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: rgba(6, 182, 212, 0.18);
  color: var(--cyan);
}

.sidebar__brand-text {
  min-width: 0;
}

.sidebar__brand-name {
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__brand-school {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  overflow-y: auto;
}

.sidebar__section-label {
  padding: 14px 12px 6px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--speed) var(--ease),
    color var(--speed) var(--ease);
}

.nav-item:hover {
  background: rgba(6, 182, 212, 0.14);
  color: #fff;
  text-decoration: none;
}

.nav-item[aria-current="page"] {
  background: rgba(6, 182, 212, 0.2);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--cyan);
}

.nav-item__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item__badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--absent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
}

.sidebar__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.2);
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar__user {
  min-width: 0;
}

.sidebar__user-name {
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.6875rem;
  white-space: nowrap;
}

/* Collapsed rail: icons only. */
.app.is-sidebar-collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
}

.app.is-sidebar-collapsed .sidebar__brand-text,
.app.is-sidebar-collapsed .sidebar__section-label,
.app.is-sidebar-collapsed .nav-item__label,
.app.is-sidebar-collapsed .nav-item__badge,
.app.is-sidebar-collapsed .sidebar__user {
  display: none;
}

.app.is-sidebar-collapsed .sidebar__brand,
.app.is-sidebar-collapsed .nav-item,
.app.is-sidebar-collapsed .sidebar__footer {
  justify-content: center;
}

/* Off-canvas drawer on small screens. */
.sidebar__scrim {
  display: none;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--speed) var(--ease);
  }

  .app.is-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app.is-sidebar-open .sidebar__scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
  }

  /* The rail toggle is desktop-only; the drawer replaces it. */
  .app.is-sidebar-collapsed .sidebar {
    width: var(--sidebar-w);
  }

  .app.is-sidebar-collapsed .sidebar__brand-text,
  .app.is-sidebar-collapsed .sidebar__section-label,
  .app.is-sidebar-collapsed .nav-item__label,
  .app.is-sidebar-collapsed .nav-item__badge,
  .app.is-sidebar-collapsed .sidebar__user {
    display: revert;
  }
}

/* --------------------------------------------------------------------------
   5. Topbar
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-h);
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 16px;
  }
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--speed) var(--ease),
    color var(--speed) var(--ease);
}

.icon-button:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.topbar__rail-toggle {
  display: none;
}

.topbar__drawer-toggle {
  display: grid;
}

@media (min-width: 901px) {
  .topbar__rail-toggle {
    display: grid;
  }

  .topbar__drawer-toggle {
    display: none;
  }
}

.search {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.search__icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--muted-light);
  pointer-events: none;
}

.search__input {
  width: 100%;
  min-height: 38px;
  padding: 8px 14px 8px 38px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.875rem;
}

.search__input::placeholder {
  color: var(--muted-light);
}

.search__input:focus {
  border-color: var(--cyan);
  background: var(--paper);
  outline: 2px solid rgba(6, 182, 212, 0.2);
  outline-offset: 0;
}

.topbar__spacer {
  flex: 1;
}

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

.topbar__date {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .topbar__date {
    display: none;
  }
}

/* Language switch (BM / EN) */
.lang-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--sunken);
}

.lang-toggle__option {
  min-width: 38px;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.lang-toggle__option[aria-pressed="true"] {
  background: var(--paper);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   6. Page header
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head__body {
  flex: 1;
  min-width: 200px;
}

.page-head__crumb {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8125rem;
}

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

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */

.card {
  padding: 20px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card--accent {
  border-left: 4px solid var(--cyan);
}

.card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card__title {
  flex: 1;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   8. Grids
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 16px;
}

.grid--stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid--classes {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.grid--halves {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack--tight {
  gap: 10px;
}

/* --------------------------------------------------------------------------
   9. Stat cards
   -------------------------------------------------------------------------- */

.stat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  background: var(--glass);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: transform var(--speed) var(--ease),
    box-shadow var(--speed) var(--ease);
}

/* Only lift stats that actually do something on click. */
.stat--interactive {
  border-width: 1px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: inherit;
}

.stat--interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--line-soft);
  color: var(--cyan);
}

.stat__icon--present {
  background: var(--present-bg);
  color: var(--present);
}
.stat__icon--absent {
  background: var(--absent-bg);
  color: var(--absent);
}
.stat__icon--late {
  background: var(--late-bg);
  color: var(--late);
}
.stat__icon--rate {
  background: #fffbeb;
  color: var(--gold);
}

.stat__value {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy);
}

.stat__label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Compact per-class percentage tile */
.class-tile {
  padding: 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  background: var(--glass);
  box-shadow: var(--shadow);
  text-align: center;
}

.class-tile__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cyan);
}

.class-tile__label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   10. Buttons
   -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--speed) var(--ease),
    border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}

.button:hover {
  text-decoration: none;
}

.button--primary {
  background: var(--cyan-dark);
  color: #fff;
}

.button--primary:hover {
  background: #0e7490;
}

.button--secondary {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink-soft);
}

.button--secondary:hover {
  border-color: var(--muted-light);
  background: var(--sunken);
}

.button--success {
  background: var(--present);
  color: #fff;
}

.button--success:hover {
  background: var(--present-ink);
}

.button--danger {
  background: var(--absent);
  color: #fff;
}

.button--danger:hover {
  background: var(--absent-ink);
}

.button--ghost {
  color: var(--muted);
}

.button--ghost:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.button--small {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 0.8125rem;
}

.button--block {
  width: 100%;
}

.button[disabled],
.button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .button {
    min-height: 44px; /* comfortable touch target */
  }
}

/* --------------------------------------------------------------------------
   11. Badges and tags
   -------------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.tag--present {
  background: var(--present-bg);
  color: var(--present-ink);
}
.tag--late {
  background: var(--late-bg);
  color: var(--late-ink);
}
.tag--absent {
  background: var(--absent-bg);
  color: var(--absent-ink);
}
.tag--excused {
  background: var(--excused-bg);
  color: var(--excused-ink);
}
.tag--info {
  background: var(--info-bg);
  color: var(--info-ink);
}
.tag--neutral {
  background: var(--line-soft);
  color: var(--muted);
}
.tag--role {
  background: #ecfeff;
  color: #155e75;
  text-transform: capitalize;
}

/* Status dot for use alongside text where colour alone must not carry meaning */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* --------------------------------------------------------------------------
   12. Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  padding: 12px 16px;
  background: var(--navy);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.table th:first-child {
  border-top-left-radius: var(--r-lg);
}
.table th:last-child {
  border-top-right-radius: var(--r-lg);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: #f6feff;
}

.table__name {
  font-weight: 500;
  color: var(--navy);
}

.table__numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table__empty {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

/* Subtle table variant for panels that already sit on a card */
.table--plain th {
  background: var(--sunken);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.table--plain th:first-child,
.table--plain th:last-child {
  border-radius: 0;
}

/* --------------------------------------------------------------------------
   13. Forms
   -------------------------------------------------------------------------- */

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

.field__label {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.field__hint {
  color: var(--muted);
  font-size: 0.75rem;
}

.field__error {
  color: var(--absent-ink);
  font-size: 0.75rem;
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.875rem;
}

.textarea {
  min-height: 76px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--cyan);
  outline: 2px solid rgba(6, 182, 212, 0.2);
  outline-offset: 0;
}

.input[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--absent);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--sunken);
  color: var(--muted);
  cursor: not-allowed;
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.select--compact {
  min-height: 32px;
  padding: 4px 30px 4px 9px;
  font-size: 0.8125rem;
}

.checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan-dark);
  cursor: pointer;
}

.field-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* Drag-and-drop upload zone, used by the roster CSV import */
.dropzone {
  position: relative;
  padding: 28px 20px;
  border: 2px dashed var(--cyan);
  border-radius: var(--r-lg);
  background: rgba(6, 182, 212, 0.03);
  text-align: center;
  transition: background var(--speed) var(--ease);
}

.dropzone:hover,
.dropzone.is-dragover {
  background: rgba(6, 182, 212, 0.08);
}

.dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone__icon {
  color: var(--cyan);
  opacity: 0.7;
}

.dropzone__title {
  margin-top: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
}

.dropzone__hint {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   14. Segmented control
   -------------------------------------------------------------------------- */

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-md);
  background: #eef6f8;
}

.segmented__option {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--speed) var(--ease),
    color var(--speed) var(--ease);
}

.segmented__option:hover {
  color: var(--ink);
}

.segmented__option[aria-pressed="true"] {
  background: var(--paper);
  color: var(--cyan-dark);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   15. Progress and intervention pipeline
   -------------------------------------------------------------------------- */

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--line);
}

.progress__bar {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--present));
  transition: width var(--speed) var(--ease);
}

.intervention {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
}

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

.intervention__student {
  flex: 1;
  min-width: 0;
}

.intervention__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--navy);
}

.intervention__meta {
  color: var(--muted);
  font-size: 0.8125rem;
}

.intervention__stage {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   16. Person rows and avatars
   -------------------------------------------------------------------------- */

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--sunken);
}

.person--risk {
  background: var(--absent-bg);
}

.person--watch {
  background: var(--late-bg);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
}

.avatar--risk {
  background: #ffe4e6;
  color: var(--absent-ink);
}

.avatar--watch {
  background: #fef3c7;
  color: var(--late-ink);
}

.person__body {
  flex: 1;
  min-width: 0;
}

.person__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person__meta {
  font-size: 0.6875rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   17. Notices and empty states
   -------------------------------------------------------------------------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  font-weight: 500;
}

.notice--info {
  border-color: #bfdbfe;
  background: var(--info-bg);
  color: #1e40af;
}

.notice--warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.notice--success {
  border-color: #a7f3d0;
  background: var(--present-bg);
  color: var(--present-ink);
}

.notice--error {
  border-color: #fecdd3;
  background: var(--absent-bg);
  color: var(--absent-ink);
}

.empty-state {
  padding: 32px 20px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   18. Modal
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.modal[hidden] {
  display: none;
}

.modal__panel {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-modal);
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal__title {
  flex: 1;
}

/* --------------------------------------------------------------------------
   19. Utilities
   -------------------------------------------------------------------------- */

.muted {
  color: var(--muted);
}

.text-small {
  font-size: 0.8125rem;
}

.text-tiny {
  font-size: 0.75rem;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mt-0 {
  margin-top: 0;
}
.mt-2 {
  margin-top: 8px;
}
.mt-4 {
  margin-top: 16px;
}
.mb-4 {
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   20. Motion preference
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .stat--interactive:hover {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   21. Print
   -------------------------------------------------------------------------- */

@media print {
  .sidebar,
  .topbar,
  .page-head__actions {
    display: none !important;
  }

  .app__content {
    padding: 0;
  }

  .card,
  .stat {
    border: 1px solid #cbd5e1;
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
  }
}
