:root {
  color-scheme: dark;
  --bg: #111113;
  --surface: #19191c;
  --fg: #ededef;
  --muted: #9b9ba4;
  --line: #2a2a2f;
  --accent: #8d8dfa;
  --accent-soft: #23234a;
  --ok: #3fbf74;
  --err: #f06464;
  --warn-bg: #3a2f12;
  --note: #221f14;
  --note-line: #4a4126;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.top nav a { color: var(--fg); padding: 6px 12px; border-radius: 8px; }
.top nav a:hover { background: var(--bg); text-decoration: none; }
.brand { font-weight: 700; font-size: 17px; color: var(--fg); letter-spacing: -0.02em; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; background: var(--accent); }
.who { color: var(--muted); font-size: 13px; }
main { max-width: 1040px; margin: 0 auto; padding: 28px 24px 48px; }
h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 24px 0 8px; }
p { margin: 8px 0; }
button { min-height: 40px; padding: 8px 16px; border: 0; border-radius: 8px; background: var(--accent); color: #111113; font: inherit; font-weight: 600; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; }
button.danger, button.decline { background: var(--err); color: #fff; }
button.accept { background: var(--ok); color: #fff; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; }
input, select { min-height: 40px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { font-size: 13px; color: var(--muted); }
code { font-family: ui-monospace, Consolas, monospace; }
code.key { font-size: 1.3rem; letter-spacing: 0.1em; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.warning { background: var(--warn-bg); padding: 10px 14px; border-radius: var(--radius); }
.error { color: var(--err); }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
section > .text { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.narrow { max-width: 380px; margin: 64px auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.narrow-form { max-width: 480px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.inline label { flex: 1; min-width: 240px; }
.check { display: inline-flex; gap: 6px; align-items: center; flex: 0 0 auto; min-width: 0; color: var(--fg); font-size: 14px; white-space: nowrap; }
.check input { display: inline-block; width: auto; min-height: 0; margin: 0; }
.actions { margin-top: 24px; }
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tile { flex: 1; min-width: 200px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg); }
.tile strong { display: block; font-size: 2rem; }
.counts { color: var(--muted); margin: 0 0 20px; }
.counts strong { color: var(--fg); font-size: 20px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 16px; background: var(--line); border-radius: 9px; }
.tabs a { padding: 6px 14px; border-radius: 7px; color: var(--muted); }
.tabs a.active { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.tabs a:hover { text-decoration: none; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.filters label { flex: 1; min-width: 200px; }
table.list { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg); }
table.list tbody tr:hover { background: var(--accent-soft); }
tr.total td { font-weight: 600; }
.task { margin: 0 0 20px; }
details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--accent); }
.chat { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.msg.student { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.ours { align-self: flex-end; background: var(--accent-soft); border-color: transparent; border-bottom-right-radius: 4px; }
.msg .meta, .note .meta { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.event { align-self: center; margin: 0; font-size: 12px; color: var(--muted); }
.note { padding: 12px 16px; background: var(--note); border: 1px solid var(--note-line); border-radius: var(--radius); font-size: 14px; }
.note p { margin: 4px 0; }
.criteria { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.criteria li { display: flex; flex-direction: column; }
.criteria q { color: var(--muted); }
.criteria .met-yes strong { color: var(--ok); }
.criteria .met-no strong { color: var(--err); }
.reply { max-width: 760px; margin-top: 20px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.reply label { color: var(--fg); font-weight: 600; font-size: 14px; }
.decide { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.decide button { flex: 1; min-width: 160px; }
.exclude { margin-top: 28px; font-size: 14px; }
@media (max-width: 700px) {
  main { padding: 16px; }
  .top { padding: 12px 16px; }
  table.list thead { display: none; }
  table.list tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.list td { display: block; border: 0; padding: 2px 0; }
  table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .msg { max-width: 92%; }
  .decide { flex-direction: column; }
}
body:has(main.shell) { height: 100vh; display: flex; flex-direction: column; }
main.shell { max-width: none; width: 100%; padding: 0; display: grid; grid-template-columns: 340px 1fr; flex: 1; min-height: 0; }
.panel { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.panel-head h1 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; }
.panel-head .counts { margin: 0; font-size: 13px; }
.panel-head .counts strong { font-size: 14px; }
.panel-head .tabs { margin: 0; align-self: flex-start; }
.back { font-size: 18px; color: var(--muted); }
.rows { overflow-y: auto; flex: 1; }
a.row { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--fg); }
a.row:hover { background: var(--bg); text-decoration: none; }
a.row.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
a.row.more { justify-content: center; color: var(--accent); }
.row .icon { font-size: 24px; width: 32px; text-align: center; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small.why { color: #e3b341; }
.count { background: var(--accent); color: #111113; font-weight: 700; font-size: 12px; border-radius: 10px; padding: 1px 8px; }
.time { color: var(--muted); font-size: 12px; align-self: flex-start; }
.empty { color: var(--muted); padding: 16px; margin: 0; }
.empty.center { margin: auto; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head small { display: block; color: var(--muted); }
.to-list { display: none; font-size: 18px; color: var(--muted); }
.feed { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.feed > * { max-width: 860px; }
.feed .msg.student, .feed .note, .feed .task, .feed .warning, .feed .event { margin-right: auto; }
.feed .msg.ours { margin-left: auto; }
.feed .event { margin-left: auto; }
.note summary { cursor: pointer; }
.composer { border-top: 1px solid var(--line); padding: 12px 20px; background: var(--surface); }
.composer form, .composer-links { max-width: 860px; }
.composer .decide { margin-top: 8px; }
.composer-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.danger-link, .danger-text { color: var(--err); font-size: 14px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.box h2 { margin-top: 0; }
.inline .icon-pick { flex: 0 0 96px; min-width: 96px; }
.icon-pick select { font-size: 20px; }
.inline.compact { margin: 0; flex-wrap: nowrap; }
.inline.compact select { min-width: 160px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; border: 0; padding: 0; margin: 0; }
.checks legend { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.invite-link input { font-family: ui-monospace, Consolas, monospace; }
tr.pending td { color: var(--muted); }
@media (max-width: 760px) {
  main.shell { grid-template-columns: 1fr; }
  main.shell.has-card .panel { display: none; }
  main.shell:not(.has-card) .chat { display: none; }
  .to-list { display: inline; }
  .feed { padding: 14px; }
}
.steps { margin: 6px 0 12px; padding-left: 22px; }
.steps li { margin: 3px 0; }
.text.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 420px; overflow: auto; }
code.small { font-size: 12px; color: var(--muted); }
button[disabled] { opacity: 0.45; cursor: not-allowed; }
body.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
body.admin .top { flex-direction: column; align-items: stretch; gap: 4px; padding: 18px 12px; border-bottom: 0; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
body.admin .top .brand { padding: 0 10px 14px; }
body.admin .top nav { flex-direction: column; flex: 1; overflow: visible; white-space: normal; gap: 2px; }
body.admin .top nav a { padding: 8px 10px; }
body.admin .top nav a.on { background: var(--accent-soft); color: var(--fg); font-weight: 600; }
body.admin .top .who { padding: 0 10px; overflow-wrap: anywhere; }
body.admin .top form { padding: 4px 10px; }
body.admin main { margin: 0; max-width: 1100px; width: 100%; }
@media (max-width: 760px) {
  body.admin { display: block; }
  body.admin .top { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  body.admin .top nav { flex-direction: row; overflow-x: auto; white-space: nowrap; }
}
.acting { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; padding: 6px 16px; background: #3a2f12; color: #f3d98b; font-size: 13px; }
.acting form { margin: 0; }
body:has(main.shell) .acting { flex: 0 0 auto; }
