:root {
  --bg: #f6f2ea;
  --bg-accent: #e4edff;
  --card: #fffdf9;
  --text: #0f172a;
  --muted: #566074;
  --accent: #1f4b8f;
  --accent-2: #d97706;
  --line: #d7dde8;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  --accent-soft: #e8f0ff;
  --accent-warm: #fff3e0;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: "Source Serif Pro", "Georgia", "Cambria", "Times New Roman", serif;
  background:
    radial-gradient(circle at 12% 12%, var(--bg-accent), transparent 40%),
    radial-gradient(circle at 88% 10%, var(--accent-warm), transparent 45%),
    var(--bg);
  color: var(--text);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(10px);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.menu a {
  margin-left: 10px;
  text-decoration: none;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.menu .menu-link {
  margin-left: 10px;
  text-decoration: none;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  font: inherit;
}

.menu a:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
}

.menu .menu-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
}


.container {
  padding: 26px;
  max-width: 1120px;
  margin: 0 auto;
}

.site-footer {
  margin-top: 32px;
  padding: 18px 24px 28px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.9);
}

.site-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.page-head h1,
h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.page-head p {
  margin: 0 0 18px;
  color: var(--muted);
}

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

.inline-form {
  margin: 0;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
  width: auto;
  padding: 8px 12px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.3;
}

.card,
.auth-box {
  background: var(--card);
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-switcher {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.auth-switcher span {
  color: var(--muted);
  font-weight: 600;
}

.auth-switcher a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 700;
  border: 1px solid rgba(31, 75, 143, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.auth-switcher a:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
}

.auth-switcher a::after {
  content: "→";
  font-weight: 700;
}

.auth-switcher a:focus-visible {
  outline: 2px solid rgba(31, 75, 143, 0.4);
  outline-offset: 2px;
}

.honeypot-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.portal-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  align-items: center;
  margin: 18px 0 26px;
}

.portal-hero-copy h1 {
  font-size: 2.4rem;
  margin: 10px 0 12px;
}

.portal-kicker {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  color: var(--accent);
  font-weight: 700;
}

.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.portal-student-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.portal-mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(31, 75, 143, 0.16);
  color: #1e3a5f;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.portal-pill {
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(31, 75, 143, 0.2);
  font-weight: 600;
}

.portal-hero-panel {
  position: relative;
  min-height: 220px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #edf2ff 55%, #fef2e8 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: hidden;
}

.portal-stamp {
  border: 2px dashed rgba(31, 75, 143, 0.35);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.75);
}

.stamp-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.stamp-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 8px 0;
  color: var(--accent);
}

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

.portal-glow {
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.35), transparent 70%);
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.portal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-card-student {
  background: linear-gradient(180deg, #f8fbff 0%, #effaf3 100%);
  border-color: #bfdbfe;
  position: relative;
  overflow: hidden;
}

.portal-card-student::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.14), transparent 70%);
}

.portal-card-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.portal-cta {
  align-self: flex-start;
  text-decoration: none;
  color: var(--accent);
  font-weight: 700;
}

.portal-help {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.portal-help-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 16px;
}

.portal-help-setup {
  border-color: rgba(217, 119, 6, 0.4);
}

.pwa-install-card[hidden] {
  display: none;
}

.pwa-install-btn {
  margin-top: 10px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(31, 75, 143, 0.2);
}

.offline-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  width: min(100%, 640px);
  margin: 20px auto;
  text-align: center;
}

.offline-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.15);
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.offline-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.offline-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.offline-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  color: #1e3a5f;
  font-size: 0.84rem;
  font-weight: 600;
}

.portal-pill-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.pwa-update-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.3);
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 1000;
}

.pwa-update-btn {
  background: #ffffff;
  color: #0f172a;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
}

