@font-face {
  font-family: "Quattrocento Sans";
  src: url("/assets/fonts/quattrocento-sans-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Quattrocento Sans";
  src: url("/assets/fonts/quattrocento-sans-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
}

@font-face {
  font-family: "Kalam";
  src: url("/assets/fonts/kalam-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --brand-red: #c8102e;
  --brand-red-dark: #8f0b22;
  --brand-red-soft: #fbe9ec;
  --brand-gold: #f2a900;
  --brand-gold-soft: #fbefd4;
  --brand-gold-dark: #8a6100;
  --ink-900: #1c1815;
  --bg-page: #f7f4f0;
  --white: #fff;
  --border: #e7e0d8;
  --track: #efe9e2;
  --text: #221d19;
  --text-secondary: #6f665d;
  --placeholder: #9a9186;
  --on-dark: #fff;
  --on-dark-muted: #b4aa9e;
  --success: #2e7d4f;
  --success-soft: #e2f0e8;
  --warning: #b7791f;
  --danger: #b42318;
  --danger-soft: #fbe5e2;
  --sidebar-width: 240px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: "Quattrocento Sans", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

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

button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

[hidden] {
  display: none !important;
}

:where(a, button, input, select, summary):focus-visible {
  outline: 3px solid var(--brand-gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  inset-block-start: 10px;
  inset-inline-start: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--white);
  color: var(--brand-red);
  font-weight: 700;
  translate: 0 -150%;
}

.skip-link:focus {
  translate: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.loading-screen {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.loading-screen h1 {
  color: var(--brand-red);
  font-family: "Kalam", cursive;
  font-size: 48px;
}

/* Authentication */

.login-page {
  min-width: 1000px;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(440px, 1.08fr) minmax(520px, 1fr);
  background: var(--white);
}

.login-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: clip;
  padding: 42px 54px;
  background: var(--ink-900);
  color: var(--on-dark);
}

.login-story::after {
  content: "";
  position: absolute;
  width: 480px;
  aspect-ratio: 1;
  right: -210px;
  bottom: -210px;
  border: 1px solid rgb(242 169 0 / 25%);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgb(200 16 46 / 8%), 0 0 0 140px rgb(242 169 0 / 4%);
  pointer-events: none;
}

.login-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.brand-word {
  color: var(--brand-gold);
  font-family: "Kalam", cursive;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .5px;
}

.brand-school {
  display: block;
  margin-top: 5px;
  color: var(--on-dark-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.25px;
  line-height: 1.2;
}

.login-message {
  position: relative;
  z-index: 1;
  max-width: 490px;
  padding-block: 70px;
}

.login-eyebrow {
  margin-bottom: 18px;
  color: var(--brand-gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.login-message h1 {
  max-width: 460px;
  font-size: clamp(36px, 3.3vw, 52px);
  line-height: 1.12;
  letter-spacing: -1.2px;
}

.login-message > p:not(.login-eyebrow) {
  max-width: 420px;
  margin-top: 22px;
  color: var(--on-dark-muted);
  font-size: 16px;
  line-height: 1.7;
}

.login-features {
  display: grid;
  gap: 16px;
  margin-top: 36px;
  list-style: none;
}

.login-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e9e2d9;
  font-size: 14px;
}

.feature-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  color: var(--brand-gold);
}

.login-footnote {
  position: relative;
  z-index: 1;
  color: var(--on-dark-muted);
  font-size: 12px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 48px 64px;
  background: var(--bg-page);
}

.login-box {
  width: min(100%, 430px);
}

.login-box h2 {
  font-size: 28px;
  line-height: 1.25;
}

.login-intro {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 15px;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
}

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

.field label,
.field-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--brand-red);
}

.field input::placeholder {
  color: var(--placeholder);
}

.field-hint {
  color: var(--text-secondary);
  font-size: 12px;
}

.form-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.demo-access {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid #ecd9ae;
  border-radius: 12px;
  background: var(--brand-gold-soft);
}

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

.demo-access h2 {
  color: var(--brand-gold-dark);
  font-size: 13px;
}

.demo-access p {
  margin-top: 6px;
  color: #705820;
  font-size: 12px;
}

.demo-account-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.demo-account-button {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgb(138 97 0 / 25%);
  border-radius: 999px;
  background: rgb(255 255 255 / 55%);
  color: var(--brand-gold-dark);
  font-size: 12px;
  font-weight: 700;
}

.demo-account-button:hover {
  background: var(--white);
}

.demo-password {
  margin-top: 10px;
  font-size: 12px;
}

.demo-password code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgb(255 255 255 / 70%);
  font-family: inherit;
  font-weight: 700;
}

/* Application shell */

.app-shell {
  min-width: 1100px;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  background: var(--ink-900);
  color: var(--on-dark);
}

.sidebar-brand {
  padding: 0 8px 22px;
}

.sidebar-brand .brand-word {
  font-size: 26px;
}

.sidebar-brand .brand-school {
  max-width: 140px;
  font-size: 8px;
}

.course-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 20px;
  padding: 11px 10px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 8px;
  background: rgb(255 255 255 / 4%);
}

.course-switcher .icon {
  color: var(--brand-gold);
}

.course-switcher-text {
  min-width: 0;
  flex: 1;
}

.course-switcher-text strong,
.course-switcher-text span {
  display: block;
}

.course-switcher-text strong {
  font-size: 12px;
}

.course-switcher-text span {
  color: var(--on-dark-muted);
  font-size: 10px;
}

.nav-label {
  padding: 0 12px 8px;
  color: #8f857b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.primary-nav ul {
  display: grid;
  gap: 5px;
  list-style: none;
}

.nav-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--on-dark-muted);
  font-weight: 400;
  transition: background 120ms ease, color 120ms ease;
}

