/* Graders HUB — academic theme: Oxford navy, academic gold and parchment, serif headings. */
:root {
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --surface-2: #f4eee1;
  --border: #e3d9c4;
  --text: #1f2a44;
  --muted: #6e6656;
  --accent: #1f3a68;
  --accent-text: #ffffff;
  --accent-soft: #e7ecf5;
  --gold: #b8892d;
  --gold-soft: #f6ecd4;
  --success: #2f6b3a;
  --error: #9b2335;
  --success-bg: #e8f1e4;
  --error-bg: #f8e6e6;
  --info-bg: #eef1f8;
  --side-bg: #1b2c4f;
  --side-text: #f1ead9;
  --side-muted: #b3b9c9;
  --side-hover: rgba(255, 255, 255, 0.07);
  --side-active: rgba(212, 166, 74, 0.16);
  --side-border: rgba(255, 255, 255, 0.14);
  --radius: 10px;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: "Lora", Georgia, "Times New Roman", serif;
  font-family: var(--font-body);
  font-size: 16px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #11151d;
  --surface: #192030;
  --surface-2: #1f2739;
  --border: #2f3a52;
  --text: #ebe5d7;
  --muted: #a69e8c;
  --accent: #d4a64a;
  --accent-text: #17130a;
  --accent-soft: #2a3247;
  --gold: #d4a64a;
  --gold-soft: #3a3220;
  --success: #8fcf8f;
  --error: #f08a8a;
  --success-bg: #1d3022;
  --error-bg: #3a1d22;
  --info-bg: #1f2840;
  --side-bg: #0c1220;
  --side-text: #ebe5d7;
  --side-muted: #9aa1b3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); }
h1, h2, h3, legend { font-family: var(--font-head); }
h1 { font-size: 1.65rem; font-weight: 600; margin: 0; letter-spacing: 0.005em; }
.subtle { color: var(--muted); font-size: 0.9rem; }
.prewrap { white-space: pre-wrap; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; margin: 0 4px 22px; }
.brand-mark { width: 38px; height: 38px; flex: none; color: var(--gold); }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; line-height: 1.1; }
.brand-tag { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--side-muted); }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex: none; background: var(--side-bg); color: var(--side-text);
  padding: 20px 12px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 3px solid var(--gold);
}
.nav-label { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--side-muted); margin: 0 10px 6px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: block; padding: 8px 12px; border-radius: 6px; color: var(--side-text); text-decoration: none;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--side-hover); }
.nav-item.active { background: var(--side-active); border-left-color: var(--gold); font-weight: 600; }
/* Admin sidebar: Dashboard plus two collapsible groups */
/* The menu takes the free height and scrolls on short windows, so the bottom buttons never cover it */
.sidebar nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sidebar-foot { flex: none; }
.nav-item.top { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.nav-icon { width: 18px; text-align: center; color: var(--gold); flex: none; }
.nav-group summary { list-style: none; cursor: pointer; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: "▸"; margin-left: auto; color: var(--side-muted); transition: transform 0.15s; }
.nav-group[open] summary::after { transform: rotate(90deg); }
.colleges-link { margin-top: 10px; border-top: 1px solid var(--side-border); padding-top: 12px; }
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--side-border); }
.nav-sub .nav-item { font-size: 0.93rem; padding: 6px 10px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--side-border); padding-top: 12px; }
.sidebar .btn { background: transparent; border-color: var(--side-border); color: var(--side-text); }
.sidebar .btn:hover { background: var(--side-hover); }
.sidebar .btn.block.active { background: var(--side-active); border-color: var(--gold); }
.who { font-size: 0.84rem; color: var(--side-muted); display: flex; flex-direction: column; gap: 2px; margin-top: 8px; padding: 0 4px; }
.who span { color: var(--side-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who a, .who .link { color: var(--side-muted); }
.who a:hover, .who .link:hover { color: var(--gold); }
.who form { margin: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 24px 28px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.btn.menu-toggle { display: none; }

/* Top navbar: Search, Notifications, Profile */
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px;
  padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.top-search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 460px; }
.top-search input {
  width: 100%; min-width: 0; padding: 8px 34px 8px 34px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font: inherit;
}
.top-search input:focus { outline: 2px solid var(--gold); outline-offset: 1px; background: var(--surface); }
.top-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 0.85rem; opacity: 0.7; }
.top-search-key {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 0.75rem var(--font-body, inherit);
  color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px;
}
.top-search-results, .top-panel {
  position: absolute; top: calc(100% + 6px); z-index: 30; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 28px rgba(31, 42, 68, 0.18);
}
.top-search-results { left: 0; right: 0; list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto; }
.top-search-results[hidden] { display: none; }
.top-search-results a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 6px; color: inherit; text-decoration: none; }
.top-search-results li.picked a, .top-search-results a:hover { background: var(--gold-soft); }
.top-search-results .none { padding: 7px 10px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-menu { position: relative; }
.top-menu summary { list-style: none; }
.top-menu summary::-webkit-details-marker { display: none; }
.top-btn {
  display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); position: relative;
}
.top-btn:hover, .top-menu[open] .top-btn { background: var(--surface-2); }
.top-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--error); color: #fff; font-size: 0.7rem; font-weight: 700; display: grid; place-items: center;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 0.78rem; font-weight: 700; flex: none;
}
.profile-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.top-panel { right: 0; width: 300px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.top-panel-head { font-weight: 700; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.notify-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.notify { border-left: 3px solid var(--border); border-radius: 4px; background: var(--surface-2); }
.notify a, .notify span { display: block; padding: 8px 10px; color: inherit; text-decoration: none; font-size: 0.9rem; }
.notify a:hover { background: var(--gold-soft); }
.notify.error { border-left-color: var(--error); }
.notify.warn { border-left-color: var(--gold); }
.notify-empty { padding: 6px 8px; margin: 0; }
.profile-card { display: flex; flex-direction: column; gap: 3px; padding: 6px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-word; }
.role-tag { align-self: flex-start; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--gold-soft); border: 1px solid var(--border); }
.top-panel form { margin: 0; }
.top-link {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text);
  text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer;
}
.top-link:hover { background: var(--surface-2); }
.statusbar {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 28px; background: var(--surface); border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--muted);
}
.statusbar .success { color: var(--success); }
.statusbar .error { color: var(--error); }

