/* ============================================================
   Scholar — warm editorial light theme
   paper cream + ink blue + sienna accents; Crimson Pro + Inter
   ============================================================ */

:root {
  --paper:      #f4ede0;
  --paper-deep: #ece2cf;
  --card:       #fbf6ea;
  --card-hover: #f7efdc;
  --ink:        #1c1a17;
  --ink-soft:   #3c3a35;
  --ink-muted:  #6e665a;
  --ink-faint:  #a79d8b;
  --line:       #d9cfb6;
  --line-soft:  #e5dcc4;
  --ink-blue:   #2b3f60;
  --ink-blue-soft: #425d8a;
  --sienna:     #a04b2a;
  --sienna-soft:#c66a45;
  --success:    #5a7a3a;
  --alert:      #a8472a;
  --focus:      #2b3f60;

  --serif: 'Crimson Pro', 'EB Garamond', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(28,26,23,0.06), 0 1px 1px rgba(28,26,23,0.04);
  --shadow-md: 0 2px 12px rgba(28,26,23,0.08), 0 1px 2px rgba(28,26,23,0.05);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* paper grain */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background:
    radial-gradient(ellipse at top left, rgba(160,75,42,0.03), transparent 40%),
    radial-gradient(ellipse at bottom right, rgba(43,63,96,0.025), transparent 40%);
}
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.11  0 0 0 0 0.10  0 0 0 0 0.09  0 0 0 0.035 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.55;
  mix-blend-mode: multiply;
}

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

::selection { background: rgba(160,75,42,0.18); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.crest {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink-blue);
}
.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 3px;
}
.course-code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-blue);
  letter-spacing: 0.02em;
}

.view-switch {
  display: inline-flex;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.view-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms, background 160ms;
}
.view-btn.active {
  background: var(--ink);
  color: var(--paper);
}
.view-btn:not(.active):hover {
  color: var(--ink);
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}
.user-text { text-align: right; line-height: 1.1; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.side-section {}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.side-title-note {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-faint);
  font-size: 12px;
}

.icon-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-muted);
  width: 22px; height: 22px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 160ms, color 160ms, border-color 160ms;
}
.icon-btn:hover {
  background: var(--card-hover);
  border-color: var(--line);
  color: var(--ink);
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.channel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13.5px;
  transition: background 140ms, color 140ms;
}
.channel:hover { background: var(--card-hover); color: var(--ink); }
.channel.active {
  background: var(--ink);
  color: var(--paper);
}
.channel.active .ch-hash { color: var(--paper); opacity: 0.7; }
.channel.active .ch-badge {
  background: var(--sienna);
  color: var(--paper);
}
.ch-hash {
  font-family: var(--mono);
  color: var(--ink-faint);
  font-size: 12px;
}
.ch-name { flex: 1; }
.ch-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--sienna);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  display: grid;
  place-items: center;
}
.channel-group-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-faint);
  margin: 14px 6px 6px;
  padding-top: 12px;
  border-top: 1px dotted var(--line);
}
.channel-group-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.stat-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 12.5px;
}
.stat-label { color: var(--ink-muted); }
.stat-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.side-note {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px 24px;
  min-height: 0;
}

.thread-header {
  margin-bottom: 18px;
}
.kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.thread-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 12px;
  max-width: 60ch;
}
.thread-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-muted);
}
.tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.dot-sep { color: var(--ink-faint); }
.muted { color: var(--ink-muted); }
.small { font-size: 12px; }
.thread-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.ghost-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
.ghost-btn:hover {
  background: var(--card-hover);
  border-color: var(--ink-faint);
}
.ghost-btn.wide {
  width: 100%;
  text-align: center;
}

.primary-btn {
  appearance: none;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms, transform 160ms;
}
.primary-btn:hover { background: #2a2723; }
.primary-btn:active { transform: translateY(1px); }

/* PROMPT CARD */
.prompt-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px 26px 20px;
  margin: 0 0 28px;
  box-shadow: var(--shadow-sm);
}
.ornament {
  position: absolute;
  top: 8px; right: 16px;
  font-family: var(--serif);
  font-size: 44px;
  color: var(--sienna);
  opacity: 0.24;
  line-height: 1;
  pointer-events: none;
}
.prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.prompt-kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--sienna);
}
.prompt-due {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
}
.prompt-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 12px;
  max-width: 68ch;
}
.accent { color: var(--sienna); font-weight: 500; }
.mono { font-family: var(--mono); font-size: 0.92em; }

.prompt-expect {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px dotted var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}
.prompt-expect li {
  padding: 3px 0 3px 14px;
  position: relative;
}
.prompt-expect li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink-faint);
}

/* THREAD */
.thread {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 20px;
}

.post {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px dotted var(--line);
}
.post:last-child { border-bottom: 0; }

.post-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.post-body {}
.post-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.post-author {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.post-time {
  font-size: 12px;
  color: var(--ink-faint);
}
.post-role {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--sienna);
}
.post-content {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 68ch;
}
.post-content .citation {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(43,63,96,0.08);
  border-radius: 3px;
  color: var(--ink-blue);
  margin: 0 2px;
}
.post-content em { color: var(--ink); }

.post-actions {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}
.post-action {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  transition: color 140ms;
}
.post-action:hover { color: var(--ink-blue); }

.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
  background: transparent;
  letter-spacing: 0.02em;
}
.ai-chip.low    { color: var(--success); border-color: rgba(90,122,58,0.35); }
.ai-chip.mid    { color: #b07215; border-color: rgba(176,114,21,0.35); }
.ai-chip.high   { color: var(--alert); border-color: rgba(168,71,42,0.45); background: rgba(168,71,42,0.06); }
.ai-chip-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}

/* Hide AI signals in student view (body-class gate) */
body.student-view .ai-chip { display: none; }

.nested {
  margin-left: 48px;
  padding-left: 14px;
  border-left: 1px dotted var(--line);
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* COMPOSER */
.composer {
  flex-shrink: 0;
  padding: 14px 36px 18px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.composer-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.meta-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-muted);
}
.meta-pill.warn { color: var(--alert); border-color: rgba(168,71,42,0.4); }
.meta-pill.good { color: var(--success); border-color: rgba(90,122,58,0.35); }

.composer textarea {
  appearance: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  resize: vertical;
  min-height: 72px;
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}
.composer textarea:focus {
  border-color: var(--ink-blue);
  box-shadow: 0 0 0 3px rgba(43,63,96,0.12);
}
.composer textarea::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}

.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.composer-tools { display: flex; gap: 6px; }
.tool-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.tool-btn:hover { background: var(--card-hover); color: var(--ink); border-color: var(--line); }

.composer-footnote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ============================================================
   RIGHTBAR
   ============================================================ */
.rightbar {
  border-left: 1px solid var(--line);
  padding: 20px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.presence {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.presence-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.presence-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin: 0 auto;
}
.presence-dot.idle { background: var(--ink-faint); }
.presence-dot.typing { background: var(--sienna); animation: pulse 1.6s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.presence-name { color: var(--ink); }
.presence-state {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-faint);
}

.pull-quote {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.quote-body {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 8px;
}
.quote-attr {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-muted);
}

.nudge-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nudge {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.45;
}
.nudge-who {
  font-weight: 500;
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 3px;
}
.nudge-text {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
}
.nudge-meta {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* TEACHER RIGHTBAR */
.action-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.action-list li {
  border-bottom: 1px dotted var(--line);
}
.action-list li:last-child { border-bottom: 0; }
.ghost-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 9px 4px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 160ms, padding-left 200ms;
}
.ghost-link::before {
  content: "→";
  color: var(--ink-faint);
  font-size: 11px;
  transition: color 160ms, transform 200ms;
}
.ghost-link:hover {
  color: var(--ink-blue);
  padding-left: 6px;
}
.ghost-link:hover::before {
  color: var(--sienna);
  transform: translateX(2px);
}

.health-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.health-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.health-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

.modlog {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modlog-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.modlog-icon {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
}
.modlog-time {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* ============================================================
   TEACHER MAIN
   ============================================================ */
.teacher-header { margin-bottom: 14px; }
.teacher-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.teacher-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 160ms, border-color 160ms;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--sienna);
}

.teacher-panels { }
.panel { display: none; }
.panel.active { display: block; }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.metric {
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.metric.alert { border-color: rgba(168,71,42,0.3); background: rgba(168,71,42,0.04); }
.metric-num {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.metric-of {
  font-size: 18px;
  color: var(--ink-faint);
  font-weight: 400;
}
.metric-label {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 6px;
}
.metric-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.metric.alert .metric-num { color: var(--alert); }

.overview-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.panel-card {
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: 60px 1fr 30px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.bar-label { color: var(--ink-muted); font-family: var(--mono); font-size: 11.5px; }
.bar-track {
  height: 8px;
  background: var(--paper-deep);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--ink-blue);
  border-radius: 999px;
}
.bar-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  text-align: right;
}

.spark {
  position: relative;
  height: 90px;
}

.flagged-preview { }
.flagged-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px dotted var(--line);
}
.flagged-item:first-child { border-top: 0; }
.flagged-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
}
.flagged-name { font-weight: 500; font-size: 13.5px; color: var(--ink); }
.flagged-snippet {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 2px;
  max-width: 42ch;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.flagged-score {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--alert);
  font-weight: 500;
}

.students-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.students-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
}
.students-table td {
  padding: 12px;
  border-bottom: 1px dotted var(--line);
}
.students-table tr:last-child td { border-bottom: 0; }
.students-table tr:hover td { background: var(--card-hover); cursor: pointer; }
.st-name { display: flex; align-items: center; gap: 10px; }
.st-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: #fff;
}
.st-attention-low { color: var(--success); }
.st-attention-mid { color: #b07215; }
.st-attention-high { color: var(--alert); }

.prompt-editor .form-row {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.form-row > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.form-row input, .form-row textarea, .form-row select {
  padding: 9px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  border-color: var(--ink-blue);
  box-shadow: 0 0 0 3px rgba(43,63,96,0.1);
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.form-grid-3 .form-row { margin-bottom: 0; }

.ai-bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: rgba(43,63,96,0.04);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  margin: 8px 0 16px;
}
.ai-bank-row strong { font-size: 13px; }
.ai-bank-row p { margin: 4px 0 0; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(28,26,23,0.35);
  backdrop-filter: blur(2px);
}
.modal-body {
  position: relative;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
.modal-body.article-modal { width: min(660px, calc(100vw - 40px)); }
.modal-kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--sienna);
  margin-bottom: 4px;
}
.modal-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  color: var(--ink);
  max-width: 28ch;
}
.modal-body p {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.modal-cite {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 12px;
}
.rubric-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rubric-list li {
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.5;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.rubric-list strong { color: var(--sienna); font-weight: 600; }

.checkbox-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 14px;
  font-size: 13px;
  color: var(--ink-soft);
}
.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  border-radius: 999px;
  z-index: 200;
  box-shadow: var(--shadow-md);
  font-family: var(--serif);
  font-style: italic;
}
.toast[hidden] { display: none; }

/* teacher view gating */
body.teacher-view #mainStudent,
body.teacher-view #rightbarStudent { display: none; }
body.teacher-view #mainTeacher { display: flex; }
body.teacher-view #rightbarTeacher { display: flex; }

body.student-view #mainTeacher,
body.student-view #rightbarTeacher,
body.student-view #addChannelBtn { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 220px 1fr; }
  .rightbar { display: none; }
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-two { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-scroll { padding: 20px 16px; }
  .composer { padding: 12px 16px 16px; }
  .thread-title { font-size: 26px; }
  .form-grid-3 { grid-template-columns: 1fr; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--paper);
}
body:not(.signed-out) .auth-screen { display: none; }
body.signed-out .topbar,
body.signed-out .app { display: none !important; }

