:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #292524;
  background: #f6f4ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;

  --bg: #f6f4ef;
  --surface: #ffffff;
  --subtle: #faf8f3;
  --border: #e6e0d4;
  --border-strong: #d6cec0;
  --ink: #1c1917;
  --ink-body: #38332e;
  --muted: #6e675f;
  --faint: #9a9287;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #047857;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

:root[data-theme="polaris"] {
  --blue: #1e3a5f;
  --blue-hover: #162c48;
  --border: #e2dcd0;
  --border-strong: #cfc7b8;
}

:root[data-theme="polaris"] .site-name {
  color: #1e3a5f;
}

:root[data-theme="polaris"] .entry-brand {
  color: #1e3a5f;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  min-width: 320px;
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, #f2ede3 0%, #f6f4ef 220px, #f7f5f0 100%);
  background-attachment: fixed;
  color: var(--ink-body);
  font-size: 15.5px;
  line-height: 1.68;
}

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

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

:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

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

/* ---- Minimal Login Portal ---- */

.entry {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 1.5rem;
}

.entry-box {
  width: min(100%, 16rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.entry-brand {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--muted);
  user-select: none;
}

.login-form {
  width: 100%;
}

.login-form input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 140ms ease;
}

.login-form input:focus {
  border-color: var(--blue);
  outline: none;
}

.login-form input[aria-invalid="true"] {
  border-color: var(--danger);
}

.login-form input:read-only {
  cursor: wait;
  opacity: 0.65;
}

.entry-status {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.82rem;
  color: var(--danger);
  text-align: center;
}

/* ---- Header (matches wentongzhang.com) ---- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: rgba(253, 252, 249, 0.90);
  backdrop-filter: blur(8px);
}

.site-shell {
  width: 100%;
  max-width: 54rem;
  margin: 0 auto;
  padding-inline: 1.5rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding-block: 0.75rem;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.site-name {
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 450;
  letter-spacing: -0.025em;
  line-height: 1;
  white-space: nowrap;
  border-radius: 0.25rem;
  transition: color 150ms ease;
}

.site-name:hover {
  color: var(--blue);
}

.role-label {
  font-size: 0.82rem;
  line-height: 1;
  color: var(--muted);
  padding-left: 0.65rem;
  border-left: 1px solid var(--border);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  padding: 0.2rem 0.15rem;
  color: #4b5563;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 0.25rem;
  transition: color 150ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--blue);
}

.nav-button {
  background: none;
  border: none;
  cursor: pointer;
}

/* ---- Page Container & Typography ---- */

.page-section {
  min-height: 100vh;
  padding: 5.5rem 0 5rem;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.page-stack-tight {
  gap: 1.65rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  transition: color 150ms ease;
}

.back-link:hover {
  color: var(--blue-hover);
}

.breadcrumb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.breadcrumb-row .back-link {
  margin-bottom: 0;
}

.breadcrumb-sep {
  color: var(--faint);
  font-size: 0.82rem;
  user-select: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.section-head-actions {
  align-items: center;
  padding-bottom: 0.85rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.page-title {
  margin: 0;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 450;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.page-desc {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 42rem;
  line-height: 1.55;
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.section-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}

.text-action {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 140ms ease;
}

.text-action:hover {
  color: var(--blue-hover);
}

.text-action.is-primary {
  color: var(--blue);
  font-weight: 500;
}

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

.text-action:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ---- Buttons (minimal, crisp) ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--subtle);
  border-color: #9ca3af;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #1f2937;
  border-color: #1f2937;
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--subtle);
  border-color: transparent;
  color: var(--ink);
}

.btn-danger {
  color: var(--danger);
  border-color: #fca5a5;
}

.btn-danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #f87171;
}

.btn-sm {
  padding: 0.3rem 0.62rem;
  font-size: 0.81rem;
}

/* ---- Clean Editorial Lists ---- */