.nav-link:hover {
  background: rgb(255 255 255 / 6%);
  color: var(--on-dark);
}

.nav-link[aria-current="page"] {
  background: var(--brand-red);
  color: var(--white);
  font-weight: 700;
}

.nav-link[aria-current="page"]::after {
  content: "";
  width: 5px;
  height: 5px;
  margin-inline-start: auto;
  border-radius: 50%;
  background: var(--white);
}

.sidebar-note {
  margin: 24px 8px 0;
  padding: 13px;
  border-radius: 8px;
  background: rgb(242 169 0 / 8%);
  color: var(--on-dark-muted);
  font-size: 11px;
  line-height: 1.55;
}

.sidebar-note strong {
  display: block;
  margin-bottom: 3px;
  color: var(--brand-gold);
  font-size: 11px;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 6px 2px;
  border-top: 1px solid rgb(255 255 255 / 10%);
}

.profile-copy {
  min-width: 0;
  flex: 1;
}

.profile-copy strong,
.profile-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy strong {
  font-size: 12px;
}

.profile-copy span {
  color: var(--on-dark-muted);
  font-size: 10px;
  text-transform: capitalize;
}

.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-gold-soft);
  color: var(--brand-gold-dark);
  font-size: 11px;
  font-weight: 700;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 10px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
}

.icon-button:hover {
  background: var(--track);
  color: var(--text);
}

.sidebar .icon-button {
  color: var(--on-dark-muted);
}

.sidebar .icon-button:hover {
  background: rgb(255 255 255 / 7%);
  color: var(--white);
}

.main-shell {
  min-height: 100dvh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.page-title {
  flex: 1;
  font-size: 22px;
  line-height: 30px;
  letter-spacing: -.25px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-container {
  position: relative;
}

.search-box {
  width: 280px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-page);
  color: var(--text-secondary);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: 0;
  font-size: 12px;
}

.search-box input::placeholder {
  color: var(--placeholder);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 360px;
  max-height: 420px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
}

.search-result:hover {
  background: var(--bg-page);
}

.search-result-copy {
  flex: 1;
  min-width: 0;
}

.search-result-copy strong,
.search-result-copy span {
  display: block;
}

.search-result-copy strong {
  font-size: 12px;
}

.search-result-copy span {
  color: var(--text-secondary);
  font-size: 11px;
}

.search-empty {
  padding: 18px 12px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 12px;
}

.notification-button {
  position: relative;
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--brand-red);
  box-sizing: content-box;
}

.notifications-panel {
  inset: 70px 24px auto auto;
  width: 320px;
  max-height: 420px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
}

.notifications-panel::backdrop {
  background: transparent;
}

.popover-header {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.notification-item {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-item:last-child {
  border: 0;
}

.notification-item p {
  font-size: 12px;
}

.notification-item time {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
}

.content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 30px 40px;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  padding: 9px 12px;
  border: 1px solid #ead6a9;
  border-radius: 8px;
  background: var(--brand-gold-soft);
  color: var(--brand-gold-dark);
  font-size: 12px;
}

.demo-banner strong {
  font-weight: 700;
}

.demo-banner .icon {
  width: 15px;
  height: 15px;
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.view-heading h2 {
  font-size: 26px;
  line-height: 34px;
  letter-spacing: -.5px;
}

.view-heading p {
  margin-top: 4px;
  color: var(--text-secondary);
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
}

.button-primary {
  background: var(--brand-red);
  color: var(--white);
}

.button-primary:hover {
  background: var(--brand-red-dark);
}

.button-secondary {
  border-color: var(--border);
  background: var(--white);
  color: var(--text);
  font-weight: 600;
}

.button-secondary:hover {
  background: var(--bg-page);
}

.button-gold {
  background: var(--brand-gold);
  color: var(--ink-900);
}

.button-gold:hover {
  background: #d99a08;
}

.button-sm {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12px;
}

.button-full {
  width: 100%;
}

.button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--brand-red);
  font-size: 12px;
  font-weight: 700;
}

