/* NSPAS — hand-rolled, mobile-first */
:root {
  --ink: #1c2431;
  --muted: #5a6678;
  --line: #d8dee8;
  --brand: #34456b;
  --brand-dark: #273450;
  --bg: #f5f6f9;
  --card: #ffffff;
  --flash: #fff3cd;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  background: var(--brand);
}
header a { color: #fff; text-decoration: none; }
header .brand { font-weight: 700; font-size: 1.1rem; }
header nav { display: flex; gap: 1rem; flex-wrap: wrap; }
header nav a:hover { text-decoration: underline; }

main { max-width: 60rem; margin: 0 auto; padding: 1rem; }

h1 { font-size: 1.4rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .3rem; }

.flash {
  max-width: 60rem;
  margin: .5rem auto 0;
  padding: .6rem 1rem;
  background: var(--flash);
  border: 1px solid #e5d9a5;
  border-radius: 6px;
}
.flash p { margin: .2rem 0; }

.muted { color: var(--muted); }

.cards { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .8rem 1rem;
}
.card p { margin: .2rem 0; color: var(--muted); }

form.stack { display: grid; gap: .8rem; max-width: 24rem; }
label { display: grid; gap: .25rem; font-weight: 600; }
input, select, textarea {
  font: inherit;
  padding: .5rem .6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 6px;
  padding: .55rem 1.2rem;
  cursor: pointer;
}
button:hover { background: var(--brand-dark); }

table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
th { background: #eef1f6; }

/* breadcrumbs, buttons, notices */
.crumbs { margin: .3rem 0 .8rem; color: var(--muted); font-size: .9rem; }
.crumbs a { color: var(--brand); text-decoration: none; }
.btns { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
a.btn {
  display: inline-block;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border-radius: 6px;
  padding: .55rem 1.2rem;
  text-decoration: none;
}
a.btn:hover { background: var(--brand-dark); }
.notice {
  background: var(--flash);
  border: 1px solid #e5d9a5;
  border-radius: 6px;
  padding: .6rem 1rem;
  margin: .8rem 0;
}
.sechead p { margin: .2rem 0; }
a.cardlink { text-decoration: none; color: inherit; }
a.cardlink:hover { border-color: var(--brand); }

/* rules */
.rule { background: var(--card); border: 1px solid var(--line); border-radius: 8px;
        padding: .7rem 1rem; }
.rulenum { font-weight: 700; margin-right: .5rem; color: var(--brand); }
.ruleheading { font-weight: 700; display: inline; }
.rulebody { display: block; margin-top: .35rem; }
.ruleem { font-weight: 600; font-style: normal; color: #8d3030; }
.rulesech { margin-top: 1.5rem; }

/* syllabus / programme */
.sylclass, .progclass { background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: .7rem 1rem; margin: .7rem 0; }
.sylclass h2, .progclass h3 { margin: 0 0 .3rem; }
.classds { white-space: pre-wrap; font: inherit; margin: .4rem 0 0; color: var(--ink); }
.classds-inline { margin: .3rem 0; }
table.comps { margin: .4rem 0; }
table.comps td.num { width: 2.2rem; text-align: right; color: var(--muted); }
.work { margin-left: .8rem; font-size: .95rem; }
.withdrawn { text-decoration: line-through; color: var(--muted); }
.highlight { background: #ffe0ef; padding: 0 .25rem; border-radius: 4px; }
.stagetime { color: var(--brand); margin-left: .4rem; }
.resultsbox { border-top: 2px solid var(--brand); margin-top: .5rem; padding-top: .4rem; }

/* drag reorder */
.draghandle { cursor: grab; color: var(--muted); width: 2rem; text-align: center; }
tr.sortable-ghost { opacity: .4; }
input.durinput { width: 5rem; }

/* admin action buttons (forms inside .btns rows) */
.btns form { display: inline; }
button.btn-form {
  font-weight: 600; color: var(--brand); background: #fff;
  border: 1px solid var(--brand); border-radius: 6px; padding: .5rem 1rem;
}
button.btn-form:hover { background: #eef1f6; }
button.danger { background: #8d3030; }
button.danger:hover { background: #6d2222; }

/* apply wizard */
a.btn.secondary { background: var(--muted); }
button.linkish {
  background: none; border: none; color: var(--brand);
  text-decoration: underline; padding: .4rem 0; cursor: pointer; font-weight: 400;
}
label.inline { display: inline-flex; gap: .4rem; align-items: center; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: 6px; }
.acbox { position: relative; max-width: 24rem; }
.acitem { background: #fff; border: 1px solid var(--line); border-top: none;
  padding: .4rem .6rem; cursor: pointer; }
.acitem:hover { background: #eef1f6; }
.workrow { display: grid; gap: .5rem; margin-bottom: .8rem; }
@media (min-width: 40rem) {
  .workrow { grid-template-columns: 2fr 1fr 1fr; align-items: end; }
}
.feetotal { font-size: 1.15rem; }
.waivebox { border-left: 4px solid var(--brand); }
.agreebox { border-left: 4px solid #8d3030; }

/* scheduling board (admin sessions) */
.board { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.board .card.pool { grid-column: 1 / -1; }
.sess-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.sess-head h3 { margin: 0; }
.sess-meta { color: var(--muted); font-size: .85em; }
ul.sess-list { list-style: none; margin: .5rem 0 0; padding: 0; min-height: 2.2rem; }
ul.sess-list.empty::after { content: "drop classes here"; color: var(--muted);
  font-size: .85em; display: block; padding: .5rem; border: 1px dashed var(--line);
  border-radius: 6px; text-align: center; }
li.sched-class { display: flex; gap: .5rem; align-items: baseline; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem;
  margin-bottom: .4rem; cursor: grab; }
li.sched-class.locked { cursor: default; }
li.sched-class .cnum { font-weight: 700; color: var(--brand-dark); }
li.sched-class .cstart { font-variant-numeric: tabular-nums; color: var(--muted);
  font-size: .85em; margin-left: auto; white-space: nowrap; }
li.sortable-ghost { opacity: .4; }
.lockbar { padding: .5rem .8rem; border-radius: 6px; margin: .6rem 0;
  display: flex; align-items: center; gap: .8rem; }
.lockbar.on { background: #fdeaea; border: 1px solid #d8a; }
.lockbar.off { background: #eef1f6; border: 1px solid var(--line); }

/* adjudicator score + WYSIWYG report */
.scoregrid { max-width: 48rem; }
.scorefields { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: end;
  margin-bottom: 1rem; }
.scorefields label { font-weight: 600; }
.scorefields input[type=number] { width: 7rem; font-size: 1.3rem; }
.report label { font-weight: 600; display: block; margin-bottom: .3rem; }
.wysiwyg-toolbar { display: flex; gap: .25rem; flex-wrap: wrap;
  border: 1px solid var(--line); border-bottom: none; border-radius: 6px 6px 0 0;
  padding: .3rem; background: #f0f3f8; }
.wysiwyg-toolbar button { background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: .3rem .6rem; cursor: pointer; color: var(--ink);
  font-size: .9rem; min-width: 2.2rem; }
.wysiwyg-toolbar button:hover { background: #e3ebf6; }
.wysiwyg { min-height: 14rem; border: 1px solid var(--line); border-radius: 0 0 6px 6px;
  padding: .7rem .9rem; background: #fff; font-size: 1.05rem; line-height: 1.5;
  overflow-y: auto; }
.wysiwyg:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.wysiwyg ul, .wysiwyg ol { margin: .3rem 0 .3rem 1.4rem; }

/* ideas & bugs list */
.kindpick { display: flex; gap: 1.5rem; }
.todo-item { max-width: 42rem; }
.todo-head { display: flex; justify-content: space-between; align-items: baseline;
  gap: .5rem; margin-bottom: .3rem; }
.todo-body { white-space: pre-wrap; margin: .2rem 0 .5rem; color: var(--ink); }
.todo-item.done { opacity: .6; }
.todo-item.done .todo-body { text-decoration: line-through; }
.tag.bug { background: #fdeaea; color: #8d3030; }

/* print */
body.print header, body.print .noprint { display: none; }
@media print {
  header, .noprint, .btns { display: none; }
  body { background: #fff; }
  .sylclass, .progclass, .rule { border: none; padding: .3rem 0; break-inside: avoid; }
}

/* admin: data grid, field tables, tags, danger button */
.grid tbody tr:hover { background: #f0f3f8; }
table.fields { width: auto; }
table.fields th { background: none; color: var(--muted); font-weight: 600;
  text-align: right; white-space: nowrap; vertical-align: top; }
.tag { display: inline-block; font-size: .7em; font-weight: 600; vertical-align: middle;
  padding: .15rem .5rem; border-radius: 10px; background: #e3ebf6; color: var(--brand-dark); }
.warn { color: #8d3030; font-size: .9em; }
button.danger { background: #8d3030; }
button.danger:hover { background: #6f2525; }
#filter { width: 100%; max-width: 20rem; margin: .3rem 0 .8rem; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 6px; }
