/* StratLytics Coding Test - exam interface.
 *
 * Brand palette taken from the StratLytics logo: two oranges against charcoal
 * and grey on white. The orange is used sparingly and never as a background
 * behind body text, because this screen is read for two continuous hours.
 * Colour carries no meaning on its own: pass and fail always carry a symbol
 * and a word as well.
 */

:root {
  /* brand */
  --brand-orange: #E2711D;
  --brand-orange-bright: #F5851F;
  --brand-orange-tint: #FDF1E5;
  --brand-ink: #2C2C2E;
  --brand-charcoal: #3A3A3C;
  --brand-grey: #6E6F71;

  /* interface */
  --line: #DCDFE3;
  --line-strong: #B9BEC4;
  --ink: var(--brand-ink);
  --muted: #63676C;
  --pass: #0F7B3F;
  --fail: #B3261E;
  --bg-soft: #F7F8F9;
  --bg-page: #FFFFFF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--ink);
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ------------------------------------------------------------------ header */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--brand-orange);
  background: #fff;
}

.brand { display: flex; align-items: center; gap: 14px; }

/* The official logo file, scaled proportionally and never above its native
   171x36, so it stays crisp. Nothing here recolours or crops it. */
.brand-logo { height: 34px; width: auto; display: block; }

.brand-divider {
  width: 1px; height: 26px; background: var(--line-strong); display: block;
}
.brand-product {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--brand-charcoal);
}

