/* Grade consultation portal.
   One brand colour (BulSU maroon), neutral greys, status colours only for
   pass / fail / review and always next to a word. System fonts: crisp on
   every phone and no download. */

:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --sunken: #efede9;
  --ink: #18171a;
  --soft: #4c4a50;
  --faint: #75727a;
  --line: #e4e1db;
  --line-strong: #cbc7bf;
  --brand: #7b1d2c;
  --brand-hover: #621522;
  --brand-ink: #ffffff;
  --brand-soft: #f5e9eb;
  --bar: #7b1d2c;
  --track: #ebe8e3;
  --pass: #1d6a3f;
  --pass-bg: #e7f1ea;
  --fail: #a3261b;
  --fail-bg: #f8e8e5;
  --review: #865600;
  --review-bg: #f7eed9;
  --focus: #7b1d2c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(24, 23, 26, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131215;
    --surface: #1b1a1e;
    --sunken: #222125;
    --ink: #ecebef;
    --soft: #bebbc3;
    --faint: #918d97;
    --line: #2c2a30;
    --line-strong: #3f3c44;
    --brand: #93293b;
    --brand-hover: #a83246;
    --brand-ink: #ffffff;
    --brand-soft: #2c1a1e;
    --bar: #d77a8b;
    --track: #2e2c32;
    --pass: #74c796;
    --pass-bg: #18291f;
    --fail: #f2907f;
    --fail-bg: #331b18;
    --review: #e3b660;
    --review-bg: #2f2615;
    --focus: #e08b9a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }

h1, h2, h3 { font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); }
h1 { font-size: 28px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0 0 12px; }
a { color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (prefers-color-scheme: dark) { a { color: var(--focus); } }
b { font-weight: 650; }
small { font-size: 13px; font-weight: 400; color: var(--faint); }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }
.wrap.wide { max-width: 1140px; }
.narrow-col { max-width: 480px; margin: 0 auto; }
.narrow { max-width: 420px; }
main.wrap { padding-top: 40px; padding-bottom: 64px; }