.offline-banner {
  background: rgba(217, 119, 6, 0.2);
  color: #7c2d12;
  text-align: center;
  padding: 8px 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.offline-sync {
  display: block;
  font-weight: 600;
  color: #92400e;
  margin-top: 4px;
  font-size: 0.82rem;
}

.online-toast {
  position: fixed;
  right: 16px;
  bottom: 84px;
  background: #14532d;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.3);
  font-weight: 700;
  z-index: 1000;
}

.last-updated {
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.compact {
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

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

.full-row {
  grid-column: 1 / -1;
}

input,
select,
button,
textarea {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%;
  font: inherit;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(31, 75, 143, 0.18);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

button {
  background: linear-gradient(135deg, var(--accent), #163b73);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  filter: brightness(1.05);
}

.flash {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}

.flash li {
  padding: 10px 12px;
  border-radius: 9px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash .success {
  color: #14532d;
  border-color: #86efac;
}

.flash .error {
  color: #991b1b;
  border-color: #fca5a5;
}

.flash-source-hidden {
  display: none;
}

.flash-dialog-stack {
  position: fixed;
  top: 78px;
  right: 16px;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  z-index: 320;
}

.flash-dialog {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.2);
  padding: 12px;
  display: grid;
  gap: 10px;
  animation: lift 180ms ease-out;
}

.flash-dialog-success {
  border-left-color: #16a34a;
}

.flash-dialog-error {
  border-left-color: #dc2626;
}

.flash-dialog-message {
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}

.flash-dialog-close {
  width: auto;
  justify-self: end;
  padding: 6px 10px;
  font-size: 0.86rem;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  cursor: pointer;
}

.flash-dialog-close:hover {
  border-color: var(--accent);
}

.ui-alert {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  margin-top: 10px;
}

.ui-alert.is-visible {
  display: flex;
  animation: lift 160ms ease-out;
}

.ui-alert--error {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #9f1239;
}

.ui-alert--info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.ui-alert--success {
  border-color: #86efac;
  background: #ecfdf3;
  color: #166534;
}

.tabs {
  animation: fade-in 260ms ease-out;
}

.tab-list {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab-btn {
  width: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  color: var(--text);
  background: #fff;
}

.tab-btn.is-active {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
  animation: lift 240ms ease-out;
}

.nested-tabs .tab-list {
  margin-bottom: 10px;
}

.table-wrap {
  overflow-x: auto;
}

.registry-table {
  width: 100%;
  border-collapse: collapse;
}

.registry-table th,
.registry-table td {
  text-align: left;
  padding: 11px;
  border-bottom: 1px solid var(--line);
}

.score-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.score-table thead th {
  background: #f8fafc;
}

.score-table tbody tr:nth-child(even) {
  background: #fcfdfb;
}

.score-table .score-cell {
  color: #0f172a;
}

.score-cell-primary .score-value {
  font-weight: 700;
}

.score-row-parent td {
  background: #ffffff;
}

.score-row-component td {
  background: #f8fafc;
}

.score-subject-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.score-subject-cell.is-component {
  padding-left: 26px;
}

.score-subject-parent {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}

.score-subject-parent::after {
  content: "•";
  margin: 0 6px;
  color: #cbd5f5;
}

.score-subject-name {
  font-weight: 700;
  color: #0f172a;
}

.score-subject-cell.is-component .score-subject-name {
  font-weight: 400;
}

.score-subject-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f766e;
  background: #ccfbf1;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 2px 8px;
}

.score-value {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.note-alias {
  display: none;
  font-weight: 700;
  color: #0f172a;
}

.status-chip-scored {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.status-chip-pending {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fdba74;
}

.status-chip-neutral {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.focused-merit-row {
  background: #fff7d6;
}

.registry-table th {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #f3f6fb;
}

.status-chip {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.trend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
}

.trend-up {
  color: #1a7f37;
  background: #e6f4ea;
}

.trend-down {
  color: #c23b22;
  background: #fdecea;
}

.trend-flat {
  color: #6b7280;
  background: #f3f4f6;
}

.trend-delta {
  margin-left: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #1f2937;
}

.student-dashboard .tab-list {
  flex-wrap: wrap;
  gap: 8px;
}

.student-dashboard .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.student-dashboard .registry-table {
  min-width: 720px;
}

.student-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fef3c7 0%, #e0f2fe 40%, #dcfce7 100%);
  border: 1px solid #dbeafe;
  margin-bottom: 16px;
}

.student-hero-copy {
  display: grid;
  gap: 10px;
}

.student-hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: #6b7280;
  margin: 0 0 6px;
}

.student-hero-summary {
  max-width: 62ch;
  color: #334155;
  margin: 0;
  line-height: 1.5;
}

.student-hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.student-hero-metric {
  min-width: 118px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.student-hero-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.1rem;
  color: #0f172a;
}

.student-hero-metric-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 700;
}

.student-hero-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.8rem;
  height: fit-content;
}

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

.student-action-card {
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  position: relative;
  overflow: hidden;
}

.student-action-card:hover {
  border-color: #cbd5f5;
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.student-action-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.student-action-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.18), transparent 70%);
}

.student-action-exams {
  background: linear-gradient(135deg, #eff6ff 0%, #ecfeff 55%, #f0fdf4 100%);
  border-color: #bae6fd;
}

.student-action-profile {
  background: linear-gradient(135deg, #fffaf0 0%, #fef3c7 45%, #fefce8 100%);
  border-color: #fcd34d;
}

.student-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0ea5e9;
  color: #ffffff;
  font-weight: 800;
  margin-bottom: 10px;
}

.student-action-icon-profile {
  background: #f59e0b;
}

.admin-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.student-action-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 10px;
}

.student-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.student-snapshot-card,
.student-timeline-card {
  border-radius: 18px;
}

.student-section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 8px;
}

.student-snapshot-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.student-snapshot-stats span {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 600;
}

.student-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.student-subject-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.student-subsection-title {
  margin-top: 18px;
}

.student-subject-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbeafe;
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
}

