:root {
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f9fafb;
  --card: #ffffff;
  --accent: #1c4e80;
  --orange: #c4622d;
  --blue: #2f6fb0;
  --danger: #b42318;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 4px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.who { display: flex; align-items: center; gap: 12px; }
.link {
  border: 0; background: none; color: var(--accent);
  font: inherit; cursor: pointer; padding: 0;
}

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 64px; }

.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.toolbar input {
  flex: 1 1 260px; min-width: 0;
  padding: 9px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); font: inherit;
}

.courses { display: flex; flex-direction: column; gap: 14px; }

.course {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.course > summary {
  display: flex; align-items: baseline; gap: 10px;
  padding: 13px 16px; cursor: pointer; list-style: none;
}
.course > summary::-webkit-details-marker { display: none; }
.course > summary::before {
  content: "›"; color: var(--muted);
  transition: transform .12s ease; display: inline-block;
}
.course[open] > summary::before { transform: rotate(90deg); }
.course-code {
  font-variant-numeric: tabular-nums; color: var(--muted);
  font-size: 13px; margin-left: auto;
}

.folder-list { list-style: none; margin: 0; padding: 0 0 6px; }
.folder {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 34px; border-top: 1px solid var(--line);
}
.folder a { color: inherit; text-decoration: none; font-weight: 500; }
.folder a:hover { text-decoration: underline; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot.orange { background: var(--orange); }
.dot.blue { background: var(--blue); }

.tags { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.tag {
  font-size: 12px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.tag.protected { border-color: #f3c9c4; color: var(--danger); }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 3ch; text-align: right; }

.archive { margin-top: 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; width: min(360px, 100%); display: flex; flex-direction: column; gap: 8px;
}
.card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.card input {
  padding: 9px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); font: inherit;
}
.card button {
  margin-top: 12px; padding: 10px 12px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; font: inherit; cursor: pointer;
}
.card button:disabled { opacity: .55; cursor: default; }

@media (max-width: 520px) {
  .folder { padding-left: 22px; flex-wrap: wrap; }
  .tags { width: 100%; margin-left: 0; }
}

/* Screen 2 — a folder's resources */
.crumbs { padding-block: 4px 14px; }
.folder-head { margin-bottom: 18px; }
.folder-head h2 { font-size: 20px; margin: 0 0 2px; }
.sections {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
}
.sections:empty { display: none; }
.section-row { padding-block: 6px; border-top: 1px solid var(--line); }
.section-row:first-child { border-top: 0; }
.section-row h3 { font-size: 14px; margin: 0 0 2px; }
.section-row p { margin: 0; color: var(--muted); font-size: 13.5px; }

table.resources {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
table.resources th, table.resources td {
  text-align: left; padding: 9px 14px; border-top: 1px solid var(--line);
  vertical-align: top;
}
table.resources thead th {
  border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); font-weight: 500; background: var(--bg);
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.title a { color: inherit; font-weight: 500; text-decoration: none; }
td.title a:hover { text-decoration: underline; }
td.lesson { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* State is the thing this screen exists to show, so it reads as a shape as
   well as a word — a locked row should be findable without reading. */
.state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state.available { color: #2f7a4f; }
.state.locked { color: var(--muted); }
.state.excluded { color: var(--danger); }
.opens { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
tr.unlisted td { opacity: .55; }
tr.deleted td.title a { text-decoration: line-through; }

/* Screen 3 — the resource editor */
.editor {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; display: flex;
  flex-direction: column; gap: 14px; max-width: 760px;
}
.editor h2 { font-size: 19px; margin: 0; }
.editor h3 { font-size: 15px; margin: 0; }
.editor label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 3px; }
.editor input[type="text"], .editor input:not([type]), .editor input[type="number"], .editor select {
  width: 100%; padding: 8px 11px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.editor input:focus-visible, .editor select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; max-width: 62ch; }
.pair { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }

fieldset.flags { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; }
fieldset.flags legend { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; margin-bottom: 6px; }
.check:last-child { margin-bottom: 0; }
.check input { width: auto; }

.rules { border-top: 1px solid var(--line); padding-top: 14px; }
.rules-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* A rule reads as a sentence, because that is how staff describe it out loud:
   "opens when they attend, plus 0, and stays open". */
.rule {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px;
}
.rule .word { color: var(--muted); font-size: 13.5px; }
.rule select, .rule input { width: auto; min-width: 0; }
.rule input.offset { width: 8ch; }
.rule .remove { margin-left: auto; }
.rule.fallback-on { border-color: var(--accent); }

.actions { display: flex; align-items: center; gap: 12px; padding-top: 6px; flex-wrap: wrap; }
button.primary {
  padding: 9px 16px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; cursor: pointer;
}
button.danger {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: none; color: var(--danger); font: inherit; cursor: pointer;
}
button.primary:disabled, button.danger:disabled { opacity: .5; cursor: default; }

@media (max-width: 560px) { .pair { grid-template-columns: 1fr; } }

/* Screens 5 and 7 — access, and what has happened */
.access, .audit { border-top: 1px solid var(--line); padding-top: 14px; }
table.people { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.people td { padding: 7px 0; border-top: 1px solid var(--line); vertical-align: middle; }
table.people tr:first-child td { border-top: 0; }
td.person { font-weight: 500; }
td.person small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
td.when { color: var(--muted); font-size: 13px; white-space: nowrap; text-align: right; }
td.act { text-align: right; width: 1%; white-space: nowrap; }

.grant-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.grant-row input { flex: 1 1 160px; min-width: 0; padding: 8px 11px; font: inherit;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.grant-row button { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: none; color: var(--accent); font: inherit; cursor: pointer; }

/* The trail is a list of facts in order, so it is a list, not a table. */
ol.trail { list-style: none; margin: 8px 0 0; padding: 0; }
ol.trail li { padding: 7px 0 7px 14px; border-left: 2px solid var(--line); position: relative; }
ol.trail li + li { margin-top: 2px; }
ol.trail .what { font-size: 14px; }
ol.trail .who { color: var(--muted); font-size: 12.5px; }

/* Screen 8 — the schedule editor */
.track-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.track-card h3 { font-size: 15px; margin: 0 0 2px; }
.track-card .muted { font-size: 13px; }

table.schedule { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.schedule th, table.schedule td {
  text-align: left; padding: 6px 10px 6px 0; border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.schedule thead th {
  border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); font-weight: 500;
}
td.pos { font-variant-numeric: tabular-nums; color: var(--muted); width: 4ch; }
td.entry input, td.entry select {
  width: 100%; padding: 6px 9px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
}
td.weeks { color: var(--muted); font-size: 13px; white-space: nowrap; }
tr.marker td.entry { color: var(--muted); font-style: italic; }
tr.deprecated td.entry { text-decoration: line-through; color: var(--muted); }
tr.leap-week td.weeks { color: var(--danger); }
.track-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
