/* Abstract review site */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --ink: #1c2230;
  --muted: #5d6676;
  --line: #d9dde4;
  --accent: #0b5d7a;
  --accent-strong: #084a61;
  --on-accent: #ffffff;
  --accent-soft: #e2eff4;
  --ok: #1b6a3f;
  --ok-soft: #e3f3e9;
  --error: #a02828;
  --error-soft: #fbe8e6;
  --note: #5f4a00;
  --note-soft: #fff4d6;
  --oral: #6d3a94;
  --oral-soft: #f0e6f7;
  --poster: #8a4b0f;
  --poster-soft: #f8ebdc;
  --s1: #eef4f6; --s2: #cfe3ea; --s3: #9fc8d6; --s4: #4f97b0; --s5: #0b5d7a;
  --s-ink-light: #10303c; --s-ink-dark: #ffffff;
  --shadow: 0 1px 2px rgba(20, 30, 50, .08), 0 4px 14px rgba(20, 30, 50, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181f;
    --surface: #1d232d;
    --ink: #e8ebf0;
    --muted: #a3acba;
    --line: #343c49;
    --accent: #6cc0dc;
    --accent-strong: #8fd2e8;
    --on-accent: #0c1c24;
    --accent-soft: #1d3540;
    --ok: #7fd3a2;
    --ok-soft: #1c3528;
    --error: #f2a09a;
    --error-soft: #43201f;
    --note: #f0d68a;
    --note-soft: #3a3118;
    --oral: #cfa6ee;
    --oral-soft: #33243f;
    --poster: #edb984;
    --poster-soft: #3d2c1a;
    --s1: #22313a; --s2: #25424f; --s3: #2b5d70; --s4: #3a86a1; --s5: #7fcde6;
    --s-ink-light: #e8f3f7; --s-ink-dark: #0c1c24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .6rem; }
p { margin: 0 0 .8rem; }
code { font-size: .9em; background: var(--accent-soft); padding: .05em .3em; border-radius: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- Header ---- */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.5rem;
  padding: .7rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.top nav a, .who a {
  padding: .3rem .7rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem;
}
.top nav a:hover, .who a:hover { color: var(--ink); background: var(--bg); }
.top a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }
.who { display: flex; align-items: center; gap: .25rem; }
.who form { margin: 0; }

main { max-width: 78rem; margin: 0 auto; padding: 1.25rem; }
.view-abstract main { max-width: 100rem; }

/* ---- Controls ---- */
button, .button, input, select, textarea { font: inherit; color: inherit; }
button, .button {
  display: inline-block; padding: .45rem .9rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem;
}
button:hover, .button:hover { border-color: var(--accent); color: var(--accent-strong); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
button.danger { color: var(--error); }
button.danger:hover { border-color: var(--error); color: var(--error); }
button.link { border: 0; background: none; padding: .3rem .5rem; color: var(--accent); font-weight: 600; }
button:disabled { opacity: .55; cursor: not-allowed; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
textarea { resize: vertical; line-height: 1.45; }
label { font-weight: 600; font-size: .95rem; }
.optional, .hint { color: var(--muted); font-weight: 400; font-size: .9rem; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; }
.check input { margin-top: .3rem; flex: none; width: 1.05rem; height: 1.05rem; }
.stack { display: grid; gap: .45rem; }
.stack input, .stack textarea { margin-bottom: .5rem; }
.stack button { justify-self: start; margin-top: .3rem; }
.stack.wide { max-width: 44rem; }

/* ---- Blocks ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card h2:first-child { margin-top: 0; }
.card.narrow { max-width: 26rem; margin: 2.5rem auto; }
.flash { padding: .65rem .9rem; border-radius: 8px; margin: 0 0 1rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.flash.error { background: var(--error-soft); color: var(--error); border-color: var(--error); }
.flash.note { background: var(--note-soft); color: var(--note); }
.flash.credentials { background: var(--surface); border-color: var(--accent); }
.flash.credentials textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; margin-bottom: .6rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.guidance { background: var(--accent-soft); border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1rem; }
.guidance h2 { margin: 0 0 .3rem; font-size: 1rem; }
.guidance p { margin: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

progress { width: 9rem; height: .6rem; accent-color: var(--accent); vertical-align: middle; }
.progress-box { display: flex; align-items: center; gap: .6rem; color: var(--muted); }
.progress-box strong { color: var(--ink); }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge.type-oral { background: var(--oral-soft); color: var(--oral); }
.badge.type-poster { background: var(--poster-soft); color: var(--poster); }
.badge.type-both { background: var(--accent-soft); color: var(--accent-strong); }
.mark { font-size: .9rem; white-space: nowrap; }
.mark.todo { color: var(--muted); }
.mark.conflict { color: var(--note); font-weight: 600; }
.mark.given b { display: inline-block; min-width: 1.5rem; text-align: center; padding: 0 .3rem; border-radius: 4px; background: var(--accent); color: var(--on-accent); }

/* ---- Toolbar with filter chips ---- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: .8rem; }
.chips { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.chips button { border: 0; border-radius: 0; background: none; padding: .4rem .8rem; color: var(--muted); }
.chips button + button { border-left: 1px solid var(--line); }
.chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); }
.toolbar input[type="search"] { flex: 1 1 14rem; max-width: 24rem; }

/* ---- Reviewer's list ---- */
.abstract-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.abstract-list li + li { border-top: 1px solid var(--line); }
.abstract-list a { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) auto 7.5rem; gap: .2rem 1rem; align-items: center; padding: .65rem 1rem; color: inherit; text-decoration: none; }
.abstract-list a:hover { background: var(--accent-soft); }
.abstract-list .id { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.abstract-list .title { display: block; font-weight: 600; }
.abstract-list .by, table .by { display: block; color: var(--muted); font-size: .9rem; }
.abstract-list li[data-status="done"] .title { font-weight: 500; }
@media (max-width: 40rem) {
  .abstract-list a { grid-template-columns: minmax(0, 1fr) auto; }
  .abstract-list .id { display: none; }
  .abstract-list .main { grid-column: 1 / -1; }
}

/* ---- Abstract page ---- */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; font-weight: 600; }
.pager a { text-decoration: none; }
.pager .steps { display: flex; gap: 1rem; color: var(--muted); }
.reading { display: flex; flex-direction: column; gap: 1rem; }
.side { display: contents; }
.meta { order: 1; }
.documents { order: 2; min-width: 0; }
.mark-form { order: 3; }
.all-marks { order: 4; }
.meta h1 { font-size: 1.3rem; }
.meta .kicker { color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.meta .by { margin-bottom: .4rem; }
.meta .co { color: var(--muted); font-size: .92rem; }
.mark-form, .all-marks { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; box-shadow: var(--shadow); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain { display: grid; gap: .5rem; margin-top: .9rem; }
legend { font-weight: 700; padding: 0; margin-bottom: .4rem; }
.score-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.score { position: relative; display: block; text-align: center; cursor: pointer; }
.score input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.score .n, .score .l { display: block; pointer-events: none; }
.score .n { font-size: 1.35rem; font-weight: 700; line-height: 1; padding-top: .55rem; }
.score .l { font-size: .72rem; font-weight: 500; color: var(--muted); padding: .2rem .1rem .5rem; }
.score::before { content: ""; position: absolute; inset: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.score > span { position: relative; }
.score:hover::before { border-color: var(--accent); }
.score:has(input:checked)::before { background: var(--accent); border-color: var(--accent); }
.score:has(input:checked) .n, .score:has(input:checked) .l { color: var(--on-accent); }
.score:has(input:focus-visible)::before { outline: 3px solid var(--accent); outline-offset: 2px; }
.score:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .3rem; }
.save-status { min-height: 1.4rem; margin: 0; font-size: .9rem; color: var(--muted); }
.save-status.ok { color: var(--ok); }
.save-status.error { color: var(--error); font-weight: 600; }
.all-marks summary { cursor: pointer; font-weight: 700; }
.all-marks ul { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .6rem; }
.all-marks li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .8rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.all-marks .name { font-weight: 600; }
.all-marks .comment { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .92rem; }
.document { margin-bottom: 1.5rem; }
.doc-bar { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; align-items: baseline; font-size: .92rem; color: var(--muted); margin-bottom: .5rem; }
.doc-bar strong { color: var(--ink); }
.sheet { display: block; width: 100%; height: auto; max-width: 62rem; margin: 0 auto .9rem; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
@media (min-width: 62rem) {
  .reading { display: grid; grid-template-columns: minmax(0, 1fr) 23rem; gap: 1.5rem; align-items: start; }
  .documents { grid-column: 1; grid-row: 1; }
  .side { display: flex; flex-direction: column; gap: 1rem; grid-column: 2; grid-row: 1; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; padding: 2px; }
}

/* ---- Organisers ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; margin-bottom: .5rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; box-shadow: var(--shadow); }
.tile .figure { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.tile .label { display: block; font-weight: 600; }
.tile .sub { display: block; color: var(--muted); font-size: .88rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table.data { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.data th, table.data td { padding: .5rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th { font-size: .82rem; color: var(--muted); white-space: nowrap; vertical-align: bottom; background: var(--surface); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td a { font-weight: 600; text-decoration: none; }
table.data td a:hover { text-decoration: underline; }
table.data tr.inactive td { color: var(--muted); }
table.marks td:nth-child(3) { min-width: 16rem; }
th button.sort { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
th button.sort:hover { color: var(--accent-strong); }
th[aria-sort="ascending"] button.sort::after { content: " ▲"; }
th[aria-sort="descending"] button.sort::after { content: " ▼"; }
abbr[title] { text-decoration: none; cursor: help; }
td.cell-score { text-align: center !important; font-weight: 700; }
td.cell-conflict, td.cell-none { text-align: center !important; color: var(--muted); }
td.s1 { background: var(--s1); color: var(--s-ink-light); }
td.s2 { background: var(--s2); color: var(--s-ink-light); }
td.s3 { background: var(--s3); color: var(--s-ink-light); }
td.s4 { background: var(--s4); color: var(--s-ink-dark); }
td.s5 { background: var(--s5); color: var(--s-ink-dark); }
td.mean { font-weight: 700; }
td.wide-spread { color: var(--error); font-weight: 700; }
.inline-form { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin-bottom: .8rem; }
.inline-form > div { flex: 1 1 12rem; display: grid; gap: .25rem; }
.row-form { display: flex; gap: .4rem; margin: 0; }
.row-form select { width: auto; padding: .3rem .4rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.row-actions form { margin: 0; }
.row-form button, .row-actions button { padding: .3rem .6rem; font-size: .88rem; }

@media print {
  .top, .toolbar, .pager, .button, .mark-form { display: none; }
  body { background: #fff; }
}