.plain-list {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1.25rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.list-row:last-child {
  border-bottom: none;
}

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

.row-title {
  display: inline;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 500;
  transition: color 140ms ease;
}

a.list-row:hover .row-title,
a.row-title:hover {
  color: var(--blue-hover);
}

.row-desc {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.meta-sep {
  color: #d1d5db;
}

.row-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.course-counts {
  display: grid;
  grid-template-columns: 7.25rem 6rem;
  gap: 0.5rem;
  text-align: right;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.course-counts.has-tests {
  grid-template-columns: 7.25rem 4.75rem 6rem;
}

.course-counts-inline {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.recent-kind-tag {
  display: inline-block;
  margin-right: 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.latest-lesson-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--subtle);
  font-size: 0.86rem;
}

.latest-lesson-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.latest-lesson-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue-hover);
}

.latest-lesson-title {
  font-weight: 550;
  color: var(--ink);
}

.latest-lesson-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  white-space: nowrap;
}

/* ---- Course Accent Dots & Quick-Reference Notation Modal ---- */

.row-title-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.course-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--blue);
}

.course-dot.is-blue { background: #2563eb; }
.course-dot.is-violet { background: #7c3aed; }
.course-dot.is-teal { background: #0d9488; }
.course-dot.is-emerald { background: #059669; }
.course-dot.is-amber { background: #d97706; }
.course-dot.is-rose { background: #e11d48; }
.course-dot.is-slate { background: #64748b; }

.summary-course-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-notation {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
  font-weight: 500;
}

.btn-notation:hover {
  border-color: var(--blue);
  color: var(--blue-hover);
}

.quick-ref-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.quick-ref-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}

.quick-ref-list {
  display: flex;
  flex-direction: column;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.quick-ref-group-head {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0.9rem 0 0.3rem;
}

.quick-ref-group-head:first-child {
  margin-top: 0.1rem;
}

.quick-ref-row {
  display: grid;
  grid-template-columns: minmax(7.25rem, 9.5rem) 1fr;
  gap: 0.4rem 1rem;
  padding: 0.65rem 0.45rem;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.quick-ref-row:last-child {
  border-bottom: none;
}

.quick-ref-symbol {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.quick-ref-detail {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.quick-ref-meaning {
  font-size: 0.9rem;
  color: var(--ink-body);
  line-height: 1.5;
}

.quick-ref-read {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.quick-ref-example {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.48;
}

.quick-ref-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.module-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.student-preview-note {
  padding: 0.85rem 1rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  background: var(--subtle);
}

.student-preview-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-body);
}

.instructor-vault {
  padding: 1rem 1.15rem;
  border-radius: 0.5rem;
  border: 1px dashed #cbd5e1;
  background: #fafafa;
}

.vault-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.52rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 550;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

/* Quiet status text instead of loud pill badges */

.status-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.status-text.status-graded { color: var(--ok); }
.status-text.status-submitted,
.status-text.status-resubmitted { color: var(--blue-hover); }
.status-text.status-returned { color: var(--warn); }
.status-text.status-missing,
.status-text.status-late { color: var(--danger); }
.status-text.status-draft,
.status-text.status-assigned,
.status-text.status-excused { color: var(--muted); }

/* ---- Tabs & Quiet Filters ---- */

.tabs {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 0.55rem 0;
  border: none;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -1px;
  background: none;
  font-size: 0.92rem;
  font-weight: 450;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1rem;
  font-size: 0.85rem;
}

.filter-link {
  background: none;
  border: none;
  padding: 0.15rem 0;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}

.filter-link:hover {
  color: var(--ink);
}

.filter-link.is-active {
  color: var(--ink);
  font-weight: 550;
  border-bottom-color: var(--ink);
}

.unit-heading {
  margin: 1.35rem 0 0;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.unit-heading:first-child {
  margin-top: 0.75rem;
}

.course-body {
  display: flex;
  flex-direction: column;
}

.course-body .filter-strip {
  padding-top: 0.85rem;
}

.course-body > .plain-list {
  margin-top: 0.25rem;
}

.course-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.course-tabs-bar .tabs {
  border-bottom: none;
}

.course-tabs-bar .btn {
  margin-bottom: 0.35rem;
}

.tab-action {
  background: none;
  border: none;
  padding: 0.4rem 0;
  color: var(--muted);
  font-size: 0.84rem;
  cursor: pointer;
  transition: color 140ms ease;
}

.tab-action:hover {
  color: var(--ink);
}

.module-picker {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* ---- Materials ---- */

.material-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.material-item:last-child {
  border-bottom: none;
}

.material-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.material-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 550;
  color: var(--ink);
}

/* ---- Prose / Markdown ---- */

.prose {
  color: var(--ink-body);
  font-size: 0.94rem;
  line-height: 1.68;
  word-break: break-word;
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0.65rem 0; }
.prose h1, .prose h2, .prose h3 {
  color: var(--ink);
  font-weight: 550;
  margin: 1.15rem 0 0.45rem;
  line-height: 1.35;
}
.prose h1 { font-size: 1.15rem; }
.prose h2 { font-size: 1.05rem; }
.prose h3 { font-size: 0.96rem; }
.prose ul, .prose ol { margin: 0.5rem 0 0.9rem; padding-left: 1.35rem; }
.prose li { margin: 0.25rem 0; }
.prose blockquote {
  margin: 0.75rem 0;
  padding-left: 0.95rem;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
  font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--subtle);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}
.prose pre {
  margin: 0.75rem 0;
  padding: 0.9rem 1rem;
  border-radius: 0.35rem;
  background: #f3f4f6;
  color: var(--ink);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
}
.prose pre code {
  background: none;
  padding: 0;
}
.prose a {
  color: #475569;
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
  text-underline-offset: 0.18em;
}
.prose a:hover {
  color: var(--blue-hover);
  text-decoration-color: #93c5fd;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.prose-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0.9rem 0 1.25rem;
}
.prose-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.5;
}
.prose-table th,
.prose-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.prose-table th {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom-color: var(--border-strong);
  white-space: nowrap;
}
.prose-table th.align-center,
.prose-table td.align-center {
  text-align: center;
}
.prose-table th.align-right,
.prose-table td.align-right {
  text-align: right;
}
.prose-table tbody tr:last-child td {
  border-bottom: none;
}

.syllabus-meta {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.85rem 0 0.65rem;
}

.syllabus-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.85rem 0 0.55rem;
}

.syllabus-meta-text {
  font-size: 0.78rem;
  color: var(--muted);
}

.tab-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.syllabus-section {
  margin-top: 1.25rem;
}

.syllabus-section-first {
  margin-top: 1.1rem;
}

.syllabus-overview-box {
  padding: 1rem 1.2rem;
}

.syllabus-plan-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.syllabus-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}

.syllabus-filter-strip {
  margin: 0;
  padding: 0;
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 0.95rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: border-color 140ms ease;
}

.lesson-card.is-upnext {
  border-color: #93c5fd;
  background: #f8fbff;
}

.lesson-card.is-completed {
  opacity: 0.68;
}

.lesson-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.lesson-card-left {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-width: 0;
}

.lesson-check {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  margin-top: 0.12rem;
  flex-shrink: 0;
  border-radius: 0.25rem;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.lesson-check:active {
  transform: scale(0.92);
}

.lesson-check:hover {
  border-color: var(--blue);
}

.lesson-check.is-done {
  background: var(--ink);
  border-color: var(--ink);
}

.lesson-card-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.lesson-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
}

.lesson-upnext-tag {
  font-weight: 600;
  color: var(--blue-hover);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}

.lesson-date-pill {
  font-weight: 550;
  color: var(--ink-body);
  font-variant-numeric: tabular-nums;
}

.lesson-module-tag {
  color: var(--muted);
}

.lesson-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 550;
  color: var(--ink);
  line-height: 1.35;
}

.lesson-card.is-completed .lesson-title {
  text-decoration: line-through;
  color: var(--muted);
}

.lesson-card-body {
  padding-left: 1.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lesson-readings {
  font-size: 0.82rem;
  color: var(--muted);
}

.lesson-readings-label {
  font-weight: 550;
  color: var(--ink-body);
}

.lesson-notes .prose {
  font-size: 0.88rem;
  line-height: 1.55;
}

.lesson-notes .prose ul {
  margin: 0.2rem 0 0;
}

.lesson-files {
  margin-top: 0.15rem;
}

.lesson-files-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.15rem;
}

.lesson-files-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.lesson-files-group.is-student .lesson-files-label {
  color: var(--blue-hover);
}

.lesson-files-group.is-private .lesson-files-label {
  color: var(--muted);
}

.student-lesson-card {
  gap: 0.55rem;
}

.student-lesson-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lesson-files .attachment-list {
  margin-top: 0;
}

.lesson-files .attachment-row {
  padding: 0.42rem 0.65rem;
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
}

.lesson-hw-subnote,
.lesson-hw-note {
  font-size: 0.82rem;
  color: var(--muted);
}

.lesson-link-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.85rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--bg);
  font-size: 0.82rem;
}

.lesson-linked-item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--ink);
  text-decoration: none;
}

.lesson-linked-item:hover .lesson-linked-title {
  color: var(--blue-hover);
  text-decoration: underline;
}

.lesson-linked-kind {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.lesson-linked-title {
  font-weight: 500;
}

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

.lesson-link-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.gradebook-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.syllabus-body {
  padding: 0.25rem 0 1.5rem;
}

.textarea-mono {
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
}

/* ---- Attachments & External Links ---- */

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.attachment-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--surface);
}