.auth-card {
  width: min(460px, 100%);
  padding: 32px 32px 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px dotted var(--line);
}
.auth-brand .brand-name { font-size: 26px; }
.auth-brand .brand-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.auth-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  border-radius: 3px;
  cursor: pointer;
  transition: background 160ms, color 160ms;
}
.auth-tab.active {
  background: var(--ink);
  color: var(--paper);
}
.auth-tab:not(.active):hover { color: var(--ink); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form[hidden] { display: none; }
.auth-form .form-row { margin-bottom: 0; }

.auth-lead {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.auth-error {
  padding: 9px 12px;
  background: rgba(168,71,42,0.08);
  border: 1px solid rgba(168,71,42,0.3);
  border-radius: var(--r-sm);
  color: var(--alert);
  font-size: 13px;
  font-family: var(--serif);
  font-style: italic;
}

.form-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 4px;
  display: block;
}

.primary-btn.wide, .form-actions.wide { width: 100%; }
.form-actions.wide .primary-btn { width: 100%; }

.auth-foot {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 8px;
}

.role-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0;
}
.role-opt {
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: border-color 160ms, background 160ms;
}
.role-opt:has(input:checked) {
  border-color: var(--ink);
  background: var(--card-hover);
}
.role-opt input { margin-top: 3px; accent-color: var(--ink); }
.role-title { font-weight: 600; font-size: 14px; }
.role-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.demo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
  text-align: left;
  width: 100%;
  appearance: none;
  color: inherit;
  font: inherit;
}
.demo-row:hover { background: var(--card-hover); border-color: var(--ink-faint); }
.demo-row .avatar { width: 30px; height: 30px; font-size: 11px; }
.demo-row .demo-name { font-weight: 500; font-size: 13.5px; }
.demo-row .demo-role {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 1px;
}
.demo-row .demo-go {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 16px;
}

/* ============================================================
   USER MENU
   ============================================================ */
.user-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 2px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 160ms;
}
.user-btn:hover { background: var(--card-hover); }
.user-btn .user-text { text-align: right; line-height: 1.1; }

.user-drop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 30;
}
.user-drop[hidden] { display: none; }
.drop-header {
  padding: 10px 12px;
  border-bottom: 1px dotted var(--line);
  margin-bottom: 4px;
}
.drop-name { font-weight: 600; font-size: 13.5px; }
.drop-email {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.drop-item {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 8px 12px;
  width: 100%;
  text-align: left;
  font-size: 13px;
  color: var(--ink-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 140ms, color 140ms;
}
.drop-item:hover { background: var(--card-hover); color: var(--ink); }
.drop-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}

.user { position: relative; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-prompt, .empty-thread {
  padding: 22px 26px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.empty-kicker {
  font-family: var(--serif);
  font-style: italic;
  color: var(--sienna);
  font-size: 13px;
  margin-bottom: 4px;
}
.empty-prompt p, .empty-thread p {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  max-width: 50ch;
}

.reply-quote {
  padding: 10px 14px;
  background: var(--card);
  border-left: 3px solid var(--sienna);
  border-radius: 3px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  max-height: 120px;
  overflow-y: auto;
}

/* ============================================================
   SWITCH (toggle)
   ============================================================ */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-muted);
  cursor: pointer;
}
.switch input { accent-color: var(--ink); }

.post-highlight {
  animation: flash 1.2s ease-out;
}
@keyframes flash {
  0%   { background: rgba(160,75,42,0.15); }
  100% { background: transparent; }
}

.post-self .post-author::after {
  content: " · you";
  font-weight: 400;
  font-style: italic;
  font-family: var(--serif);
  color: var(--ink-faint);
  font-size: 12px;
}

.thread-actions { gap: 8px; }

/* ============================================================
   TOPBAR — search + notifications
   ============================================================ */
.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  justify-self: center;
}
.search-wrap {
  position: relative;
  width: 340px;
}
.search-wrap input {
  width: 100%;
  padding: 7px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}
.search-wrap input:focus {
  border-color: var(--ink-blue);
  box-shadow: 0 0 0 3px rgba(43,63,96,0.1);
}
.search-wrap input::placeholder { color: var(--ink-faint); font-style: italic; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  max-height: 360px;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 30;
  padding: 6px;
}
.search-results[hidden] { display: none; }
.search-hit {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
}
.search-hit:hover { background: var(--card-hover); }
.search-hit-kind {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: var(--sienna);
}
.search-hit-body {
  margin-top: 2px;
  color: var(--ink-soft);
}
.search-hit mark {
  background: rgba(160,75,42,0.2);
  color: var(--ink);
  padding: 0 2px;
  border-radius: 2px;
}

.user-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  position: relative;
}
.notif-btn {
  appearance: none;
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-muted);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 160ms, color 160ms, border-color 160ms;
}
.notif-btn:hover { background: var(--card-hover); color: var(--ink); border-color: var(--line); }
.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: var(--sienna);
  border-radius: 50%;
  border: 2px solid var(--paper);
}
.notif-drop {
  position: absolute;
  top: calc(100% + 6px);
  right: 60px;
  min-width: 320px;
  max-width: 360px;
  max-height: 420px;
  overflow-y: auto;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 30;
}
.notif-drop[hidden] { display: none; }
.drop-mini {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.drop-mini:hover { color: var(--sienna); }
.notif-row {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  border-bottom: 1px dotted var(--line);
}
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--card-hover); }
.notif-row.unread { background: rgba(160,75,42,0.05); }
.notif-row.unread::before {
  content: "• ";
  color: var(--sienna);
  font-weight: 700;
}
.notif-time {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.notif-empty {
  padding: 20px;
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
}

/* ============================================================
   COMPOSER — anonymous, mentions
   ============================================================ */
.composer-textwrap { position: relative; }
.anon-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 160ms, color 160ms;
}
.anon-toggle input { accent-color: var(--sienna); }
.anon-toggle:hover { color: var(--ink); border-color: var(--line); }
.anon-toggle:has(input:checked) {
  color: var(--sienna);
  border-color: rgba(160,75,42,0.3);
  background: rgba(160,75,42,0.05);
}

.mention-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 20;
  overflow: hidden;
}
.mention-menu[hidden] { display: none; }
.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}
.mention-item:hover, .mention-item.active { background: var(--card-hover); }
.mention-item .avatar { width: 24px; height: 24px; font-size: 10px; }

.mention {
  color: var(--ink-blue);
  font-weight: 500;
  background: rgba(43,63,96,0.08);
  padding: 0 4px;
  border-radius: 3px;
}

/* ============================================================
   LIBRARY + CALIBRATION UI
   ============================================================ */
.pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pill-select, .pill-row input[type="text"] {
  padding: 7px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
}
.pill-row input[type="text"] { flex: 1; min-width: 180px; }
.pill-select { background: var(--card); min-width: 200px; }
.or-sep {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-faint);
}

.paste-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
}
.paste-row input[type="url"], .paste-row input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 7px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.form-row.inline {
  flex: 1;
  min-width: 180px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.form-row.inline > span { margin: 0; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.form-grid-2 .form-row { margin-bottom: 0; }

.library-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.library-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.library-row:hover { background: var(--card-hover); }
.lib-title { font-weight: 500; font-size: 13.5px; }
.lib-meta {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.lib-size {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}

.ai-sample-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.ai-sample-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.sample-label { font-weight: 500; font-size: 13px; }
.sample-snippet {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 3px;
  max-height: 3em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sample-stats {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  text-align: right;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}
.phrase-chip {
  padding: 3px 10px;
  background: rgba(43,63,96,0.06);
  border: 1px solid rgba(43,63,96,0.18);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-blue);
}

.test-result {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   GRADE / STARS
   ============================================================ */
.star-row {
  display: flex;
  gap: 4px;
}
.star {
  appearance: none;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0 2px;
  transition: color 140ms, transform 140ms;
}
.star:hover { transform: scale(1.1); }
.star.filled { color: var(--sienna); }

.grade-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  background: rgba(90,122,58,0.12);
  border: 1px solid rgba(90,122,58,0.3);
  border-radius: 999px;
  font-size: 11px;
  color: var(--success);
  font-family: var(--mono);
}
.grade-note {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(90,122,58,0.06);
  border-left: 3px solid var(--success);
  border-radius: 3px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 60ch;
}
.grade-note strong {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  color: var(--success);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 3px;
}

.anon-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--sienna);
}

.reading-body {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-wrap;
  max-height: 420px;
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 14px;
}

/* ============================================================
   DRAFT HINT
   ============================================================ */
.draft-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11.5px;
  color: var(--ink-faint);
  padding: 2px 8px;
}
.draft-hint::before {
  content: "● ";
  color: var(--sienna-soft);
}

/* Re-tighten topbar grid to 3 columns again */
@media (max-width: 1200px) {
  .search-wrap { width: 260px; }
}
@media (max-width: 900px) {
  .search-wrap { display: none; }
}

/* ============================================================
   CRAFTED EDITORIAL PASS
   "Less AI-generated, more hand-set" — layered on top of the
   existing theme. Fraunces display type + drop caps + real
   fleurons + red-pencil integrity marks + letterpress buttons +
   Roman numerals + marginalia. No emoji icons. No generic
   drop-shadows on cards. Mixed radii on purpose.
   ============================================================ */
:root {
  --display: 'Fraunces', 'Crimson Pro', Georgia, serif;
  --oxblood: #8a2a1f;
  --oxblood-soft: #b2422f;
  --pencil: #9e2b1f;
  --paper-dark: #1a1815;
  --rule: #c8bc9d;
  --rule-soft: #e3d9bf;
}

/* Kill generic soft shadows on editorial cards — rely on hairlines */
.prompt-card,
.panel-card,
.metric,
.side-note,
.pull-quote,
.nudge {
  box-shadow: none;
}

/* ---------- Brand: set in Fraunces with a touch of WONK ---------- */
.brand-name {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 600;
  font-size: 23px;
  letter-spacing: -0.015em;
}
.brand-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.auth-brand .brand-name { font-size: 30px; }

/* ---------- Thread title: chiseled display ---------- */
.thread-title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 30, "WONK" 0, "opsz" 72;
  font-weight: 500;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 22ch;
}

.kicker {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-muted);
  font-size: 13px;
  letter-spacing: 0.005em;
}
.kicker::before {
  content: "❦  ";
  color: var(--oxblood);
  font-style: normal;
  opacity: 0.55;
}

/* ---------- Prompt card: serious, unhurried, no shadow ---------- */
.prompt-card {
  background: #fbf5e7;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 26px 30px 22px;
  position: relative;
  overflow: hidden;
}
.prompt-card::before {
  /* left rule — like a printer's register */
  content: "";
  position: absolute;
  left: 14px;
  top: 22px;
  bottom: 22px;
  width: 1px;
  background: var(--oxblood);
  opacity: 0.4;
}
.prompt-card .fleuron {
  position: absolute;
  top: 14px;
  right: 20px;
  color: var(--oxblood);
  pointer-events: none;
}
.prompt-kicker {
  font-family: var(--display);
  font-variation-settings: "SOFT" 60;
  font-weight: 500;
  font-style: italic;
  font-size: 14px;
  color: var(--oxblood);
  letter-spacing: 0.01em;
}
.prompt-body {
  font-family: var(--display);
  font-variation-settings: "SOFT" 20, "opsz" 36;
  font-weight: 400;
  font-size: 19px;
  line-height: 1.45;
  max-width: 62ch;
}
/* Drop cap on the first letter of the prompt body */
.prompt-body::first-letter {
  font-family: var(--display);
  font-variation-settings: "SOFT" 80, "opsz" 144;
  font-weight: 600;
  float: left;
  font-size: 58px;
  line-height: 0.86;
  padding: 4px 8px 0 0;
  color: var(--ink);
}

/* ---------- Posts: monogram plate + pilcrow sign-off ---------- */
.post {
  grid-template-columns: 44px 1fr;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom-style: dotted;
  border-bottom-color: var(--rule-soft);
}
.post-avatar {
  width: 40px; height: 40px;
  border-radius: 4px;            /* square-ish plate, not circle */
  font-family: var(--display);
  font-variation-settings: "SOFT" 30;
  font-weight: 600;
  font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(28,26,23,0.15), inset 0 -1px 0 rgba(28,26,23,0.22);
}
.post-author {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 20;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
}
.post-time {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 12.5px;
}
.post-content {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 64ch;
}
/* Drop cap only on the very first post in a thread */
.thread > .post:first-child .post-content::first-letter {
  font-family: var(--display);
  font-variation-settings: "SOFT" 70, "opsz" 144;
  font-weight: 600;
  float: left;
  font-size: 46px;
  line-height: 0.9;
  padding: 2px 8px 0 0;
  color: var(--ink);
}
/* Pilcrow before paragraphs inside post content */
.post-content p + p::before {
  content: "¶  ";
  color: var(--oxblood);
  opacity: 0.45;
  font-family: var(--display);
  font-weight: 500;
}

/* ---------- AI integrity: red-pencil margin rule (teacher-only) ---------- */
/* The old .ai-chip pill is replaced entirely. Teacher sees a physical
   pencil mark down the left margin of the post, plus an italic
   margin note. Students see nothing. */
