:root {
  --ink: #172232;
  --muted: #6c788a;
  --faint: #96a0af;
  --line: #e6eaf0;
  --line-strong: #d7dde6;
  --canvas: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --navy: #172a46;
  --navy-2: #203a5d;
  --teal: #16a6a0;
  --teal-dark: #0d817d;
  --teal-soft: #e5f7f5;
  --blue: #4979db;
  --blue-soft: #eaf0fd;
  --orange: #e88a3f;
  --orange-soft: #fff1e5;
  --yellow: #d69b22;
  --yellow-soft: #fff7dc;
  --red: #d95757;
  --red-soft: #fdecec;
  --green: #3d9a6d;
  --green-soft: #e9f6ef;
  --purple: #7c62c9;
  --purple-soft: #f0ecfb;
  --shadow-sm: 0 1px 2px rgba(20, 35, 53, .04), 0 5px 16px rgba(20, 35, 53, .045);
  --shadow-md: 0 16px 45px rgba(17, 36, 61, .13);
  --sidebar-w: 244px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font-body: "DM Sans", sans-serif;
  --font-display: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.025em; }
code { padding: 2px 5px; border-radius: 5px; background: #eef1f5; font-size: .9em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Icons */
[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
[data-icon] svg { width: 18px; height: 18px; stroke-width: 1.8; }

/* Authentication */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .92fr) 1.08fr; background: var(--surface); }
.auth-art {
  position: relative;
  min-height: 100vh;
  padding: 48px 56px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 0 100%, rgba(25, 182, 172, .45), transparent 44%),
    linear-gradient(145deg, #11243d 0%, #1c3c5d 62%, #126e71 140%);
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: -.035em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  color: #fff;
  background: var(--teal);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.auth-art-copy { position: absolute; z-index: 2; left: 56px; right: 56px; bottom: 15%; max-width: 530px; }
.auth-art-copy h1 { max-width: 500px; margin-bottom: 22px; font-size: clamp(38px, 4vw, 58px); line-height: 1.07; }
.auth-art-copy > p:last-child { max-width: 470px; margin: 0; color: rgba(255,255,255,.72); font-size: 17px; line-height: 1.7; }
.eyebrow { margin-bottom: 9px; color: var(--teal-dark); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow--light { color: #76ddd5; }
.auth-orbit { position: absolute; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; }
.auth-orbit--one { width: 440px; height: 440px; top: -130px; right: -170px; }
.auth-orbit--two { width: 650px; height: 650px; top: -215px; right: -270px; }
.auth-panel { display: grid; place-items: center; padding: 48px; }
.auth-card { width: min(100%, 410px); }
.auth-card h2 { margin-bottom: 9px; font-size: 29px; }
.auth-card > .muted { margin-bottom: 30px; }
.auth-hint { margin: 22px 8px 0; color: var(--faint); font-size: 12px; text-align: center; }
.mobile-brand { display: none; }

/* Forms and buttons */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > span, .form-label { color: #455164; font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea,
.control {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22,166,160,.12);
}
.field input:disabled, .field select:disabled { color: var(--muted); background: #f3f5f8; }
.field-hint { margin: -4px 0 0; color: var(--faint); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn--primary { color: #fff; background: var(--teal); box-shadow: 0 5px 13px rgba(22,166,160,.18); }
.btn--primary:hover { background: var(--teal-dark); }
.btn--secondary { color: var(--teal-dark); background: var(--teal-soft); }
.btn--outline { border-color: var(--line-strong); background: #fff; }
.btn--outline:hover { border-color: #bac3cf; background: var(--surface-soft); }
.btn--ghost { color: var(--muted); }
.btn--ghost:hover { color: var(--ink); background: #f2f4f7; }
.btn--danger { color: #fff; background: var(--red); }
.btn--danger-soft { color: var(--red); background: var(--red-soft); }
.btn--wide { width: 100%; margin-top: 4px; }
.btn--compact { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.btn--sidebar { width: 100%; justify-content: flex-start; color: #afbdd0; }
.btn--sidebar:hover { color: #fff; background: rgba(255,255,255,.06); }
.btn-icon-only { width: 34px; min-height: 34px; padding: 7px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(25,40,60,.06); }
.inline-alert { margin-bottom: 18px; padding: 11px 13px; color: #8b5d15; background: var(--yellow-soft); border: 1px solid #f2dda6; border-radius: var(--radius-sm); font-size: 12px; }

/* Shell and navigation */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 25px 15px 18px;
  color: #fff;
  background: var(--navy);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 27px; }
.brand--sidebar { color: #fff; }
.sidebar-close { display: none; color: #fff; }
.main-nav { display: flex; flex: 1; flex-direction: column; gap: 4px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #aebbd0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: color .18s ease, background .18s ease;
}
.nav-link::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -15px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--teal);
  content: "";
  opacity: 0;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.08); }
.nav-link.active::before { opacity: 1; }
.sidebar-footer { padding-top: 13px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-help { display: flex; align-items: center; gap: 10px; margin: 0 7px 12px; color: #c4cede; }
.sidebar-help-icon { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.08); }
.sidebar-help strong, .sidebar-help small { display: block; }
.sidebar-help strong { font-size: 11px; }
.sidebar-help small { color: #8292aa; font-size: 10px; }
.main-content { min-height: 100vh; margin-left: var(--sidebar-w); }
.topbar {
  position: sticky;
  z-index: 25;
  top: 0;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 31px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 13px; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar-kicker { margin: 0 0 1px; color: var(--faint); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.menu-btn { display: none; }
.user-menu-wrap { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 2px 3px 3px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--navy-2); font-weight: 700; }
.user-copy { min-width: 118px; text-align: left; }
.user-copy strong, .user-copy small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy small { color: var(--faint); font-size: 10px; }
.user-chip > [data-icon] { color: var(--faint); }
.user-chip > [data-icon] svg { width: 14px; height: 14px; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 170px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}
.user-dropdown button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-size: 12px; }
.user-dropdown button:hover { background: var(--surface-soft); }
.page-content { padding: 25px 31px 42px; }
.page-loading { min-height: 55vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; margin-bottom: 12px; border: 3px solid #dfe5eb; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar-scrim { display: none; }

/* General page components */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-head h2 { margin: 0 0 4px; font-size: 22px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.card-body { padding: 20px; }
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.filters .control { width: auto; min-width: 132px; min-height: 36px; padding: 7px 10px; font-size: 12px; }
.filters .filter-search { flex: 1 1 220px; max-width: 340px; position: relative; }
.filter-search [data-icon] { position: absolute; z-index: 1; top: 9px; left: 10px; color: var(--faint); }
.filter-search input { width: 100%; padding-left: 35px; }
.filter-spacer { flex: 1; }
.filter-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.section-grid--sidebar { grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); }
.divider { height: 1px; margin: 20px 0; background: var(--line); }
.action-link { padding: 0; color: var(--teal-dark); border: 0; background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.action-link:hover { text-decoration: underline; }
.empty-state { display: grid; min-height: 270px; place-content: center; justify-items: center; padding: 38px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 13px; color: var(--teal-dark); background: var(--teal-soft); border-radius: 14px; }
.empty-state h3 { margin-bottom: 6px; font-size: 15px; }
.empty-state p { max-width: 350px; margin-bottom: 15px; color: var(--muted); font-size: 12px; }

/* Dashboard */
.dashboard-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dashboard-welcome h2 { margin: 0 0 4px; font-size: 22px; }
.dashboard-welcome p { margin: 0; color: var(--muted); }
.period-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.period-filter .control { min-width: 115px; min-height: 36px; padding: 7px 10px; font-size: 12px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { position: relative; overflow: hidden; min-height: 120px; padding: 18px; }
.metric-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 600; }
.metric-value { margin-top: 7px; font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -.04em; }
.metric-note { margin-top: 3px; color: var(--faint); font-size: 10px; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; }
.metric-icon--teal { color: var(--teal-dark); background: var(--teal-soft); }
.metric-icon--orange { color: var(--orange); background: var(--orange-soft); }
.metric-icon--green { color: var(--green); background: var(--green-soft); }
.metric-icon--purple { color: var(--purple); background: var(--purple-soft); }
.metric-card--accent { color: #fff; background: linear-gradient(145deg, var(--navy-2), #1a4f6c); border-color: transparent; }
.metric-card--accent .metric-label, .metric-card--accent .metric-note { color: rgba(255,255,255,.66); }
.metric-card--accent .metric-icon { color: #fff; background: rgba(255,255,255,.12); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 18px; margin-bottom: 18px; }
.bar-list { display: flex; flex-direction: column; gap: 16px; }
.bar-row-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 12px; }
.bar-row-head strong { font-weight: 600; }
.bar-row-head span { color: var(--muted); }
.bar-track { height: 7px; overflow: hidden; background: #eef1f4; border-radius: 9px; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--teal); }
.bar-fill--blue { background: var(--blue); }
.bar-fill--orange { background: var(--orange); }
.bar-fill--purple { background: var(--purple); }
.status-list { display: flex; flex-direction: column; gap: 11px; }
.status-list-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.status-list-row:last-child { padding: 0; border: 0; }
.status-list-label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status-dot--yellow { background: var(--yellow); }
.status-dot--blue { background: var(--blue); }
.status-dot--green { background: var(--green); }
.status-dot--red { background: var(--red); }
.status-list-row strong { font-family: var(--font-display); }

/* Tables */
.table-card { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th {
  padding: 11px 14px;
  color: #7a8697;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .035em;
  text-align: left;
  text-transform: uppercase;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid #edf0f4; font-size: 12px; vertical-align: middle; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #fbfcfd; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .checkbox-col { width: 38px; padding-right: 5px; text-align: center; }
.data-table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--teal); cursor: pointer; }
.student-cell { display: flex; align-items: center; gap: 9px; }
.student-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--teal-dark); background: var(--teal-soft); font-size: 10px; font-weight: 700; }
.student-cell strong, .student-cell small { display: block; }
.student-cell strong { max-width: 180px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; }
.student-cell small { max-width: 180px; overflow: hidden; color: var(--faint); font-size: 10px; text-overflow: ellipsis; }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 600; }
.badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.badge--neutral { color: #697587; background: #eff2f5; }
.badge--green { color: #277d53; background: var(--green-soft); }
.badge--yellow { color: #9c721a; background: var(--yellow-soft); }
.badge--red { color: #b34242; background: var(--red-soft); }
.badge--blue { color: #3d69bd; background: var(--blue-soft); }
.badge--orange { color: #bd682b; background: var(--orange-soft); }
.badge--purple { color: #674db6; background: var(--purple-soft); }
.badge--teal { color: var(--teal-dark); background: var(--teal-soft); }
.row-actions { display: flex; align-items: center; gap: 3px; }
.row-menu { position: relative; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-top: 1px solid var(--line); }
.pagination-info { color: var(--muted); font-size: 11px; }
.pagination-buttons { display: flex; align-items: center; gap: 5px; }
.page-btn { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; cursor: pointer; }
.page-btn.active { color: #fff; background: var(--teal); border-color: var(--teal); }
.page-btn:disabled { opacity: .45; cursor: default; }
.bulk-bar { display: flex; align-items: center; gap: 10px; margin: -2px 0 13px; padding: 9px 13px; color: #fff; background: var(--navy-2); border-radius: 9px; }
.bulk-bar strong { font-size: 12px; }
.bulk-bar .btn { min-height: 31px; padding: 5px 10px; }
.bulk-spacer { flex: 1; }

/* Course groups and batch cards */
.entity-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.entity-card { position: relative; padding: 18px; }
.entity-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.course-code { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; color: var(--teal-dark); background: var(--teal-soft); border-radius: 11px; font-family: var(--font-display); font-size: 11px; font-weight: 800; }
.entity-card h3 { margin: 15px 0 5px; font-size: 14px; }
.entity-card p { min-height: 37px; margin: 0 0 15px; color: var(--muted); font-size: 11px; }
.entity-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.entity-meta small { color: var(--faint); font-size: 10px; }
.kebab { color: var(--faint); }

/* Reports and settings */
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.report-card { display: flex; align-items: center; gap: 13px; padding: 18px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.report-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(20,35,53,.09); }
.report-icon { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; color: var(--teal-dark); background: var(--teal-soft); border-radius: 11px; }
.report-card h3 { margin: 0 0 3px; font-size: 13px; }
.report-card p { margin: 0; color: var(--muted); font-size: 10px; }
.report-card > [data-icon] { margin-left: auto; color: var(--faint); }
.settings-nav { display: flex; flex-direction: column; padding: 8px; }
.settings-nav button { display: flex; align-items: center; gap: 9px; padding: 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; font-size: 12px; }
.settings-nav button.active { color: var(--teal-dark); background: var(--teal-soft); font-weight: 600; }
.settings-content h3 { margin-bottom: 4px; font-size: 16px; }
.settings-content > p { margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.connection-status { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; padding: 11px 13px; background: var(--green-soft); border-radius: 8px; color: #277d53; font-size: 12px; }
.connection-status--bad { color: #b34242; background: var(--red-soft); }

/* Modals */
.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 23, 39, .58);
  backdrop-filter: blur(3px);
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: min(100%, 600px);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  background: #fff;
  border-radius: 15px;
  box-shadow: var(--shadow-md);
  animation: modal-in .18s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal--wide { width: min(100%, 1060px); }
.modal--medium { width: min(100%, 760px); }
.modal--small { width: min(100%, 430px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 21px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0 0 2px; font-size: 18px; }
.modal-header p { margin: 0; color: var(--muted); font-size: 11px; }
.modal-body { max-height: calc(100vh - 185px); overflow-y: auto; padding: 21px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 21px; background: var(--surface-soft); border-top: 1px solid var(--line); }
.confirm-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 14px; color: var(--red); background: var(--red-soft); border-radius: 13px; }
.confirm-copy h3 { margin-bottom: 6px; }
.confirm-copy p { margin: 0; color: var(--muted); font-size: 12px; }

/* Student profile */
.profile-modal .modal-body { padding: 0; }
.profile-header {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 19px 22px;
  background: linear-gradient(90deg, #f8fbfc, #fff);
  border-bottom: 1px solid var(--line);
}
.profile-avatar { display: grid; place-items: center; width: 54px; height: 54px; color: #fff; background: var(--teal); border-radius: 15px; font-family: var(--font-display); font-size: 17px; font-weight: 800; }
.profile-title { min-width: 0; }
.profile-title h2 { margin: 0 0 2px; font-size: 19px; }
.profile-title p { margin: 0; color: var(--muted); font-size: 11px; }
.profile-header-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.profile-header .icon-btn { margin-left: auto; align-self: flex-start; }
.profile-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 18px; border-bottom: 1px solid var(--line); }
.profile-tab { position: relative; padding: 13px 11px; color: var(--muted); border: 0; background: transparent; white-space: nowrap; font-size: 11px; font-weight: 600; cursor: pointer; }
.profile-tab::after { position: absolute; right: 9px; bottom: 0; left: 9px; height: 2px; background: var(--teal); border-radius: 2px 2px 0 0; content: ""; opacity: 0; }
.profile-tab.active { color: var(--teal-dark); }
.profile-tab.active::after { opacity: 1; }
.profile-content { min-height: 390px; padding: 21px 22px 25px; }
.profile-content h3 { margin-bottom: 14px; font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.detail-item { padding: 11px 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.detail-item small, .detail-item strong { display: block; }
.detail-item small { margin-bottom: 3px; color: var(--faint); font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.detail-item strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; }
.profile-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 21px 0 12px; }
.profile-section-head h3 { margin: 0; }
.activity-list { display: flex; flex-direction: column; gap: 9px; }
.activity-row { display: grid; grid-template-columns: minmax(170px, 1.4fr) minmax(110px, .7fr) 80px minmax(140px, 1fr) 125px auto; align-items: end; gap: 9px; padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; }
.activity-row .field { margin: 0; }
.activity-row .field > span { font-size: 9px; }
.activity-name { align-self: center; font-size: 11px; font-weight: 600; }
.certificate-card { padding: 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.certificate-card + .certificate-card { margin-top: 12px; }
.certificate-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.certificate-card-head h4 { margin: 0; font-size: 12px; }
.note-compose { display: flex; gap: 9px; align-items: flex-end; margin-bottom: 16px; }
.note-compose .field { flex: 1; margin: 0; }
.notes-list { display: flex; flex-direction: column; gap: 10px; }
.note-item { padding: 12px 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; }
.note-item p { margin-bottom: 6px; font-size: 12px; white-space: pre-wrap; }
.note-item small { color: var(--faint); font-size: 9px; }
.requirement-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding: 13px 15px; border-radius: 9px; }
.requirement-banner--ready { color: #277d53; background: var(--green-soft); }
.requirement-banner--review { color: #9c721a; background: var(--yellow-soft); }
.requirement-banner strong, .requirement-banner small { display: block; }
.requirement-banner small { opacity: .78; font-size: 10px; }

/* CSV import */
.dropzone { display: grid; min-height: 180px; place-content: center; justify-items: center; padding: 25px; border: 1.5px dashed #bfc8d4; border-radius: 12px; background: var(--surface-soft); text-align: center; transition: border-color .18s ease, background .18s ease; cursor: pointer; }
.dropzone.dragover { border-color: var(--teal); background: var(--teal-soft); }
.dropzone [data-icon] { width: 42px; height: 42px; margin-bottom: 10px; color: var(--teal-dark); background: var(--teal-soft); border-radius: 12px; }
.dropzone h3 { margin-bottom: 4px; font-size: 14px; }
.dropzone p { margin: 0; color: var(--muted); font-size: 11px; }
.import-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.import-summary > div { padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.import-summary strong, .import-summary span { display: block; }
.import-summary strong { font-family: var(--font-display); font-size: 21px; }
.import-summary span { color: var(--muted); font-size: 10px; }
.skip-list { max-height: 170px; overflow-y: auto; margin-top: 14px; padding: 10px 12px; background: var(--red-soft); border-radius: 8px; color: #9d4040; font-size: 10px; }

/* Toasts */
.toast-region { position: fixed; z-index: 200; top: 18px; right: 18px; width: min(360px, calc(100vw - 36px)); display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px; color: #fff; background: var(--navy); border-radius: 10px; box-shadow: var(--shadow-md); animation: toast-in .25s ease; pointer-events: auto; }
@keyframes toast-in { from { opacity: 0; transform: translateX(15px); } }
.toast--success { background: #287e59; }
.toast--error { background: #a94343; }
.toast--warning { background: #986b16; }
.toast-copy { flex: 1; }
.toast-copy strong, .toast-copy span { display: block; }
.toast-copy strong { margin-bottom: 1px; font-size: 12px; }
.toast-copy span { color: rgba(255,255,255,.78); font-size: 10px; }
.toast button { padding: 1px; color: rgba(255,255,255,.7); border: 0; background: transparent; cursor: pointer; }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-row { grid-template-columns: minmax(150px, 1.2fr) minmax(100px, .7fr) 70px minmax(120px, 1fr) 115px auto; }
}

@media (max-width: 920px) {
  :root { --sidebar-w: 238px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-md); }
  .sidebar-close, .menu-btn { display: inline-grid; }
  .sidebar-scrim { position: fixed; z-index: 35; inset: 0; background: rgba(10,22,38,.46); }
  body.sidebar-open .sidebar-scrim { display: block; }
  .main-content { margin-left: 0; }
  .dashboard-grid, .section-grid--sidebar { grid-template-columns: 1fr; }
  .entity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { min-height: 100vh; }
  .mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 35px; font-family: var(--font-display); font-size: 20px; font-weight: 800; }
}

@media (max-width: 680px) {
  .topbar { min-height: 66px; padding: 11px 16px; }
  .topbar-actions { gap: 8px; }
  .topbar .btn--primary span:not([data-icon]) { display: none; }
  .user-copy, .user-chip > [data-icon] { display: none; }
  .page-content { padding: 18px 15px 32px; }
  .page-head, .dashboard-welcome { flex-direction: column; align-items: stretch; }
  .page-actions { justify-content: flex-start; }
  .metrics-grid, .section-grid, .entity-grid, .report-grid, .detail-grid { grid-template-columns: 1fr; }
  .period-filter .control { flex: 1; }
  .filters { align-items: stretch; }
  .filters .control, .filters .filter-search { width: 100%; max-width: none; }
  .filter-spacer { display: none; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 94vh; border-radius: 15px 15px 0 0; }
  .modal-body { max-height: calc(94vh - 135px); }
  .profile-content { padding: 18px 16px 22px; }
  .profile-header { padding: 16px; }
  .profile-tabs { padding: 0 8px; }
  .activity-row { grid-template-columns: 1fr 1fr; align-items: end; }
  .activity-name { grid-column: 1 / -1; }
  .activity-row .save-activity { grid-column: 1 / -1; }
  .auth-panel { padding: 30px 22px; }
}