.whoami { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.who { color: var(--muted); }
.who b { color: var(--ink); }

.clock {
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 4px 10px;
  background: var(--bg-soft);
}
.clock b { font-size: 17px; letter-spacing: 0.5px; }
.clock.low { border-color: var(--fail); background: #FDF3F2; }
.clock.low b { color: var(--fail); }

.inline-form { display: inline; margin: 0; }
.link-button {
  background: none; border: 0; padding: 0;
  color: var(--brand-orange); cursor: pointer; font-size: 14px;
  text-decoration: underline; font-family: inherit;
}
.link-button:hover { color: var(--brand-orange-bright); }

.rehearsal-banner {
  background: #4A3000; color: #fff; padding: 8px 22px; font-size: 13px;
  border-bottom: 3px solid var(--brand-orange-bright);
}
.rehearsal-banner b { letter-spacing: 0.6px; }

/* -------------------------------------------------------------------- page */

.page { max-width: 1500px; margin: 0 auto; padding: 20px 22px 40px; }

.card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px 22px;
  margin-bottom: 18px;
  background: #fff;
}
.card.narrow { max-width: 440px; margin: 56px auto; }
.center { text-align: center; }

h1 { font-size: 21px; margin: 0 0 10px; letter-spacing: -0.2px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h2.qtitle { font-size: 16px; margin: 0 0 14px; color: var(--muted); font-weight: 600; }
h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.9px;
  color: var(--brand-grey); margin: 20px 0 6px; font-weight: 700;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error {
  border: 1px solid var(--fail); border-left-width: 4px;
  color: var(--fail); padding: 9px 12px; border-radius: 4px; background: #FDF3F2;
}
.countdown { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.countdown b { color: var(--brand-orange); }

/* ------------------------------------------------------------------- forms */

.stack { display: flex; flex-direction: column; gap: 6px; }
.stack label { font-weight: 600; margin-top: 10px; font-size: 14px; }
.stack input {
  padding: 10px 11px; border: 1px solid var(--line-strong);
  border-radius: 4px; font-size: 16px; font-family: inherit;
}
.stack input:focus {
  outline: 2px solid var(--brand-orange); outline-offset: 1px; border-color: var(--brand-orange);
}

button, .button {
  font: inherit; padding: 9px 17px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  text-decoration: none; display: inline-block;
}
button:hover, .button:hover { border-color: var(--brand-orange); }
button.primary {
  background: var(--brand-orange); border-color: var(--brand-orange); color: #fff;
  font-weight: 600;
}
button.primary:hover { background: var(--brand-orange-bright); border-color: var(--brand-orange-bright); }
button.secondary { background: #fff; border-color: var(--line-strong); }
button:disabled, button:disabled:hover {
  opacity: 0.45; cursor: not-allowed; border-color: var(--line-strong);
}
.stack button { margin-top: 18px; }

/* -------------------------------------------------------------- navigation */

.qnav {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px;
  border-bottom: 1px solid var(--line); padding-bottom: 14px;
}
.qtab {
  border: 1px solid var(--line); border-radius: 4px; padding: 8px 15px;
  text-decoration: none; color: var(--ink); min-width: 104px; text-align: center;
  background: #fff;
}
.qtab:hover { border-color: var(--brand-orange); }
.qtab.active {
  border-color: var(--brand-orange); background: var(--brand-orange-tint);
  font-weight: 700; box-shadow: inset 0 -3px 0 var(--brand-orange);
}
.qtab-sub {
  display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px;
}

/* ------------------------------------------------------------------ tables */

.grid { border-collapse: collapse; width: 100%; margin-top: 10px; }
.grid th, .grid td {
  border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top;
}
.grid thead th {
  background: var(--bg-soft); font-size: 13px; letter-spacing: 0.3px;
  border-bottom-color: var(--line-strong);
}
.grid tbody tr:hover { background: #FCFCFD; }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid tfoot th { background: var(--bg-soft); }

.status { font-size: 13px; font-weight: 600; }
.status-submitted { color: var(--pass); }
.status-saved { color: var(--brand-orange); }
.status-not-attempted { color: var(--muted); font-weight: 400; }

/* ------------------------------------------------------- question workspace */

.split { display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.problem-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--brand-orange); padding-bottom: 8px; margin-bottom: 12px;
}
.problem-head h1 { margin: 0; }
.marks { font-weight: 700; color: var(--brand-orange); }
.problem { max-height: calc(100vh - 180px); overflow-y: auto; }

pre.prose {
  white-space: pre-wrap; word-wrap: break-word; font-family: inherit;
  margin: 0; background: var(--bg-soft); border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 4px; padding: 11px 13px;
}

.sample { margin-bottom: 14px; }
.sample-label { font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.sample-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sample-cap {
  font-size: 11px; color: var(--brand-grey); text-transform: uppercase;
  letter-spacing: 0.6px; font-weight: 700;
}
.sample pre, .results pre {
  margin: 3px 0 0; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 4px; padding: 8px 10px; overflow-x: auto;
  font: 13px/1.45 "Cascadia Mono", Consolas, "Courier New", monospace;
  white-space: pre-wrap; word-break: break-word;
}

.editor-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--brand-orange); padding-bottom: 8px; margin-bottom: 12px;
}
.editor-head h3 { margin: 0; }
.save-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.save-status.error { color: var(--fail); border: 0; background: none; padding: 0; }

.CodeMirror {
  border: 1px solid var(--line-strong); border-radius: 4px; height: 470px;
  font: 14px/1.5 "Cascadia Mono", Consolas, "Courier New", monospace;
}
.CodeMirror-focused { border-color: var(--brand-orange); }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }

/* ----------------------------------------------------------------- results */

.results { margin-top: 18px; }
.result {
  border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 4px; padding: 9px 13px; margin-bottom: 8px;
}
.result.pass { border-left-color: var(--pass); }
.result.fail { border-left-color: var(--fail); }
.result-head { font-weight: 600; }
.result.pass .result-head { color: var(--pass); }
.result.fail .result-head { color: var(--fail); }
.result-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
@media (max-width: 900px) { .result-cols { grid-template-columns: 1fr; } }

.notice {
  border: 1px solid var(--line); border-left: 4px solid var(--brand-orange);
  padding: 11px 13px; border-radius: 4px; margin-bottom: 10px; background: var(--brand-orange-tint);
}
.notice.bad { border-left-color: var(--fail); background: #FDF3F2; }
.notice.good { border-left-color: var(--pass); background: #F1F8F3; }

/* ------------------------------------------------------------------ footer */

.footer {
  border-top: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--brand-orange);
  padding: 14px 22px; color: var(--muted); font-size: 12.5px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--bg-soft);
}
.footer a { color: var(--brand-orange); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer .copyright { font-weight: 600; color: var(--brand-charcoal); }

/* ------------------------------------------------------------------- admin */

.admin-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge {
  padding: 3px 9px; border-radius: 11px; font-size: 12px;
  border: 1px solid var(--line-strong); font-weight: 600;
}
.badge.healthy { color: var(--pass); border-color: var(--pass); background: #F1F8F3; }
.badge.degraded { color: #8A5B00; border-color: #8A5B00; background: #FDF6E7; }
.badge.unavailable { color: var(--fail); border-color: var(--fail); background: #FDF3F2; }
code {
  background: var(--bg-soft); padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--line); font-size: 0.92em;
}