.post.flagged {
  position: relative;
  padding-left: 14px;
}
.post.flagged::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 22px;
  width: 2.5px;
  background: var(--pencil);
  border-radius: 1px;
  /* slight irregular squiggle feel via skew */
  transform: translateX(0) rotate(0.6deg);
  transform-origin: top;
  opacity: 0.85;
}
body.student-view .post.flagged::before { display: none; }
body.student-view .post.flagged { padding-left: 0; }

.pencil-note {
  margin-top: 8px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--pencil);
  padding: 4px 0 4px 10px;
  border-left: 1px dashed rgba(158,43,31,0.45);
  max-width: 56ch;
}
.pencil-note::before {
  content: "editor's note — ";
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.02em;
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--pencil);
  opacity: 0.7;
  margin-right: 4px;
}
body.student-view .pencil-note { display: none; }
/* Keep legacy ai-chip hidden in student view (already in CSS) and
   give it a pencil-like look in teacher view if it's still rendered */
.ai-chip.high {
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--pencil);
  border-radius: 0;
  padding: 1px 2px 2px;
  color: var(--pencil);
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: lowercase;
}
.ai-chip.mid,
.ai-chip.low {
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: lowercase;
  padding: 1px 2px;
}
.ai-chip .ai-chip-dot { display: none; }

/* Student view never sees AI surfaces of any kind — belt & suspenders */
body.student-view .ai-chip,
body.student-view .pencil-note,
body.student-view .post.flagged::before,
body.student-view #mainTeacher,
body.student-view [data-tab="flagged"],
body.student-view [data-tab="calibrate"],
body.student-view #flaggedList,
body.student-view .red-pencil {
  display: none !important;
}

/* ---------- Channels: Roman-numeral sections, italic labels ---------- */
.channel {
  border-radius: 3px;
  padding: 8px 10px;
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
}
.channel.active {
  background: var(--ink);
  color: #fbf5e7;
  border-radius: 2px;
}
.channel.active .ch-hash { color: #fbf5e7; opacity: 0.55; }
.ch-hash {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30;
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  font-feature-settings: "smcp";
}
.ch-name {
  font-family: var(--serif);
  font-size: 14.5px;
  letter-spacing: 0;
}
.channel-group-title {
  font-family: var(--display);
  font-variation-settings: "SOFT" 50, "WONK" 1;
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  color: var(--oxblood);
  opacity: 0.85;
  text-transform: none;
  letter-spacing: 0;
  border-top-style: solid;
  border-top-color: var(--rule-soft);
}

.side-title {
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 14;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
}
.side-title-note {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- Buttons: letterpress, pressable ---------- */
.primary-btn {
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: 0.015em;
  border-radius: 3px;
  padding: 9px 18px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform 120ms ease, box-shadow 120ms ease, background 160ms;
}
.primary-btn:hover {
  background: #2a2723;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.1);
}
.primary-btn:active {
  transform: translateY(1.5px);
  box-shadow: inset 0 -0.5px 0 rgba(0,0,0,0.28);
}
.ghost-btn {
  font-family: var(--sans);
  border-radius: 3px;
  padding: 7px 13px;
  letter-spacing: 0.01em;
  transition: background 140ms, border-color 140ms, color 140ms;
}
.ghost-btn:hover {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

/* ---------- View switch: tighter, editorial ---------- */
.view-switch {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 3px;
}
.view-btn {
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 14;
  font-weight: 500;
  border-radius: 1px;
  padding: 5px 16px;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.view-btn.active {
  background: var(--ink);
  color: #fbf5e7;
  border-radius: 1px;
}

/* ---------- Meta pills → tickets, not pills ---------- */
.meta-pill {
  border-radius: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px dotted var(--rule);
  padding: 2px 0;
  margin-right: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.meta-pill.warn { color: var(--pencil); border-bottom-color: rgba(158,43,31,0.5); }
.meta-pill.good { color: var(--success); border-bottom-color: rgba(90,122,58,0.5); }

/* ---------- Composer: less boxed, more paper ---------- */
.composer textarea {
  background: #fbf5e7;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.6;
  padding: 14px 16px;
}
.composer textarea::placeholder {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
}
.composer textarea:focus {
  border-color: var(--oxblood);
  box-shadow: inset 0 0 0 1px rgba(158,43,31,0.15);
}
.composer-footnote {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 12.5px;
  padding-left: 1ch;
  border-left: 2px dotted var(--rule-soft);
  margin-left: 2px;
}

/* ---------- Tags: no pill — print-shop tag ---------- */
.tag {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--oxblood);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tag::before { content: "— "; color: var(--ink-faint); }

/* ---------- Teacher tabs: slightly more newsprint ---------- */
.teacher-tabs {
  border-bottom: 1px solid var(--rule);
}
.tab {
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 14;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.01em;
}
.tab.active {
  color: var(--ink);
  border-bottom: 2px solid var(--oxblood);
}

/* ---------- Metrics: large Fraunces numerals, tiny caption ---------- */
.metric {
  border-radius: 2px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ink);
  padding: 14px 4px 6px;
}
.metric.alert { background: transparent; border-top-color: var(--pencil); }
.metric-num {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 144;
  font-weight: 500;
  font-size: 44px;
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.metric-of {
  font-family: var(--display);
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 22px;
}
.metric-label {
  font-family: var(--sans);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-top: 10px;
}
.metric-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* ---------- Panels: flat, editorial ---------- */
.panel-card {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  padding: 18px 2px 20px;
}
.panel-head h3 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 24;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.005em;
}

/* ---------- Side note: pull-quote with a rule, not a box ---------- */
.side-note {
  background: transparent;
  border: 0;
  border-left: 2px solid var(--oxblood);
  border-radius: 0;
  padding: 2px 0 2px 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ---------- Pull-quote in rightbar: broadsheet style ---------- */
.pull-quote {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px dotted var(--rule);
  border-radius: 0;
  padding: 12px 2px;
}
.quote-body {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 36;
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
}
.quote-attr {
  font-family: var(--serif);
  font-style: normal;
  font-size: 11.5px;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}
.quote-attr::before { content: "— "; color: var(--ink-faint); }

/* ---------- Nudges: no boxes ---------- */
.nudge {
  background: transparent;
  border: 0;
  border-top: 1px dotted var(--rule);
  border-radius: 0;
  padding: 10px 0;
}
.nudge:first-child { border-top: 0; padding-top: 0; }

/* ---------- Auth card: paper stock ---------- */
.auth-card {
  background: #fbf5e7;
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 8px 30px rgba(28,26,23,0.08);
}
.auth-brand .brand-name {
  font-family: var(--display);
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 144;
  font-weight: 600;
}

/* ---------- Ornament: horizontal fleuron divider ---------- */
.fleuron-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--oxblood);
  opacity: 0.6;
  margin: 18px 0;
}
.fleuron-rule::before,
.fleuron-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.fleuron-rule span {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.02em;
}

/* ---------- Course code ticket ---------- */
.course-code {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--oxblood);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Auth: unified door for students + teachers ---------- */
.auth-card {
  width: min(560px, 94vw);
  padding: 30px 34px 26px;
}
.auth-brand .brand-sub {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* Quick-demo strip under the Sign in form */
.quick-demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}
.quick-demo-col { display: flex; flex-direction: column; gap: 8px; }
.quick-demo-label {
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 14;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 4px;
}
.quick-demo-body { display: flex; flex-direction: column; gap: 6px; }

/* Full demo panel: 2-column split */
.demo-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 4px;
}
.demo-col { display: flex; flex-direction: column; gap: 10px; }
.demo-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 6px;
}
.demo-col-title {
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 20;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.demo-col-note {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-muted);
}
.demo-list { display: flex; flex-direction: column; gap: 6px; }

/* Demo row card — paper ticket, not a pill */
.demo-row {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 140ms, border-color 140ms, transform 140ms;
}
.demo-row:hover {
  background: #fbf5e7;
  border-color: var(--ink-faint);
  transform: translateY(-1px);
}
.demo-row .avatar {
  width: 30px; height: 30px;
  border-radius: 3px;
  font-family: var(--display);
  font-variation-settings: "SOFT" 30;
  font-weight: 600;
  font-size: 11px;
  box-shadow: inset 0 0 0 1px rgba(28,26,23,0.15), inset 0 -1px 0 rgba(28,26,23,0.22);
  color: #fbf5e7;
  display: grid;
  place-items: center;
}
.demo-text { min-width: 0; }
.demo-row .demo-name {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 20;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-row .demo-role {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 1px;
}
.demo-row .demo-go {
  font-family: var(--display);
  font-size: 18px;
  color: var(--oxblood);
  opacity: 0.5;
  transition: transform 160ms, opacity 160ms;
}
.demo-row:hover .demo-go { transform: translateX(3px); opacity: 1; }
.demo-empty {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
  padding: 6px 2px;
  display: block;
}

/* Auth tabs: newsprint-style — override earlier pill treatment */
.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 18px;
  margin-top: 16px;
  background: transparent;
  padding: 0;
}
.auth-tab {
  flex: 0 0 auto;
  appearance: none;
  background: transparent !important;
  border: 0;
  padding: 8px 14px 9px;
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 14;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 0 !important;
  margin-bottom: -1px;
  letter-spacing: 0.01em;
  transition: color 140ms, border-color 140ms;
}
.auth-tab:hover { color: var(--ink); background: transparent !important; }
.auth-tab.active {
  background: transparent !important;
  color: var(--ink) !important;
  border-bottom-color: var(--oxblood) !important;
}

/* Role picker on Create tab — equal weight for both */
.role-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 2px 0 2px;
}
.role-opt {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  cursor: pointer;
  align-items: start;
  transition: border-color 140ms, background 140ms;
}
.role-opt:hover { border-color: var(--ink-faint); }
.role-opt:has(input:checked) {
  border-color: var(--oxblood);
  background: #fbf5e7;
}
.role-title {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 20;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
}
.role-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Responsive: stack auth columns on narrow */
@media (max-width: 560px) {
  .quick-demo, .demo-split, .role-pick { grid-template-columns: 1fr; }
}

/* ---------- Grain: pulled-back so type reads cleaner ---------- */
.grain { opacity: 0.28; }
.grain::after { opacity: 0.4; }

/* ---------- Subtle motion respect ---------- */
@media (prefers-reduced-motion: reduce) {
  .primary-btn, .ghost-btn, .tab, .channel, .composer textarea,
  .ghost-link {
    transition: none !important;
  }
  .presence-dot.typing { animation: none; }
}

/* ---------- Keep the empty states human ---------- */
.empty-thread, .empty-prompt {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-muted);
  padding: 22px 0;
  border-top: 1px dotted var(--rule);
  border-bottom: 1px dotted var(--rule);
  max-width: 56ch;
  font-style: italic;
}
.empty-kicker {
  font-family: var(--display);
  font-variation-settings: "SOFT" 50, "WONK" 1;
  font-style: italic;
  font-size: 14px;
  color: var(--oxblood);
  margin-bottom: 4px;
  font-weight: 500;
}

/* ================================================================
   POST INTERACTION PASS — reactions, version history, teacher nudge,
   pencil note sub-elements. Read the whole block as one system: the
   reactions row is public to everyone; the pencil note + signals and
   the nudge button are teacher-only (hidden in student view below).
   ================================================================ */

/* ---- Reactions row: humane, lowercase verbs, underlined on click ---- */
.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 10px 0 2px;
  padding-top: 8px;
  border-top: 1px dotted var(--rule);
}
.react-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 2px 0;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-muted);
  transition: color 140ms;
}
.react-btn:hover { color: var(--ink); }
.react-btn:hover .react-label { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.react-btn.on { color: var(--oxblood); }
.react-btn.on .react-label {
  text-decoration: underline;
  text-decoration-style: solid;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--oxblood);
}
.react-label { letter-spacing: 0.005em; }
.react-count {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  color: var(--ink-faint);
  min-width: 0.9em;
  text-align: left;
}
.react-btn.on .react-count { color: var(--oxblood); opacity: 0.85; }
/* empty counts stay subtle */
.react-btn:not(.on) .react-count:empty { display: none; }

/* ---- Edited indicator: quiet, italic, marginal ---- */
.post-edited {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-left: 6px;
  cursor: pointer;
  border-bottom: 1px dotted rgba(0,0,0,0.2);
  padding-bottom: 1px;
  transition: color 140ms, border-color 140ms;
}
.post-edited:hover {
  color: var(--ink-muted);
  border-color: var(--ink-faint);
}

/* ---- Teacher nudge button — a touch warmer than plain post-action ---- */
.post-action.nudge {
  color: var(--oxblood);
  font-style: italic;
}
.post-action.nudge:hover { color: var(--pencil); }