.text-link:hover {
  color: var(--brand-red-dark);
  text-decoration: underline;
}

.card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
}

.card-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
  font-size: 16px;
  line-height: 24px;
}

.card-header-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.card-body {
  padding: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: grid;
  gap: 4px;
  padding: 17px 18px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 36px;
}

.stat-subtext {
  color: var(--text-secondary);
  font-size: 12px;
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 20px;
}

.list {
  list-style: none;
}

.list-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.list-row:first-child {
  border-top: 0;
}

.list-row-main {
  flex: 1;
  min-width: 0;
}

.list-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
}

.list-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.list-row-action {
  flex: 0 0 auto;
}

.class-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.class-icon.gold {
  background: var(--brand-gold-soft);
  color: var(--brand-gold-dark);
}

.row-progress {
  width: 130px;
  flex: 0 0 auto;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

progress {
  width: 100%;
  height: 6px;
  display: block;
  flex: 1;
  overflow: clip;
  border: 0;
  border-radius: 999px;
  background: var(--track);
  color: var(--brand-red);
  accent-color: var(--brand-red);
  appearance: none;
}

progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--track);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--brand-red);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--brand-red);
}

progress.success {
  color: var(--success);
  accent-color: var(--success);
}

progress.success::-webkit-progress-value {
  background: var(--success);
}

progress.success::-moz-progress-bar {
  background: var(--success);
}

.progress-label {
  min-width: 34px;
  color: var(--text-secondary);
  font-size: 11px;
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--track);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
}

.badge-active,
.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-info {
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.badge-watch,
.badge-warning {
  background: var(--brand-gold-soft);
  color: var(--brand-gold-dark);
}

.badge-closed,
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-neutral {
  background: var(--track);
  color: var(--text-secondary);
}

.date-item {
  display: flex;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
}

.date-item:first-child {
  border-top: 0;
}

.date-block {
  width: 38px;
  flex: 0 0 auto;
  overflow: clip;
  border: 1px solid var(--border);
  border-radius: 7px;
  text-align: center;
}

.date-block span,
.date-block strong {
  display: block;
}

.date-block span {
  padding: 2px;
  background: var(--brand-red-soft);
  color: var(--brand-red);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.date-block strong {
  padding: 2px 0 4px;
  font-size: 16px;
}

.date-copy strong {
  display: block;
  font-size: 12px;
}

.date-copy span {
  color: var(--text-secondary);
  font-size: 11px;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 42px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.empty-state h3 {
  font-size: 16px;
}

.empty-state p {
  max-width: 400px;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.empty-state .button {
  margin-top: 18px;
}

/* Filters and tables */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-chip {
  min-height: 32px;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.filter-chip:hover {
  border-color: #cfc5ba;
  color: var(--text);
}

.filter-chip[aria-pressed="true"] {
  border-color: var(--ink-900);
  background: var(--ink-900);
  color: var(--white);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

caption {
  padding: 0 18px 12px;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
}

th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: #fcfaf8;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td .progress-line {
  min-width: 120px;
}

.table-title {
  font-size: 14px;
  font-weight: 600;
}

.table-meta {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}

/* Textbook */

.textbook-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.textbook-tree {
  position: sticky;
  top: 88px;
  max-height: calc(100dvh - 112px);
  display: flex;
  flex-direction: column;
  overflow: clip;
}

.tree-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.tree-header h2 {
  font-size: 15px;
}

.tree-header p {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 11px;
}

.tree-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.chapter-disclosure {
  border-radius: 8px;
}

.chapter-disclosure summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}

.chapter-disclosure summary::-webkit-details-marker {
  display: none;
}

.chapter-disclosure summary:hover {
  background: var(--bg-page);
}

.chapter-disclosure summary .chevron {
  transition: rotate 120ms ease;
}

.chapter-disclosure[open] summary .chevron {
  rotate: 90deg;
}

.chapter-number {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--track);
  color: var(--text-secondary);
  font-size: 11px;
}

.chapter-disclosure[open] .chapter-number {
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.section-list {
  display: grid;
  gap: 2px;
  margin: 2px 0 8px 19px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  list-style: none;
}

.section-link {
  min-height: 34px;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 7px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.section-link:hover {
  background: var(--bg-page);
  color: var(--text);
}

.section-link[aria-current="page"] {
  background: var(--brand-red-soft);
  color: var(--brand-red);
  font-weight: 700;
}

.section-code {
  flex: 0 0 auto;
  font-weight: 700;
}

.level-dot {
  margin: 5px 0 0 auto;
  color: var(--brand-gold-dark);
  font-size: 8px;
  font-weight: 700;
}

.reader {
  min-width: 0;
}

.reader-card {
  overflow: clip;
}

.reader-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  color: var(--text-secondary);
  font-size: 12px;
}

.breadcrumb strong {
  color: var(--text);
}

.reader-content {
  min-height: 500px;
  display: grid;
  place-items: center;
  padding: 56px 40px;
}

.content-placeholder {
  max-width: 520px;
  text-align: center;
}

.placeholder-symbol {
  position: relative;
  width: 78px;
  height: 88px;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-page);
  color: var(--brand-red);
}

.placeholder-symbol::after {
  content: "";
  position: absolute;
  inset: 8px -8px -8px 8px;
  z-index: -1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
}

.content-placeholder .badge {
  margin-bottom: 14px;
}

.content-placeholder h2 {
  font-size: 26px;
  line-height: 34px;
  letter-spacing: -.4px;
}

.content-placeholder > p {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.placeholder-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 22px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--track);
  color: var(--text-secondary);
  font-size: 12px;
}

.section-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-top: 1px solid var(--border);
}

.pager-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.pager-link:hover {
  color: var(--brand-red);
}

.pager-link.next {
  text-align: right;
}

.practice-card {
  margin-top: 20px;
}

.practice-card .empty-state {
  padding: 32px 20px;
}

.practice-card .empty-state-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
}

