:root {
  /* Brand primary — overridden at runtime by Layout from District Settings */
  --sped-primary: #5b4b8a;
  --sped-primary-dark: #46396c;
  --sped-primary-shade-1: color-mix(in srgb, var(--sped-primary) 88%, #ffffff);
  --sped-primary-shade-2: color-mix(in srgb, var(--sped-primary) 72%, #ffffff);
  --sped-primary-shade-3: color-mix(in srgb, var(--sped-primary) 56%, #ffffff);
  /* Legacy names → always track primary */
  --sped-purple: var(--sped-primary);
  --sped-purple-dark: var(--sped-primary-dark);
  --sped-pink: #c45c8a;
  --sped-pink-light: #d46b9a;
  --sped-lavender: color-mix(in srgb, var(--sped-primary) 55%, #ffffff);
  --sped-bg: #f6f5fa;
  --sped-card: #ffffff;
  --sped-ok: #1f7a4c;
  --sped-bad: #b42318;

  /* Bootstrap theme overrides — track primary brand */
  --bs-primary: var(--sped-primary);
  --bs-primary-rgb: 91, 75, 138;
  --bs-link-color: var(--sped-primary);
  --bs-link-color-rgb: 91, 75, 138;
  --bs-link-hover-color: var(--sped-primary-dark);
  --bs-link-hover-color-rgb: 70, 57, 108;
  --bs-focus-ring-color: color-mix(in srgb, var(--sped-primary) 35%, transparent);
}

body {
  background: var(--sped-bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---- Global purple theme (buttons, links, headings) ---- */

a:not(.nav-link):not(.navbar-brand):not(.btn):not(.page-link):not(.dropdown-item) {
  color: var(--sped-purple);
}

a:not(.nav-link):not(.navbar-brand):not(.btn):not(.page-link):not(.dropdown-item):hover {
  color: var(--sped-purple-dark);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--sped-purple);
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--sped-purple);
  --bs-btn-border-color: var(--sped-purple);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-purple-dark);
  --bs-btn-hover-border-color: var(--sped-purple-dark);
  --bs-btn-focus-shadow-rgb: 91, 75, 138;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--sped-purple-dark);
  --bs-btn-active-border-color: #3a2f5a;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--sped-lavender);
  --bs-btn-disabled-border-color: var(--sped-lavender);
}

.btn-outline-primary {
  --bs-btn-color: var(--sped-purple);
  --bs-btn-border-color: var(--sped-purple);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-purple);
  --bs-btn-hover-border-color: var(--sped-purple);
  --bs-btn-focus-shadow-rgb: 91, 75, 138;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--sped-purple-dark);
  --bs-btn-active-border-color: var(--sped-purple-dark);
  --bs-btn-disabled-color: var(--sped-lavender);
  --bs-btn-disabled-border-color: var(--sped-lavender);
}

.btn-link {
  --bs-btn-color: var(--sped-purple);
  --bs-btn-hover-color: var(--sped-purple-dark);
  --bs-btn-active-color: var(--sped-purple-dark);
}

.btn-secondary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--sped-lavender);
  --bs-btn-border-color: var(--sped-lavender);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-purple);
  --bs-btn-hover-border-color: var(--sped-purple);
  --bs-btn-active-bg: var(--sped-purple-dark);
  --bs-btn-active-border-color: var(--sped-purple-dark);
}

.btn-outline-secondary {
  --bs-btn-color: var(--sped-purple);
  --bs-btn-border-color: var(--sped-lavender);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-purple);
  --bs-btn-hover-border-color: var(--sped-purple);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--sped-purple-dark);
  --bs-btn-active-border-color: var(--sped-purple-dark);
}

.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--sped-purple);
  --bs-btn-border-color: var(--sped-purple);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-purple-dark);
  --bs-btn-hover-border-color: var(--sped-purple-dark);
  --bs-btn-active-bg: var(--sped-purple-dark);
  --bs-btn-active-border-color: #3a2f5a;
  --bs-btn-focus-shadow-rgb: 91, 75, 138;
}

.btn-info {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--sped-lavender);
  --bs-btn-border-color: var(--sped-lavender);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-purple);
  --bs-btn-hover-border-color: var(--sped-purple);
  --bs-btn-active-bg: var(--sped-purple-dark);
  --bs-btn-active-border-color: var(--sped-purple-dark);
}

/* Warning actions (Submit for review) — true amber/yellow, not pink */
.btn-warning {
  --bs-btn-color: #3d3200;
  --bs-btn-bg: #f0c14a;
  --bs-btn-border-color: #d4a017;
  --bs-btn-hover-color: #2a2200;
  --bs-btn-hover-bg: #e6b800;
  --bs-btn-hover-border-color: #c49200;
  --bs-btn-active-bg: #c49200;
  --bs-btn-active-border-color: #a87c00;
  --bs-btn-focus-shadow-rgb: 212, 160, 23;
}

.btn-outline-danger {
  --bs-btn-color: var(--sped-pink);
  --bs-btn-border-color: var(--sped-pink);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-pink);
  --bs-btn-hover-border-color: var(--sped-pink);
}

.btn-outline-warning {
  --bs-btn-color: var(--sped-purple);
  --bs-btn-border-color: var(--sped-lavender);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sped-purple);
  --bs-btn-hover-border-color: var(--sped-purple);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--sped-lavender);
  box-shadow: 0 0 0 0.2rem rgba(91, 75, 138, 0.25);
}

.form-check-input:checked {
  background-color: var(--sped-purple);
  border-color: var(--sped-purple);
}

.form-check-input:focus {
  border-color: var(--sped-lavender);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background-color: var(--sped-purple);
  color: #fff !important;
}

/* Identity Manage account sidebar: readable active + hover */
#manage .nav-pills .nav-link,
ul.nav-pills.flex-column .nav-link {
  color: var(--sped-purple);
}

#manage .nav-pills .nav-link:hover,
ul.nav-pills.flex-column .nav-link:hover {
  color: var(--sped-purple-dark);
}

#manage .nav-pills .nav-link.active,
ul.nav-pills.flex-column .nav-link.active {
  background-color: var(--sped-purple);
  color: #fff !important;
}

