:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3ff;
  --text: #101828;
  --text-muted: #475467;
  --primary: #0f62fe;
  --primary-2: #0043ce;
  --danger: #b42318;
  --ok: #027a48;
  --warning: #b54708;
  --border: #d0d5dd;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #dbe7ff 0, transparent 35%),
    radial-gradient(circle at 90% 10%, #ffe8d8 0, transparent 30%),
    var(--bg);
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(560px, 100%);
  padding: 24px;
}

h1, h2, h3 {
  margin: 0;
}

p {
  color: var(--text-muted);
}

.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.grid > *,
.two-col > *,
.filters > * {
  min-width: 0;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

input,
select,
textarea,
button {
  font: inherit;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

textarea {
  min-height: 80px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-2);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: #fee4e2;
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #0b1e5b;
  color: #f8f9ff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar > .status-line {
  color: #c9d4ff;
}

.brand {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
}

.brand small {
  color: #c9d4ff;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  text-align: left;
  background: transparent;
  color: #dce4ff;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}

.topbar-right {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#pageContent {
  min-width: 0;
}

.top-user-block {
  position: relative;
  display: grid;
  justify-items: end;
}

.top-user-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 10px;
  border-radius: 10px;
}

.top-user-main:hover {
  background: #f8faff;
}

.top-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
}

.top-user-name {
  font-size: 14px;
}

.top-user-actions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  display: none;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
}

.top-user-block.open .top-user-actions {
  display: grid;
  gap: 6px;
}

.top-user-actions button {
  width: 100%;
  text-align: left;
}

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

.kpi {
  padding: 14px;
  min-width: 150px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.kpi strong {
  display: block;
  font-size: 24px;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid #eaecf0;
  text-align: left;
  padding: 10px;
  font-size: 14px;
}

tbody tr.clickable-row:hover {
  background: #f8faff;
}

tr.archived-row {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  background: #eef4ff;
  color: #1d4ed8;
}

.tag.ok {
  background: #dcfae6;
  color: var(--ok);
}

.tag.warn {
  background: #fff0d5;
  color: var(--warning);
}

.tag.danger {
  background: #fee4e2;
  color: var(--danger);
}

.series-badge {
  margin-left: 6px;
  white-space: nowrap;
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
}

.series-occurrence-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
}

.series-occurrence-note span {
  color: #334155;
}

.series-update-scope {
  width: 100%;
  min-width: 0;
}

.series-update-scope select {
  width: 100%;
  max-width: 100%;
}

.series-overview-list {
  display: grid;
  gap: 8px;
  max-height: min(60vh, 520px);
  overflow: auto;
}

.series-overview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dbe3f0;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.series-overview-item:hover,
.series-overview-item:focus-visible {
  border-color: var(--primary);
}