/* ---- Pencil-note sub-structure ---- */
.pencil-head {
  font-style: normal;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--pencil);
  margin-bottom: 4px;
  display: inline;
}
.pencil-head em {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}
.pencil-list {
  list-style: none;
  margin: 4px 0 6px;
  padding: 0 0 0 10px;
  display: block;
  font-size: 12px;
  font-style: normal;
  font-family: var(--serif);
  color: var(--ink-muted);
}
.pencil-list li {
  position: relative;
  padding: 1px 0 1px 10px;
  line-height: 1.55;
}
.pencil-list li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--pencil);
}
.pencil-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 6px;
  padding-top: 4px;
}
.pencil-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--pencil);
  cursor: pointer;
  border-bottom: 1px dotted rgba(158,43,31,0.5);
  padding-bottom: 1px;
  transition: color 140ms, border-color 140ms;
}
.pencil-btn:hover {
  color: var(--oxblood);
  border-bottom-color: var(--oxblood);
  border-bottom-style: solid;
}
.pencil-btn:focus-visible {
  outline: 2px solid var(--oxblood);
  outline-offset: 2px;
  border-radius: 1px;
}

/* Student-view belt & suspenders — no pencil innards ever */
body.student-view .pencil-head,
body.student-view .pencil-list,
body.student-view .pencil-actions,
body.student-view .pencil-btn,
body.student-view .post-action.nudge {
  display: none !important;
}

/* ---- Notification panel items ---- */
.notif-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 11px 14px;
  border-bottom: 1px dotted var(--rule);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--card-hover); }
.notif-item.unread { background: rgba(158,43,31,0.04); }
.notif-item .notif-kind {
  grid-column: 1 / 2;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin-bottom: 1px;
}
.notif-item .notif-text {
  grid-column: 1 / 2;
  font-style: italic;
  color: var(--ink);
}
.notif-item .notif-meta {
  grid-column: 1 / 2;
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 1px;
}
.notif-item .notif-time {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.notif-empty {
  padding: 20px 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--oxblood);
}
.drop-mini {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 2px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--oxblood);
  cursor: pointer;
  border-bottom: 1px dotted rgba(158,43,31,0.5);
}
.drop-mini:hover {
  border-bottom-style: solid;
  border-bottom-color: var(--oxblood);
}

/* ---- Search results ---- */
.search-result {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 10px 14px;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px dotted var(--rule);
  line-height: 1.45;
  transition: background 120ms;
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover, .search-result.active {
  background: var(--card-hover);
}
.search-result .sr-kind {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin-right: 6px;
}
.search-result .sr-room {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-left: 6px;
}
.search-result .sr-snippet {
  display: block;
  font-style: italic;
  color: var(--ink-muted);
  margin-top: 2px;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-result mark {
  background: rgba(196,152,38,0.25);
  color: inherit;
  padding: 0 1px;
}
.search-empty {
  padding: 16px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}

/* ---- Mention menu ---- */
.mention-item {
  appearance: none;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 12px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  transition: background 120ms;
}
.mention-item:hover, .mention-item.active { background: var(--card-hover); }
.mention-item .mention-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
}
.mention-item .mention-role {
  margin-left: auto;
  font-family: var(--serif);
  font-style: italic;
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ---- Library list items ---- */
.library-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dotted var(--rule);
}
.library-item:last-child { border-bottom: 0; }
.library-item .lib-title {
  font-family: var(--display);
  font-variation-settings: "SOFT" 40, "opsz" 24;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.library-item .lib-meta {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.library-item .lib-snippet {
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 4px;
  max-width: 64ch;
  font-style: italic;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.library-item .lib-actions {
  display: flex;
  gap: 12px;
}
.library-item .lib-action {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--oxblood);
  cursor: pointer;
  border-bottom: 1px dotted rgba(158,43,31,0.5);
  padding-bottom: 1px;
}
.library-item .lib-action:hover {
  border-bottom-style: solid;
  color: var(--oxblood);
}

/* ---- AI sample list items ---- */
.ai-sample-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  padding: 12px 0;
  border-bottom: 1px dotted var(--rule);
}
.ai-sample-item:last-child { border-bottom: 0; }
.ai-sample-item .smp-label {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 22;
  font-weight: 500;
  font-size: 14.5px;
  color: var(--ink);
}
.ai-sample-item .smp-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  text-align: right;
}
.ai-sample-item .smp-snippet {
  grid-column: 1 / 3;
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--ink-muted);
  font-style: italic;
  max-width: 64ch;
  line-height: 1.5;
}
.ai-sample-item .smp-remove {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--pencil);
  cursor: pointer;
  border-bottom: 1px dotted rgba(158,43,31,0.4);
  padding-bottom: 1px;
  justify-self: end;
}
.ai-sample-item .smp-remove:hover {
  border-bottom-style: solid;
  color: var(--oxblood);
}
.ai-sample-empty {
  padding: 18px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
  border-top: 1px dotted var(--rule);
  border-bottom: 1px dotted var(--rule);
}

/* ---- Calibration chip grid ---- */
.calib-chip {
  display: inline-block;
  padding: 3px 9px;
  margin: 3px 4px 3px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--pencil);
  background: rgba(158,43,31,0.06);
  border: 1px solid rgba(158,43,31,0.18);
  border-radius: 999px;
  letter-spacing: 0.005em;
}
.calib-empty {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
  padding: 6px 0;
}

/* ---- Test result chip (calibration) ---- */
.test-result {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-family: var(--serif);
  font-size: 13px;
}
.test-result .test-verdict {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 22;
  font-weight: 600;
  font-size: 15px;
  padding: 2px 10px;
  border-radius: 2px;
  letter-spacing: 0.005em;
}
.test-result .test-verdict.high {
  background: rgba(158,43,31,0.1);
  color: var(--oxblood);
  border-bottom: 2px solid var(--oxblood);
}
.test-result .test-verdict.mid {
  background: rgba(196,152,38,0.12);
  color: #8a6915;
  border-bottom: 2px solid #c49826;
}
.test-result .test-verdict.low {
  background: rgba(52,85,60,0.08);
  color: #34553c;
  border-bottom: 2px solid #34553c;
}
.test-result .test-fired {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.test-result .test-details {
  grid-column: 1 / 3;
  width: 100%;
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-muted);
  list-style: none;
  padding: 0;
}
.test-result .test-details li {
  padding: 2px 0 2px 12px;
  position: relative;
  line-height: 1.5;
}
.test-result .test-details li::before {
  content: "○";
  position: absolute;
  left: 0;
  color: var(--ink-faint);
  font-size: 10px;
  top: 3px;
}
.test-result .test-details li.on::before {
  content: "●";
  color: var(--oxblood);
}

/* ---- Grade modal stars ---- */
.star {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0 4px;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 120ms, transform 140ms;
}
.star:hover, .star.on { color: var(--oxblood); }
.star:hover { transform: translateY(-1px); }

/* ---- Reading modal body ---- */
.article-modal { max-width: 720px; }
.modal-cite {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 12px;
  text-transform: lowercase;
  font-style: italic;
  font-family: var(--serif);
}
.reading-body p + p { margin-top: 1em; }

/* ---- Anon badge on posts (teacher sees real name + badge; students see "anonymous") ---- */
.anon-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 1px 5px;
  margin-left: 6px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink-muted);
  background: var(--card-hover);
}
body.student-view .anon-real { display: none; }
body.teacher-view .anon-masked { display: none; }

/* ---- Nudge receipt on student side (when teacher has messaged you) ---- */
.nudge-receipt {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  margin: 4px 0 10px;
  background: rgba(158,43,31,0.05);
  border-left: 2.5px solid var(--oxblood);
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink);
}
.nudge-receipt .nr-kicker {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--oxblood);
  white-space: nowrap;
}
.nudge-receipt .nr-text { font-style: italic; }

/* ---- Draft autosave notice ---- */
.draft-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-left: 6px;
  opacity: 0;
  transition: opacity 300ms;
}
.draft-note.show { opacity: 1; }

/* ---- Form hint styling (already base but needs the italic) ---- */
.form-hint {
  font-style: italic;
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 4px;
  display: block;
  line-height: 1.5;
}

