/* ================= Design tokens =================
   Adapted from the StoreSense UI Brief's own token sheet: light, airy,
   precise. One dark "well" surface is the only permitted dark note on
   an otherwise light page. Every colour, size, radius and shadow here
   is meant to come from this one file. */
:root {
  --page: #eef1ef;
  --panel: #ffffff;
  --panel-2: #f6f7f6;
  --line: #e3e7e5;
  --head: #16211e;
  --body: #3a4542;
  --soft: #6b7672;
  --well: #0e1513;
  --on-well-muted: #9fb0aa;
  --brand: #106b4f;
  --brand-tint: #e7f2ee;
  --ok: #1e8e5a;      --ok-tint: #e6f4ec;
  --warn: #b7791f;    --warn-tint: #faf1e0;
  --bad: #c0392b;     --bad-tint: #faeae8;
  --info: #2563eb;    --info-tint: #e8eefc;
  --shadow: 0 1px 3px rgba(16, 33, 30, .08);
  --shadow-lg: 0 8px 28px rgba(16, 33, 30, .12);
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Archivo', system-ui, sans-serif;
  --ui: 'Inter', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b1210;
    --panel: #141d1a;
    --panel-2: #101815;
    --line: #253430;
    --head: #eef3f0;
    --body: #cdd8d3;
    --soft: #8fa39c;
    --well: #060a09;
    --on-well-muted: #7f9791;
    --brand: #35a67e;
    --brand-tint: #123328;
    --ok: #3fbb8a;      --ok-tint: #103023;
    --warn: #d99d3f;    --warn-tint: #33270f;
    --bad: #e2685a;     --bad-tint: #3a1714;
    --info: #6f9bf5;    --info-tint: #142442;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--body);
  font-family: var(--ui);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); color: var(--head); margin: 0; }
a { color: var(--brand); }
code { font-family: var(--mono); font-size: .92em; }

/* ---------- Header band: dark "well" chrome, wordmark + tag ---------- */
.topband {
  background: var(--well);
  color: #fff;
  padding: 18px clamp(20px, 5vw, 40px);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.wordmark { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.wordmark .brand { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: .2px; color: #fff; }
.wordmark .tag {
  font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--on-well-muted); border: 1px solid rgba(159, 176, 170, .4); border-radius: 20px;
  padding: 3px 11px;
}
.topband a.logout { color: var(--on-well-muted); font-size: 13px; text-decoration: none; }
.topband a.logout:hover { color: #fff; }

/* ---------- Page shell ---------- */
.shell { max-width: 720px; margin: 0 auto; padding: 36px clamp(20px, 5vw, 40px) 90px; }
.shell.narrow { max-width: 440px; }

.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 6px;
}

/* ---------- shared card ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 16px; }

/* ---------- callout (used for errors and notices) ---------- */
.callout {
  border-left: 3px solid var(--brand); background: var(--brand-tint); border-radius: 8px;
  padding: 14px 18px; font-size: 14.5px; color: var(--body); margin-bottom: 18px;
}
.callout.bad { border-left-color: var(--bad); background: var(--bad-tint); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-tint); }
.callout strong { color: var(--head); }

/* ---------- chip ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.chip-brand { background: var(--brand-tint); color: var(--brand); }
.chip-warn { background: var(--warn-tint); color: var(--warn); }

/* ---------- form controls ---------- */
.field { margin-bottom: 18px; }
.field label, .field > .label-text {
  display: block; font-size: 13px; font-weight: 600; color: var(--head); margin-bottom: 6px;
}
.field .hint { font-size: 12.5px; color: var(--soft); margin-top: 4px; }
select, textarea, input[type="password"], input[type="file"] {
  width: 100%; font-family: var(--ui); font-size: 14.5px; color: var(--body);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px;
}
textarea { min-height: 76px; resize: vertical; }
select:focus, textarea:focus, input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint);
}
input[type="file"] { padding: 7px 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid transparent; padding: 10px 20px; font-size: 14px;
  font-weight: 600; font-family: var(--ui); cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { opacity: .92; }

/* ---------- login card ---------- */
.login-card { margin-top: 15vh; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .lede { color: var(--soft); font-size: 14px; margin-bottom: 18px; }

/* ---------- result page ---------- */
.result-section { margin-bottom: 22px; }
.result-section:last-child { margin-bottom: 0; }
.result-section h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 8px;
}
.result-section p { margin: 0; white-space: pre-wrap; font-size: 15px; color: var(--body); }

/* ================= Result: short version ================= */
.short-card .cue p { font-family: var(--display); font-size: 19px; color: var(--head); }
.full-read { margin-top: 20px; }
.full-read summary { cursor: pointer; font-weight: 600; color: var(--brand); font-size: 14px; }
.callout.ok { border-left-color: var(--ok); background: var(--ok-tint); }

/* ================= Grading ================= */
.shell.wide { max-width: 1160px; }
.gradenav { display: flex; gap: 18px; flex-wrap: wrap; }
.gradenav a { color: var(--on-well-muted); font-size: 13px; text-decoration: none; }
.gradenav a:hover { color: #fff; }
.lede { color: var(--soft); margin: 6px 0 12px; }
.muted { color: var(--soft); }
.meta { color: var(--soft); font-size: 13px; margin: 6px 0 18px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.toolbar { font-size: 14px; margin: 0 0 14px; }
.card-title { font-size: 15px; margin-bottom: 14px; }
.subhead { font-size: 14px; margin: 18px 0 6px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.grid-2 > div > .card + .card, .grid-2 > div > .media + .card { margin-top: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; }
.media { display: block; width: 100%; max-height: 420px; border-radius: 12px; background: var(--well); }
.table-card { padding: 0; overflow-x: auto; }
table.runs { width: 100%; border-collapse: collapse; font-size: 14px; }
table.runs th, table.runs td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.runs th { font-size: 12px; color: var(--soft); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
table.runs tr:last-child td { border-bottom: 0; }
dl.intake { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.intake dt { color: var(--soft); font-weight: 600; }
dl.intake dd { margin: 0; white-space: pre-wrap; }
input[type="text"] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--panel); color: var(--body); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.btn-secondary { background: var(--brand-tint); color: var(--brand); }
.btn-danger { background: var(--bad-tint); color: var(--bad); }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Navigation for graders ---------- */
.topnav { display: flex; gap: 18px; align-items: baseline; }
.topband a.nav-grade { color: #fff; font-size: 13px; font-weight: 600; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 20px; padding: 3px 12px; }
.topband a.nav-grade:hover { background: rgba(255, 255, 255, .1); }
.btn-small { padding: 5px 12px; font-size: 13px; background: var(--brand); color: #fff;
  text-decoration: none; display: inline-block; white-space: nowrap; }
.btn-small:hover { opacity: .92; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--brand-tint); }