/* Hide Personal Data (download/delete) from Manage Your Account */
#personal-data,
.nav-item:has(#personal-data) {
  display: none !important;
}

.page-link {
  color: var(--sped-purple);
}

.page-item.active .page-link {
  background-color: var(--sped-purple);
  border-color: var(--sped-purple);
}

.badge.bg-primary {
  background-color: var(--sped-purple) !important;
}

/* Workload Not Sent To Teacher — solid red, white text */
.badge.bg-danger {
  background-color: #c0392b !important;
  color: #fff !important;
}

.badge.bg-danger.text-white {
  color: #fff !important;
}

.table thead th,
.table-light {
  color: var(--sped-purple-dark);
}

/* Identity / account pages */
#account .btn-primary,
form[id="account"] .btn-primary {
  background-color: var(--sped-purple);
  border-color: var(--sped-purple);
}

#account a:not(.nav-link),
form[id="account"] a:not(.nav-link) {
  color: var(--sped-purple);
}

#account a:not(.nav-link):hover,
form[id="account"] a:not(.nav-link):hover {
  color: var(--sped-purple-dark);
}

#account .nav-pills .nav-link.active,
#manage .nav-pills .nav-link.active {
  color: #fff !important;
  background-color: var(--sped-purple);
}

.sped-nav {
  background: linear-gradient(90deg, var(--sped-purple-dark), var(--sped-purple));
  box-shadow: 0 2px 8px rgba(70, 57, 108, 0.25);
}

.brand-mark {
  background: #fff;
  color: var(--sped-purple);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
}