/* Assignments and progress */

.assignment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.assignment-title-cell {
  max-width: 340px;
}

.assignment-row-progress {
  width: 100%;
  margin-top: 8px;
}

.score-pill {
  display: inline-block;
  min-width: 46px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.jump-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.jump-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
}

.jump-card:hover {
  border-color: #cdbfb5;
}

.jump-card-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--brand-red-soft);
  color: var(--brand-red);
}

.jump-card.gold .jump-card-icon {
  background: var(--brand-gold-soft);
  color: var(--brand-gold-dark);
}

.jump-card-copy {
  flex: 1;
}

.jump-card-copy span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.jump-card-copy h2 {
  margin-top: 3px;
  font-size: 16px;
}

.jump-card-copy p {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.jump-card > .icon {
  color: var(--text-secondary);
}

.chart {
  display: flex;
  align-items: end;
  gap: 12px;
  height: 210px;
  padding: 22px 18px 14px;
}

.chart-column {
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.chart-value {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.chart-bar-track {
  width: min(100%, 36px);
  height: calc(100% - 44px);
  display: flex;
  align-items: end;
  border-radius: 5px 5px 0 0;
  background: var(--track);
}

.chart-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: var(--brand-red);
}

.chart-column.latest .chart-bar,
.chart-column.peak .chart-bar {
  background: var(--brand-red-dark);
}

.chart-label {
  color: var(--text-secondary);
  font-size: 10px;
  white-space: nowrap;
}

.mastery-list {
  list-style: none;
}

.mastery-item {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.mastery-item:first-child {
  border-top: 0;
}

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

.mastery-top strong {
  font-size: 13px;
}

.mastery-top span {
  color: var(--text-secondary);
  font-size: 12px;
}

.mastery-item .text-link {
  margin-top: 8px;
}

.watchlist-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
}

/* Dialogs and notifications */

dialog {
  width: min(560px, calc(100% - 40px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  color: var(--text);
}

dialog[open] {
  animation: dialog-in 140ms ease-out;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgb(28 24 21 / 55%);
}

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

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  font-size: 20px;
}

.dialog-header p {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.dialog-form {
  display: grid;
  gap: 17px;
  padding: 22px;
}

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

.dialog-note {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--brand-gold-soft);
  color: var(--brand-gold-dark);
  font-size: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: #fcfaf8;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink-900);
  color: var(--white);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  translate: 0 8px;
  transition: opacity 140ms ease, translate 140ms ease;
}

.toast.visible {
  opacity: 1;
  translate: 0;
}

@media (max-width: 1240px) {
  :root {
    --sidebar-width: 220px;
  }

  .content,
  .topbar {
    padding-inline: 24px;
  }

  .stats-grid {
    gap: 12px;
  }

  .stat-card {
    padding: 15px;
  }

  .textbook-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

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

@media (forced-colors: active) {
  .nav-link[aria-current="page"],
  .section-link[aria-current="page"] {
    outline: 2px solid currentColor;
    outline-offset: -2px;
  }

  .badge,
  .card,
  .button {
    border: 1px solid currentColor;
  }
}