/* ---- header ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; margin-right: auto; min-width: 0; }
.brand-mark {
  font-weight: 750; font-size: 15px; letter-spacing: .01em; color: var(--brand-ink); background: var(--brand);
  padding: 5px 9px 6px; border-radius: 6px; line-height: 1;
}
.brand-name { font-size: 15px; font-weight: 600; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toplink { font-size: 14px; font-weight: 500; color: var(--soft); text-decoration: none; padding: 8px 2px; }
.toplink:hover { color: var(--ink); }

.tabs { display: flex; gap: 4px; align-self: stretch; }
.tabs button {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--soft); background: none; border: 0;
  border-bottom: 2px solid transparent; padding: 0 12px; cursor: pointer; min-height: 58px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tabs button:focus { outline: none; }
.tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: -6px; border-radius: 8px; }
.tabs .quiet { color: var(--faint); }
.count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 650; line-height: 20px; text-align: center;
}

/* ---- text ---- */
.step { font-size: 13px; font-weight: 600; color: var(--brand); margin-bottom: 8px; letter-spacing: .01em; }
@media (prefers-color-scheme: dark) { .step { color: var(--focus); } }
.lede { color: var(--soft); font-size: 16px; margin-bottom: 24px; max-width: 62ch; }
.fine { color: var(--faint); font-size: 13px; }
.center { text-align: center; margin-top: 16px; }
.kicker { color: var(--soft); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.meta { color: var(--faint); font-size: 14px; margin-bottom: 0; }
.back { margin-bottom: 16px; font-size: 14px; }
.back a { text-decoration: none; font-weight: 500; }
.back a::before { content: "\2190\00a0"; }
.empty { color: var(--soft); padding: 32px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { margin: 0; }

/* ---- surfaces ---- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.panel { margin-top: 24px; }
.panel h2 { margin-bottom: 4px; }
.block { margin-top: 36px; }
#app > h2 { margin-top: 36px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.block-head h2 { margin: 0; }

/* ---- forms ---- */
label, legend { display: block; font-size: 14px; font-weight: 600; margin: 16px 0 6px; padding: 0; color: var(--ink); }
.card > label:first-child, .panel > h2 + p + label { margin-top: 0; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; min-height: 44px;
  transition: border-color .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
textarea { resize: vertical; line-height: 1.5; }
input[type="file"] { font: inherit; font-size: 14px; max-width: 100%; color: var(--soft); }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 14px; color: var(--ink); background: var(--sunken);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 14px; margin-right: 12px; cursor: pointer;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
input.short { width: 96px; text-align: right; }
::placeholder { color: var(--faint); opacity: .7; }

.big-input {
  font-size: 22px !important; font-weight: 500; letter-spacing: .06em; min-height: 56px !important;
  padding: 10px 16px !important; font-variant-numeric: tabular-nums;
}
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 15px; margin-top: 18px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--brand-ink); background: var(--brand); border: 1px solid var(--brand); border-radius: 8px;
  padding: 11px 18px; min-height: 44px; cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.wide { width: 100%; margin-top: 16px; min-height: 50px; font-size: 16px; }
.btn.plain { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.btn.plain:hover { background: var(--sunken); color: var(--ink); }
.btn.danger { background: var(--fail); border-color: var(--fail); color: #fff; }
.link { font: inherit; font-size: 14px; font-weight: 500; color: var(--brand); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (prefers-color-scheme: dark) { .link { color: var(--focus); } }
.link.danger { color: var(--fail); }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.actions.end { margin-top: 40px; }
.head .actions { margin-top: 0; }

/* ---- messages ---- */
.msg { border-radius: 8px; background: var(--sunken); padding: 11px 14px; margin: 14px 0; font-size: 14px; color: var(--ink); }
.msg p { margin: 0 0 4px; }
.msg p:last-child { margin: 0; }
.msg.err { background: var(--fail-bg); color: var(--fail); }
.msg.ok { background: var(--pass-bg); color: var(--ink); }
.msg.warn { background: var(--review-bg); color: var(--ink); }
.msg .actions { margin-top: 10px; }
.secret { font: 600 18px/1.4 ui-monospace, Consolas, "Courier New", monospace; letter-spacing: .04em; user-select: all; }

.pass { color: var(--pass); }
.fail { color: var(--fail); }
.review { color: var(--review); }
.tag { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---- confirm step ---- */
.facts { margin: 0; }
.facts div { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts div:first-child { padding-top: 0; }
.facts dt { width: 84px; flex: none; color: var(--faint); font-size: 14px; }
.facts dd { margin: 0; font-weight: 600; }
.pick { border: 0; padding: 0; margin: 18px 0 0; }
.pick legend { margin-top: 0; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; font-weight: 500; margin: 0 0 8px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.choice small { display: block; margin-top: 2px; }

/* ---- record ---- */
.record-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.switch { margin: 0; min-width: 240px; font-weight: 500; font-size: 13px; color: var(--faint); }
.switch select { margin-top: 4px; }

.result { display: grid; grid-template-columns: 1fr 1fr 1.2fr; padding: 0; overflow: hidden; }
.figure { padding: 18px 22px 20px; border-left: 1px solid var(--line); min-width: 0; }
.figure:first-child { border-left: 0; }
.figure > span { display: block; font-size: 13px; font-weight: 500; color: var(--faint); margin-bottom: 4px; }
.figure strong {
  display: flex; align-items: baseline; gap: 2px; font-size: 34px; line-height: 1.15; font-weight: 650;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.figure strong small { font-size: 18px; font-weight: 600; color: var(--soft); }
.figure.standing { background: var(--sunken); }
.figure.standing.pass { background: var(--pass-bg); }
.figure.standing.fail { background: var(--fail-bg); }
.figure.standing.review { background: var(--review-bg); }
.figure.standing strong { font-size: 24px; line-height: 39px; align-items: center; gap: 10px; letter-spacing: -.01em; }
.figure.standing.pass strong { color: var(--pass); }
.figure.standing.fail strong { color: var(--fail); }
.figure.standing.review strong { color: var(--review); }
.figure.standing.none strong { color: var(--soft); }
.figure.standing i {
  font-style: normal; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid currentColor; flex: none;
}

.comps { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.comp { padding: 16px 20px 18px; border-top: 1px solid var(--line); }
.comp:first-child { border-top: 0; }
.comp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.comp-weight { font-size: 13px; color: var(--faint); white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--track); margin: 10px 0 8px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 4px; background: var(--bar); min-width: 2px; }
.comp-nums { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--soft); }
.comp-nums b { color: var(--ink); }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; margin: 12px 0 0; }
.items div { background: var(--sunken); border-radius: 6px; padding: 7px 10px 8px; }
.items dt { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.items dd { margin: 1px 0 0; font-weight: 650; font-size: 15px; }
.items dd small { font-size: 12px; font-weight: 400; }
.items .pending dd { color: var(--faint); font-weight: 500; }
.comps:has(+ .total) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.total {
  display: flex; justify-content: space-between; align-items: baseline; padding: 14px 20px; font-size: 15px; color: var(--soft);
  background: var(--sunken); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius);
}
.total b { color: var(--ink); font-size: 17px; }

.appeal form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 22px; }
.appeal form > :first-child { margin-top: 0; }

/* ---- tables (faculty) ---- */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .scroll, .grid.tight { box-shadow: none; }
.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th, .grid td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr:last-child th, .grid tbody tr:last-child td { border-bottom: 0; }
.grid thead th { font-size: 12px; font-weight: 600; color: var(--faint); background: var(--sunken); white-space: nowrap; vertical-align: bottom; border-bottom-color: var(--line); }
.grid tbody th { font-weight: 600; }
.grid tbody tr:hover { background: color-mix(in srgb, var(--sunken) 50%, transparent); }
.grid .n { text-align: right; white-space: nowrap; }
.grid tfoot th, .grid tfoot td { font-weight: 650; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.grid th a { text-decoration: none; font-weight: 600; }
.grid th a:hover { text-decoration: underline; }
.grid th small { display: block; margin-top: 2px; }
.grid.tight th, .grid.tight td { padding: 6px 12px; vertical-align: middle; }
.grid.tight input, .grid.tight select { min-height: 38px; padding: 6px 10px; font-size: 15px; }
.roster { font-size: 14px; }
.roster th, .roster td { white-space: nowrap; }
.roster thead small { font-size: 11px; }
.rowacts { text-align: right; white-space: nowrap; }
.grid td .link { padding: 0; line-height: inherit; vertical-align: baseline; }
.rowacts .link { margin-left: 14px; }
.panel h3 { margin: 22px 0 10px; }

/* ---- lists: appeals ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px 18px; margin-bottom: 10px; }
.list-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.quote { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 12px; }
.reply { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sunken); border-radius: 8px; padding: 10px 12px; margin: 0; }
.appeal h3 { margin: 28px 0 10px; }
.filter { display: inline-flex; background: var(--sunken); border-radius: 8px; padding: 3px; gap: 2px; }
.filter button { font: inherit; font-size: 14px; font-weight: 500; background: none; border: 0; border-radius: 6px; padding: 6px 14px; cursor: pointer; color: var(--soft); }
.filter button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.foot { color: var(--faint); font-size: 13px; padding: 20px 0 32px; border-top: 1px solid var(--line); }
.faculty .foot { display: none; }

/* ---- phones ---- */
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 28px; }
  h1 { font-size: 24px; }
  .card, .panel { padding: 18px; }
  .result { grid-template-columns: 1fr 1fr; }
  .figure { padding: 14px 16px 16px; }
  .figure strong { font-size: 28px; }
  .figure.standing { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .comp { padding: 14px 16px 16px; }
  .total { padding: 14px 16px; }
  .record-head { align-items: stretch; }
  .switch { min-width: 0; width: 100%; }
  .actions .btn { flex: 1; }
  .top-in { gap: 8px; min-height: 56px; }
  .faculty .top-in { flex-wrap: wrap; }
  .faculty .tabs { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 8px; overflow-x: auto; border-top: 1px solid var(--line); }
  .tabs button { min-height: 46px; padding: 0 10px; white-space: nowrap; }
  .grid th, .grid td { padding: 10px 12px; }
}