.brand-text {
  font-weight: 600;
  font-size: 1rem;
  color: #f3efff !important;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}

.district-logo {
  max-height: 36px;
  max-width: 120px;
  object-fit: contain;
  background: #fff;
  border-radius: 0.35rem; /* match .brand-mark */
  padding: 2px 4px;
}

.dashboard-header {
  padding-bottom: 0.25rem;
}

.district-title {
  color: var(--sped-purple);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0;
  line-height: 1.3;
}

.dashboard-subtitle {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 400;
  margin-top: 0.2rem;
}

.teacher-status-banner {
  border-left: 4px solid var(--sped-purple);
  background: #fff;
  border: 1px solid #e4e0f0;
  border-left-width: 4px;
  border-left-color: var(--sped-purple);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

/* Top nav right cluster: Create New Workload | User | Logout (no divider line) */
.navbar-end {
  margin-left: auto;
}

.btn-create-workload {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.65) !important;
  font-weight: 500 !important;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  border-radius: 0.375rem;
  padding: 0.4rem 0.95rem;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-create-workload:hover {
  background: #fff !important;
  color: var(--sped-purple) !important;
  border-color: #fff !important;
}

.navbar-end .nav-user-name {
  font-weight: 500;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 992px) {
  .navbar-end {
    margin-left: 1rem;
    gap: 0.75rem !important;
  }
}

/*
 * Site-wide button weight: medium (500) so primary / outline / custom actions match.
 * Avoid mixed bold vs regular controls on lists and toolbars.
 */
.btn,
.btn-sm,
.btn-lg {
  font-weight: 500 !important;
  letter-spacing: normal;
}

/*
 * Action button family — shared size with btn-sm.
 * Bulk = light purple outline, Annual/Send = light green outline.
 */
.btn-action-pair {
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  padding: 0.25rem 0.75rem !important;
  border-radius: 0.375rem !important;
  white-space: nowrap;
}

/* Green outline actions (Send / Send Annual) */
.btn-send-annual {
  background: #f0faf4 !important;
  border: 1px solid #2d8a57 !important;
  color: #1a6b42 !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  padding: 0.25rem 0.75rem !important;
  border-radius: 0.375rem !important;
}

.btn-send-annual:hover {
  background: #e0f3e8 !important;
  border-color: #1a6b42 !important;
  color: #0f4a2d !important;
}

/* Workloads page: secondary action — light purple outline */
.btn-bulk-annual {
  background: #f7f5fb !important;
  border: 1px solid var(--sped-purple) !important;
  color: var(--sped-purple) !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  padding: 0.25rem 0.75rem !important;
  border-radius: 0.375rem !important;
}

.btn-bulk-annual:hover {
  background: color-mix(in srgb, var(--sped-purple) 12%, #fff) !important;
  border-color: var(--sped-purple-dark) !important;
  color: var(--sped-purple-dark) !important;
}

/* List/table action rows: keep all control text the same weight */
.table .btn,
.table .badge {
  font-weight: 500 !important;
}

/* Status badges — uniform padding so colored pill has space above/below text */
.badge,
span.badge {
  display: inline-block;
  padding: 0.5em 0.8em;
  line-height: 1.3;
  font-weight: 600;
  vertical-align: middle;
  white-space: normal;
  border-radius: 0.375rem;
}

.table .badge,
.workloads-list-table .badge,
.mobile-card-table .badge,
.list-card .badge,
.dash-tile .badge {
  padding: 0.55em 0.85em;
  line-height: 1.35;
}

.navbar-nav .nav-link,
.navbar-nav .btn-link {
  font-weight: 500 !important;
}

/* KPI cards — colored rounded boxes, refined typography */
.dash-tile {
  display: block;
  text-decoration: none !important;
  border-radius: 0.65rem;
  padding: 1rem 1.15rem 1.05rem;
  border: 1px solid #e5e2ee;
  background: #fff;
  transition: box-shadow .15s ease, filter .15s ease;
  color: inherit !important;
  min-height: 5rem;
  box-shadow: 0 1px 2px rgba(55, 48, 74, 0.04);
}

.dash-tile:hover {
  box-shadow: 0 3px 10px rgba(55, 48, 74, 0.08);
  filter: brightness(0.99);
  color: inherit !important;
}

/* Default (neutral) tiles */
.dash-tile .stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5b6170;
  line-height: 1.35;
  margin-bottom: 0.45rem;
}

.dash-tile .stat-value {
  font-size: 1.85rem;
  font-weight: 500;
  line-height: 1.15;
  color: #2d3340;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Status tiles — solid fills, light professional text */
.dash-tile.dash-tile-alert,
.dash-tile.tile-solid-red,
.dash-tile.tile-red {
  background: #c53d32 !important;
  border-color: #b4352b !important;
}
.dash-tile.dash-tile-alert .stat-value,
.dash-tile.tile-solid-red .stat-value,
.dash-tile.tile-red .stat-value {
  color: #ffffff !important;
  font-weight: 500;
}
.dash-tile.dash-tile-alert .stat-label,
.dash-tile.tile-solid-red .stat-label,
.dash-tile.tile-red .stat-label {
  color: rgba(255, 255, 255, 0.88) !important;
  font-weight: 500;
}

.dash-tile.dash-tile-caution,
.dash-tile.tile-solid-yellow,
.dash-tile.tile-yellow {
  background: #e6b800 !important;
  border-color: #d4a800 !important;
}
.dash-tile.dash-tile-caution .stat-value,
.dash-tile.tile-solid-yellow .stat-value,
.dash-tile.tile-yellow .stat-value {
  color: #2c2410 !important;
  font-weight: 500;
}
.dash-tile.dash-tile-caution .stat-label,
.dash-tile.tile-solid-yellow .stat-label,
.dash-tile.tile-yellow .stat-label {
  color: rgba(44, 36, 16, 0.78) !important;
  font-weight: 500;
}

.dash-tile.dash-tile-success,
.dash-tile.tile-solid-green,
.dash-tile.tile-green {
  background: #2d8a57 !important;
  border-color: #267a4c !important;
}
.dash-tile.dash-tile-success .stat-value,
.dash-tile.tile-solid-green .stat-value,
.dash-tile.tile-green .stat-value {
  color: #ffffff !important;
  font-weight: 500;
}
.dash-tile.dash-tile-success .stat-label,
.dash-tile.tile-solid-green .stat-label,
.dash-tile.tile-green .stat-label {
  color: rgba(255, 255, 255, 0.88) !important;
  font-weight: 500;
}

.field-changed {
  background: #fdecec !important;
  border-color: #f3b4b0 !important;
  box-shadow: 0 0 0 1px #e35d5d;
}

.approval-yes { color: #1f7a4c !important; font-weight: 700; }
.approval-no { color: #b42318 !important; font-weight: 700; }

.setup-card {
  display: block;
  text-decoration: none;
  color: inherit !important;
  border: 1px solid #e4e0f0;
  border-radius: 0.65rem;
  padding: 1.1rem;
  background: #fff;
  height: 100%;
}
.setup-card:hover {
  border-color: var(--sped-purple);
  box-shadow: 0 2px 10px rgba(70,57,108,.1);
  color: inherit !important;
}
.setup-card h3 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.setup-card p { font-size: 0.85rem; color: #6c6785; margin: 0; }

.navbar .dropdown-menu a.dropdown-item {
  color: #333 !important;
}
.navbar .dropdown-menu a.dropdown-item:hover {
  background: #f3f0fa;
  color: var(--sped-purple) !important;
}

.sped-footer {
  background: #fff;
}

.page-title {
  color: var(--sped-purple);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sped-card {
  background: var(--sped-card);
  border: 1px solid #e4e0f0;
  border-radius: 0.65rem;
  box-shadow: 0 1px 3px rgba(70, 57, 108, 0.06);
}

/* Equal-height section cards on workload form */
.equal-section-row > [class*="col-"] {
  display: flex;
}

.sped-section-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
}

.sped-section-header {
  color: #fff;
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 0.85rem;
  border-radius: 0.5rem 0.5rem 0 0;
  flex-shrink: 0;
}

/* Top read-only sections — full district primary brand */
.sped-section-header.purple { background: var(--sped-primary); }

/*
 * Second-row task headers — lighter tints of PRIMARY brand color.
 * When District Settings primary is blue/green/etc., these follow automatically.
 */
.sped-section-header.shade-1 { background: var(--sped-primary-shade-1); }
.sped-section-header.shade-2 { background: var(--sped-primary-shade-2); }
.sped-section-header.shade-3 { background: var(--sped-primary-shade-3); }

/* Legacy class aliases → primary tints */
.sped-section-header.pink { background: var(--sped-primary-shade-1); }
.sped-section-header.pink-light { background: var(--sped-primary-shade-2); }
.sped-section-header.lavender { background: var(--sped-primary-shade-3); }

/* Workload mix bar — same primary tint ladder */
.mix-contractual { background: var(--sped-primary) !important; }
.mix-planning { background: var(--sped-primary-shade-1) !important; }
.mix-workload { background: var(--sped-primary-shade-2) !important; }
.mix-other { background: var(--sped-primary-shade-3) !important; }
.mix-direct { background: var(--sped-primary-dark) !important; }

.sped-section-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.85rem 0.75rem;
  border: 1px solid #e4e0f0;
  border-top: 0;
  border-radius: 0 0 0.5rem 0.5rem;
  background: #fff;
}

.form-label-sm {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #4a4560;
  margin-bottom: 0.15rem;
}

/* Read-only values — same weight as form labels / inputs */
.static-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: #2c2840;
  line-height: 1.35;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.minute-row .static-value {
  text-align: right;
  flex-shrink: 0;
  max-width: 58%;
}

.calc-input {
  max-width: 7rem;
  font-weight: 500;
}

.minute-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f0edf6;
  font-size: 0.875rem;
  font-weight: 500;
  color: #2c2840;
  min-height: 2rem;
}

.minute-row > span:first-child {
  font-weight: 500;
  color: #4a4560;
}

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

/* Total row: pin to bottom of equal-height cards; same weight as other rows */
.minute-row.minute-row-total {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid #e4e0f0;
  border-bottom: 0;
}

.minute-row.minute-row-total > span {
  font-weight: 500;
  color: #2c2840;
}

.banner-minutes {
  text-align: center;
  font-weight: 700;
  color: var(--sped-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.05rem;
  margin: 1rem 0 0.75rem;
  line-height: 1.35;
}

/* Section banners between form blocks — more presence + breathing room */
.banner-minutes-section {
  margin-top: 2rem;
  margin-bottom: 1.15rem;
  padding: 0.35rem 0;
  font-size: 1.12rem;
  letter-spacing: 0.07em;
  border: 0;
  background: transparent;
}

/* Keep Teacher/District approval label + value on one line when wrapping */
.approval-status-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.approval-status-line {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

.approval-status-label {
  color: #4a4560;
}

.status-pill-nowrap {
  white-space: nowrap !important;
  flex-shrink: 0;
}

.summary-footer-msg {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}

/* Capacity status cards (hours / students) */
.status-metric {
  border: 1px solid #e4e0f0;
  border-radius: 0.65rem;
  padding: 0.9rem 1rem;
  background: #faf9fc;
}

.status-metric.is-ok {
  border-color: color-mix(in srgb, var(--sped-ok) 35%, #e4e0f0);
  background: color-mix(in srgb, var(--sped-ok) 6%, #ffffff);
}

.status-metric.is-bad {
  border-color: color-mix(in srgb, var(--sped-bad) 35%, #e4e0f0);
  background: color-mix(in srgb, var(--sped-bad) 6%, #ffffff);
}

.status-metric-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.45rem;
}

.status-delta {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-metric-msg {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}

/* Workload mix horizontal bar chart (primary shade ladder) */
.mix-chart-card,
.status-summary-card {
  min-height: 100%;
}

.mix-chart-subtext {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c6785;
  letter-spacing: 0.02em;
}

.mix-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: 100%;
  padding: 0.15rem 0 0.25rem;
}

.mix-bar-row {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.65rem 0.75rem;
}

.mix-bar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4a4560;
  text-align: right;
  line-height: 1.2;
}

.mix-bar-track {
  height: 1.35rem;
  background: #efeaf8;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(70, 57, 108, 0.08);
  min-width: 0;
}

.mix-bar-fill {
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  transition: width 0.28s ease;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.mix-bar-pct {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--sped-primary-dark);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.calc-caseload-row .caseload-bar {
  margin-top: 0.25rem;
}



.sped-section-header {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em;
  padding: 0.65rem 0.95rem !important;
}

.status-pill {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-pill.ok {
  background: #e8f7ee;
  color: var(--sped-ok);
  border: 1px solid #9ed9b5;
}

.status-pill.bad {
  background: #fdecec;
  color: var(--sped-bad);
  border: 1px solid #f3b4b0;
}

/* Drawn signature pads (mouse / touch) */
.signature-pad-wrap {
  max-width: 100%;
}

.signature-pad {
  display: block;
  width: 100%;
  max-width: 480px;
  height: 140px;
  background: #fff;
  border: 1px solid #cfc8e0;
  border-radius: 0.35rem;
  touch-action: none;
  cursor: crosshair;
  box-shadow: inset 0 1px 2px rgba(40, 30, 70, 0.06);
}

.signature-signer-name {
  font-weight: 600;
  color: #2c2840;
  border-top: 1px solid #e4e0f0;
  padding-top: 0.35rem;
  font-size: 0.95rem;
}

.signature-image {
  max-width: 240px;
  max-height: 80px;
  object-fit: contain;
  border: 1px solid #e4e0f0;
  border-radius: 0.25rem;
  background: #fff;
}

.summary-box {
  border: 2px solid var(--sped-purple);
  border-radius: 0.65rem;
  padding: 1rem;
  background: #fff;
}

.summary-box.overloaded {
  border-color: var(--sped-bad);
}

/* ---- Student services table (quick entry, clean) ---- */
.students-entry-card {
  padding: 0;
  overflow: hidden;
}

.students-entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.85rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid #efeaf8;
  background: color-mix(in srgb, var(--sped-primary) 4%, #fff);
}

/* Simple professional totals (no pill/box) */
.students-totals-meta {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  color: #5c5670;
  line-height: 1.2;
}

.students-totals-meta-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6c6785;
}

.students-totals-meta-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--sped-primary);
  font-variant-numeric: tabular-nums;
}

.students-totals-meta-unit {
  font-size: 0.7rem;
  font-weight: 500;
  color: #8a849c;
}

.students-table-scroll {
  max-width: 100%;
}

.students-table {
  width: 100%;
  min-width: 920px;
  font-size: 0.8rem;
  margin-bottom: 0;
  --bs-table-bg: transparent;
}

.students-table thead th {
  background: var(--sped-primary) !important;
  color: #fff !important;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: normal;
  vertical-align: middle;
  text-align: center;
  padding: 0.4rem 4px !important; /* min ~3px side padding between header names */
  border: 0 !important;
  line-height: 1.2;
  max-width: 4.2rem;
}

.students-table thead th.col-num {
  max-width: 2rem;
  width: 2rem;
  padding-left: 3px !important;
  padding-right: 3px !important;
}

.students-table thead th.col-flag {
  max-width: 3.1rem;
  min-width: 2.7rem;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

.students-table tbody td {
  padding: 0.28rem 0.25rem !important;
  vertical-align: middle;
  border-color: #efeaf8 !important;
  background: #fff;
}

.students-table tbody tr.student-row-filled td {
  background: color-mix(in srgb, var(--sped-primary) 3%, #fff);
}

.students-table tbody tr:hover td {
  background: color-mix(in srgb, var(--sped-primary) 6%, #fff);
}

.students-table tfoot td {
  padding: 0.4rem 0.3rem !important;
  background: color-mix(in srgb, var(--sped-primary) 6%, #fff) !important;
  border-top: 2px solid color-mix(in srgb, var(--sped-primary) 22%, #e4e0f0) !important;
  font-size: 0.78rem;
  color: var(--sped-primary-dark);
}

.students-table .col-num {
  width: 2rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #6c6785;
}

.students-table .col-flag {
  width: 2.55rem;
  min-width: 2.55rem;
  text-align: center;
  padding-left: 3px !important;
  padding-right: 3px !important;
}

.students-table .form-control,
.students-table .form-select {
  font-size: 0.8rem;
  min-height: 1.85rem;
  padding: 0.15rem 0.3rem;
  border-color: #dcd6ea;
}

.students-table .form-control:focus,
.students-table .form-select:focus {
  border-color: var(--sped-primary);
  box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--sped-primary) 18%, transparent);
}

.students-table .form-check-input {
  margin: 0;
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  vertical-align: middle;
}

.students-table .student-input-initials {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Mobile-only section label — never a desktop table column */
.students-table .student-needs-heading {
  display: none;
}

.students-table .student-input-num {
  font-variant-numeric: tabular-nums;
}

/* Desktop table only: compact column widths (must NOT apply on mobile cards) */
@media (min-width: 768px) {
  .students-table .student-input-initials {
    width: 3.1rem;
    max-width: 3.4rem;
    text-align: center;
  }

  .students-table .student-input-num {
    width: 3.25rem;
    max-width: 3.5rem;
  }

  .students-table .student-input-lre {
    min-width: 4rem;
    width: auto;
    max-width: 5.5rem;
  }

  .students-table .student-input-count {
    min-width: 3.25rem;
    width: auto;
    max-width: 4.25rem;
  }

  .students-table select[name*="Disability"],
  .students-table select[name*="Supervision"] {
    min-width: 3.6rem;
    max-width: 5rem;
  }
}

.students-table .student-calc {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  white-space: nowrap;
}

/* LRE concurrency factor + optional override under LRE dropdown */
.students-table .col-lre-block .lre-factor-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.students-table .lre-factor-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #6c6785;
  white-space: nowrap;
}

.students-table .lre-factor-value {
  font-variant-numeric: tabular-nums;
  color: var(--sped-primary-dark);
}

.students-table .student-input-override {
  width: 3.6rem;
  max-width: 4.2rem;
  min-height: 1.55rem !important;
  height: 1.55rem !important;
  padding: 0.1rem 0.25rem !important;
  font-size: 0.72rem !important;
}

.students-concurrency-note {
  line-height: 1.35;
}

.students-table .student-total {
  font-variant-numeric: tabular-nums;
  color: var(--sped-primary-dark);
  min-width: 2.75rem;
  white-space: nowrap;
}

/*
 * Mobile student cards — clean form layout (not a stretched table).
 * Same form fields as desktop; presentation only.
 */
@media (max-width: 767.98px) {
  .students-table-scroll {
    overflow: visible;
  }

  .students-table {
    min-width: 0 !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  .students-table thead {
    display: none;
  }

  .students-table tbody {
    display: block;
    padding: 0.45rem 0.5rem 0.2rem;
  }

  .students-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 0.65rem;
    row-gap: 0.7rem;
    align-items: start;
    border: 1px solid #e4e0f0;
    border-radius: 0.7rem;
    background: #fff;
    margin-bottom: 0.7rem;
    padding: 0.75rem 0.8rem 0.7rem;
    box-shadow: none !important;
  }

  .students-table tbody tr.student-row-filled {
    border-color: color-mix(in srgb, var(--sped-primary) 28%, #e4e0f0);
  }

  .students-table tbody tr.student-row-empty {
    opacity: 0.95;
  }

  /* Kill tablet sticky-column left offset + edge shadows on phone cards */
  .students-table thead th,
  .students-table tbody td,
  .students-table tfoot td {
    position: static !important;
    left: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
  }

  /* Default field cell: label above, control full width */
  .students-table tbody td {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.28rem;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
    box-sizing: border-box;
  }

  .students-table tbody td::before {
    content: attr(data-label);
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #6c6785;
    line-height: 1.25;
  }

  .students-table tbody td[data-label=""]::before,
  .students-table tbody td:not([data-label])::before {
    content: none !important;
    display: none !important;
  }

  /* Row number */
  .students-table tbody td.col-num {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    padding-bottom: 0.55rem !important;
    margin-bottom: 0.1rem !important;
    border-bottom: 1px solid #f0edf6 !important;
  }

  .students-table tbody td.col-num .student-row-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.4rem;
    background: var(--sped-primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
  }

  /* All inputs/selects fill their cell evenly — same box model for every field */
  .students-table tbody td .form-control:not(.student-input-override),
  .students-table tbody td .form-select,
  .students-table tbody td input.form-control:not(.student-input-override),
  .students-table tbody td select.form-select,
  .students-table tbody td input.student-input-initials,
  .students-table tbody td input.student-input-num,
  .students-table tbody td select.student-input-lre,
  .students-table tbody td select.student-input-count {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 2.35rem !important;
    height: 2.35rem !important;
    font-size: 0.92rem !important;
    border-radius: 0.4rem !important;
    border: 1px solid #d8d2e8 !important;
    background: #fff !important;
    margin: 0 !important;
    padding: 0.35rem 0.5rem !important;
    box-sizing: border-box !important;
    align-self: stretch !important;
    flex: 0 0 auto !important;
  }

  .students-table tbody td .student-input-override {
    width: 4rem !important;
    max-width: 4.5rem !important;
    min-height: 1.7rem !important;
    height: 1.7rem !important;
    font-size: 0.78rem !important;
    padding: 0.15rem 0.3rem !important;
    margin: 0 !important;
  }

  .students-table tbody td .lre-factor-row {
    width: 100%;
  }

  .students-table tbody td .form-control:focus,
  .students-table tbody td .form-select:focus {
    border-color: var(--sped-primary) !important;
    background: #fff !important;
  }

  /* Initials: no special offset — same as Disability/LRE; label heading has no extra pad */
  .students-table tbody td[data-label="Student Initials"] {
    padding: 0 !important;
    margin: 0 !important;
  }

  .students-table tbody td[data-label="Student Initials"]::before {
    padding: 0 !important;
    margin: 0 !important;
    letter-spacing: 0.02em;
  }

  .students-table tbody td[data-label="Student Initials"] .student-input-initials,
  .students-table tbody td[data-label="Student Initials"] input {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0.35rem 0.5rem !important;
    text-align: left !important;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  /* Read-only calc values */
  .students-table tbody td.student-calc .student-calc-value,
  .students-table tbody td.student-total .student-calc-value {
    display: flex;
    align-items: center;
    min-height: 2.35rem;
    height: 2.35rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0.4rem;
    background: #f5f3fa;
    border: 1px solid #e6e1f2;
    color: #4a4460;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.92rem;
    width: 100%;
    box-sizing: border-box;
  }

  /* —— Student needs section —— */
  .students-table tbody td.student-needs-heading {
    display: block !important;
    grid-column: 1 / -1;
    margin: 0.15rem 0 0 !important;
    padding: 0.55rem 0 0 !important;
    border: 0 !important;
    border-top: 1px solid #f0edf6 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sped-primary);
    line-height: 1.2;
  }

  .students-table tbody td.student-needs-heading::before,
  .students-table tbody td.student-needs-heading::after {
    content: none !important;
    display: none !important;
  }

  /* Simple 2-col checkbox list — no panel borders / no empty half */
  .students-table tbody td.col-flag {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    min-height: 2rem;
    padding: 0.15rem 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .students-table tbody td.col-flag::before {
    order: 2;
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #3d3850;
    line-height: 1.25;
  }

  .students-table tbody td.col-flag::after {
    content: none !important;
    display: none !important;
  }

  .students-table tbody td.col-flag .form-check-input {
    order: 1;
    flex: 0 0 auto;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    border-color: #b5adc9;
  }

  .students-table tbody td.col-flag .form-check-input:checked {
    background-color: var(--sped-primary);
    border-color: var(--sped-primary);
  }

  /* Behavior Plan alone — stay half width, no fake fill */
  .students-table tbody td.col-flag-last {
    grid-column: 1 / 2;
  }

  /* Supervision + totals full width */
  .students-table tbody td[data-label="Supervision"] {
    grid-column: 1 / -1;
    margin-top: 0.1rem !important;
    padding-top: 0.55rem !important;
    border-top: 1px solid #f0edf6 !important;
  }

  .students-table tbody td.student-total {
    grid-column: 1 / -1;
    padding-top: 0.55rem !important;
    border-top: 1px solid #f0edf6 !important;
  }

  .students-table tbody td.student-total::before {
    color: var(--sped-primary);
  }

  .students-table tbody td.student-total .student-calc-value {
    background: color-mix(in srgb, var(--sped-primary) 7%, #fff);
    border-color: color-mix(in srgb, var(--sped-primary) 20%, #e4e0f0);
    color: var(--sped-primary-dark);
    font-size: 1rem;
  }

  /* Footer totals card */
  .students-table tfoot {
    display: block;
    padding: 0 0.5rem 0.6rem;
  }

  .students-table tfoot tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.65rem;
    border: 1px solid color-mix(in srgb, var(--sped-primary) 16%, #e4e0f0);
    border-radius: 0.6rem;
    background: color-mix(in srgb, var(--sped-primary) 4%, #fff);
    padding: 0.65rem 0.75rem;
  }

  .students-table tfoot td {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding: 0.15rem 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .students-table tfoot td::before {
    content: attr(data-label);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c6785;
  }

  .students-table tfoot td.students-tfoot-note,
  .students-table tfoot td.students-tfoot-spacer {
    display: none !important;
  }

  .students-table tfoot td[data-label="Totals"] {
    grid-column: 1 / -1;
    font-weight: 800;
    color: var(--sped-primary);
    flex-direction: row;
  }

  .students-table tfoot td[data-label="Totals"]::before {
    content: none;
  }

  .students-table tfoot td[data-label="Grand total"] {
    grid-column: 1 / -1;
    padding-top: 0.35rem !important;
    border-top: 1px solid color-mix(in srgb, var(--sped-primary) 14%, #e4e0f0) !important;
    font-size: 1rem;
    color: var(--sped-primary-dark);
  }
}

.students-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid #f0edf6;
}

.students-add-row .btn {
  font-weight: 600;
}

.students-footnote-details {
  padding: 0.5rem 0.85rem 0.85rem;
  margin-top: 0.35rem;
}

.students-footnote-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--sped-purple-dark, #3d3558);
  list-style-position: outside;
}

.students-footnote-details.calc-notes-panel {
  background: #faf9fc;
  border: 1px solid #e8e4f0;
  border-radius: 0.5rem;
  margin: 0.75rem 0 0.25rem;
  /* Extra left padding so disclosure arrow is not flush with the border */
  padding: 0.7rem 1rem 1rem 1.35rem;
}

.students-footnote-details.calc-notes-panel summary {
  font-size: 1rem;
  font-weight: 650;
  padding: 0.25rem 0.5rem 0.25rem 0.35rem;
  margin-left: 0.35rem;
  list-style-position: outside;
}

.students-footnote-details.calc-notes-panel summary::-webkit-details-marker {
  margin-right: 0.5rem;
}

.students-footnote-details.calc-notes-panel summary::marker {
  content: "";
}

/* Consistent chevron with spacing (avoids native marker against the border) */
.students-footnote-details.calc-notes-panel summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.students-footnote-details.calc-notes-panel summary::before {
  content: "▸";
  flex: 0 0 auto;
  width: 0.85rem;
  color: var(--sped-purple-dark, #3d3558);
  font-size: 0.85em;
  line-height: 1;
  transition: transform 0.12s ease;
}

.students-footnote-details.calc-notes-panel[open] summary::before {
  content: "▾";
}

.calc-notes-body {
  margin-top: 0.85rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #2c2840;
}

.calc-notes-lead {
  font-size: 0.95rem;
  color: #4a4560;
}

.calc-iep-highlight {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.55rem;
  background: linear-gradient(135deg, #f3efff 0%, #eef8f3 100%);
  border: 1px solid #d9d0ef;
  box-shadow: 0 1px 2px rgba(60, 40, 100, 0.06);
}

.calc-iep-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.calc-iep-label {
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5b5278;
}

.calc-iep-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--sped-purple-dark, #3d3558);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.calc-iep-hint {
  font-size: 0.78rem;
  color: #6f6888;
}

.calc-notes-card {
  height: 100%;
  background: #fff;
  border: 1px solid #e4e0f0;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
}

.calc-notes-card-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0 0 0.5rem;
  color: var(--sped-purple-dark, #3d3558);
}

.calc-notes-list {
  padding-left: 1.1rem;
  margin-bottom: 0.5rem;
}

.calc-notes-list li {
  margin-bottom: 0.35rem;
}

.calc-notes-foot {
  font-size: 0.82rem;
  color: #6f6888;
  margin-top: 0.5rem;
}

.calc-notes-grid-4 {
  margin-bottom: 0.25rem;
}

.calc-notes-definitions {
  margin-top: 1.1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.5rem;
  background: #fff;
  border: 1px solid #e4e0f0;
}

.calc-notes-definitions-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0 0 0.65rem;
  color: var(--sped-purple-dark, #3d3558);
}

.calc-notes-def-line {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #3a3550;
}

.calc-notes-def-line strong {
  color: #2c2840;
}

@media (max-width: 1199.98px) {
  .calc-notes-grid-4 > [class*="col-"] {
    flex: 0 0 auto;
    width: 50%;
  }
}

@media (max-width: 767.98px) {
  .calc-notes-grid-4 > [class*="col-"] {
    width: 100%;
  }
}

.students-footnote {
  margin-top: 0.3rem;
  line-height: 1.4;
  font-size: 0.75rem;
}

@media (max-width: 767.98px) {
  .calc-iep-highlight {
    grid-template-columns: 1fr;
  }
}

/* Horizontal scroll wrappers — never clip off-screen */
.table-scroll,
.table-responsive {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  overscroll-behavior-x: contain;
}

.table-scroll {
  /* Subtle edge cue that more content is available */
  background:
    linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left center / 1.25rem 100% no-repeat,
    linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right center / 1.25rem 100% no-repeat,
    linear-gradient(to right, rgba(70, 57, 108, 0.12), transparent 1.1rem) left center / 1.1rem 100% no-repeat local,
    linear-gradient(to left, rgba(70, 57, 108, 0.12), transparent 1.1rem) right center / 1.1rem 100% no-repeat local;
}

.list-card {
  overflow: visible;
}

.list-actions-inner {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
}

.workloads-list-table {
  min-width: 720px;
}

.stat-tile {
  background: #fff;
  border: 1px solid #e4e0f0;
  border-radius: 0.65rem;
  padding: 1rem 1.15rem;
}

.stat-tile .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--sped-purple);
  line-height: 1.1;
}

.stat-tile .stat-label {
  font-size: 0.8rem;
  color: #6c6785;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.caseload-bar {
  height: 0.55rem;
  background: #ece8f5;
  border-radius: 999px;
  overflow: hidden;
}

.caseload-bar > span {
  display: block;
  height: 100%;
  background: var(--sped-lavender);
}

.caseload-bar.over > span {
  background: var(--sped-bad);
}

.activity-item {
  border-left: 3px solid var(--sped-lavender);
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
}

.table-hover tbody tr:hover {
  background: #f8f6fc;
}

.btn-sped {
  background: var(--sped-purple);
  border-color: var(--sped-purple);
  color: #fff;
}

.btn-sped:hover {
  background: var(--sped-purple-dark);
  border-color: var(--sped-purple-dark);
  color: #fff;
}

.btn-sped-outline {
  border-color: var(--sped-purple);
  color: var(--sped-purple);
}

.btn-sped-outline:hover {
  background: var(--sped-purple);
  color: #fff;
}

.pct-bar {
  display: flex;
  height: 1.25rem;
  border-radius: 0.35rem;
  overflow: hidden;
  font-size: 0.65rem;
  color: #fff;
  font-weight: 700;
}

.pct-bar > div {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

/* Setup → Disability Types: aligned editable grid */
.disabilities-table {
  --bs-table-bg: transparent;
}

/* Setup option panels (application toggles) */
.setup-option-panel {
  border: 1px solid #e4e0f0;
  border-radius: 0.65rem;
  background: #faf9fc;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.setup-option-panel.is-enabled {
  border-color: color-mix(in srgb, var(--sped-purple) 35%, #e4e0f0);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sped-purple) 12%, transparent);
  background: #fff;
}

.setup-option-panel-header {
  padding: 1rem 1.15rem 0.9rem;
}

.setup-option-panel-header .form-check-label {
  color: var(--sped-purple-dark);
  font-size: 0.95rem;
  padding-left: 0.35rem; /* gap after switch — Bootstrap default is too tight */
  cursor: pointer;
}

/* Switch track + thumb — never use Bootstrap default blue */
.setup-switch.form-switch {
  padding-left: 3rem; /* room for wider switch + label spacing */
  min-height: 1.5rem;
}

.setup-switch .form-check-input {
  width: 2.75rem;
  height: 1.4rem;
  margin-left: -3rem;
  margin-top: 0.1rem;
  cursor: pointer;
  background-color: #c5c2ce;
  border: 1px solid #a8a4b5;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  transition: background-color 0.15s ease, border-color 0.15s ease, background-position 0.15s ease;
}

.setup-switch .form-check-input:focus {
  border-color: #a8a4b5;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(108, 103, 133, 0.22);
  background-color: #c5c2ce;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.setup-switch .form-check-input:active {
  background-color: #b0acbb;
  border-color: #9590a3;
  filter: none;
}

.setup-switch .form-check-input:checked {
  background-color: var(--sped-purple);
  border-color: var(--sped-purple);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.setup-switch .form-check-input:checked:focus {
  border-color: var(--sped-purple);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--sped-purple) 28%, transparent);
  background-color: var(--sped-purple);
}

.setup-switch .form-check-input:checked:active {
  background-color: var(--sped-purple-dark);
  border-color: var(--sped-purple-dark);
  filter: none;
}

.setup-option-panel-desc {
  margin-top: 0.55rem;
  margin-left: 3rem; /* align with label after switch */
  font-size: 0.825rem;
  line-height: 1.45;
  color: #6c6785;
  max-width: 40rem;
}

.setup-option-panel-body {
  padding: 0 1.15rem 1.15rem;
  margin-left: 3rem;
  border-top: 0;
}

.setup-option-panel-body:not([hidden]) {
  padding-top: 0.15rem;
}

.setup-option-field {
  max-width: 22rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e8e4f2;
  border-radius: 0.5rem;
  background: #f8f6fc;
}

.setup-option-field .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a4560;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.setup-option-hours {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 16rem;
}

.setup-option-hours .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  max-width: 7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.setup-option-hours-unit {
  display: inline-flex;
  align-items: center;
  padding: 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sped-purple-dark);
  background: #efeaf8;
  border: 1px solid #dcd5ec;
  border-left: 0;
  border-radius: 0 0.375rem 0.375rem 0;
  white-space: nowrap;
}

.setup-option-field .form-text {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #6c6785;
}

@media (max-width: 576px) {
  .setup-option-panel-desc,
  .setup-option-panel-body {
    margin-left: 0;
  }
}
.disabilities-table thead th {
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  vertical-align: middle;
  color: var(--sped-purple-dark);
}
.disabilities-table tbody td {
  vertical-align: middle;
}
.disabilities-table .form-control,
.disabilities-table .form-select {
  min-width: 0;
}
.disabilities-table .form-check-input {
  margin-top: 0;
  vertical-align: middle;
}

/* ========== Mobile / tablet friendly layouts ========== */

/* Show swipe hint on phones/tablets for wide student grid */
@media (max-width: 991.98px) {
  .students-scroll-hint {
    display: block !important;
  }

  .banner-minutes {
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    margin: 0.75rem 0 0.5rem;
    padding: 0 0.25rem;
  }

  .minute-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .minute-row > span:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .minute-row .form-control,
  .minute-row .calc-input {
    max-width: 100%;
  }

  .minute-row .static-value {
    max-width: 100%;
    text-align: left;
  }

  /* Label + minutes on "other" rows: stack on narrow screens */
  .minute-row:has(input + input) {
    flex-direction: column;
    align-items: stretch;
  }

  .minute-row:has(input + input) .form-control {
    width: 100%;
    max-width: none;
  }

  .students-footnote {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /*
   * Sticky first two student columns while scrolling sideways.
   * Only for intermediate widths where the table still scrolls horizontally.
   * Phone card layout (≤767.98px) turns rows into cards — sticky left:2rem
   * must NOT apply there or Student Initials is offset.
   */
  @media (min-width: 768px) {
    .students-table thead th:nth-child(1),
    .students-table tbody td:nth-child(1),
    .students-table tfoot td:nth-child(1) {
      position: sticky;
      left: 0;
      z-index: 2;
      background: #fff;
      box-shadow: 1px 0 0 #e4e0f0;
    }

    .students-table thead th:nth-child(1) {
      background: var(--sped-purple) !important;
      z-index: 3;
    }

    .students-table thead th:nth-child(2),
    .students-table tbody td:nth-child(2),
    .students-table tfoot td:nth-child(2) {
      position: sticky;
      left: 2rem;
      z-index: 2;
      background: #fff;
      box-shadow: 2px 0 4px rgba(70, 57, 108, 0.08);
    }

    .students-table thead th:nth-child(2) {
      background: var(--sped-purple) !important;
      z-index: 3;
    }
  }
}

/* Phone: stack list rows into cards; keep student grid scrollable with denser controls */
@media (max-width: 767.98px) {
  .container-fluid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .page-title.h3 {
    font-size: 1.25rem;
  }

  .banner-minutes-section {
    font-size: 0.95rem;
    margin-top: 1.5rem;
    letter-spacing: 0.04em;
  }

  .mix-bar-row {
    grid-template-columns: 5.25rem minmax(0, 1fr) 2.75rem;
    gap: 0.45rem 0.5rem;
  }

  .mix-bar-label {
    font-size: 0.75rem;
    text-align: left;
  }

  .mix-bar-track {
    height: 1.15rem;
  }

  .mix-bar-pct {
    font-size: 0.8rem;
  }

  .status-metric-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-pill-nowrap,
  .status-delta {
    white-space: nowrap !important;
  }

  .approval-status-line {
    white-space: nowrap;
  }

  /* Workload list → card stack (no horizontal cut-off) */
  .mobile-card-table {
    min-width: 0 !important;
  }

  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table tbody {
    display: block;
  }

  .mobile-card-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #e4e0f0;
    border-radius: 0.55rem;
    margin: 0.65rem 0.75rem;
    padding: 0.65rem 0.75rem 0.5rem;
    box-shadow: 0 1px 2px rgba(70, 57, 108, 0.05);
  }

  .mobile-card-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.35rem 0 !important;
    border: 0 !important;
    text-align: right;
    width: 100%;
  }

  .mobile-card-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: #6c6785;
    text-align: left;
    flex: 0 0 38%;
    max-width: 9rem;
  }

  .mobile-card-table tbody td[data-label=""]::before,
  .mobile-card-table tbody td:not([data-label])::before {
    display: none;
  }

  .mobile-card-table tbody td.list-actions {
    display: block;
    text-align: left;
    border-top: 1px solid #f0edf6 !important;
    margin-top: 0.35rem;
    padding-top: 0.55rem !important;
  }

  .mobile-card-table tbody td.list-actions::before {
    display: none;
  }

  .mobile-card-table .list-actions-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: stretch;
    width: 100%;
  }

  .mobile-card-table .list-actions-inner .btn,
  .mobile-card-table .list-actions-inner form {
    flex: 1 1 auto;
  }

  .mobile-card-table .list-actions-inner .btn {
    min-height: 2.25rem;
  }

  .col-hide-sm {
    /* still shown in card stack with data-label; hide only in table-ish intermediate if needed */
  }

  .students-entry-header {
    padding: 0.5rem 0.65rem;
  }

  .students-table {
    min-width: 860px;
  }

  /* Action toolbars wrap cleanly */
  .no-print.d-flex,
  .d-flex.flex-wrap.gap-2 {
    row-gap: 0.4rem;
  }

  .signature-pad {
    height: 120px;
  }

  /* Filter form full-width controls */
  .sped-card .form-control,
  .sped-card .form-select {
    max-width: 100%;
  }
}

/* Extra-small phones */
@media (max-width: 400px) {
  .btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
  }

  .mobile-card-table tbody tr {
    margin-left: 0.4rem;
    margin-right: 0.4rem;
  }

  .badge {
    white-space: normal;
    text-align: left;
    line-height: 1.2;
  }
}

@media print {
  .sped-nav, .sped-footer, .no-print { display: none !important; }
  body { background: #fff; }
  .students-table { min-width: 0; }
}