/* ---- AI bank row (on prompt editor) ---- */
.ai-bank-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 12px 14px;
  margin: 8px 0 12px;
  background: rgba(43,63,96,0.04);
  border-left: 2px solid var(--ink-blue);
  border-radius: 0 2px 2px 0;
  align-items: start;
}
.ai-bank-row strong {
  font-family: var(--display);
  font-variation-settings: "SOFT" 30, "opsz" 22;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.ai-bank-row p { margin: 4px 0 0; }

/* ---- Responsive: keep things calm on small screens ---- */
@media (max-width: 720px) {
  .reactions { gap: 12px; }
  .library-item { grid-template-columns: 1fr; }
  .library-item .lib-actions { justify-content: flex-start; }
  .pencil-actions { gap: 10px; }
}

/* ============================================================
   POLISH PASS — teacher preview banner, unread dots, drill-in,
   anonymous self-view hint, shortcut hint, small affordances.
   ============================================================ */

/* Teacher-as-student preview banner: a thin, printmaker-red strip pinned to
   the bottom of the viewport so the teacher can't forget they're previewing.
   The banner itself is presentation-only; it doesn't mutate any data. */
.preview-banner {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 16px;
  background: #2b1c16;
  color: #f6ecd8;
  border: 1px solid rgba(246, 236, 216, 0.18);
  border-radius: 6px;
  font-family: var(--serif, "Crimson Pro", Georgia, serif);
  font-size: 14px;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 36px -18px rgba(24, 16, 10, 0.5), 0 2px 0 rgba(24, 16, 10, 0.25);
}
.preview-banner .preview-eye {
  color: #d26f50;
  font-size: 12px;
  line-height: 1;
}
.preview-banner .preview-exit {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(246, 236, 216, 0.35);
  border-radius: 3px;
  color: #f6ecd8;
  font: inherit;
  font-size: 12.5px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.preview-banner .preview-exit:hover {
  background: rgba(246, 236, 216, 0.12);
  border-color: rgba(246, 236, 216, 0.6);
}

/* Make the role-switch look like a switch rather than two loose buttons. */
body.preview-mode .view-switch .view-btn[data-view="student"] {
  box-shadow: inset 0 0 0 1.5px var(--sienna, #a8472a);
}

/* Subtle ⌘↵ pill — reads like a keyboard hint, not a status indicator. */
.meta-pill.shortcut-hint {
  background: transparent;
  border: 1px dashed var(--line, rgba(60, 40, 30, 0.2));
  color: var(--ink-faint, #9a8a7c);
  letter-spacing: 0.04em;
  font-size: 11px;
  font-family: var(--mono, "JetBrains Mono", monospace);
}

/* Channel unread dot — shown when a channel has posts newer than the viewer
   last visited it. Printed as a small terracotta disc next to the #name. */
.channel .unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sienna, #a8472a);
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(168, 71, 42, 0.12);
}
.channel.active .unread-dot { display: none; }

/* Student drill-in: when a name is clicked in the Students table or the
   Overview bar, the thread shows only that student's posts. A quiet chip
   lives above the thread so you know why the list looks short. */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 7px 10px 7px 12px;
  background: rgba(168, 71, 42, 0.07);
  border: 1px solid rgba(168, 71, 42, 0.22);
  border-radius: 3px;
  font-size: 12.5px;
  color: var(--ink, #1d1410);
}
.filter-chip .filter-chip-label {
  font-family: var(--display, Fraunces, Georgia, serif);
  font-style: italic;
}
.filter-chip .filter-chip-clear {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--sienna, #a8472a);
  font: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 2px;
}
.filter-chip .filter-chip-clear:hover {
  background: rgba(168, 71, 42, 0.12);
}

/* Anonymous author's self-view gets a private line of reassurance so the
   poster knows exactly what the class sees vs what the teacher sees. */
.anon-self-note {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-muted, #6e5e52);
  font-style: italic;
}

/* Students-table rows become clickable when a drill-in handler is wired up. */
.students-table tbody tr[data-student-id] { cursor: pointer; }
.students-table tbody tr[data-student-id]:hover {
  background: rgba(168, 71, 42, 0.04);
}
.students-table tbody tr.selected {
  background: rgba(168, 71, 42, 0.08);
}

/* =========================================================
   CITATION UPGRADES
   Library autocomplete menu, clickable citation links in
   post bodies, and a quiet "not in library" marker for
   citations that don't resolve to a known source.
   ========================================================= */

/* Library-pick menu that appears when the student types "(" —
   visual cousin of the @mention menu, anchored to the composer. */
.cite-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  max-width: 380px;
  background: var(--paper, #f6ecd8);
  border: 1px solid var(--line, #c9b998);
  border-radius: var(--r-md, 6px);
  box-shadow: 0 8px 24px rgba(60, 40, 20, 0.12);
  z-index: 22;
  overflow: hidden;
}
.cite-menu[hidden] { display: none; }
.cite-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(168, 143, 95, 0.14);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.cite-item:last-child { border-bottom: 0; }
.cite-item:hover,
.cite-item.active { background: rgba(168, 71, 42, 0.06); }
.cite-item-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: var(--ink, #2b1c16);
}
.cite-item-sub {
  font-size: 11.5px;
  color: var(--ink-muted, #6e5e52);
  font-style: italic;
}

/* A matched citation in a post body — clickable, opens the reading. */
.cite-link {
  display: inline;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  /* A thin terracotta underline marks it as a reading-backed claim
     without looking like a hyperlink. */
  border-bottom: 1px dotted rgba(168, 71, 42, 0.55);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.cite-link:hover,
.cite-link:focus-visible {
  background: rgba(168, 71, 42, 0.08);
  border-bottom-color: rgba(168, 71, 42, 0.85);
  outline: none;
}

/* A citation-shaped phrase we couldn't resolve. Quiet — it's a hint
   to the teacher and the student, not an accusation. No hover. */
.cite-unknown {
  display: inline;
  border-bottom: 1px dotted rgba(120, 95, 80, 0.35);
  cursor: help;
  /* Subtle marginal asterisk so skimming catches the uncertainty. */
}
.cite-unknown::after {
  content: '\2217'; /* asterisk operator — looks more like an editor's mark */
  font-size: 9px;
  color: rgba(120, 95, 80, 0.6);
  vertical-align: super;
  margin-left: 1px;
}

/* ============================================================
   HUMAN-CRAFTED EDITORIAL LAYER  (v8 redesign)
   ---
   Appended to refine the surface without touching the bones.
   Goal: stop reading as a templated SaaS page; start reading as
   a well-set printed one. Everything below is either additive
   (new components) or a higher-specificity polish of what's
   already there.
   ============================================================ */

:root {
  --gilt:        #9a7a36;   /* muted brass — ornaments, dinkus */
  --ink-dye:     #14161b;   /* cooler, deeper ink for display */
  --paper-deep2: #e7dcc2;   /* a second paper tone for depth */
  --measure:     66ch;      /* canonical text measure */
}

/* Enable oldstyle-nums, ligatures, kerning everywhere. Numerals
   fall into line with running text instead of standing tabular. */
html, body, button, input, select, textarea {
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "onum" 1;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(154, 122, 54, 0.22); }

/* ---- Brand wordmark gets the variable-Fraunces treatment. ---- */
.brand-name {
  font-family: 'Fraunces', 'Crimson Pro', Georgia, serif;
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 72, "SOFT" 40, "WONK" 1;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.topbar .brand-name { font-size: 23px; }
.auth-brand .brand-name { font-size: 30px; }

.brand-sub {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-muted);
}
.brand-sub em {
  font-family: 'Crimson Pro', Georgia, serif;
  letter-spacing: 0.005em;
  font-size: 13px;
  color: var(--ink-muted);
}
.brand-sub .course-code {
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--sienna);
  letter-spacing: 0;
}

/* ---- True small-caps utility (replaces fake CSS uppercase). ---- */
.smallcaps {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  text-transform: none;
}

/* Side-title: real small caps + hairline under. */
.side-title {
  font-variant-caps: all-small-caps;
  text-transform: none;
  letter-spacing: 0.04em;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.side-title-note {
  font-variant-caps: normal;
  letter-spacing: 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* Kicker — italic, slightly warmer, a semicolon's weight before content. */
.kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  letter-spacing: 0.005em;
}

/* ---- Prompt card reads like a printed lede, not a card. ---- */
.prompt-card {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 24px 0 26px;
  margin: 0 0 30px;
}
.prompt-head { margin-bottom: 10px; }
.prompt-kicker {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  font-style: normal;
  font-size: 13.5px;
  color: var(--sienna);
}
.prompt-body {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 19.5px;
  line-height: 1.5;
  max-width: var(--measure);
  color: var(--ink);
}
/* Dropcap on the lede — applied via .has-dropcap by JS when there's text. */
.prompt-body.has-dropcap::first-letter {
  initial-letter: 3 3;
  -webkit-initial-letter: 3 3;
  font-family: 'Fraunces', 'Crimson Pro', serif;
  font-variation-settings: "opsz" 144, "WONK" 1, "SOFT" 30;
  font-weight: 600;
  color: var(--sienna);
  margin-right: 10px;
  /* fallback for browsers without initial-letter */
  float: left;
  font-size: 3.4em;
  line-height: 0.86;
  padding-top: 4px;
}
.prompt-expect li::before {
  content: "§";
  color: var(--gilt);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 13px;
}

/* ---- Fleuron divider: a quiet section-break. ---- */
.fleuron-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 18px;
  color: var(--gilt);
  opacity: 0.75;
}
.fleuron-divider::before,
.fleuron-divider::after {
  content: "";
  flex: 0 0 56px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 40%, var(--line) 60%, transparent);
}
.fleuron-divider .glyph {
  font-family: 'Fraunces', 'Crimson Pro', serif;
  font-size: 18px;
  line-height: 1;
}

/* ---- Composer becomes a writing desk, not a submit form. ---- */
.composer {
  position: relative;
  padding-top: 18px;
}
.composer::before {
  /* A lightly-notched rule at the top — not a clean edge. */
  content: "";
  position: absolute;
  left: 0; right: 0; top: -1px; height: 1px;
  background:
    linear-gradient(90deg,
      var(--line) 22%, transparent 22%, transparent 27%, var(--line) 27%,
      var(--line) 63%, transparent 63%, transparent 69%, var(--line) 69%);
}
.composer-meta {
  display: flex;
  align-items: baseline;
  gap: 0;
  flex-wrap: wrap;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.composer-meta .meta-pill {
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-muted);
  letter-spacing: 0;
}
.composer-meta .meta-pill.good { color: var(--success); font-style: italic; }
.composer-meta .meta-pill.warn { color: var(--alert); }
.composer-meta .meta-pill + .meta-pill::before {
  content: "  \2014  ";
  color: var(--ink-faint);
  font-style: normal;
}
.composer-meta .meta-pill.shortcut-hint {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-style: normal;
  font-size: 11.5px;
}

.composer textarea {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16.5px;
  line-height: 1.6;
  padding: 14px 16px;
  color: var(--ink);
}
.composer textarea:focus {
  border-color: var(--ink-blue);
  background: var(--card);
  box-shadow: none;
}
.composer textarea::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}

.tool-btn {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  letter-spacing: 0;
  color: var(--ink-muted);
  padding: 4px 8px;
  border-color: transparent;
}
.tool-btn:hover {
  color: var(--ink-blue);
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-style: dotted;
}
.composer-footnote {
  border-top: 1px dotted var(--line-soft);
  padding-top: 8px;
  margin-top: 4px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ---- Thread header: big Fraunces title, narrow measure. ---- */
.thread-title {
  font-family: 'Fraunces', 'Crimson Pro', serif;
  font-weight: 500;
  font-variation-settings: "opsz" 96, "SOFT" 40;
  font-size: 40px;
  line-height: 1.06;
  letter-spacing: -0.015em;
  max-width: 22ch;   /* force wrap, hand-set feel */
}
.thread-meta {
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--ink-muted);
}
.thread-meta .muted { font-style: italic; }
.thread-meta .course-code {
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: var(--sienna);
}

/* ---- Posts as day-book entries: hairline, signed. ---- */
.post {
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.post .post-avatar {
  width: 32px; height: 32px;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}
.post-head {
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
}
.post-author {
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}
.post-time {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.post-role {
  font-variant-caps: all-small-caps;
  font-style: normal;
  letter-spacing: 0.06em;
  font-size: 13px;
  color: var(--sienna);
}
.post-content {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: var(--measure);
}
.post-content p + p {
  text-indent: 1.2em;
  margin-top: 0.4em;
}
.post-signature {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  margin-top: 8px;
  letter-spacing: 0.005em;
}

/* Reactions as quiet margin marks */
.reactions {
  margin-top: 10px;
  display: flex;
  gap: 18px;
  border-top: 1px dotted var(--line-soft);
  padding-top: 8px;
}
.react-btn {
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
  cursor: pointer;
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
}
.react-btn:hover { color: var(--ink-blue); }
.react-btn.on { color: var(--sienna); }
.react-btn .react-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}

/* Post actions: italic marginalia */
.post-actions {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-muted);
}
.post-action {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: color 140ms;
  border-bottom: 1px dotted transparent;
}
.post-action:hover {
  color: var(--ink-blue);
  border-bottom-color: var(--ink-blue);
}

/* ---- View-switch tabs (student/teacher) lose the pill. ---- */
.view-switch {
  background: transparent;
  border: 0;
  padding: 0;
  gap: 6px;
}
.view-btn {
  padding: 5px 4px;
  font-family: var(--serif);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  font-size: 14.5px;
  color: var(--ink-muted);
  border: 0;
  background: transparent;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}
.view-btn.active {
  background: transparent;
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.view-btn:not(.active):hover { color: var(--ink); }

/* ---- Teacher tabs — editorial horizontal menu. ---- */
.teacher-tabs {
  border-bottom: 1px solid var(--line);
  gap: 2px;
}
.tab {
  font-family: var(--serif);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 14px 11px;
  border-bottom: 2px solid transparent;
}
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--sienna);
  background: transparent;
}
.tab:hover { color: var(--ink); }

/* ---- Channels: course directory, not Slack sidebar. ---- */
.channel {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  padding: 6px 8px;
  border-radius: 2px;
  gap: 10px;
  position: relative;
}
.channel:hover { background: transparent; color: var(--ink); }
.channel.active {
  background: transparent;
  color: var(--ink);
}
.channel.active::before {
  content: "";
  position: absolute;
  left: -10px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--sienna);
}
.channel.active .ch-hash { color: var(--sienna); opacity: 1; }
.ch-hash {
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-size: 15px;
  color: var(--gilt);
}
.ch-name { letter-spacing: 0; }
.ch-badge {
  min-width: auto;
  height: auto;
  padding: 0;
  background: transparent;
  color: var(--sienna);
  border-radius: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  font-weight: 500;
}
.ch-badge::before { content: "· "; color: var(--ink-faint); }

.channel-group-title {
  font-family: var(--serif);
  font-variant-caps: all-small-caps;
  font-style: normal;
  letter-spacing: 0.05em;
  font-size: 13px;
  color: var(--ink-muted);
  border-top: 1px solid var(--line-soft);
  padding: 14px 0 4px;
  margin: 10px 0 4px;
}
.channel-group-title:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

/* Side-note reads as marginalia, not a tip-card. */
.side-note {
  background: transparent;
  border: 0;
  border-left: 2px solid var(--gilt);
  border-radius: 0;
  padding: 8px 0 8px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* Pull-quote: open it up, big quote mark. */
.pull-quote {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2px 0 0;
  margin: 0 0 8px;
  position: relative;
}
.pull-quote::before {
  content: "\201C";
  font-family: 'Fraunces', 'Crimson Pro', serif;
  font-variation-settings: "opsz" 144;
  font-size: 58px;
  line-height: 0.4;
  color: var(--gilt);
  display: block;
  margin-bottom: 10px;
}
.quote-body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  font-style: italic;
}
.quote-attr {
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.quote-attr::before { content: "— "; color: var(--ink-faint); }

/* Nudge rows: flat, hairline-separated. */
.nudge {
  background: transparent;
  border: 0;
  border-top: 1px dotted var(--line-soft);
  border-radius: 0;
  padding: 10px 0 4px;
}
.nudge:first-child { border-top: 0; padding-top: 0; }

/* Teacher metrics: no boxes, a single top-rule and a big figure. */
.metric {
  background: transparent;
  border: 0;
  border-top: 2px solid var(--line);
  border-radius: 0;
  padding: 14px 4px 16px;
}
.metric.alert {
  border-top-color: var(--sienna);
  background: transparent;
}
.metric-num {
  font-family: 'Fraunces', 'Crimson Pro', serif;
  font-variation-settings: "opsz" 144, "SOFT" 40;
  font-weight: 500;
  font-size: 46px;
  letter-spacing: -0.03em;
}
.metric-label {
  font-variant-caps: all-small-caps;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.06em;
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Modals — tighter corners, more weight. */
.modal-body {
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 24px 60px rgba(28,22,14,0.22);
}
.modal-kicker {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  color: var(--gilt);
  font-style: normal;
  font-size: 13px;
}
.modal-kicker em { font-style: normal; }
.modal-body h2 {
  font-family: 'Fraunces', 'Crimson Pro', serif;
  font-variation-settings: "opsz" 96, "SOFT" 30;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.008em;
  margin: 4px 0 14px;
}

/* Action list (teacher "Do next"): § pilcrow-like prefix */
.action-list li { border-bottom: 1px dotted var(--line-soft); }
.action-list li:last-child { border-bottom: 0; }
.ghost-link {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink-soft);
  gap: 10px;
  padding: 10px 0;
}
.ghost-link::before { content: "§"; color: var(--gilt); font-weight: 500; }
.ghost-link:hover { color: var(--ink); padding-left: 0; }
.ghost-link:hover::before { transform: none; color: var(--sienna); }

/* Ghost button less soft */
.ghost-btn {
  border-radius: 2px;
  padding: 7px 14px;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 400;
  background: transparent;
  border: 1px solid var(--line);
}
.ghost-btn:hover { background: var(--card); border-color: var(--ink-muted); }

.primary-btn {
  border-radius: 2px;
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  padding: 8px 18px;
}

/* Search input: dotted underline becomes a pen-line on focus. */
.search-wrap input[type="search"] {
  background: transparent;
  border: 0;
  border-bottom: 1px dotted var(--ink-faint);
  border-radius: 0;
  padding: 6px 2px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  width: 260px;
  color: var(--ink);
}
.search-wrap input[type="search"]:focus {
  border-bottom: 1px solid var(--ink);
  font-style: normal;
  outline: none;
}
.search-wrap input[type="search"]::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}

/* Auth card: slight paper-stack drop-shadow, thin rule */
.auth-card {
  border-radius: 3px;
  box-shadow: 0 2px 0 var(--line), 0 20px 50px rgba(28,22,14,0.08);
}

/* Colophon — for auth screen foot & teacher-rightbar foot */
.colophon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11.5px;
  color: var(--ink-faint);
  text-align: center;
  padding: 16px 8px 2px;
  border-top: 1px dotted var(--line-soft);
  margin-top: 22px;
  letter-spacing: 0.005em;
  line-height: 1.5;
}
.colophon::before { content: "❦  "; color: var(--gilt); }