.attachment-info {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.attachment-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}

.attachment-size {
  font-size: 0.78rem;
  color: var(--muted);
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.inline-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.inline-thumb {
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
}

.inline-thumb img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.ext-link {
  font-size: 0.875rem;
  color: #475569;
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
  text-underline-offset: 0.18em;
}

.ext-link:hover {
  color: var(--blue-hover);
  text-decoration-color: #93c5fd;
}

/* ---- Assignment Sections ---- */

.surface-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 1.25rem;
}

.grade-summary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.grade-score-main {
  font-size: 1.25rem;
  font-weight: 550;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.attempt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  font-size: 0.84rem;
}

/* ---- Discussion Thread ---- */

.comment-list {
  display: flex;
  flex-direction: column;
}

.comment-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.comment-author {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.comment-time {
  font-size: 0.78rem;
  color: var(--faint);
}

.comment-body {
  font-size: 0.9rem;
  color: var(--ink-body);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

/* ---- Forms ---- */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-body);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.input, .textarea, .select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color 140ms ease;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--blue);
  outline: none;
}

.textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.55;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
}

.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: 0.35rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--blue);
  background: #eff6ff;
}

.dropzone-title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
}

.dropzone-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.staged-files {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.staged-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.38rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--surface);
  font-size: 0.83rem;
}