.series-overview-item span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.series-overview-item small {
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.series-overview-item > .tag {
  flex: 0 0 auto;
}

.rate-card-fieldset {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #dbe3f0;
  border-radius: 8px;
}

.rate-card-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.section-title {
  margin-bottom: 10px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}

.status-line {
  color: var(--text-muted);
  font-size: 13px;
}

.notification-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 90;
  width: min(380px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.app-notification {
  --notification-accent: var(--primary);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--notification-accent);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateX(18px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: auto;
}

.app-notification.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.app-notification-success { --notification-accent: var(--ok); }
.app-notification-warning { --notification-accent: var(--warning); }
.app-notification-error { --notification-accent: var(--danger); }

.app-notification-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--notification-accent);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.app-notification-message {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.app-notification-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.app-notification-close:hover,
.app-notification-close:focus-visible {
  background: var(--surface-2);
  color: var(--text);
}

.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.inline-check input {
  width: auto;
}

.recurrence-card {
  padding: 12px;
}

.recurrence-toggle {
  width: fit-content;
  margin: 0;
  line-height: 1.25;
}

.recurrence-toggle input,
[data-weekday-controls] .inline-check input {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
}

.field-help {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.icon-btn {
  border: 1px solid #fbcaca;
  color: #c81e1e;
  background: #fff5f5;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.icon-btn:hover {
  background: #fee2e2;
}

.icon-btn.restore {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
}

.icon-btn.restore:hover {
  background: #dbeafe;
}

.icon-glyph {
  font-size: 14px;
  display: inline-block;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-dow {
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 12px;
}

.calendar-cell {
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
}

.calendar-cell.muted {
  background: #f8fafc;
  opacity: 0.7;
}

.calendar-day-surface {
  cursor: pointer;
}

.calendar-day-surface:hover {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent);
}

.calendar-day-surface:has(.event-pill:hover) {
  border-color: var(--border);
  box-shadow: none;
}

.calendar-cell-date {
  font-size: 12px;
  font-weight: 700;
}

.calendar-day-link {
  min-width: 32px;
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.calendar-day-link:hover {
  background: #eef2f7;
}

.calendar-day-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.calendar-cell-events {
  display: grid;
  min-width: 0;
  gap: 4px;
  align-content: start;
  overflow: hidden;
}

.event-pill {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  border: 0;
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  overflow: hidden;
}

.event-pill.tag,
.event-pill.tag.ok,
.event-pill.tag.warn,
.event-pill.tag.danger {
  background: var(--event-bg, #bde0fe);
  color: var(--event-fg, #000);
  border: 1px solid currentColor;
}

.event-pill > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-content {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
  overflow: hidden;
}

.event-title {
  font-weight: 700;
}

.event-time {
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0.85;
}

.event-recurring {
  display: inline-block;
  margin-left: 2px;
  font-size: 10px;
}

.event-status-label {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.85;
}

.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 7px;
  vertical-align: text-bottom;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: var(--swatch-color, #bde0fe);
}

.color-control {
  display: grid;
  grid-template-columns: minmax(80px, 120px) auto;
  align-items: center;
  gap: 12px;
}

.color-control input[type="color"] {
  min-height: 44px;
  padding: 4px;
}

.color-control output,
td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.classroom-calendar-card {
  margin-bottom: 10px;
  background: #fdfdff;
  border-left: 6px solid var(--classroom-color, #bde0fe);
}

.event-pill[draggable="true"] {
  cursor: grab;
}

.event-pill.dragging {
  opacity: 0.55;
}

.event-avatar {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.drop-active {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: #eff6ff;
}

.calendar-week-header {
  font-weight: 700;
  font-size: 12px;
  min-width: 0;
  padding: 6px 4px;
  border-left: 1px solid var(--border);
  background: #fff;
}

.calendar-week-day-link {
  width: 100%;
  justify-content: flex-start;
  border-radius: 8px;
  text-align: left;
}

.calendar-timeline-scroll {
  max-height: min(720px, 72vh);
  overflow: auto;
  border: 1px solid var(--border);
  background: #fff;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
}

.calendar-timeline {
  --timeline-hour-height: 60px;
  min-width: 900px;
}

.calendar-timeline-single-day {
  min-width: 540px;
}

.calendar-timeline-headers,
.calendar-timeline-body {
  display: grid;
  grid-template-columns: 64px repeat(7, minmax(116px, 1fr));
}

.calendar-timeline-single-day .calendar-timeline-body {
  grid-template-columns: 64px minmax(0, 1fr);
}

.calendar-timeline-headers {
  position: sticky;
  top: 0;
  z-index: 8;
  border-bottom: 1px solid var(--border);
}

.calendar-timeline-corner {
  position: sticky;
  left: 0;
  z-index: 9;
  background: #fff;
}

.calendar-timeline-axis,
.calendar-timeline-day {
  position: relative;
  height: calc(24 * var(--timeline-hour-height));
}

.calendar-timeline-axis {
  position: sticky;
  left: 0;
  z-index: 6;
  background: #fff;
  border-right: 1px solid var(--border);
}

.calendar-timeline-axis span {
  position: absolute;
  top: calc(var(--timeline-hour) * var(--timeline-hour-height));
  right: 8px;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.calendar-timeline-axis span:first-child {
  transform: none;
}

.calendar-timeline-day {
  min-width: 0;
  border-right: 1px solid var(--border);
  background: repeating-linear-gradient(to bottom, #fff 0, #fff calc(var(--timeline-hour-height) - 1px), #e7ebf2 calc(var(--timeline-hour-height) - 1px), #e7ebf2 var(--timeline-hour-height));
}

.calendar-timeline-day.calendar-day-surface:hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent);
}

.calendar-timeline-drop-zone {
  position: absolute;
  top: calc(var(--timeline-hour) * var(--timeline-hour-height));
  left: 0;
  right: 0;
  height: var(--timeline-hour-height);
  z-index: 1;
}

.calendar-timeline-events {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.calendar-timeline-event {
  position: absolute;
  top: calc(var(--event-top) * 1px + 1px);
  left: calc((100% / var(--event-columns)) * var(--event-column) + 2px);
  width: calc(100% / var(--event-columns) - 4px);
  height: max(4px, calc(var(--event-duration) * 1px - 2px));
  padding: 3px 5px;
  overflow: hidden;
  align-items: flex-start;
  pointer-events: auto;
  z-index: 4;
}

.calendar-timeline-event .event-avatar {
  flex: 0 0 auto;
}

.calendar-current-time {
  position: absolute;
  top: calc(var(--current-minute) * 1px);
  left: 0;
  right: 0;
  height: 2px;
  background: #e53935;
  pointer-events: none;
  z-index: 5;
}

.calendar-current-time span {
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53935;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100vw;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 32px 16px;
  z-index: 50;
}

.modal-card {
  width: min(620px, 100%);
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  margin: auto 0;
  overflow-x: hidden;
}

.modal-card > *,
.modal-card form,
.modal-card form > * {
  min-width: 0;
  max-width: 100%;
}

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

.modal-header h3 {
  margin: 0;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  padding: 0 2px;
}

.modal-close:hover,
.modal-close:focus {
  color: var(--primary);
}

.student-picker {
  position: relative;
}

.student-picker-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 70;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
}

.student-picker-result {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  text-align: left;
}

.student-picker-result:last-child {
  border-bottom: 0;
}

.student-picker-result:hover,
.student-picker-result:focus {
  background: #f8fafc;
}

.student-picker-result small,
.student-picker-empty {
  color: var(--muted);
}

.student-picker-empty {
  padding: 10px 12px;
}

.student-picker-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.student-chip {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.student-chip-remove {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover,
.clickable-row:focus {
  background: #f8fafc;
  outline: 2px solid rgba(37, 99, 235, 0.18);
  outline-offset: -2px;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.password-toggle {
  white-space: nowrap;
}

.strength-wrap {
  margin-top: 6px;
}

.strength-bar {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.strength-bar span {
  display: block;
  height: 100%;
  width: 10%;
  transition: width 0.15s ease, background-color 0.15s ease;
}

.strength-1 {
  background: #dc2626;
}

.strength-2 {
  background: #d97706;
}

.strength-3 {
  background: #2563eb;
}

.strength-4 {
  background: #16a34a;
}

.profile-grid {
  gap: 14px;
}

/* Cadence design language — adapted from the supplied desktop and mobile mockups. */
:root {
  --bg: #f2f2f3;
  --surface: #ffffff;
  --surface-2: #e9e9ea;
  --text: #1d1f20;
  --text-muted: #62676b;
  --primary: #5980a6;
  --primary-2: #416180;
  --danger: #9f3028;
  --ok: #2e6d55;
  --warning: #90651f;
  --border: rgba(29, 31, 32, 0.17);
  --shadow: 0 3px 10px rgba(43, 43, 45, 0.13);
  --nav-bg: #1d2d3d;
  --nav-text: #d6ebff;
  --nav-active-bg: #eef6ff;
  --nav-active-text: #2c455d;
  --radius: 4px;
}

body {
  font-family: "Barlow", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
}

h1,
h2,
h3,
h4,
h5,
h6,
button,
.kpi strong,
.card-title {
  font-family: "Barlow Condensed", "Arial Narrow", "Avenir Next Condensed", "Segoe UI", sans-serif;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(30px, 4vw, 42px);
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

p {
  margin: 0 0 10px;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid #94bce3;
  outline-offset: 2px;
}

input,
select,
textarea {
  min-height: 38px;
  border-color: var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  background: var(--surface-2);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(29, 31, 32, 0.4);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-weight: 600;
}

.btn-primary {
  border-color: var(--primary-2);
  background: var(--primary-2);
  color: #fff;
}

.btn-primary:hover {
  background: #2c455d;
}

.btn-secondary {
  border-color: var(--border);
  background: transparent;
}

.btn-secondary:hover,
.btn-secondary.active {
  background: var(--surface-2);
}

.btn-danger {
  border-color: rgba(159, 48, 40, 0.28);
  background: #faecea;
}

.card {
  border-radius: var(--radius);
  box-shadow: none;
}

.panel {
  padding: 17px;
}

.app-shell {
  grid-template-columns: 216px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 216px;
  overflow-y: auto;
  padding: 20px 10px 16px;
  gap: 9px;
  background: var(--nav-bg);
  color: var(--nav-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 7px 12px;
  border-bottom: 1px solid rgba(214, 235, 255, 0.15);
  border-radius: 0;
  background: transparent;
}

.brand h3 {
  margin: 0;
  color: #fff;
  font-size: 19px;
}

.brand small {
  display: block;
  color: #b5d9fd;
  font-size: 10px;
  line-height: 1.2;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #94bce3;
  background: #597ea3;
  color: #fff;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.tenant-name {
  padding: 2px 9px 8px;
  color: #94bce3;
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 4px;
  padding: 0;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 38px;
  padding: 7px 10px;
  border-color: transparent;
  border-radius: 0;
  color: var(--nav-text);
  font-family: "Barlow", "Avenir Next", sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.nav button.active,
.nav button:hover {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.main {
  grid-column: 2;
  min-height: 100vh;
  padding: 72px 20px 24px;
  gap: 16px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 216px;
  z-index: 20;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 20px;
  border: 0;
  border-bottom: 1px solid rgba(214, 235, 255, 0.14);
  background: var(--nav-bg);
  color: #fff;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h2 {
  color: #fff;
  font-size: 21px;
}

.topbar .status-line,
.topbar label > .status-line {
  color: #b5d9fd;
}

.topbar select {
  min-height: 34px;
  border-color: rgba(214, 235, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.topbar select option {
  color: var(--text);
}

.top-user-main {
  min-height: 38px;
  border-color: rgba(214, 235, 255, 0.2);
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
}

.top-user-main:hover {
  background: rgba(255, 255, 255, 0.08);
}

.top-user-avatar {
  border-color: rgba(214, 235, 255, 0.3);
}

.top-user-actions {
  border-radius: var(--radius);
}

.mobile-menu-btn,
.nav-scrim {
  display: none;
}

#pageContent {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}

.row {
  gap: 10px;
}

.kpi {
  position: relative;
  flex: 1 1 160px;
  min-height: 92px;
  padding: 15px;
  border-radius: 0;
  background: var(--surface);
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}

.kpi small,
th {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.kpi strong {
  margin-top: 6px;
  font-size: 30px;
}

.section-title {
  margin-bottom: 14px;
}

table {
  border: 1px solid var(--border);
  border-radius: 0;
}

th,
td {
  padding: 9px 10px;
  border-bottom-color: rgba(29, 31, 32, 0.09);
}

tbody tr.clickable-row:hover,
.clickable-row:hover,
.clickable-row:focus {
  background: #f7f9fb;
}

.tag {
  border-radius: 3px;
  padding: 3px 9px;
  background: #eef6ff;
  color: #2c455d;
}

.tag.ok {
  background: #e8f3ed;
}

.tag.warn {
  background: #f8f0df;
}

.tag.danger {
  background: #faecea;
}

.filters {
  gap: 12px;
  padding-bottom: 3px;
}

.calendar-cell,
.classroom-calendar-card,
.student-picker-results,
.series-overview-item,
.rate-card-fieldset {
  border-radius: var(--radius);
}

.calendar-cell {
  border-color: rgba(29, 31, 32, 0.15);
}

.calendar-cell.muted {
  background: #f2f2f3;
}

.calendar-dow,
.calendar-week-header {
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.event-pill.tag,
.event-pill.tag.ok,
.event-pill.tag.warn,
.event-pill.tag.danger {
  border-width: 0 0 0 3px;
  border-radius: 0;
}

.modal-overlay {
  background: rgba(29, 45, 61, 0.62);
}

.modal-card {
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(29, 45, 61, 0.24);
}

.login-screen {
  background:
    linear-gradient(90deg, rgba(29, 45, 61, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(29, 45, 61, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-size: 19px;
}

.login-kicker {
  margin-bottom: 4px;
  color: var(--primary-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-card h1 {
  margin-bottom: 4px;
}

.login-card > p {
  margin-bottom: 22px;
}

.login-card form {
  gap: 14px;
}

.login-card #loginBtn {
  width: 100%;
  margin-top: 4px;
}

.demo-credentials {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.demo-credentials summary {
  cursor: pointer;
}

.demo-credentials p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 180ms ease,
      visibility 180ms;
  }

  .app-shell.nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(29, 45, 61, 0.54);
  }

  .app-shell.nav-open .nav-scrim {
    display: block;
  }

  .main {
    grid-column: 1;
    padding: 72px 14px 20px;
  }

  .topbar {
    inset-inline-start: 0;
    padding-inline: 14px;
  }

  .mobile-menu-btn {
    display: grid;
    width: 36px;
    height: 36px;
    place-content: center;
    gap: 4px;
    padding: 0;
    border-color: transparent;
    background: transparent;
  }

  .mobile-menu-btn span {
    display: block;
    width: 19px;
    height: 1px;
    background: #d6ebff;
  }

  .topbar-right > .status-line {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .notification-container {
    top: 64px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .main {
    padding: 68px 10px 16px;
  }

  .topbar {
    min-height: 54px;
    padding: 8px 10px;
  }

  .topbar h2 {
    font-size: 18px;
  }

  .topbar-right {
    gap: 7px;
  }

  .topbar-right label {
    gap: 0 !important;
  }

  .topbar-right label > .status-line {
    display: none;
  }

  .topbar-right label select {
    min-width: 68px !important;
    width: 68px !important;
    padding-inline: 6px;
  }

  .top-user-name {
    display: none;
  }

  .top-user-main {
    width: 36px;
    padding: 3px;
    border: 0;
  }

  .top-user-avatar {
    width: 30px;
    height: 30px;
  }

  .panel {
    padding: 13px;
  }

  .page-toolbar,
  .page-toolbar > .row,
  .card.panel > .row[style*="justify-content:space-between"] {
    align-items: stretch !important;
    flex-direction: column;
  }

  .page-toolbar button,
  .card.panel > .row[style*="justify-content:space-between"] button {
    flex: 1 1 auto;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .row > .kpi {
    flex-basis: calc(50% - 5px);
    min-width: 0;
  }

  .kpi {
    min-height: 82px;
  }

  .kpi strong {
    font-size: 26px;
  }

  .table-wrap,
  .calendar-timeline-scroll {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .calendar-timeline-week {
    max-width: 100%;
    min-width: 880px;
  }

  .calendar-month-grid {
    min-width: 0;
    grid-template-columns: repeat(7, minmax(42px, 1fr));
    gap: 4px;
  }

  .calendar-cell {
    min-height: 104px;
    min-width: 0;
    padding: 4px;
    gap: 3px;
    overflow: hidden;
  }

  .calendar-cell-date {
    min-width: 0;
  }

  .calendar-cell .calendar-day-link {
    min-width: 28px;
    min-height: 28px;
    padding: 3px;
  }

  .calendar-cell .calendar-cell-events {
    gap: 3px;
  }

  .calendar-cell .event-pill {
    min-height: 18px;
    padding: 2px 3px;
    gap: 0;
  }

  .calendar-cell .event-avatar,
  .calendar-cell .event-time,
  .calendar-cell .event-status-label {
    display: none;
  }

  .calendar-cell .event-title {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .modal-overlay {
    padding: 0;
    overscroll-behavior: contain;
  }

  .modal-card {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
  }

  .login-screen {
    align-items: center;
    padding: 18px;
  }

  .login-card {
    padding: 26px 20px;
  }
}

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

/* Material Dashboard 2 direction — adapted for EduPlanner's vanilla SPA. */
:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --text: #344767;
  --text-muted: #596579;
  --muted: #596579;
  --primary: #d81b60;
  --primary-2: #ad1457;
  --danger: #c62828;
  --ok: #2e7d32;
  --warning: #9a6200;
  --border: #e7e9ec;
  --nav-bg: linear-gradient(195deg, #42424a 0%, #191919 100%);
  --nav-text: rgba(255, 255, 255, 0.76);
  --nav-active-bg: linear-gradient(195deg, #ec407a 0%, #c2185b 100%);
  --nav-active-text: #ffffff;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-raised: 0 8px 26px rgba(52, 71, 103, 0.14);
}

html { background: var(--bg); }

body {
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, strong {
  color: var(--text);
  letter-spacing: -0.025em;
}

h1, h2, h3, h4, h5, h6, button, .kpi strong, .card-title {
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
}

p { color: var(--text-muted); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(216, 27, 96, 0.35);
  outline-offset: 2px;
}

.card {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel { padding: 20px; }

input, select, textarea {
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid #d2d6da;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"] {
  display: block;
  width: 100%;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value,
input[type="month"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

input:hover, select:hover, textarea:hover { border-color: #aeb4be; }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(216, 27, 96, 0.1);
}

label {
  color: #4f5b73;
  font-size: 12px;
  font-weight: 600;
}

button {
  min-height: 38px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.015em;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

button:not(:disabled):active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(195deg, #ec407a 0%, #c2185b 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(194, 24, 91, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(195deg, #d81b60 0%, #ad1457 100%);
  box-shadow: 0 5px 12px rgba(194, 24, 91, 0.3);
}

.btn-secondary {
  border: 1px solid #d2d6da;
  background: #fff;
  color: #5f6678;
}

.btn-secondary:hover, .btn-secondary.active {
  border-color: #7b809a;
  background: #f8f9fa;
  color: var(--text);
}

.btn-danger { background: #ffebee; color: #b71c1c; }

.app-shell {
  grid-template-columns: 268px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 16px;
  inset-inline: auto;
  inset-block-end: auto;
  width: 252px;
  height: max-content;
  min-height: calc(100vh - 32px);
  align-self: start;
  margin: 16px 0 16px 16px;
  overflow: visible;
  padding: 18px 14px;
  border-radius: 12px;
  background: var(--nav-bg);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.18);
}

.brand {
  min-height: 58px;
  gap: 11px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
}

.brand h3 { color: #fff; font-size: 15px; font-weight: 600; }
.brand small { color: rgba(255, 255, 255, 0.72); font-size: 10px; }

.brand-mark {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(195deg, #ec407a 0%, #c2185b 100%);
  box-shadow: 0 4px 9px rgba(194, 24, 91, 0.32);
  font-family: Roboto, sans-serif;
  font-weight: 700;
}

.tenant-name {
  padding: 14px 12px 7px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 700;
}

.nav {
  gap: 3px;
  padding-bottom: 12px;
  overflow: visible;
}

.nav button {
  min-height: 44px;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--nav-text);
  font-family: Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.nav button.active {
  background: var(--nav-active-bg);
  box-shadow: 0 4px 10px rgba(194, 24, 91, 0.28);
  color: #fff;
}

.nav button:hover:not(.active) { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-icon { width: 18px; height: 18px; }

.sidebar-collapse-btn {
  display: flex;
  width: 38px;
  min-height: 38px;
  align-items: center;
  align-self: flex-end;
  justify-content: center;
  margin: 10px 2px 0 auto;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.sidebar-collapse-btn:hover,
.sidebar-collapse-btn:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-collapse-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 180ms ease;
}

.app-shell,
.sidebar,
.topbar {
  transition: grid-template-columns 180ms ease, width 180ms ease, inset-inline-start 180ms ease;
}

.app-shell.sidebar-collapsed { grid-template-columns: 96px minmax(0, 1fr); }
.app-shell.sidebar-collapsed .sidebar { width: 80px; padding-inline: 10px; }
.app-shell.sidebar-collapsed .brand { justify-content: center; padding-inline: 0; }

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .tenant-name,
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-collapse-btn,
.app-shell.sidebar-collapsed .nav button {
  justify-content: center;
  padding-inline: 0;
}

.app-shell.sidebar-collapsed .sidebar-collapse-btn { align-self: center; margin-inline: auto; }
.app-shell.sidebar-collapsed .sidebar-collapse-icon { transform: rotate(180deg); }
.app-shell.sidebar-collapsed .topbar { inset-inline-start: 96px; }

.main {
  grid-column: 2;
  padding: 82px 24px 28px;
  gap: 20px;
}

.topbar {
  inset: 0 0 auto 268px;
  min-height: 70px;
  padding: 12px 24px;
  border: 0;
  background: rgba(240, 242, 245, 0.88);
  color: var(--text);
  backdrop-filter: blur(12px);
}

.topbar-title { gap: 10px; }

.breadcrumb {
  display: flex;
  gap: 7px;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.breadcrumb span:last-child { color: var(--text); }
.topbar h2 { color: var(--text); font-size: 16px; font-weight: 700; }
.topbar .status-line, .topbar label > .status-line { color: var(--text-muted); }

.topbar select {
  min-height: 36px;
  border-color: #d2d6da;
  background: transparent;
  color: var(--text);
}

.top-user-main {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.top-user-main:hover { background: rgba(52, 71, 103, 0.06); }
.top-user-avatar { border-color: #d2d6da; }
.top-user-actions { border: 0; border-radius: 10px; box-shadow: var(--shadow-raised); }
#pageContent { max-width: 1600px; }

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding-top: 18px;
}

.kpi {
  min-width: 0;
  min-height: 104px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 16px;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.kpi::before { display: none; }

.kpi > div {
  order: -1;
  flex: 1;
  min-width: 0;
  text-align: right;
}

.kpi small {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.kpi strong { margin-top: 4px; font-size: 24px; font-weight: 700; }

.kpi-icon, .card-heading-icon {
  width: 56px;
  height: 56px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  margin-top: -34px;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 5px 12px rgba(52, 71, 103, 0.22);
}

.kpi-icon .nav-icon, .card-heading-icon .nav-icon { width: 23px; height: 23px; }
.kpi-dark .kpi-icon { background: linear-gradient(195deg, #42424a 0%, #191919 100%); }
.kpi-pink .kpi-icon { background: linear-gradient(195deg, #ec407a 0%, #c2185b 100%); }
.kpi-green .kpi-icon { background: linear-gradient(195deg, #66bb6a 0%, #2e7d32 100%); }
.kpi-blue .kpi-icon { background: linear-gradient(195deg, #49a3f1 0%, #1769aa 100%); }
.dashboard-recent { margin-top: 28px !important; }

.dashboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 10px;
}

.dashboard-heading h3 {
  margin: 2px 0 6px;
  color: var(--text);
  font-size: clamp(22px, 2.3vw, 30px);
}

.dashboard-heading p { margin: 0; }
.dashboard-eyebrow { color: var(--primary-2); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.platform-cost-kpi strong { font-size: clamp(17px, 1.8vw, 24px); }
.platform-cost-kpi > div > span { display: block; margin-top: 5px; color: var(--text-muted); font-size: 10px; line-height: 1.35; }

.platform-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  margin-top: 28px;
}

.platform-status-list { display: grid; gap: 12px; }

.platform-status-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
}

.platform-status-card h4 { margin: 0 0 5px; color: var(--text); font-size: 14px; }
.platform-status-card p { margin: 0; font-size: 12px; line-height: 1.5; }
.platform-status-card .tag { flex: 0 0 auto; }
.platform-tenants .table-wrap { max-height: 340px; overflow: auto; }

.super-admin-table-wrap {
  margin-top: 10px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.super-admin-table { min-width: 520px; }
.super-admin-audit-table { min-width: 820px; }

.tenant-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.metric-list { display: grid; gap: 2px; }

.metric-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.metric-list > div:last-child { border-bottom: 0; }
.metric-list strong { color: var(--text); font-size: 14px; }
.finance-metric-list .metric-total { margin-top: 4px; padding-top: 14px; border-top: 2px solid var(--border); }

.directory-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.directory-summary > div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 10px;
  background: #f8f9fa;
  text-align: center;
}

.directory-summary strong { color: var(--text); font-size: 18px; }
.directory-summary span { color: var(--text-muted); font-size: 10px; line-height: 1.35; }
.resource-utilization { margin-top: 20px !important; }

.resource-utilization-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.resource-utilization-grid h4 { margin: 0 0 10px; color: var(--text); font-size: 14px; }

.utilization-value { color: var(--green); white-space: nowrap; }

.teacher-dashboard-lists {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  gap: 20px;
  margin-top: 20px;
}

.teacher-lesson-list,
.teacher-student-list,
.student-lesson-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.teacher-lesson-row,
.student-lesson-row {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 18px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
}

.teacher-lesson-row:last-child,
.student-lesson-row:last-child,
.teacher-student-list li:last-child { border-bottom: 0; }

.teacher-lesson-row > div:first-child,
.student-lesson-row > div:first-child { display: grid; gap: 4px; }
.teacher-lesson-row strong, .student-lesson-row strong { color: var(--text); font-size: 13px; }
.teacher-lesson-row span, .student-lesson-row span { color: var(--text-muted); font-size: 11px; }

.teacher-lesson-meta,
.student-lesson-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 12px;
}

.teacher-lesson-meta .tag, .student-lesson-meta .tag { justify-self: end; color: inherit; }

.teacher-student-list li {
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}

.teacher-dashboard-empty {
  padding: 18px 4px !important;
  border: 0 !important;
  color: var(--text-muted) !important;
  font-size: 12px !important;
}

.student-dashboard-empty {
  padding: 18px 4px !important;
  border: 0 !important;
  color: var(--text-muted) !important;
  font-size: 12px !important;
}

.teacher-utilization-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.teacher-utilization-value strong { color: var(--green); font-size: 28px; }
.teacher-utilization-value span { color: var(--text-muted); font-size: 12px; }

.utilization-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f2;
}

.utilization-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(195deg, #66bb6a 0%, #2e7d32 100%);
}

.teacher-finance-summary { margin-top: 18px; }
.student-dashboard-lessons { margin-top: 20px !important; }

.student-finance-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border-radius: 10px;
  background: #f8f9fa;
}

.student-finance-total span { color: var(--text-muted); font-size: 12px; }
.student-finance-total strong { color: var(--primary-2); font-size: clamp(22px, 3vw, 32px); }
.student-finance-note { margin: 14px 2px 0; line-height: 1.5; }

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.card-heading p { margin: 5px 0 0; font-size: 12px; }

.card-heading-icon {
  width: 48px;
  height: 48px;
  margin-top: -35px;
  background: linear-gradient(195deg, #49a3f1 0%, #1769aa 100%);
}

.section-title { color: var(--text); font-size: 16px; font-weight: 700; }

table { border: 0; border-radius: 0; background: transparent; }

th {
  padding: 10px 12px;
  border-bottom: 1px solid #e7e9ec;
  color: #596579;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.045em;
}

td {
  padding: 13px 12px;
  border-bottom: 1px solid #edf0f2;
  color: #596579;
  font-size: 12px;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable-row:hover, .clickable-row:hover, .clickable-row:focus { background: #f8f9fa; }

.tag {
  border-radius: 6px;
  padding: 4px 8px;
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 600;
}

.tag.ok { background: #e8f5e9; color: #2e7d32; }
.tag.warn { background: #fff8e1; color: #9a6200; }
.tag.danger { background: #ffebee; color: #b71c1c; }
.filters { gap: 14px; }

.page-toolbar {
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.directory-toolbar {
  margin-bottom: 10px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.directory-toolbar .section-title {
  margin-bottom: 0;
}

.directory-controls {
  display: grid;
  grid-template-columns: minmax(220px, 420px) max-content max-content;
  align-items: center;
  justify-content: start;
  gap: 10px;
  margin-bottom: 10px;
}

.directory-archive-toggle {
  min-height: 36px;
  margin-bottom: 0;
  white-space: nowrap;
}

.directory-search-btn {
  min-width: 96px;
}

.directory-table th,
.directory-table td {
  padding: 5px 10px;
}

.directory-action.icon-btn,
.directory-action.icon-btn.restore {
  border: 0;
  background: transparent;
  color: var(--text-muted);
}

.directory-action.icon-btn:hover,
.directory-action.icon-btn:focus-visible {
  background: var(--surface-2);
  color: var(--danger);
}

.directory-action.icon-btn.restore:hover,
.directory-action.icon-btn.restore:focus-visible {
  background: var(--surface-2);
  color: var(--primary-2);
}

.directory-action .icon-glyph {
  display: inline-flex;
}

.unavailability-form .form-grid.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.unavailability-history {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line, #e2e8f0);
}

.unavailability-history h4,
.unavailability-form h4 {
  margin: 0 0 10px;
}

.unavailability-table {
  min-width: 680px;
}

@media (max-width: 640px) {
  .unavailability-form .form-grid.two-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

.directory-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.student-relationships {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.student-relationships h4,
.student-relationships h5 {
  margin: 0;
}

.student-relationship-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.student-relationship-grid > div {
  min-width: 0;
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.student-relationship-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.student-relationship-empty {
  display: block;
  color: var(--text-muted);
  margin-top: 8px;
}

input[readonly] {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
}

.student-picker-results, .top-user-actions { border-color: transparent; box-shadow: var(--shadow-raised); }

.calendar-cell, .classroom-calendar-card,
.series-overview-item, .rate-card-fieldset {
  border-color: var(--border);
  border-radius: 8px;
}

.calendar-cell.muted { background: #f8f9fa; opacity: 1; }
.calendar-cell.muted .calendar-cell-date { color: #657086; }
.calendar-dow, .calendar-week-header { color: var(--text-muted); }

.event-pill.tag, .event-pill.tag.ok, .event-pill.tag.warn, .event-pill.tag.danger {
  border-radius: 6px;
}

.modal-overlay {
  background: rgba(25, 25, 25, 0.58);
  backdrop-filter: blur(3px);
}

.modal-card { border-radius: 14px; box-shadow: 0 18px 52px rgba(0, 0, 0, 0.24); }

.lifecycle-bulk-controls {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px;
  margin-bottom: 16px;
  background: #fff;
}

.lifecycle-bulk-heading,
.lifecycle-bulk-fields {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.lifecycle-bulk-heading { justify-content: space-between; align-items: center; }
.lifecycle-bulk-heading h4 { margin: 0; }
.lifecycle-bulk-fields > label { flex: 1 1 220px; }
.lifecycle-bulk-select-all,
.lifecycle-bulk-item { display: inline-flex; align-items: center; gap: 8px; }
.lifecycle-bulk-select-all input,
.lifecycle-bulk-item input { min-height: auto; width: 16px; height: 16px; }
.lifecycle-resolution-summary { margin: 8px 0 0; font-weight: 600; color: var(--text); }

@media (max-width: 640px) {
  .lifecycle-bulk-controls { position: static; }
  .lifecycle-bulk-fields { align-items: stretch; }
  .lifecycle-bulk-fields > label,
  .lifecycle-bulk-fields > button { flex: 1 1 100%; width: 100%; }
}
.modal-close,
.modal-close:hover,
.modal-close:focus,
.modal-close:active {
  background: transparent;
  box-shadow: none;
}

.modal-close {
  display: inline-grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  color: #4a4a4a;
  font-size: 30px;
  font-weight: 300;
}

.modal-close:hover,
.modal-close:focus-visible {
  color: #242424;
}

.modal-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.modal-header-close-only { justify-content: flex-end; }

.schedule-grid-panel { min-width: 0; }

.schedule-filter-panel { margin-bottom: 12px; }

.schedule-filter-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) repeat(2, minmax(0, 1.35fr)) repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.schedule-filter-fields > * { min-width: 0; }

.schedule-filter-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.schedule-grid-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.schedule-grid-toolbar p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.schedule-grid-toolbar .btn-primary { flex: 0 0 auto; }

.schedule-view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.schedule-view-switcher .btn-secondary.active,
.schedule-view-switcher .btn-secondary[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.schedule-grid-wrap { width: 100%; }
.schedule-grid { min-width: 940px; }
.schedule-grid th:first-child,
.schedule-grid td:first-child { font-weight: 700; }

.schedule-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
}

.schedule-sort-button:hover,
.schedule-sort-button:focus-visible {
  color: var(--primary);
  background: transparent;
}

.schedule-sort-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.schedule-grid tbody tr.cancelled-lesson-row {
  opacity: 0.58;
  background: #f8f9fa;
}

.schedule-grid tbody tr.cancelled-lesson-row:hover,
.schedule-grid tbody tr.cancelled-lesson-row:focus {
  opacity: 0.78;
}

.lesson-editor-modal { width: min(820px, 100%); }
.lesson-editor-form { margin-top: 14px; }
.lesson-editor-actions { grid-column: 1 / -1; }

.app-dialog-card { width: min(520px, 100%); }

.app-dialog-content {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #f7f9fb;
}

.app-dialog-content p {
  margin: 0;
  white-space: pre-line;
}
.app-dialog-warning { border-left-color: var(--warning); background: #fff8e1; }
.app-dialog-danger { border-left-color: var(--danger); background: #ffebee; }

.app-dialog-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.app-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

@media (max-width: 640px) {
  .app-dialog-actions > button { flex: 1 1 0; }
}

.login-screen {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0 0 54% 0;
  background:
    linear-gradient(195deg, rgba(66, 66, 74, 0.82), rgba(25, 25, 25, 0.9)),
    radial-gradient(circle at 22% 25%, #ec407a, transparent 38%),
    radial-gradient(circle at 78% 40%, #49a3f1, transparent 42%);
}

.login-card {
  position: relative;
  width: min(430px, 100%);
  padding: 34px;
  border-radius: 14px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
}

.login-brand {
  justify-content: center;
  margin: -58px -10px 28px;
  padding: 22px;
  border-radius: 12px;
  background: linear-gradient(195deg, #ec407a 0%, #c2185b 100%);
  box-shadow: 0 7px 18px rgba(194, 24, 91, 0.28);
  color: #fff;
}

.login-brand strong, .login-brand .brand-mark { color: #fff; }
.login-brand .brand-mark { background: rgba(255, 255, 255, 0.14); }
.login-kicker { color: var(--primary); }
.demo-credentials { border-color: var(--border); }

.calendar-filters {
  margin-top: 12px;
}

.calendar-filter-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.calendar-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.calendar-filter-summary {
  margin-right: auto;
}

@media (max-width: 1180px) {
  .schedule-filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 38px;
  }

  .platform-dashboard-grid, .teacher-dashboard-lists { grid-template-columns: 1fr; }
  .tenant-dashboard-grid, .resource-utilization-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }

  .app-shell.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    inset: 12px auto 12px 12px;
    width: min(280px, calc(100vw - 32px));
    height: calc(100dvh - 24px);
    min-height: 0;
    margin: 0;
    overflow-y: auto;
    transform: translateX(calc(-100% - 20px));
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: min(280px, calc(100vw - 32px));
    padding: 18px 14px;
  }

  .app-shell.sidebar-collapsed .brand { justify-content: flex-start; padding: 6px 10px 16px; }

  .app-shell.sidebar-collapsed .brand-copy,
  .app-shell.sidebar-collapsed .tenant-name,
  .app-shell.sidebar-collapsed .nav-label {
    display: block;
  }

  .app-shell.sidebar-collapsed .nav button { justify-content: flex-start; padding: 10px 12px; }
  .app-shell.sidebar-collapsed .topbar { inset-inline-start: 0; }
  .sidebar-collapse-btn { display: none; }

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

  .nav-scrim {
    background: rgba(25, 25, 25, 0.56);
    backdrop-filter: blur(2px);
  }

  .main { grid-column: 1; padding: 76px 14px 22px; }
  .topbar { inset-inline-start: 0; min-height: 64px; padding-inline: 14px; }
  .mobile-menu-btn { border-color: transparent; background: transparent; }

  .mobile-menu-btn span {
    height: 2px;
    border-radius: 2px;
    background: var(--text);
  }
}

@media (max-width: 640px) {
  .student-relationship-grid { grid-template-columns: 1fr; }

  .directory-controls {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .directory-search-btn {
    width: 100%;
  }

  .directory-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .directory-pagination .row,
  .directory-pagination button {
    width: 100%;
  }

  .schedule-filter-fields { grid-template-columns: 1fr; }
  .schedule-filter-actions { justify-content: stretch; }
  .schedule-filter-actions button { flex: 1 1 0; }
  .calendar-filter-fields { grid-template-columns: 1fr; }
  .calendar-filter-actions { flex-wrap: wrap; }
  .calendar-filter-summary { flex: 1 0 100%; margin-right: 0; }
  .calendar-filter-actions button { flex: 1 1 0; }
  .main { padding: 68px 10px 18px; }
  .topbar { min-height: 58px; padding: 8px 10px; }
  .breadcrumb { display: none; }

  .dashboard-kpis {
    grid-template-columns: 1fr;
    gap: 34px;
    padding-top: 26px;
  }

  .kpi { min-height: 96px; }
  .panel { padding: 15px; }
  .dashboard-recent { margin-top: 26px !important; }
  .card-heading-icon { display: none; }
  .dashboard-heading { align-items: stretch; flex-direction: column; }
  .dashboard-heading .btn-secondary { width: 100%; }
  .platform-status-card { align-items: stretch; flex-direction: column; }
  .platform-status-card .tag { align-self: flex-start; }
  .directory-summary { grid-template-columns: 1fr; }
  .super-admin-workspace { gap: 12px; }
  .super-admin-card { padding-inline: 14px; }
  .super-admin-form { grid-template-columns: minmax(0, 1fr); }
  .super-admin-form .btn-primary,
  .super-admin-form .btn-secondary { width: 100%; min-height: 44px; }
  .super-admin-form .inline-check { min-height: 44px; }
  .resource-utilization .table-wrap { overflow: visible; }

  .resource-utilization-table,
  .resource-utilization-table tbody { display: block; width: 100%; }

  .resource-utilization-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .resource-utilization-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
  }

  .resource-utilization-table tbody td {
    display: flex;
    min-width: 0;
    padding: 0;
    border: 0;
    flex-direction: column;
    gap: 4px;
    white-space: normal;
  }

  .resource-utilization-table tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.3;
    text-transform: uppercase;
  }

  .resource-utilization-table tbody td:first-child,
  .resource-utilization-table tbody td:last-child { grid-column: 1 / -1; }

  .resource-utilization-table tbody td:first-child {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
  }

  .resource-utilization-table .resource-empty-row { display: block; }
  .resource-utilization-table .resource-empty-row td { display: block; }
  .resource-utilization-table .resource-empty-row td::before { content: none; }
  .teacher-lesson-row, .student-lesson-row { grid-template-columns: 1fr; gap: 10px; }
  .teacher-lesson-meta, .student-lesson-meta { grid-template-columns: 1fr; gap: 5px; }
  .teacher-lesson-meta .tag, .student-lesson-meta .tag { justify-self: start; margin-top: 3px; }
  .teacher-utilization-value { align-items: flex-start; flex-direction: column; gap: 3px; }
  .student-finance-total { align-items: flex-start; flex-direction: column; gap: 5px; }
  .schedule-grid-toolbar { align-items: stretch; flex-direction: column; }
  .schedule-grid-toolbar .btn-primary { width: 100%; }
  .schedule-view-switcher { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-view-switcher .btn-secondary { width: 100%; }
  .modal-overlay {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .modal-card,
  .lesson-editor-modal {
    width: 100%;
    max-width: 100vw;
    min-height: 100dvh;
    margin: 0;
    padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
    border-radius: 0;
    overflow-x: hidden;
  }
  .login-screen { padding: 28px 16px; }
  .login-card { padding: 28px 20px; }
  .login-brand { margin: -50px 0 26px; }
}