/* Anon bits refined */
.anon-toggle { font-family: var(--serif); font-style: italic; font-size: 13.5px; }
.anon-badge {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
  font-size: 12.5px;
  background: transparent;
  padding: 0;
  border: 0;
  color: var(--gilt);
}
.anon-self-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 12px;
  margin: 4px 0 8px;
  display: block;
}

/* Preview banner: quieter, paper-toned, not a SaaS toast */
.preview-banner {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
}
.preview-banner .preview-eye { color: var(--sienna); }
.preview-banner .preview-exit {
  font-family: var(--serif);
  font-style: normal;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 2px;
  padding: 4px 10px;
}

/* Scrollbar: a calmer gutter (paper against paper) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 10px;
  border: 3px solid var(--paper);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* Accessibility: honor reduced-motion everywhere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Focus-visible editorial ring */
:focus-visible {
  outline: 2px solid var(--ink-blue);
  outline-offset: 2px;
  border-radius: 1px;
}

/* A tiny reassurance on the teacher's "+" room button — gilt on hover */
.icon-btn.add-channel:hover {
  color: var(--sienna);
  border-color: var(--sienna);
  background: transparent;
}

/* ============================================================
   CHANNEL CHARACTER + DAY-BREAK FLEURONS  (v9)
   ---
   Rooms now have a "character" (discussion, debate, reading, office)
   that tints the sidebar accent and seeds the prompt editor. Thread
   runs get a ❦ day-divider each time the calendar crosses over.
   ============================================================ */

/* Character picker in the create-room modal */
.character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.character-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 160ms, background 160ms;
}
.character-opt:hover { border-color: var(--ink-faint); }
.character-opt:has(input:checked) {
  border-color: var(--sienna);
  background: rgba(160, 75, 42, 0.04);
}
.character-opt input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--sienna);
  flex: 0 0 auto;
}
.character-title {
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}
.character-sub {
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.character-sub em { font-style: italic; }

/* Sidebar: tint the active bar + show a muted italic tag after the name.
   Legacy rooms without data-character read as discussion (ink). */
.channel .ch-character {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0;
  padding-left: 4px;
}
.channel.active .ch-character { color: currentColor; opacity: 0.7; }

.channel[data-character="debate"].active::before   { background: var(--sienna); }
.channel[data-character="reading"].active::before  { background: var(--gilt); }
.channel[data-character="office"].active::before   { background: var(--ink-blue); }
.channel[data-character="discussion"].active::before,
.channel.active::before                            { background: var(--ink); }

/* The # prefix and badge also pick up the character color on active. */
.channel[data-character="debate"].active .ch-hash  { color: var(--sienna); }
.channel[data-character="reading"].active .ch-hash { color: var(--gilt); }
.channel[data-character="office"].active .ch-hash  { color: var(--ink-blue); }
.channel[data-character="debate"].active .ch-badge  { color: var(--sienna); }
.channel[data-character="reading"].active .ch-badge { color: var(--gilt); }
.channel[data-character="office"].active .ch-badge  { color: var(--ink-blue); }

/* Day-break fleuron with an italic date label.
   Uses the existing .fleuron-divider structure but adds .with-label
   which puts the date on the left of the glyph, not under it. */
.fleuron-divider.with-label {
  padding: 22px 0 16px;
  opacity: 1;
  color: var(--ink-muted);
}
.fleuron-divider.with-label::before,
.fleuron-divider.with-label::after {
  flex: 1 1 auto;
  background: linear-gradient(90deg, transparent, var(--line-soft) 30%, var(--line-soft) 70%, transparent);
}
.fleuron-divider.with-label .day-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-muted);
  letter-spacing: 0.015em;
  white-space: nowrap;
}
.fleuron-divider.with-label .glyph {
  color: var(--gilt);
  font-size: 14px;
}

/* The first divider at the top of a thread feels loud with full-width
   rules on both sides. Tighten it so the opening day reads as a slug. */
.thread > .fleuron-divider.with-label:first-child {
  padding-top: 4px;
  padding-bottom: 14px;
  justify-content: flex-start;
  gap: 10px;
}
.thread > .fleuron-divider.with-label:first-child::before {
  flex: 0 0 0;
  background: transparent;
}
.thread > .fleuron-divider.with-label:first-child::after {
  flex: 1 1 auto;
}

/* ============================================================
   v10 — VERIFICATION, RESET, SETTINGS, SHORTCUTS, CLOSED THREADS
   All additive. No modifications to earlier rules.
   ============================================================ */

/* The HTML `hidden` attribute should always win over our flex/grid layouts.
   Without this rule, elements with display:flex in their class will still
   render when hidden is set. */
[hidden] { display: none !important; }

/* Auth sub-screen typography */
.auth-kicker {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 2px;
}
.auth-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 10px 0;
  color: var(--ink);
}
.auth-lead {
  font-family: var(--serif);
  color: var(--ink);
  opacity: 0.82;
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 18px 0;
  max-width: var(--measure, 66ch);
}
.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
}
.auth-links .ghost-link {
  background: none;
  border: 0;
  color: var(--sienna);
  font-family: var(--serif);
  font-style: italic;
  cursor: pointer;
  padding: 4px 2px;
  font-size: 13px;
}
.auth-links .ghost-link:hover { text-decoration: underline; }

/* Demo token reveal — a small mono card that shows the code you'd normally get by email */
.demo-reveal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 0 18px 0;
  background: rgba(154, 122, 54, 0.08);
  border-left: 3px solid var(--gilt, #9a7a36);
  border-radius: 3px;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink);
  flex-wrap: wrap;
}
.demo-reveal em {
  font-style: italic;
  color: var(--muted);
}
.demo-token {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.18em;
  padding: 3px 10px;
  background: var(--paper);
  border: 1px solid rgba(20, 22, 27, 0.12);
  border-radius: 3px;
  color: var(--ink-dye, #14161b);
}

/* Verify banner above composer */
.verify-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin: 10px 0 0 0;
  background: rgba(154, 122, 54, 0.07);
  border: 1px solid rgba(154, 122, 54, 0.22);
  border-radius: 3px;
  color: var(--ink);
}
.verify-banner .fleuron { color: var(--gilt, #9a7a36); flex: 0 0 auto; }
.verify-banner-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.verify-banner-body strong {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
}
.verify-banner-body em {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
}
.verify-banner .ghost-btn {
  flex: 0 0 auto;
}

/* Dim the composer when the user is unverified — visible but clearly muted */
.composer.disabled {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.2);
}
.composer.disabled button[type="submit"] {
  background: var(--muted);
}

/* Thread-closed notice */
.thread-closed-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 34px 24px 38px;
  margin: 18px 0 0 0;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid rgba(20, 22, 27, 0.08);
  border-bottom: 1px solid rgba(20, 22, 27, 0.08);
  background:
    linear-gradient(to bottom, rgba(20, 22, 27, 0.01), rgba(20, 22, 27, 0));
}
.thread-closed-notice .fleuron { color: var(--sienna); opacity: 0.7; }
.thread-closed-notice .closed-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-top: 4px;
}
.thread-closed-notice .closed-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  max-width: 52ch;
  line-height: 1.55;
  color: var(--muted);
}
#closeThreadBtn.is-reopen {
  color: var(--sienna);
  border-color: rgba(160, 75, 42, 0.35);
}

/* Settings modal */
.settings-section {
  margin: 20px 0;
  padding: 16px 0 4px;
  border-top: 1px solid rgba(20, 22, 27, 0.08);
}
.settings-section:first-of-type {
  border-top: 0;
  padding-top: 8px;
}
.settings-section h4.smallcaps {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 10px 0;
}
.domain-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.domain-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(20, 22, 27, 0.03);
  border-radius: 3px;
  font-size: 14px;
}
.domain-item .mono {
  font-family: var(--mono);
  color: var(--ink);
}
.domain-item .ghost-link {
  background: none;
  border: 0;
  color: var(--sienna);
  font-family: var(--serif);
  font-style: italic;
  cursor: pointer;
  font-size: 12.5px;
}
.domain-item .ghost-link:hover { text-decoration: underline; }
.verified-list .verify-stat-row {
  display: flex;
  gap: 24px;
  padding: 10px 0 4px;
  font-family: var(--serif);
  font-size: 15px;
}
.verified-list .verify-stat-row strong {
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  margin-right: 4px;
}

/* Keyboard shortcuts modal */
.shortcuts-body { max-width: 640px; }
.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 22px;
  margin: 18px 0 8px;
}
@media (max-width: 700px) {
  .shortcut-grid { grid-template-columns: 1fr; }
}
.shortcut-group h4 {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(20, 22, 27, 0.08);
}
.shortcut-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 7px 0;
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.5;
}
.shortcut-row kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--paper);
  border: 1px solid rgba(20, 22, 27, 0.2);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ink-dye, #14161b);
  text-align: center;
}
.shortcut-row span {
  flex: 1 1 auto;
  color: var(--ink);
  opacity: 0.82;
}
.drop-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 0 6px;
  border: 1px solid rgba(20, 22, 27, 0.15);
  border-radius: 3px;
  background: var(--paper);
}
.drop-item { display: flex; align-items: center; }

/* Keyboard-focused post — subtle sienna left-bar */
.post.kbd-focus {
  box-shadow: -3px 0 0 0 var(--sienna);
}

/* Inline citation hover preview */
.cite-pop {
  position: absolute;
  z-index: 60;
  width: 320px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid rgba(20, 22, 27, 0.12);
  border-radius: 3px;
  box-shadow: 0 8px 26px rgba(20, 22, 27, 0.12);
  font-family: var(--serif);
  pointer-events: none;
}
.cite-pop-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 2px;
}
.cite-pop-author {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.cite-pop-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  opacity: 0.9;
  margin-bottom: 8px;
}
.cite-pop-foot {
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
}

/* ============================================================
   v11 — less-AI-generated redesign
   Goal: pull back ornament, make type do the heavy lifting,
   add chat channels, rewrite the surface so it reads as
   considered rather than templated.
   ============================================================ */