.student-subject-pill strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.85rem;
}

.student-subject-list-focus .student-subject-pill {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffdf4 0%, #ffffff 100%);
}

.student-subject-list-focus .student-subject-pill strong {
  background: #b45309;
}

.student-timeline-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.student-timeline-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.student-timeline-title {
  font-weight: 700;
  color: #0f172a;
}

.student-timeline-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.is-latest-exam {
  background: #fef9c3;
}

.status-active {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.status-inactive {
  background: #ffe4e6;
  color: #9f1239;
  border-color: #fda4af;
}

.status-graduated {
  background: #dbeafe;
  color: #1e3a8a;
  border-color: #93c5fd;
}

.status-transferred {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}

.class-picker h3 {
  margin: 0 0 10px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.check-grid input[type="checkbox"] {
  width: auto;
}

.assignment-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.picker-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.picker-panel h4 {
  margin: 0 0 6px;
}

.streams-panel {
  border-color: #bcd5f7;
  background: linear-gradient(180deg, #f5f9ff 0%, #eef5ff 100%);
}

.grades-panel {
  border-color: #f2c27a;
  background: linear-gradient(180deg, #fff9f1 0%, #fff3e4 100%);
}

.stream-options label {
  border-color: #b8e4dc;
  background: #fcfffe;
}

.grade-options label {
  border-color: #c3d9ff;
  background: #fcfdff;
}

.assignment-actions {
  margin-top: 14px;
}

.student-flow {
  display: grid;
  gap: 12px;
}

.flow-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.flow-step {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  color: var(--muted);
  background: #fff;
}

.flow-step.is-active {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.flow-arrow {
  color: var(--muted);
  font-weight: 700;
}

.flow-panel {
  display: none;
}

.flow-panel.is-active {
  display: block;
  animation: lift 220ms ease-out;
}

.flow-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

.class-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border-color: #bdd5ff;
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7ff 100%);
  font-weight: 700;
}

.guardian-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.guardian-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.guardian-card h4 {
  margin: 0;
}

.guardian-list {
  display: grid;
  gap: 6px;
}

.guardian-pill {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  border: 1px solid #c9ddff;
  background: linear-gradient(180deg, #f8fbff 0%, #f0f6ff 100%);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.88rem;
}

.guardian-name {
  font-weight: 700;
  color: #163b73;
}

.guardian-meta {
  color: #334155;
  background: #ffffff;
  border: 1px solid #dbe3f1;
  border-radius: 999px;
  padding: 2px 8px;
}

.stream-map {
  display: grid;
  gap: 8px;
}

.stream-row {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.edit-grade-row {
  align-items: center;
  grid-template-columns: minmax(220px, 1fr) 120px;
}

.manage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.manage-edit-row {
  align-items: center;
  grid-template-columns: minmax(220px, 1fr) 120px;
}

.inline-delete-form {
  margin: 0;
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 92px;
  background: linear-gradient(135deg, #c32035, #a51226);
  border: 1px solid #9f1239;
  color: #fff;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.3;
}

.muted-text {
  color: var(--muted);
  margin: 8px 0 0;
}

.entry-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.entry-grid-tight {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: start;
}

.entry-help {
  margin-top: 8px;
}

.entry-selected-list {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.entry-selected-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 6px 8px;
}

.entry-selected-label {
  min-width: 0;
}

.inline-btn {
  width: auto;
  min-width: 108px;
  padding: 8px 12px;
}

.button-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.button-secondary:hover {
  filter: none;
  border-color: var(--accent);
}

.table-action-cell {
  white-space: nowrap;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.action-cell .ghost-btn,
.action-cell .danger-btn {
  width: auto;
  min-width: 96px;
}

.action-cell .inline-delete-form {
  margin: 0;
}

.registry-table .ghost-btn,
.registry-table .danger-btn,
.registry-table .inline-btn {
  max-width: 100%;
}

.grade-preview {
  display: grid;
  gap: 10px;
}

.grade-preview-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.grade-preview-name {
  font-weight: 700;
}

.grade-stream-chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.grade-stream-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  border-radius: 999px;
  border: 1px solid #9ad9cd;
  background: linear-gradient(180deg, #effcf8 0%, #e2f8f2 100%);
  color: #0f4f47;
  font-size: 0.92rem;
}

.inline-chip-form {
  margin: 0;
}

.chip-remove-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0;
  border: 1px solid #fca5a5;
  background: linear-gradient(180deg, #fff6f7 0%, #ffe7ea 100%);
  color: #b91c1c;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.18);
}

.chip-remove-btn:hover {
  filter: none;
  background: #ffd8de;
  transform: translateY(-1px);
}

.modal-open {
  overflow: hidden;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.confirm-modal.is-open {
  display: flex;
  animation: fade-in 180ms ease-out;
}

.confirm-modal-panel {
  width: min(480px, 100%);
  background: #fffdf8;
  border: 1px solid #f8c4cc;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(20, 20, 30, 0.28);
  padding: 18px;
  animation: lift 180ms ease-out;
}

.confirm-modal-panel h3 {
  margin: 0 0 6px;
  color: #8a1024;
}

.confirm-modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  width: auto;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 700;
}

.modal-cancel {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.modal-danger {
  background: linear-gradient(135deg, #c32035, #a51226);
  border: 1px solid #9f1239;
  color: #fff;
}

.modal-primary {
  background: linear-gradient(135deg, var(--accent), #163b73);
  border: 1px solid var(--accent);
  color: #fff;
}

.modal-neutral {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.student-edit-panel {
  width: min(920px, 100%);
  max-height: 88vh;
  overflow-y: auto;
}

.edit-field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
}

.picker-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.subject-group-card {
  display: grid;
  gap: 10px;
}

.subject-group-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.subject-group-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.subject-group-actions .ghost-btn {
  width: auto;
  padding: 6px 10px;
}

#grade-picker {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.js-group-meta {
  white-space: nowrap;
}

.assignment-primary-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

#secondary-picker-list {
  max-height: 300px;
  overflow-y: auto;
}

.score-progress {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 6px;
}

.score-progress-text {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.25;
}

.score-progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.score-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    hsl(var(--progress-hue, 0), 78%, 48%),
    hsl(var(--progress-hue, 0), 70%, 40%)
  );
  transition: width 220ms ease;
}

.grade-entry-link {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 120px;
  width: 100%;
  text-align: center;
  word-break: break-word;
}

.grade-entry-link small {
  font-size: 0.75rem;
  line-height: 1;
}

.grade-entry-link.is-pending {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.grade-entry-link.is-complete {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.grade-entry-link.is-no-data {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.grade-entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.analytics-kpi-card {
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fbff;
}

.analytics-kpi-label {
  font-size: 0.82rem;
  color: #5b6b83;
}

.analytics-kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
  margin-top: 4px;
}

.analytics-kpi-unit {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  margin-left: 2px;
}

.teacher-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(260px, 1fr);
  gap: 16px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 34%),
    linear-gradient(180deg, #fffdf8 0%, #f7fbff 100%);
}

.teacher-profile {
  display: flex;
  gap: 14px;
  align-items: center;
}

.teacher-avatar {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: #0f4f47;
  background: linear-gradient(180deg, #e6fbf5 0%, #d4f2eb 100%);
  border: 1px solid #9ad9cd;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.12);
}

.teacher-kicker {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f766e;
}

.teacher-profile-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.teacher-meta-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.84);
  display: grid;
  gap: 6px;
}

.teacher-meta-label,
.teacher-profile-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.teacher-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(280px, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.teacher-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.teacher-section-head h3 {
  margin: 0;
}

.teacher-profile-panel {
  display: grid;
  gap: 10px;
}

.school-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(240px, 0.8fr);
  gap: 16px;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 38%),
    linear-gradient(180deg, #fffdf8 0%, #f7fbff 100%);
}

.school-hero-chip {
  align-self: center;
  justify-self: end;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #9ad9cd;
  background: linear-gradient(180deg, #e6fbf5 0%, #d4f2eb 100%);
  color: #0f4f47;
  min-width: 200px;
  text-align: center;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.12);
}

.school-hero-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.school-hero-value {
  font-size: 1.3rem;
  font-weight: 800;
  margin-top: 6px;
}

.school-profile-grid {
  display: grid;
  grid-template-columns: minmax(320px, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}

.school-profile-grid > .card {
  min-width: 0;
  overflow: hidden;
}

.school-form-grid,
.school-asset-grid {
  min-width: 0;
}

.school-form-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.school-form-section h4 {
  margin: 0 0 12px;
}

.school-form-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.school-asset-grid {
  display: grid;
  gap: 12px;
}

.school-asset-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.school-asset-preview {
  width: 100%;
  min-width: 0;
  min-height: 160px;
  max-width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.school-asset-card img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 140px;
  object-fit: contain;
}

.school-asset-header {
  font-weight: 700;
  color: #0f172a;
}

.school-asset-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
}

.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.settings-card-head h3 {
  margin: 0;
}

.settings-intro {
  margin: 0;
}

.settings-form {
  display: grid;
  gap: 10px;
}

.settings-card-body {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 4px;
}

.settings-card-wide {
  grid-column: span 2;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.settings-check input {
  width: auto;
  margin: 0;
}

@media (max-width: 1120px) {
  .settings-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }

  .settings-card-wide {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-card-wide {
    grid-column: span 1;
  }

  .settings-card-body {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

.teacher-profile-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
}

.teacher-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.teacher-subject-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #9ad9cd;
  background: linear-gradient(180deg, #effcf8 0%, #e2f8f2 100%);
  color: #0f4f47;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.pending-comment-action-cell {
  min-width: 144px;
}

.pending-comment-action-btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #bfd7cb;
  background: linear-gradient(180deg, #ffffff 0%, #ecfaf5 100%);
  color: #0f5c4d;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(15, 92, 77, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.3;
}

.pending-comment-action-btn:hover {
  transform: translateY(-1px);
  border-color: #63b89c;
  box-shadow: 0 14px 24px rgba(15, 92, 77, 0.12);
}

.band-chart {
  display: grid;
  gap: 10px;
}

.band-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(160px, 4fr) 52px;
  align-items: center;
  gap: 10px;
}

.band-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
  color: #1e293b;
}

.band-track {
  height: 12px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.band-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.error-log-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.error-summary-card {
  border-width: 1px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.error-summary-count {
  font-size: 2rem;
  font-weight: 800;
  margin: 4px 0 8px;
}

.severity-critical {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
}

.severity-high {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
}

.severity-medium {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}

.severity-low {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.severity-priority-users {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}

.severity-background-noise {
  border-color: #dbeafe;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.error-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: end;
}

.error-filter-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.error-filter-actions .ghost-btn {
  width: auto;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost-btn.is-active {
  border-color: #0f766e;
  color: #0f766e;
  background: #ecfeff;
  font-weight: 700;
}

.error-bulk-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.error-group-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 18px 0 10px;
}

.severity-chip.severity-critical {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.severity-chip.severity-high {
  color: #9a3412;
  background: #ffedd5;
  border-color: #fdba74;
}

.severity-chip.severity-medium {
  color: #854d0e;
  background: #fef3c7;
  border-color: #fcd34d;
}

.severity-chip.severity-low {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #93c5fd;
}

.severity-chip.severity-priority-users {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.severity-chip.severity-background-noise {
  color: #475569;
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.error-log-table {
  min-width: 920px;
  table-layout: fixed;
}

.error-log-select-col {
  width: 90px;
}

.error-log-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.error-log-checkbox input {
  width: auto;
  margin: 0;
}

.error-log-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.error-log-open-btn {
  width: min(160px, 100%);
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  text-align: left;
}

.error-log-open-btn:hover {
  transform: translateY(-1px);
  border-color: #0f766e;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.error-log-open-btn-label {
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.1;
}

.error-log-open-btn-meta {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.2;
}

.error-log-table th:nth-child(2),
.error-log-table td:nth-child(2) {
  width: 24%;
}

.error-log-table th:nth-child(3),
.error-log-table td:nth-child(3) {
  width: 25%;
}

.error-log-table th:nth-child(4),
.error-log-table td:nth-child(4) {
  width: 16%;
}

.error-log-table th:nth-child(5),
.error-log-table td:nth-child(5) {
  width: 12%;
}

.error-log-table th:last-child,
.error-log-table td:last-child {
  width: 170px;
  position: sticky;
  right: 0;
  z-index: 1;
  background: #fffdf9;
}

.error-log-table thead th:last-child {
  z-index: 2;
  background: #f8fafc;
}

.error-log-modal-panel {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  text-align: left;
}

.error-log-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.error-log-close-btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #d7dde8;
  background: #ffffff;
  color: #475569;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.error-log-close-btn:hover {
  border-color: #94a3b8;
  color: #0f172a;
  background: #f8fafc;
}

.error-log-inspector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.error-log-panel {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #dbe3ec;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.error-log-panel h4 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: #0f172a;
}

.error-log-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 14px;
  margin: 0;
}

.error-log-meta div {
  min-width: 0;
}

.error-log-meta .full-width {
  grid-column: 1 / -1;
}

.error-log-meta dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}

.error-log-meta dd {
  margin: 0;
  color: #0f172a;
  word-break: break-word;
}

.error-log-panel pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  overflow-x: auto;
}

.error-log-wrap {
  word-break: break-word;
}

.student-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.student-row-action-form {
  margin: 0;
}

.student-row-action {
  width: auto;
  min-width: 118px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.student-row-action:hover {
  transform: translateY(-1px);
}

.student-row-action-edit {
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
  color: #163b73;
  border-color: #bfd3f8;
  box-shadow: 0 10px 20px rgba(22, 59, 115, 0.08);
}

.student-row-action-edit:hover {
  border-color: #7aa2e8;
  box-shadow: 0 14px 24px rgba(22, 59, 115, 0.12);
}

.student-row-action-danger {
  background: linear-gradient(135deg, #c32035, #a51226);
  color: #fff;
  border-color: #9f1239;
  box-shadow: 0 10px 20px rgba(159, 18, 57, 0.16);
}

.student-row-action-danger:hover {
  filter: brightness(1.04);
  box-shadow: 0 14px 24px rgba(159, 18, 57, 0.22);
}

.exam-row-action {
  width: auto;
  min-width: 126px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #bfd7cb;
  background: linear-gradient(180deg, #ffffff 0%, #ecfaf5 100%);
  color: #0f5c4d;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(15, 92, 77, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.exam-row-action:hover {
  transform: translateY(-1px);
  border-color: #63b89c;
  box-shadow: 0 14px 24px rgba(15, 92, 77, 0.12);
}

.exam-list-wrap {
  overflow-x: auto;
}

.exam-list-table {
  min-width: 920px;
}

.exam-list-title {
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}

.exam-list-meta {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.82rem;
}

.exam-list-term {
  font-weight: 700;
  color: #163b73;
}

.exam-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #dbe3f1;
  background: #f8fbff;
  color: #163b73;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.exam-status-chip.exam-status-open {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.exam-status-chip.exam-status-draft {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #c4b5fd;
}

.exam-status-chip.exam-status-closed {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fdba74;
}

.exam-status-chip.exam-status-completed {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.exam-scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exam-scope-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #d9e5d2;
  background: linear-gradient(180deg, #f7fcf3 0%, #edf7e6 100%);
  color: #365314;
  font-size: 0.8rem;
  font-weight: 700;
}

.exam-scope-empty {
  color: #64748b;
  font-size: 0.84rem;
}

.band-exceed {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.band-meeting {
  background: linear-gradient(135deg, #0284c7, #0369a1);
}

.band-approaching {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.band-below {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.band-pct {
  text-align: right;
  font-weight: 600;
  color: #334155;
}

.merit-score-cell {
  min-width: 150px;
}

.merit-score-cell span {
  display: inline-block;
  min-width: 42px;
  font-weight: 600;
  color: #1e293b;
}

.merit-score-track {
  margin-top: 4px;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.merit-score-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  align-items: end;
  gap: 10px;
}

.trend-chart-wrap {
  overflow-x: auto;
}

.trend-chart-inner {
  min-width: 560px;
}

.trend-chart-svg {
  display: block;
  width: 100%;
  height: 220px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid #dbe3ef;
  border-radius: 10px;
}

.trend-grid-line {
  stroke: #dbe3ef;
  stroke-width: 0.4;
}

.trend-axis-label {
  fill: #94a3b8;
  font-size: 2.8px;
  text-anchor: end;
}

.trend-bar-rect {
  fill: #7dd3fc;
  stroke: #0284c7;
  stroke-width: 0.3;
}

.trend-bar-rect.is-current {
  fill: #38bdf8;
  stroke: #0369a1;
  stroke-width: 0.5;
}

.trend-line-path {
  fill: none;
  stroke: #dc2626;
  stroke-width: 0.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-line-point {
  fill: #dc2626;
  stroke: #ffffff;
  stroke-width: 0.28;
}

.trend-chart-labels {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.trend-chart-label-col {
  text-align: center;
}

.trend-chart-label-col.is-current .trend-bar-value,
.trend-chart-label-col.is-current .trend-bar-label {
  color: #0f172a;
}

.trend-combo-wrap {
  overflow-x: auto;
}

.trend-combo-chart {
  position: relative;
  min-width: 560px;
  padding-top: 16px;
}

.trend-combo-bars {
  display: grid;
  align-items: end;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.trend-combo-col {
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px 8px;
  display: grid;
  gap: 6px;
}

.trend-combo-col.is-current {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.15) inset;
}

.trend-line-svg {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 40px;
  height: 140px;
  width: calc(100% - 16px);
  z-index: 2;
  pointer-events: none;
}

.trend-line-svg polyline {
  fill: none;
  stroke: #dc2626;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-line-svg circle {
  fill: #dc2626;
  stroke: #ffffff;
  stroke-width: 0.8;
}

.trend-combo-labels {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  min-width: 560px;
}

.trend-combo-label-col {
  text-align: center;
}

.trend-combo-label-col.is-current .trend-bar-label {
  color: #0f172a;
}

.trend-bar-col {
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px 8px;
  display: grid;
  gap: 6px;
}

.trend-bar-col.is-current {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.15) inset;
}

.trend-bar-value {
  text-align: center;
  font-weight: 700;
  color: #0f172a;
}

.trend-bar-track {
  height: 140px;
  border-radius: 8px;
  background: #e2e8f0;
  position: relative;
  overflow: hidden;
}

.trend-bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #0ea5e9, #0369a1);
}

.trend-bar-label {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.trend-bar-meta {
  text-align: center;
  font-size: 0.76rem;
  color: #64748b;
}

.trend-bar-name {
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.2;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .portal-hero {
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 10px 0 20px;
  }

  .portal-hero-copy h1 {
    font-size: 1.8rem;
    line-height: 1.12;
  }

  .portal-hero-panel {
    min-height: 0;
    padding: 14px;
  }

  .portal-stamp {
    padding: 14px;
  }

  .portal-grid,
  .portal-help {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .portal-card,
  .portal-help-card {
    padding: 14px;
  }

  .portal-card-title {
    font-size: 1rem;
  }

  .offline-panel {
    width: 100%;
    padding: 20px 16px;
  }

  .offline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .offline-actions .portal-pill,
  .offline-actions .portal-pill-ghost {
    width: 100%;
    justify-content: center;
  }

  .offline-tip {
    width: 100%;
  }

  .student-dashboard .registry-table th,
  .student-dashboard .registry-table td {
    padding: 8px;
    font-size: 0.85rem;
  }

  .student-dashboard .tab-btn {
    width: 100%;
    text-align: left;
  }

  .student-dashboard .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .teacher-subject-chip {
    width: 100%;
    justify-content: center;
    border-radius: 16px;
    padding: 10px 12px;
  }

  .error-bulk-bar,
  .error-group-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .error-filter-actions {
    width: 100%;
  }

  .error-filter-actions button,
  .error-filter-actions .ghost-btn {
    width: 100%;
  }

  .error-log-modal-header {
    width: 100%;
    flex-direction: column;
  }

  .error-log-open-btn {
    width: 100%;
    align-items: stretch;
  }

  .student-row-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .student-row-action,
  .student-row-action-form,
  .student-row-action-form .student-row-action,
  .exam-row-action {
    width: 100%;
    min-width: 0;
  }

  .exam-list-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 12px;
  }

  .exam-list-table thead {
    display: none;
  }

  .exam-list-table tbody,
  .exam-list-table tr,
  .exam-list-table td {
    display: block;
    width: 100%;
  }

  .exam-list-table tr {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
  }

  .exam-list-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e8edf5;
  }

  .exam-list-table td:last-child {
    border-bottom: none;
  }

  .exam-list-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .exam-list-title {
    font-size: 1rem;
  }

  .exam-list-meta {
    font-size: 0.78rem;
  }

  .pending-comment-action-cell {
    min-width: 132px;
  }

  .pending-comment-action-btn {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .student-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .portal-actions,
  .student-hero-metrics,
  .student-inline-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .portal-student-highlights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .portal-pill,
  .student-inline-actions .ghost-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .portal-mini-pill {
    width: 100%;
    min-height: 48px;
    padding: 10px 8px;
    line-height: 1.2;
    border-radius: 14px;
  }

  .portal-cta {
    align-self: stretch;
    text-align: center;
  }

  .student-snapshot-grid {
    grid-template-columns: 1fr;
  }

  .student-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .student-hero-metric {
    width: 100%;
  }

  .student-timeline-item,
  .student-timeline-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .student-subject-pill {
    align-items: flex-start;
    flex-direction: column;
  }

  .school-hero {
    grid-template-columns: 1fr;
  }

  .school-hero-chip {
    justify-self: start;
    width: 100%;
  }

  .school-profile-grid {
    grid-template-columns: 1fr;
  }

  .school-profile-grid > .card {
    overflow: visible;
  }

  .school-form-actions {
    flex-direction: column;
  }

  .school-form-actions button {
    width: 100%;
  }


  .nav {
    padding: 10px 14px;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .menu a {
    margin: 0 8px 8px 0;
    display: inline-block;
  }

  .flash-dialog-stack {
    top: 94px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .grade-preview-row {
    grid-template-columns: 1fr;
  }

  .confirm-modal-actions {
    justify-content: stretch;
  }

  .modal-btn {
    flex: 1;
  }

  .manage-row {
    grid-template-columns: 1fr;
  }

  .assignment-layout {
    grid-template-columns: 1fr;
  }

  .subject-group-actions {
    width: 100%;
  }

  .subject-group-actions .ghost-btn {
    flex: 1;
  }

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

  .flow-steps {
    gap: 8px;
  }

  .flow-arrow {
    display: none;
  }

  .flow-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .flow-actions a,
  .flow-actions button {
    flex: 1 1 180px;
  }

  .band-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .band-pct {
    text-align: left;
  }

  .trend-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-chart-inner {
    min-width: 520px;
  }

  .trend-combo-chart,
  .trend-combo-labels {
    min-width: 520px;
  }

  .entry-grid-tight {
    grid-template-columns: 1fr;
  }

  .table-action-cell .inline-btn {
    min-width: 0;
  }

  .action-cell {
    display: grid;
    grid-template-columns: 1fr;
  }

  .action-cell .ghost-btn,
  .action-cell .danger-btn,
  .action-cell .inline-delete-form,
  .table-action-cell .ghost-btn,
  .table-action-cell .danger-btn,
  .table-action-cell .inline-btn,
  .registry-table .ghost-btn,
  .registry-table .danger-btn,
  .registry-table .inline-btn {
    width: 100%;
    min-width: 0;
  }

  .action-cell .inline-delete-form button,
  .table-action-cell .inline-delete-form button {
    width: 100%;
  }

  .teacher-hero,
  .teacher-dashboard-grid,
  .teacher-profile-row {
    grid-template-columns: 1fr;
  }

  .teacher-profile {
    align-items: flex-start;
  }

  .teacher-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .score-table {
    min-width: 100%;
    width: 100%;
    table-layout: fixed;
  }

  .score-table th,
  .score-table td {
    padding: 8px;
    font-size: 0.86rem;
    word-wrap: break-word;
    white-space: normal;
  }

  .score-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .score-table .score-cell {
    font-size: 0.98rem;
  }

  .score-subject-cell.is-component {
    padding-left: 14px;
  }

  .note-full {
    display: none;
  }

  .note-alias {
    display: inline;
  }
}