.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--border); position: relative;
}
.page-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 56px; height: 3px; background: var(--gold); border-radius: 2px; }
.head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.controls, .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }
.scores { display: flex; gap: 24px; flex-wrap: wrap; }
.scores b { color: var(--accent); }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 7px 14px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--gold); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.accent:hover { filter: brightness(1.12); }
.btn.block { width: 100%; justify-content: flex-start; }
.btn.block.active { background: var(--accent-soft); font-weight: 600; }
.btn.small { padding: 4px 10px; font-size: 0.87rem; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.provider-picker { display: flex; align-items: center; gap: 4px; }

input[type=text], input[type=search], input[type=email], input[type=password], input[type=url], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus, .editor:focus { outline: 2px solid var(--gold); outline-offset: -1px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0;
  box-shadow: 0 1px 2px rgba(31, 42, 68, 0.05);
}
.panel-title { font-size: 1.02rem; font-weight: 600; margin: 0 0 10px; }
.subhead { font-size: 1rem; margin: 18px 0 8px; color: var(--text); }
fieldset.panel { margin: 0; }
legend { font-weight: 600; font-size: 1.05rem; padding: 0 6px; }

/* Workflow split view */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.detail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.items-panel .table-wrap { max-height: calc(100vh - 270px); }
.readonly {
  white-space: pre-wrap; max-height: 220px; overflow: auto; font-size: 0.95rem;
  border-left: 3px solid var(--gold); padding: 2px 0 2px 12px;
}
.editor {
  white-space: pre-wrap; min-height: 140px; max-height: 420px; overflow: auto; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 0.97rem; line-height: 1.6;
  /* faint ruled-paper lines behind drafts */
  background-image: linear-gradient(transparent calc(1.6em - 1px), var(--surface-2) calc(1.6em - 1px));
  background-size: 100% 1.6em; background-position: 0 10px; background-attachment: local;
}
.editor.tall { min-height: 240px; }
.empty { text-align: center; margin: 12px 0 4px; font-style: italic; }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.grid th, .grid td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid th {
  background: var(--surface-2); position: sticky; top: 0; font-weight: 600; font-size: 0.78rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--gold);
}
.grid tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.grid.selectable tbody tr { cursor: pointer; }
.grid.selectable tbody tr:hover { background: var(--accent-soft); }
.grid tbody tr.selected { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.grid tr.flagged td { color: var(--error); }
.row-actions form { display: flex; gap: 6px; margin: 0; flex-wrap: wrap; }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius);
}
.tile:hover { border-color: var(--gold); }
.tile.warn { border-top-color: var(--gold); background: var(--gold-soft); }
.tile-label { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tile-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1.2; }
.tile-note { font-size: 0.85rem; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 2rem; align-items: center; gap: 8px; font-size: 0.9rem; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.bar-value { text-align: right; font-weight: 600; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
.checklist { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li.ok { color: var(--success); }
.checklist li.todo { color: var(--error); }
.steps { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.faq { margin: 0; }
.faq dt { font-weight: 600; margin-top: 10px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 2px 0 0; color: var(--muted); }
.readonly.code { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 0.86rem; tab-size: 4; max-height: 320px; }
/* Add User: name, email, role, package, grader type, create */
.form-row.user-row { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; }
.form-row.user-row .admin-note { grid-column: span 2; }
@media (max-width: 1100px) { .form-row.user-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .form-row.user-row { grid-template-columns: minmax(0, 1fr); } }
.access-field[hidden] { display: none; }
.form-hint { margin: 10px 0 0; }
.multi-select.locked summary { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.access-form .package-select { width: 100%; font-size: 0.87rem; padding: 4px 8px; }

/* Credits */
.credits-pill { display: inline-block; font-size: 0.82rem; padding: 2px 10px; border-radius: 999px;
  background: var(--gold-soft); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.credits-pill.empty { background: var(--error-bg); color: var(--error); }
.who .credits-pill { margin: 4px 0 2px; align-self: flex-start; background: var(--side-active); color: var(--side-text); border-color: var(--side-border); }
.who .credits-pill.empty { background: rgba(240, 138, 138, 0.2); color: #ffd1d1; }
.topup-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--border); }
.topup-form input[type=number] { width: 90px; padding: 4px 8px; font-size: 0.87rem; }
.tiny { font-size: 0.8rem; margin: 6px 0 0; }

/* Add New Package: name, two dropdowns, credits, cost, save */
/* Two rows of four: name and three menu groups, then Value-Added Services, credits, cost and Save. */
.form-row.package-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-row.package-row > button { justify-self: start; }
@media (max-width: 1100px) { .form-row.package-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .form-row.package-row { grid-template-columns: minmax(0, 1fr); } }
input[type=number] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; max-width: 100%; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.currency-code { display: block; font-size: 0.72rem; color: var(--muted); letter-spacing: 0.05em; }
.money-input { display: flex; }
.money-input select { flex: none; width: auto; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0;
  background: var(--surface-2); font-weight: 600; padding: 0 6px; }
.money-input input { flex: 1; min-width: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.form-row .money-input select { width: auto; }
.grid td.nowrap { white-space: nowrap; }
/* Book Search */
.book-way[hidden] { display: none; }
.book-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.book-hit { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.book-hit:last-child { border-bottom: 0; padding-bottom: 0; }
.book-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.book-tags .tag { font-size: 0.78rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.book-tags .tag.ok { background: var(--success-bg); color: var(--success); }
.book-tags .tag.price { background: var(--gold-soft); color: var(--text); font-weight: 600; }
.book-group { font-size: 0.95rem; margin: 16px 0 8px; }

/* PDU Search */
.req { color: var(--gold); font-weight: 700; }
.pdu-sources { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pdu-sources legend { padding: 0 4px; font-weight: 600; }
.pdu-cert { font-size: 0.88rem; }

/* Job Finder */
.cv-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.profile-grid .wide { grid-column: span 2; }
@media (max-width: 760px) { .profile-grid .wide { grid-column: auto; } }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.job-head a { font-weight: 600; }
.match { flex: none; font-size: 0.8rem; font-weight: 700; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.match.ok { background: var(--success-bg); color: var(--success); }
.match.price { background: var(--gold-soft); color: var(--text); }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.match-filter { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.match-filter select { width: auto; }
.match-reasons { margin: 4px 0 0; padding-left: 18px; font-size: 0.88rem; color: var(--muted); }

/* Syllabus Builder */
.course-in-use { padding: 8px 12px; border-radius: 6px; background: var(--info-bg); border-left: 4px solid var(--accent); font-size: 0.93rem; }
.course-in-use.missing { background: var(--error-bg); border-left-color: var(--error); }
.course-in-use a { margin-left: 6px; }
#syllabus-root { display: flex; flex-direction: column; gap: 14px; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.step-head .panel-title { margin: 0; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 10px 0 12px; }
.details-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; font-weight: 600; }
.details-grid label.wide { grid-column: 1 / -1; }
.details-grid input { width: 100%; }
@media (max-width: 760px) { .details-grid { grid-template-columns: minmax(0, 1fr); } }
.outline-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.outline-stats span { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; }
.outline-sections { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; background: var(--surface); }
.outline-sections h4 { margin: 10px 0 4px; font-family: var(--font-head); font-size: 0.98rem; }
.outline-sections ul { margin: 0 0 6px; padding-left: 20px; font-size: 0.9rem; }
.outline-sections .due { color: var(--muted); white-space: nowrap; }
.outline-notes { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 0.85rem; }
.syllabus-doc { white-space: normal; background-image: none; min-height: 320px; max-height: none; line-height: 1.55; padding: 16px 20px; }
.syllabus-doc h1 { font-size: 1.6rem; margin: 0 0 10px; }
.syllabus-doc h2 { font-size: 1.2rem; margin: 18px 0 6px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.syllabus-doc h3 { font-size: 1.02rem; margin: 12px 0 4px; }
.syllabus-doc p { margin: 6px 0; }
.syllabus-doc ul, .syllabus-doc ol { margin: 4px 0 8px; padding-left: 22px; }
.syllabus-doc table { border-collapse: collapse; width: 100%; margin: 8px 0 12px; font-size: 0.9rem; }
.syllabus-doc th, .syllabus-doc td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.syllabus-doc th { background: var(--surface-2); }
.syllabus-doc .ph { background: var(--gold-soft); border-radius: 3px; padding: 0 2px; }
@media print {
  body[data-page="syllabus"] .sidebar, body[data-page="syllabus"] .statusbar, body[data-page="syllabus"] .page-head,
  body[data-page="syllabus"] .menu-toggle, body[data-page="syllabus"] .flash, body[data-page="syllabus"] .topbar,
  body[data-page="syllabus"] #syllabus-root > *:not(#result-panel), body[data-page="syllabus"] #result-panel > *:not(#syllabus-doc) { display: none !important; }
  body[data-page="syllabus"], body[data-page="syllabus"] .main, body[data-page="syllabus"] .content { background: #fff; padding: 0; }
  body[data-page="syllabus"] #result-panel { border: 0; box-shadow: none; padding: 0; }
  body[data-page="syllabus"] .syllabus-doc { border: 0; padding: 0; color: #000; }
  body[data-page="syllabus"] .syllabus-doc .ph { background: none; }
}
.credit-form { max-width: 820px; display: flex; flex-direction: column; gap: 12px; }
.credit-table .group-row th { position: static; background: var(--gold-soft); color: var(--text); font-size: 0.8rem; }
.row-note { display: block; font-size: 0.78rem; }
.credit-table td.na { text-align: center; }
.credit-table td { vertical-align: middle; }
.credit-table input[type=number] { width: 110px; }
.credit-note { margin: -4px 0 0; }
.packages-table tr.editing td { box-shadow: inset 0 -2px 0 var(--gold); background: var(--gold-soft); }
.type-tags li.addon { background: var(--accent-soft); }
.coming-soon { text-align: center; padding: 40px 20px; max-width: 560px; margin: 10px auto 0; }
.coming-soon h2 { margin: 6px 0 8px; }
.coming-mark { font-size: 2.4rem; }
.section-title { font-size: 1.15rem; margin: 10px 0 0; }
.status-text { display: block; font-weight: 600; }
.status-text.ok { color: var(--success); }
.status-text.off { color: var(--error); }
.sub-line { display: block; font-size: 0.82rem; white-space: nowrap; }
.dialog .stats { margin-bottom: 10px; }
.conn-ok { color: var(--success); }
.conn-no { color: var(--error); }
.type-tags li.issue { background: var(--error-bg); color: var(--error); }

/* Report stats */
.stats { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 7px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.tab:hover { border-color: var(--gold); }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, .settings-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; font-weight: 600; }
.stack label.check, .settings-form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--muted); font-weight: 400; }
.settings-form { display: flex; flex-direction: column; gap: 14px; max-width: 1240px; }
/* LMS Connection and AI keys sit side by side, and stack when there isn't room for both */
.settings-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.narrow { max-width: 440px; }
.settings-form.narrow-form { max-width: 640px; }

/* Manage Colleges */
.form-mode { max-width: 640px; padding: 8px 12px; border-radius: 6px; border-left: 4px solid var(--accent); background: var(--info-bg); font-size: 0.92rem; }
.form-mode.pick { border-left-color: var(--gold); background: var(--gold-soft); }
.colleges-table tr.in-use td { background: color-mix(in srgb, var(--success-bg) 60%, transparent); }
.colleges-table tr.editing td { box-shadow: inset 0 -2px 0 var(--gold); }
.url-cell { word-break: break-all; }
.in-use-pill { margin-left: 6px; font-size: 0.78rem; }
.college-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.college-actions form { margin: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font-size: 1rem; }
.icon-btn:hover { border-color: var(--gold); background: var(--surface-2); }
.icon-btn.danger:hover { border-color: var(--error); background: var(--error-bg); }
.disabled-btn { opacity: 0.6; cursor: default; }
[data-show][hidden], [data-lms][hidden] { display: none !important; }
.oauth-box { border-left: 3px solid var(--gold); padding-left: 12px; }
.oauth-help { margin: 0; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--muted); }
.connect-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-pill { font-size: 0.88rem; color: var(--muted); }
.status-pill.ok { color: var(--success); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#grader-type-field[hidden] { display: none; }
/* Add a user: fields side by side in one row, wrapping to two columns, then one, on narrower screens */
.form-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; font-weight: 600; min-width: 0; }
.form-row input:not([type=checkbox]), .form-row select, .form-row .multi-select summary { width: 100%; height: 40px; }
.form-row .ms-menu label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form-row .ms-menu .ms-all { font-weight: 600; }
.form-row .multi-select summary { white-space: nowrap; overflow: hidden; }
.form-row .ms-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.form-row .ms-menu { min-width: 260px; }
.form-row .btn { height: 40px; }
.admin-note { margin: 0; height: 40px; display: flex; align-items: center; }
.admin-note[hidden] { display: none; }
@media (max-width: 1100px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-row .btn { justify-self: start; } }
@media (max-width: 600px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
.field-label { font-size: 0.92rem; font-weight: 600; }

/* Grader Type multi-select dropdown */
.multi-select { position: relative; }
.multi-select summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select summary::after { content: "▾"; color: var(--muted); }
.multi-select[open] summary { outline: 2px solid var(--gold); outline-offset: -1px; }
.multi-select[open] summary::after { content: "▴"; }
.ms-menu {
  position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(31, 42, 68, 0.15);
  display: flex; flex-direction: column;
}
.ms-menu label.check { padding: 6px 8px; border-radius: 5px; color: var(--text); font-weight: 400; cursor: pointer; }
.ms-menu label.check:hover { background: var(--accent-soft); }
.ms-menu .ms-all { border-bottom: 1px solid var(--border); border-radius: 5px 5px 0 0; margin-bottom: 2px; font-weight: 600; }
/* Inside the users table the menu opens in place, since the scrolling table would clip a floating menu */
.multi-select.inline .ms-menu { position: static; box-shadow: none; margin-top: 4px; }
.multi-select.inline summary { padding: 4px 8px; font-size: 0.87rem; }
.types-cell { min-width: 220px; }
.type-tags { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.type-tags li { background: var(--gold-soft); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 0.8rem; }
.access-form { display: flex; flex-direction: column; gap: 6px; margin: 0; align-items: flex-start; }
.access-form .multi-select { width: 100%; }

.flash { padding: 10px 14px; border-radius: 6px; margin: 14px 28px 0; border-left: 4px solid currentColor; }
.content .flash { margin: 0; }
.flash.success { background: var(--success-bg); color: var(--success); }
.flash.error { background: var(--error-bg); color: var(--error); }
.flash.info { background: var(--info-bg); color: var(--text); border-left-color: var(--gold); }

/* Sign-in pages */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 55%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 30px 30px 26px; border-top: 5px solid var(--accent); box-shadow: 0 10px 30px rgba(31, 42, 68, 0.1);
}
.auth-card .brand { justify-content: center; flex-direction: column; text-align: center; gap: 6px; margin-bottom: 18px; }
.auth-card .brand-mark { width: 48px; height: 48px; }
.auth-card .brand-name { color: var(--text); font-size: 1.5rem; }
.auth-card .brand-tag { color: var(--muted); }
.auth-card .flash { margin: 0 0 12px; }
.auth-card h1 { margin-bottom: 14px; font-size: 1.3rem; text-align: center; }
.signed-in-as { text-align: center; margin: 0 0 16px; }
.auth-card .stack form { margin: 0; }
.btn.block-center { width: 100%; }

/* Dialog */
.dialog { border: 1px solid var(--border); border-top: 4px solid var(--gold); border-radius: 12px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); padding: 20px; }
.dialog::backdrop { background: rgba(12, 18, 32, 0.5); }
.dialog h2 { margin: 0 0 12px; font-size: 1.15rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Phones and narrow windows */
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .items-panel .table-wrap { max-height: 320px; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform 0.2s; box-shadow: 0 0 24px rgba(0,0,0,0.3); }
  .sidebar.open { transform: none; }
  .btn.menu-toggle { display: inline-flex; flex: none; }
  .topbar { padding: 8px 16px; gap: 8px; }
  .top-search-key, .profile-name { display: none; }
  .top-search input { padding-right: 10px; }
  .menu-toggle .menu-word { display: none; }
  .top-panel { width: min(300px, calc(100vw - 32px)); }
  .content { padding: 14px 16px; }
  .statusbar { padding: 8px 16px; }
  .flash { margin: 12px 16px 0; }
  .stats { grid-template-columns: 1fr; }
  .stats dd { margin-bottom: 6px; }
}

/* Security and Activity Log */
.status-tag { font-size: 0.75rem; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); vertical-align: middle; margin-left: 6px; font-family: var(--font-body); }
.status-tag.ok { background: var(--success-bg); color: var(--success); }
.setup-2fa { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.setup-2fa .qr svg { display: block; border: 1px solid var(--border); border-radius: 8px; }
.setup-key { font-size: 1rem; letter-spacing: 0.08em; word-break: break-all; }
@media (max-width: 600px) { .setup-2fa { grid-template-columns: minmax(0, 1fr); } }
.backup-codes { border: 2px dashed var(--gold); border-radius: 10px; padding: 12px 16px; background: var(--gold-soft); }
.backup-codes h3 { margin: 0 0 4px; }
.backup-codes ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.backup-codes code { font-size: 1rem; }
.security-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.security-forms h3 { margin: 0; font-size: 1rem; }
@media (max-width: 760px) { .security-forms { grid-template-columns: minmax(0, 1fr); } }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.filters-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters-row label { flex: 1 1 180px; }
.activity-table tr.bad td { background: var(--error-bg); }