.link-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.link-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.link-editor-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 0.45rem;
  align-items: center;
}

/* ---- Gradebook (dedicated, strictly aligned tabular design) ---- */

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

.grade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

.grade-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.55rem 0.75rem 0.55rem 0;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.grade-table td {
  padding: 0.72rem 0.75rem 0.72rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.grade-table th:last-child,
.grade-table td:last-child {
  padding-right: 0;
}

.grade-table .col-course {
  width: 5.5rem;
}

.grade-table .col-due {
  width: 7.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.grade-table .col-status {
  width: 6.75rem;
  white-space: nowrap;
}

.grade-table .col-score {
  width: 6.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.grade-table .col-grade {
  width: 5.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary-table tr.is-overall td {
  font-weight: 600;
  color: var(--ink);
  border-bottom-color: var(--border-strong);
}

.summary-table .col-score {
  color: var(--muted);
}

.summary-table tr.is-overall .col-score {
  color: var(--ink-body);
  font-weight: 500;
}

.summary-table .col-grade {
  font-weight: 500;
  color: var(--ink);
}

.summary-table .col-summary-course {
  width: 9.5rem;
}

.summary-table .col-weights {
  color: var(--muted);
}

.weight-muted {
  color: var(--muted);
  font-weight: 400;
}

.weight-pills {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.weight-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--subtle);
  font-size: 0.77rem;
  line-height: 1.35;
  white-space: nowrap;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.weight-pill.is-unweighted {
  background: transparent;
  color: var(--muted);
}

.weight-pill-label {
  color: var(--muted);
  font-weight: 450;
}

.weight-pill-pct {
  color: var(--ink);
  font-weight: 550;
}

.weight-pill.is-unweighted .weight-pill-pct {
  color: var(--muted);
  font-weight: 500;
}

.weight-pill-avg {
  color: var(--blue);
  font-weight: 550;
}

.weight-edit-trigger {
  background: none;
  border: none;
  padding: 0.15rem 0.25rem;
  margin-left: -0.25rem;
  border-radius: 0.35rem;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background-color 120ms ease;
}

.weight-edit-trigger:hover .weight-pill {
  border-color: var(--blue);
  background: #eff6ff;
}

.modal-section-divider {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.85rem;
  margin-top: 0.2rem;
  border-top: 1px solid var(--border);
}

.modal-section-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.grade-link {
  color: var(--ink);
  font-weight: 500;
  transition: color 140ms ease;
}

.grade-link:hover {
  color: var(--blue-hover);
}

.summary-course-link {
  color: var(--ink-body);
  font-weight: 450;
  transition: color 140ms ease;
}

.summary-course-link:hover {
  color: var(--blue-hover);
}

.grade-unit-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.score-edit-trigger {
  background: none;
  border: none;
  padding: 0.15rem 0.35rem;
  margin-right: -0.35rem;
  border-radius: 0.25rem;
  cursor: pointer;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-decoration: underline dotted;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.22em;
  transition: background-color 120ms ease, color 120ms ease, text-decoration-color 120ms ease;
}

.score-edit-trigger:hover {
  background: var(--subtle);
  color: var(--blue-hover);
  text-decoration-color: var(--blue);
}

.status-edit-trigger {
  background: none;
  border: none;
  padding: 0.15rem 0.3rem;
  margin-left: -0.3rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.status-edit-trigger:hover {
  background: var(--subtle);
}

.inline-score-form {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
}

.inline-score-input {
  width: 4rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--blue);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--ink);
  text-align: right;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.inline-score-input:focus {
  outline: none;
}

.gradebook-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.gradebook-bar .tabs {
  border-bottom: none;
  flex-wrap: wrap;
  gap: 0.15rem 1.35rem;
}

.status-filter-select {
  max-width: 100%;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--surface);
  color: var(--ink-body);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.status-filter-select:focus {
  border-color: var(--blue);
  outline: none;
}

.rubric-box {
  padding: 1rem 1.25rem;
}

.rubric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1.5rem;
}

.rubric-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rubric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.86rem;
}

.rubric-letter {
  font-weight: 600;
  color: var(--ink);
}

.rubric-range {
  color: var(--muted);
}

@media (max-width: 640px) {
  .rubric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Modals & Lightbox ---- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.4);
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal {
  width: min(100%, 580px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.modal-wide {
  width: min(100%, 760px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 550;
  color: var(--ink);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.course-edit-row {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.course-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.course-add-section {
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* ---- Friendly Due Date Picker (presets + mini calendar) ---- */

.date-picker {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.date-trigger-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.date-trigger {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease;
}

.date-trigger:hover {
  border-color: #9ca3af;
}

.date-trigger.is-empty {
  color: var(--muted);
}

.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.date-preset-btn {
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--bg);
  color: var(--ink-body);
  font-size: 0.76rem;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.date-preset-btn:hover {
  background: var(--subtle);
  border-color: var(--border-strong);
}

.mini-cal {
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface);
  padding: 0.7rem;
}

.mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.mini-cal-month {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.mini-cal-dow {
  font-size: 0.72rem;
  color: var(--faint);
  padding: 0.2rem 0;
}

.mini-cal-day {
  padding: 0.32rem 0;
  border: none;
  border-radius: 0.3rem;
  background: transparent;
  color: var(--ink-body);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.mini-cal-day:hover {
  background: var(--subtle);
  color: var(--ink);
}

.mini-cal-day.is-today {
  font-weight: 650;
  color: var(--blue);
}

.mini-cal-day.is-selected {
  background: var(--ink);
  color: #ffffff;
  font-weight: 600;
}

.mini-cal-pad {
  padding: 0.32rem 0;
}

.lightbox {
  max-width: min(94vw, 1040px);
  max-height: 92vh;
  background: var(--surface);
  border-radius: 0.45rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.lightbox-media {
  overflow: auto;
  background: #111827;
  display: grid;
  place-items: center;
}

.lightbox-media img {
  max-width: 100%;
  max-height: calc(92vh - 56px);
  display: block;
}

/* ---- Empty Lines & Toasts ---- */

.empty-line {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.toast-root {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.55rem 0.9rem;
  border-radius: 0.35rem;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.84rem;
  max-width: 320px;
}

.toast.is-error {
  background: var(--danger);
}

.spacer-sm {
  margin-top: 0.75rem;
}

.sub-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sub-block {
  margin-bottom: 0.85rem;
}

.sub-block:last-child {
  margin-bottom: 0;
}

.gradebook-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.25rem;
}

/* ---- Published vs. Draft Badges & Inline Publish ---- */

.list-row-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.list-row-link:hover .row-title {
  color: var(--blue-hover);
}

.list-row.is-draft {
  padding-left: 0.7rem;
  border-left: 2px dashed #d97706;
  margin-left: -0.7rem;
}

.list-row.is-draft .row-title {
  color: var(--ink-body);
}

.material-item.is-draft {
  padding-left: 0.75rem;
  border-left: 2px dashed #d97706;
  margin-left: -0.75rem;
}

.pub-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 550;
  line-height: 1.3;
  white-space: nowrap;
}

.pub-badge.is-published {
  background: #ecfdf5;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.pub-badge.is-published::before {
  content: "";
  width: 0.36rem;
  height: 0.36rem;
  border-radius: 50%;
  background: #16a34a;
}

.pub-badge.is-draft {
  background: #fffbeb;
  color: #b45309;
  border: 1px dashed #fcd34d;
}

.pub-badge.is-partial {
  background: #eff6ff;
  color: var(--blue-hover);
  border: 1px solid #bfdbfe;
}

.btn-publish-inline {
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
  border-radius: 0.32rem;
  padding: 0.22rem 0.62rem;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.btn-publish-inline:hover {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
}

.btn-publish-inline:disabled {
  opacity: 0.55;
  cursor: default;
}

.pub-unpublish-action {
  color: var(--muted);
  font-size: 0.76rem;
  opacity: 0.72;
}

.pub-unpublish-action:hover {
  opacity: 1;
  color: var(--ink);
}

.course-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.75rem 0 0.25rem;
}

/* ---- Instructor Calendar View ---- */

.cal-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding-top: 0.9rem;
}

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cal-month-title {
  margin: 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  min-width: 9.5rem;
  text-align: center;
}

.cal-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.cal-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.cal-filter-chip.is-on {
  border-color: var(--border-strong);
  background: var(--subtle);
  color: var(--ink);
}

.cal-filter-chip:hover {
  border-color: var(--blue);
}

.cal-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  display: inline-block;
}

.cal-dot.is-lesson { background: #15803d; }
.cal-dot.is-assignment { background: var(--blue); }
.cal-dot.is-test { background: #dc2626; }
.cal-dot.is-draft {
  background: #fffbeb;
  border: 1.5px dashed #d97706;
}

.cal-summary-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.4rem;
  background: var(--subtle);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-body);
}

.cal-legend-hint {
  color: var(--muted);
  font-size: 0.76rem;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: 0.45rem;
  overflow: hidden;
  background: #ffffff;
}

.cal-dow {
  padding: 0.45rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--subtle);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.cal-cell {
  min-height: 5.5rem;
  padding: 0.4rem 0.42rem;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  cursor: pointer;
  font: inherit;
  transition: background-color 110ms ease, box-shadow 110ms ease;
}

.cal-cell:hover:not(.is-outside) {
  background: #f8fafc;
}

.cal-cell.is-weekend {
  background: #fbfcfd;
}

.cal-cell.is-outside {
  background: var(--subtle);
  opacity: 0.55;
  cursor: default;
}

.cal-cell.is-selected {
  background: #f0f7ff;
  box-shadow: inset 0 0 0 1.5px var(--blue);
}

.cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-body);
}

.cal-cell.is-today .cal-day-num {
  background: var(--blue);
  color: #ffffff;
  font-weight: 600;
}

.cal-cell-events {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}

.cal-pill {
  padding: 0.14rem 0.34rem;
  border-radius: 0.24rem;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-pill.is-lesson {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.cal-pill.is-lesson.is-draft {
  background: #f0fdf4;
  color: #166534;
  border: 1px dashed #86efac;
}

.cal-pill.is-lesson.is-done {
  opacity: 0.62;
  text-decoration: line-through;
}

.cal-pill.is-assignment.is-published {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.cal-pill.is-assignment.is-draft {
  background: #fffbeb;
  color: #b45309;
  border: 1px dashed #f59e0b;
}

.cal-pill.is-test.is-published {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.cal-pill.is-test.is-draft {
  background: #fff7ed;
  color: #b91c1c;
  border: 1px dashed #dc2626;
}

.cal-day-panel {
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  padding: 0.95rem 1.1rem;
  background: #ffffff;
}

.cal-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.cal-day-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink);
}

.cal-day-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cal-day-item {
  padding: 0.65rem 0.75rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: var(--subtle);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cal-day-item.is-draft {
  border-style: dashed;
  border-color: #f59e0b;
  background: #fffdf7;
}

.cal-day-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.cal-day-item-left {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-width: 0;
  flex: 1 1 220px;
}

.cal-item-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.cal-type-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cal-type-tag.is-lesson { background: #dcfce7; color: #166534; }
.cal-type-tag.is-assignment { background: #dbeafe; color: #1d4ed8; }
.cal-type-tag.is-test { background: #fee2e2; color: #b91c1c; }

.cal-item-title {
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--ink);
}

.cal-item-link:hover {
  color: var(--blue-hover);
}

.cal-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.cal-linked-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}

.cal-linked-label {
  color: var(--muted);
  font-weight: 500;
}

.cal-queue-section {
  margin-top: 0.25rem;
}

@media (max-width: 640px) {
  .cal-cell {
    min-height: 3.8rem;
    padding: 0.25rem;
  }

  .cal-pill {
    font-size: 0.62rem;
    padding: 0.1rem 0.22rem;
  }
}

@media (max-width: 640px) {
  .page-section {
    padding: 4.75rem 0 3.5rem;
  }

  .nav-links {
    gap: 0.85rem;
  }

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

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

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

  .summary-pts {
    display: none;
  }
}