/* ---- Mode switching: discussion vs chat rooms ---------------- */
body.chat-room .discussion-only        { display: none !important; }
body.discussion-room .chat-only         { display: none !important; }
/* When signed out, none of these matter; auth screen owns the view. */
body.signed-out .discussion-only,
body.signed-out .chat-only              { display: none !important; }

/* ---- Ornament restraint -------------------------------------- */
/* Kill the <em>-as-default-kicker pattern. Real emphasis should
   stay italic, but our kickers were italic just to look literary,
   which reads as AI-template. Small-caps tracking instead. */
.kicker,
.modal-kicker,
.empty-kicker,
.prompt-kicker,
.auth-kicker,
.preview-banner span:first-of-type ~ span,
.channel-kind-head {
  font-family: var(--sans);
  font-style: normal !important;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.kicker em,
.modal-kicker em,
.empty-kicker em,
.prompt-kicker,
.auth-kicker em { font-style: normal !important; }

/* Fleurons belonged everywhere. Keep one in the prompt card,
   one in the day-divider, and hide the rest. */
.verify-banner > svg.fleuron,
.thread-closed-notice > svg.fleuron,
.empty-prompt svg,
.empty-thread svg,
.auth-screen .fleuron-rule,
.colophon .fleuron { display: none; }

/* ---- Typography refinements ---------------------------------- */
.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  font-style: normal;
}
.brand-sub {
  font-style: normal !important;
  color: var(--ink-muted);
  font-size: 12.5px;
}
.brand-sub em { font-style: normal !important; }
.course-code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

/* ---- Sidebar — channel kind heads (Discussions / Chats) ------ */
.channel-kind-head {
  padding: 18px 4px 6px 4px;
  color: var(--ink-blue);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
  font-size: 10.5px;
}
.channel-kind-head.chats-head { margin-top: 18px; }

/* Chat-type rooms get a lighter hash mark so the sidebar reads
   at a glance: serious rooms in ink-blue, chats in warm grey. */
.channel[data-kind="chat"] .ch-hash  { color: var(--ink-faint); }
.channel[data-kind="chat"] .ch-name  { font-family: var(--sans); font-weight: 500; }
.channel[data-kind="chat"].active .ch-hash { color: var(--sienna); }

/* ---- Room-kind picker in the create-room modal --------------- */
.kind-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.kind-opt {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--card);
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
  transition: border-color 180ms, background 180ms;
}
.kind-opt:hover { background: var(--card-hover); }
.kind-opt input { margin-top: 3px; accent-color: var(--sienna); }
.kind-opt:has(input:checked) {
  border-color: var(--sienna);
  background: var(--card-hover);
  box-shadow: inset 0 0 0 1px var(--sienna);
}
.kind-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 2px;
  color: var(--ink);
}
.kind-sub {
  color: var(--ink-muted);
  font-size: 12.5px;
  line-height: 1.45;
  font-style: normal;
}

.form-label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.modal-lede {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 18px 0;
  max-width: 56ch;
}

/* ---- Chat room header ---------------------------------------- */
.chat-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 0 16px 0;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 12px;
}
.chat-hash {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1;
  font-weight: 300;
  color: var(--ink-faint);
  margin-top: 2px;
}
.chat-head-body { flex: 1; min-width: 0; }
.chat-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px 0;
  color: var(--ink);
}
.chat-sub {
  color: var(--ink-muted);
  font-size: 13.5px;
  font-family: var(--serif);
  font-style: italic;
}
.chat-sub:empty::before { content: "a place for your class to talk"; }
.chat-actions { align-self: flex-end; }
.chat-members {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

/* ---- Chat message list --------------------------------------- */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 2px 20px 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 10px 0;
  color: var(--ink-muted);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.chat-day-divider::before,
.chat-day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}
.chat-day-label { flex: 0 0 auto; padding: 0 4px; }

.chat-msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 120ms;
}
.chat-msg:hover { background: rgba(217,207,182,0.22); }
.chat-msg:hover .chat-time-hover { opacity: 1; }

.chat-msg.grouped {
  padding-top: 1px;
  padding-bottom: 1px;
}
.chat-msg.grouped .chat-body { margin-top: 0; }
.chat-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  color: #fdf8ea;
  flex-shrink: 0;
}
.chat-avatar.spacer {
  background: none !important;
  font-size: 10.5px;
  color: var(--ink-faint);
  font-family: var(--mono);
}
.chat-time-hover {
  opacity: 0;
  transition: opacity 120ms;
  font-size: 10px;
}
.chat-body { min-width: 0; }
.chat-byline {
  display: flex; align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.chat-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.chat-role {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sienna);
  border: 1px solid var(--sienna);
  border-radius: 3px;
  padding: 1px 5px;
}
.chat-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.chat-text {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.chat-msg.chat-mine .chat-name { color: var(--ink-blue); }
.empty-chat {
  padding: 36px 20px;
  text-align: center;
  color: var(--ink-muted);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.5;
  max-width: 46ch;
  margin: 40px auto 0 auto;
}
.empty-chat .empty-kicker {
  display: block;
  margin-bottom: 10px;
}

/* ---- Chat composer ------------------------------------------- */
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 10px;
}
.chat-composer.disabled {
  opacity: 0.55;
  pointer-events: none;
}
.chat-input-wrap {
  flex: 1;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px 12px;
}
.chat-input-wrap:focus-within {
  border-color: var(--ink-blue);
  box-shadow: 0 0 0 3px rgba(43,63,96,0.08);
}
.chat-input-wrap textarea {
  border: 0;
  background: transparent;
  width: 100%;
  resize: none;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
  outline: none;
  min-height: 24px;
  max-height: 200px;
  padding: 0;
}
.chat-send {
  padding: 9px 16px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
}

/* ---- Preview-mode banner: quieter ---------------------------- */
.preview-banner {
  font-family: var(--sans);
  font-size: 12.5px;
}
.preview-banner span:not(.preview-eye) { font-style: normal; }

/* ---- Thread header: less ornament, more hierarchy ------------ */
.thread-header {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.thread-header .kicker {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.thread-header .kicker em { font-style: normal; }
.thread-title {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 10px 0;
}

/* ---- Prompt card: ONE fleuron moment, nothing else ---------- */
.prompt-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sienna);
  border-radius: var(--r-md);
  padding: 20px 24px 22px 24px;
  margin-bottom: 28px;
  position: relative;
}
.prompt-card .fleuron { display: none; }
.prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.prompt-kicker {
  font-style: normal !important;
  color: var(--sienna);
}
.prompt-due {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-muted);
}
.prompt-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 12px 0;
  max-width: 68ch;
}
.prompt-expect {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13.5px;
  color: var(--ink-muted);
  font-family: var(--sans);
}
.prompt-expect li::before {
  content: "— ";
  color: var(--ink-faint);
}

/* ---- Thread post redesign: marginalia timestamp ------------- */
.thread .post {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  padding: 20px 0 20px 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-radius: 0;
}
.thread .post.reply { padding-left: 30px; }
.thread .post.post-self .post-body { border-left: 2px solid var(--ink-blue-soft); padding-left: 12px; margin-left: -14px; }
.thread .post .post-meta-col {
  /* we reuse the existing meta as the gutter */
  grid-column: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  padding-top: 2px;
  text-align: right;
  line-height: 1.45;
}

/* ---- Composer: quieter ---------------------------------------- */
.composer-footnote {
  font-family: var(--serif);
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-muted);
  padding-top: 6px;
}

/* ---- Auth screen: less marketing, more specific -------------- */
.auth-brand .brand-sub {
  font-style: normal !important;
  color: var(--ink-muted);
  font-size: 12.5px;
  letter-spacing: 0;
}
.auth-brand .brand-sub em { font-style: normal !important; }
.auth-tabs {
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
}
.auth-tab {
  background: none;
  border: 0;
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  margin-bottom: -1px;
}
.auth-tab:hover { color: var(--ink); }
.auth-tab.active {
  color: var(--ink);
  border-bottom-color: var(--sienna);
}
.auth-foot {
  font-family: var(--serif);
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-muted);
  margin-top: 14px;
  text-align: center;
}
.auth-foot em { font-style: italic; }
.auth-kicker {
  font-style: normal !important;
}

/* ---- Colophon: quieter --------------------------------------- */
.colophon {
  font-family: var(--serif);
  font-size: 11px;
  font-style: normal;
  color: var(--ink-faint);
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  letter-spacing: 0.02em;
}
.colophon em { font-style: italic; }

/* ---- Verify banner / closed notice: calmer ------------------- */
.verify-banner,
.thread-closed-notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.thread-closed-notice .closed-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 4px;
}
.closed-sub {
  font-style: normal;
  color: var(--ink-muted);
  font-size: 13.5px;
  font-family: var(--serif);
}

/* ---- Teacher tabs: quieter current state --------------------- */
.teacher-tabs {
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 22px;
}
.teacher-tabs .tab {
  background: none;
  border: 0;
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  margin-bottom: -1px;
}
.teacher-tabs .tab:hover { color: var(--ink); }
.teacher-tabs .tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink-blue);
  background: none;
  box-shadow: none;
}

/* ---- Teacher overview cards: less ornament, clearer hierarchy  */
.overview-grid > div,
.panel-card {
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: none;
}
.panel-head h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  font-style: normal;
}
.muted.small { font-style: normal; }

/* ---- Modal kickers: quieter ---------------------------------- */
.modal-kicker em { font-style: normal !important; }

/* ---- Settings / shortcuts: keep but quieter ------------------ */
.settings-section h4,
.shortcut-group h4 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 14px 0 8px 0;
}

/* ---- Utility: smallcaps class used in a few places ----------- */
.smallcaps {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---- Quick-demo columns (auth screen): simpler chips --------- */
.quick-demo-label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
  font-style: normal;
}

/* ---- Sidebar rooms header — tighten & de-italicize ----------- */
.side-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 8px 0;
  font-style: normal !important;
}
.side-title em,
.side-title-note {
  font-family: var(--sans);
  font-style: normal !important;
  font-weight: 400;
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: none;
  letter-spacing: 0;
}

/* ---- empty-prompt / empty-thread: kinder, plainer ------------ */
.empty-prompt, .empty-thread {
  padding: 32px 16px;
  text-align: center;
  color: var(--ink-muted);
  font-family: var(--serif);
  max-width: 52ch;
  margin: 20px auto;
}
.empty-prompt p, .empty-thread p {
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

/* ---- Search: simpler border ---------------------------------- */
.search-wrap input {
  background: var(--paper);
  border: 1px solid var(--line);
  transition: border-color 150ms, box-shadow 150ms;
}
.search-wrap input:focus {
  border-color: var(--ink-blue);
  box-shadow: 0 0 0 3px rgba(43,63,96,0.08);
  outline: none;
}

/* ---- View-switch (student/teacher in topbar) ----------------- */
.view-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--paper);
}
.view-btn {
  background: none;
  border: 0;
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  border-radius: 999px;
  cursor: pointer;
  transition: all 150ms;
}
.view-btn.active {
  background: var(--ink);
  color: var(--paper);
}

/* ---- Anonymity/cursor fixes ---------------------------------- */
.anon-toggle { cursor: pointer; }
.tool-btn { cursor: pointer; }
.channel { cursor: pointer; }
.drop-item { cursor: pointer; }
.auth-tab, .tab, .view-btn { cursor: pointer; }

/* ---- Responsive: chat on narrow screens ---------------------- */
@media (max-width: 860px) {
  .chat-msg { grid-template-columns: 32px 1fr; gap: 8px; }
  .chat-avatar { width: 32px; height: 32px; font-size: 12px; }
  .chat-title { font-size: 24px; }
  .kind-pick { grid-template-columns: 1fr; }
}

.cite-pop-foot em { font-style: italic; }

/* ---- Fix: teacher/student view gating must beat [hidden] !important ----
   The v10 `[hidden] { display: none !important }` rule above is too broad —
   it hides the #mainTeacher / #rightbarTeacher panels (which are born with
   the `hidden` HTML attribute) even after setView flips the body class. We
   rescue them with matching !important rules. */
body.teacher-view #mainTeacher { display: flex !important; }
body.teacher-view #rightbarTeacher { display: flex !important; }
body.teacher-view #mainStudent,
body.teacher-view #rightbarStudent { display: none !important; }
body.student-view #mainStudent { display: flex !important; }
body.student-view #rightbarStudent { display: flex !important; }
body.student-view #mainTeacher,
body.student-view #rightbarTeacher { display: none !important; }
/* Signed-out or no-view state: never show either main/rightbar. The auth
   card has its own container. */
