/* Paper Setter — a working tool, not a showpiece.
   Print-shop palette: ink on paper, one blue for action, red kept for warnings. */

:root {
  --paper: #f5f6f8;
  --card: #ffffff;
  --ink: #16202c;
  --soft: #5a6675;
  --faint: #8d99a8;
  --rule: #dde2e9;
  --blue: #1f5c8b;
  --blue-bg: #eaf1f7;
  --green: #2c6b4f;
  --amber: #8a6116;
  --amber-bg: #fdf5e4;
  --red: #a8342a;
  --red-bg: #fbeeec;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.55 system-ui, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--blue); }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.25; font-family: Cambria, Georgia, serif; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; font-family: inherit; }
p { margin: 0 0 .6rem; }

header.top {
  background: var(--ink); color: #fff; padding: .7rem 1.2rem;
  display: flex; align-items: center; gap: 1.2rem;
}
header.top .brand { font-family: Cambria, Georgia, serif; font-size: 1.1rem; font-weight: 700; }
header.top a { color: #cfe0ee; text-decoration: none; font-size: .92rem; }
header.top a:hover { color: #fff; }
header.top .spacer { flex: 1; }

main { max-width: 1080px; margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }

.card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 4px; padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.muted { color: var(--soft); font-size: .9rem; }
.tiny { font-size: .82rem; color: var(--faint); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { border-bottom: 1px solid var(--rule); padding: .45rem .5rem; text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-block; background: var(--blue); color: #fff; border: 0;
  padding: .5rem .9rem; border-radius: 3px; font-size: .92rem; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #17496f; }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn.ghost:hover { background: var(--blue-bg); }
.btn[disabled] { background: var(--faint); cursor: not-allowed; }

label { display: block; font-size: .84rem; color: var(--soft); margin: .5rem 0 .15rem; }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: .42rem .5rem; border: 1px solid var(--rule);
  border-radius: 3px; font: inherit; background: #fff;
}
select[multiple] { min-height: 7rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 .9rem; }

.pill {
  display: inline-block; padding: .08rem .45rem; border-radius: 9px;
  font-size: .76rem; font-weight: 600;
}
.pill.ok { background: #e6f2ec; color: var(--green); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.info { background: var(--blue-bg); color: var(--blue); }

.notice { border-left: 3px solid var(--blue); background: var(--blue-bg); padding: .6rem .8rem; margin-bottom: 1rem; }
.notice.warn { border-color: var(--amber); background: var(--amber-bg); }
.notice.bad { border-color: var(--red); background: var(--red-bg); }

.bar { height: 9px; background: #e7ebf0; border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); }
.bar.top > i { background: var(--red); }

.q { border-bottom: 1px solid var(--rule); padding: .7rem 0; }
.q:last-child { border-bottom: 0; }
.q .stem { white-space: pre-wrap; }
.q .opts { margin: .3rem 0 0 1rem; font-size: .93rem; }
.q .opts .right { color: var(--green); font-weight: 600; }
.q .meta { font-size: .8rem; color: var(--faint); margin-top: .25rem; }

.log {
  background: #10161e; color: #d6dee7; font: 12px/1.5 Consolas, monospace;
  padding: .7rem .8rem; border-radius: 3px; max-height: 21rem; overflow: auto;
}
.log .stage { color: #7fb2d6; }
.log .warn { color: #e0b35a; }
.log .failed { color: #e08278; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* --- the editor ---------------------------------------------------------
   Dense on purpose. A teacher is comparing questions against each other, so
   the useful comparison is vertical and the controls stay out of the way
   until the row is hovered. */

.edit-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.edit-head > div:first-child { flex: 1; min-width: 16rem; }
.edit-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.edit-actions form { margin: 0; }

.status .status-figures {
  display: flex; gap: 1.6rem; flex-wrap: wrap; margin-bottom: .6rem;
  padding-bottom: .6rem; border-bottom: 1px solid var(--rule);
}
.status-figures > div { display: flex; flex-direction: column; }
.status-figures b { font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.status-figures span { font-size: .76rem; color: var(--soft); }
.status-figures .off b { color: var(--red); }
.card.status.bad { border-left: 3px solid var(--red); }
.status .notice { margin: .5rem 0 0; }

.qrow { display: grid; grid-template-columns: 2.2rem 1fr 9rem; gap: .6rem; align-items: start; }
.qrow.focused { background: var(--blue-bg); margin: 0 -.6rem; padding: .7rem .6rem; border-radius: 3px; }
.qnum { font-variant-numeric: tabular-nums; color: var(--faint); font-size: .9rem; padding-top: .1rem; }
.qnum .lock {
  display: block; margin-top: .2rem; font-size: .62rem; font-weight: 700;
  color: var(--amber); background: var(--amber-bg); border-radius: 2px;
  text-align: center; padding: 0 .2rem;
}
.qbody { min-width: 0; }
.qbody .quote {
  border-left: 2px solid var(--rule); padding-left: .5rem; color: var(--soft);
  font-family: Cambria, Georgia, serif;
}
.qbody details { margin-top: .3rem; }
.qbody summary { cursor: pointer; }
.alt { margin-top: .4rem; padding-left: .7rem; border-left: 2px solid var(--rule); font-size: .93rem; }

.qtools { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; }
.qtools form.inline { display: flex; align-items: center; gap: .25rem; margin: 0; }
.qtools .mini { width: 3.1rem; padding: .1rem .25rem; font-size: .8rem; }
.qtools details.rewrite { width: 100%; }
.qtools details.rewrite[open] {
  position: relative; z-index: 2; background: var(--card);
  border: 1px solid var(--rule); border-radius: 3px; padding: .5rem; width: 22rem;
  margin-left: -13rem;
}

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--blue); font: inherit; font-size: .84rem; text-align: left;
  text-decoration: none;
}
.linkish:hover { text-decoration: underline; }
.linkish.danger { color: var(--red); }

hr { border: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }

@media (max-width: 820px) {
  .qrow { grid-template-columns: 1.8rem 1fr; }
  .qtools { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: .7rem; }
  .qtools details.rewrite { width: 100%; margin-left: 0; }
}