body.signed-out #mainTeacher,
body.signed-out #mainStudent,
body.signed-out #rightbarTeacher,
body.signed-out #rightbarStudent { display: none !important; }

/* ============================================================
   LMS LAYER (v13) — announcements, assignments, gradebook,
   syllabus, upcoming. Canvas/Blackboard-style pages layered on
   top of the forum, styled to match the paper-typography voice.
   ============================================================ */

/* ---- Section routing (data-section on body) ---------------- */
/* When not in room view, hide room-only machinery (composer, banners,
   thread/chat content, presence, pull quotes, nudges). */
body:not([data-section="room"]) .room-only { display: none !important; }
body:not([data-section="room"]) #roomView  { display: none !important; }

/* When in room view, hide all the section pages. */
body[data-section="room"] .section-page { display: none !important; }

/* Section pages: show when their section is active. Using !important
   because section-page carries the `hidden` HTML attribute. */
body[data-section="announcements"] #announcementsSection { display: block !important; }
body[data-section="assignments"]  #assignmentsSection    { display: block !important; }
body[data-section="syllabus"]     #syllabusSection       { display: block !important; }
body[data-section="gradebook"]    #gradebookSection      { display: block !important; }

/* Teachers working on a section page (not room view): swap in mainStudent
   as the content host. The section-page markup includes .teacher-only
   controls that only show in teacher view. */
body.teacher-view:not([data-section="room"]) #mainStudent { display: flex !important; }
body.teacher-view:not([data-section="room"]) #mainTeacher { display: none !important; }

/* Student view with a non-room section — same host, just no teacher chrome. */
body.student-view:not([data-section="room"]) #mainStudent { display: flex !important; }

/* Hide teacher-only UI in student view, broadly. */
body.student-view .teacher-only { display: none !important; }

/* Gradebook is teacher-only; don't let students reach it even via URL noodling. */
body.student-view #gradebookSection { display: none !important; }

/* ---- Sidebar: the Course nav -------------------------------- */
.course-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}
.course-link {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  text-align: left;
  transition: background 120ms, color 120ms;
}
.course-link:hover { background: rgba(43, 63, 96, 0.05); }
.course-link.active {
  background: rgba(43, 63, 96, 0.09);
  color: var(--ink-blue);
  font-weight: 600;
}
.course-link .cl-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--ink-muted);
}
.course-link.active .cl-icon { color: var(--ink-blue); }
.course-link .cl-label { line-height: 1.2; }
.course-link .cl-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9px;
  background: var(--oxblood);
  color: var(--paper);
  letter-spacing: 0.02em;
}

/* ---- Sidebar: per-room actions (rename/delete, teacher-only) */
.channel { position: relative; }
.ch-row-actions {
  display: none;
  margin-left: auto;
  gap: 2px;
  align-items: center;
}
.channel:hover .ch-row-actions,
.channel:focus-within .ch-row-actions {
  display: inline-flex;
}
.ch-action {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.ch-action:hover { background: rgba(43, 63, 96, 0.10); color: var(--ink-blue); }
.ch-action.ch-delete:hover { background: rgba(125, 32, 32, 0.10); color: var(--oxblood); }

/* ---- Section page scaffold (shared) ------------------------- */
.section-page {
  padding: 44px 48px 64px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.page-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
  margin-bottom: 28px;
}
.page-header .kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.page-title {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 36px;
  line-height: 1.1;
  margin: 0 0 10px 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.page-lede {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-muted);
  margin: 0 0 14px 0;
  max-width: 62ch;
}
.page-actions {
  margin-top: 6px;
  display: flex;
  gap: 10px;
}
.section-empty {
  padding: 28px 24px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--ink-muted);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  max-width: 52ch;
  margin: 24px auto;
}

/* ---- Announcements banner + cards --------------------------- */
.ann-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(212, 180, 131, 0.14) 0%, rgba(212, 180, 131, 0.05) 100%);
  border: 1px solid rgba(125, 32, 32, 0.18);
  border-left: 3px solid var(--oxblood);
  border-radius: 2px;
  margin: 18px 32px 4px 32px;
  align-items: center;
}
.ann-banner-kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 10px;
  color: var(--oxblood);
  font-weight: 600;
  margin-bottom: 4px;
}
.ann-banner-title {
  font-family: var(--serif-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.ann-banner-text {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.48;
  margin-bottom: 6px;
}
.ann-banner-meta {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-muted);
}
.ann-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.announcements-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ann-card {
  position: relative;
  padding: 22px 26px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: border-color 150ms;
}
.ann-card.is-pinned { border-left: 3px solid var(--oxblood); padding-left: 24px; }
.ann-card.is-acked { opacity: 0.86; }
.ann-pinned-tag {
  position: absolute;
  top: 14px;
  right: 18px;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  color: var(--oxblood);
  font-weight: 600;
}
.ann-card-title {
  font-family: var(--serif-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 6px 0;
  letter-spacing: -0.005em;
  line-height: 1.18;
}
.ann-card-meta {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.ann-card-body {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 14px;
}
.ann-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.ann-read-tag {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-muted);
  font-style: italic;
}
.ghost-btn.danger:hover { color: var(--oxblood); border-color: var(--oxblood); }

/* ---- Assignments -------------------------------------------- */
.assignments-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.asg-card {
  padding: 24px 28px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: border-color 150ms;
}
.asg-card:hover { border-color: rgba(43, 63, 96, 0.32); }
.asg-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 14px;
}
.asg-title {
  font-family: var(--serif-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 6px 0;
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.asg-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}
.asg-due {
  color: var(--ink-blue);
  font-weight: 500;
}
.asg-right {
  text-align: right;
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-muted);
  min-width: 120px;
}
.asg-progress { padding: 1px 0; }
.asg-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.asg-status-not-started { background: rgba(43, 63, 96, 0.08); color: var(--ink-muted); }
.asg-status-draft       { background: rgba(212, 180, 131, 0.26); color: #715018; }
.asg-status-submitted   { background: rgba(43, 63, 96, 0.14); color: var(--ink-blue); }
.asg-status-graded      { background: rgba(53, 102, 58, 0.14); color: #35663a; }
.asg-status-missing     { background: rgba(125, 32, 32, 0.12); color: var(--oxblood); }

.asg-desc {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 12px;
}
.asg-rubric {
  list-style: none;
  padding: 12px 16px;
  margin: 0 0 14px 0;
  background: rgba(245, 240, 228, 0.45);
  border-left: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.asg-rubric li {
  display: flex;
  justify-content: space-between;
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--ink);
}
.asg-rubric li .mono { color: var(--ink-muted); font-size: 12px; }
.asg-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 8px;
}
.asg-subs {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.asg-sub-row {
  display: grid;
  grid-template-columns: 1fr 120px 80px auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  font-family: var(--sans);
  font-size: 13px;
  border-bottom: 1px dotted var(--line);
}
.asg-sub-row:last-child { border-bottom: 0; }
.asg-sub-name { color: var(--ink); }
.asg-sub-grade { color: var(--ink-blue); font-weight: 500; text-align: right; }
.asg-subs-empty { padding: 8px 0; }

/* ---- Submission modal -------------------------------------- */
.assignment-modal { max-width: 720px; }
.submit-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.submit-desc {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
  padding: 12px 14px;
  background: rgba(245, 240, 228, 0.5);
  border-left: 2px solid var(--line);
  line-height: 1.5;
  margin-bottom: 18px;
}
.submit-wc {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-muted);
  text-align: right;
  margin-top: 4px;
}
.submission-grade {
  margin-top: 20px;
  padding: 16px 18px;
  background: rgba(53, 102, 58, 0.08);
  border-left: 3px solid #35663a;
}
.sg-kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  font-weight: 600;
  color: #35663a;
  margin-bottom: 6px;
}
.sg-score {
  font-family: var(--serif-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}
.sg-note {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 6px;
  font-style: italic;
}
.sg-meta {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-muted);
}
.gs-body {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  padding: 14px 16px;
  background: rgba(245, 240, 228, 0.6);
  border-left: 2px solid var(--line);
  margin-bottom: 16px;
  max-height: 320px;
  overflow-y: auto;
}

/* ---- Syllabus ----------------------------------------------- */
.syllabus-hd { border-bottom: 1px solid var(--line); }
.syllabus-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  margin-top: 6px;
}
.syllabus-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink);
  max-width: 65ch;
  margin-bottom: 28px;
}
.syllabus-body p { margin: 0 0 1em 0; }

/* ---- Gradebook ---------------------------------------------- */
.gb-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
}
.gradebook {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 12.5px;
}
.gradebook th, .gradebook td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}
.gradebook th {
  background: rgba(245, 240, 228, 0.6);
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.gb-col-title {
  display: block;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gb-col-meta {
  display: block;
  font-size: 10px;
  color: var(--ink-muted);
  text-transform: none;
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.gb-name, th.gb-name {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--paper);
  min-width: 190px;
  max-width: 220px;
  z-index: 1;
  box-shadow: 1px 0 0 var(--line);
}
.gradebook th.gb-name {
  z-index: 3;
  background: rgba(245, 240, 228, 0.96);
}
.gb-name-inner { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 14px; color: var(--ink); }
.gb-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.gb-cell {
  font-family: var(--mono);
  font-size: 13px;
  min-width: 78px;
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms;
}
.gb-cell[data-act]:hover { background: rgba(43, 63, 96, 0.08); }
.gb-of { color: var(--ink-muted); font-size: 11px; padding-left: 2px; }
.gb-note { color: var(--ink-muted); font-size: 10px; padding-left: 4px; display: block; margin-top: 2px; }
.gb-ok    { background: rgba(53, 102, 58, 0.10); }
.gb-mid   { background: rgba(212, 180, 131, 0.22); }
.gb-low   { background: rgba(125, 32, 32, 0.10); }
.gb-submitted { background: rgba(43, 63, 96, 0.08); color: var(--ink-blue); font-weight: 500; }
.gb-draft { color: #715018; font-style: italic; }
.gb-missing { color: var(--oxblood); font-weight: 500; }
.gb-empty { color: var(--ink-muted); }
.gb-score { display: inline-flex; align-items: baseline; gap: 2px; }
.gb-score-ok { color: #35663a; }
.gb-total-cell {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  min-width: 90px;
  background: rgba(245, 240, 228, 0.5);
}
th.gb-total { background: rgba(245, 240, 228, 0.85); }
th.gb-col-discussion { font-style: italic; }

/* ---- Upcoming widget ---------------------------------------- */
.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.up-item {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dotted var(--line);
  cursor: pointer;
  transition: background 120ms;
}
.up-item:hover { background: rgba(43, 63, 96, 0.05); }
.up-item:last-child { border-bottom: 0; }
.up-when {
  font-family: var(--sans);
  font-size: 11px;
  text-align: right;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.up-day {
  font-weight: 600;
  color: var(--ink);
  text-transform: capitalize;
  letter-spacing: 0.01em;
  font-size: 11.5px;
}
.up-time {
  color: var(--ink-muted);
  font-size: 10.5px;
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.up-body { min-width: 0; }
.up-title {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.up-meta {
  font-family: var(--sans);
  font-size: 10.5px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.up-tag {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 2px;
}
.up-kind-class        .up-tag { background: rgba(43, 63, 96, 0.10); color: var(--ink-blue); }
.up-kind-office-hours .up-tag { background: rgba(212, 180, 131, 0.26); color: #715018; }
.up-kind-exam         .up-tag { background: rgba(125, 32, 32, 0.13); color: var(--oxblood); }
.up-kind-assignment   .up-tag { background: rgba(53, 102, 58, 0.13); color: #35663a; }
.up-sub { color: var(--ink-muted); }

/* ---- Minor: danger ghost-btn + disabled form rows ----------- */
.ghost-btn.danger {
  color: var(--ink-muted);
}
.ghost-btn.danger:hover,
.ghost-btn.danger:focus-visible {
  color: var(--oxblood);
  border-color: var(--oxblood);
  background: rgba(125, 32, 32, 0.04);
}

/* Checkbox rows in LMS modals match the house style */
.assignment-modal .checkbox-row { margin: 8px 0 4px; }

/* Responsive: stack upcoming/sidebar on narrow screens. */
@media (max-width: 860px) {
  .section-page { padding: 28px 22px 48px; }
  .page-title { font-size: 28px; }
  .asg-head { grid-template-columns: 1fr; }
  .asg-right { text-align: left; }
  .asg-sub-row { grid-template-columns: 1fr 70px auto; }
  .asg-sub-when { display: none; }
  .ann-banner { grid-template-columns: 1fr; }
  .ann-banner-actions { flex-direction: row; }
}
