/* GreenMind Hackathon — light "glasshouse" theme (see bench/web/design.md v3).
   Green stays the one identity color (wordmark, links, active nav, primary
   actions). Status now reads through an ordinary grader vocabulary instead
   of a second brand accent: green = pass, amber = running, clay = fail.
   The log/console panel is the one surface kept intentionally dark — raw
   output reads better dark regardless of the surrounding theme. */
:root {
  /* GreenMind token palette (v3, light) */
  --color-paper: #F6F9F2;
  --color-surface: #FFFFFF;
  --color-canvas-sunken: #EEF3E7;
  --color-line: #E1E8D8;
  --color-line-firm: #C7D2B9;
  --color-ink: #13201A;
  --color-ink-mid: #48594A;
  --color-ink-faint: #5E6E5A;
  --color-sprout: #1E8E4F;
  --color-sprout-deep: #136138;
  --color-sprout-tint: rgba(30, 142, 79, 0.10);
  --color-amber: #92600E;
  --color-amber-tint: rgba(146, 96, 14, 0.12);
  --color-clay: #B3402C;
  --color-clay-tint: rgba(179, 64, 44, 0.10);
  --color-console: #0F1912;
  --color-console-ink: #CFE8CE;
  --color-console-line: #25392A;

  /* semantic aliases used throughout this file */
  --paper: var(--color-paper);
  --raised: var(--color-surface);
  --sunken: var(--color-canvas-sunken);
  --ink: var(--color-ink);
  --ink-mid: var(--color-ink-mid);
  --ink-faint: var(--color-ink-faint);
  --rule: var(--color-line);
  --rule-firm: var(--color-line-firm);
  --accent: var(--color-sprout);
  --accent-bg: var(--color-sprout-tint);
  --warn: var(--color-amber);
  --warn-bg: var(--color-amber-tint);
  --danger: var(--color-clay);
  --danger-bg: var(--color-clay-tint);
  --good: var(--color-sprout-deep);

  --sans: 'Inter Variable', 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: 'Space Grotesk', 'Inter Tight', var(--sans);
  --mono: 'Fira Mono', ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --thai: "Leelawadee UI", "Noto Sans Thai", "Sarabun", Tahoma, sans-serif;

  --radius-cards: 10px;
  --radius-inputs: 8px;
  --radius-buttons: 8px;
  --radius-pills: 9999px;
}
* {
  box-sizing: border-box;
  transition: color 0.2s ease-out, background-color 0.2s ease-out, border-color 0.2s ease-out;
}
body {
  margin: 0; font-family: var(--sans); color: var(--ink-mid); background: var(--paper);
  line-height: 1.5; font-feature-settings: "cv11";
  letter-spacing: -0.352px;
}
header {
  padding: 14px 24px; background: var(--raised); border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
h1 {
  margin: 0; font-family: var(--display); font-size: 20px; font-weight: 500;
  letter-spacing: -0.36px; color: var(--ink);
}
h1 .v { color: var(--accent); }
nav { display: flex; gap: 4px; margin-left: auto; }
nav button {
  padding: 7px 6px 5px; background: transparent; color: var(--ink-faint);
  border: none; border-bottom: 2px solid transparent; border-radius: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500; letter-spacing: -0.026em;
}
nav button:hover { color: var(--ink); }
nav button.active { color: var(--good); border-bottom-color: var(--good); }
main { max-width: 1120px; margin: 0 auto; padding: 24px; }
h2 {
  margin: 0 0 12px; font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.6px;
}
h3 {
  margin: 0 0 12px; font-family: var(--display); font-size: 16px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.01em;
}
.view { display: none; }
.view.active { display: block; }
.card {
  background: var(--raised); border: 1px solid var(--rule); border-radius: var(--radius-cards);
  padding: 24px; margin-bottom: 16px;
}
.row { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.row:last-child { margin-bottom: 0; }
label { font-size: 13px; color: var(--ink-mid); min-width: 100px; font-weight: 500; }
select, input[type="text"], input[type="number"], input[type="password"] {
  padding: 7px 10px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule-firm); border-radius: var(--radius-inputs); font: inherit; min-width: 280px;
}
select:focus, input:focus { outline: none; border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; accent-color: var(--accent); }

/* visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, select:focus-visible,
input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* button system — rectangles act, pills report status (see design.md) */
button {
  padding: 7px 14px; background: var(--raised); color: var(--ink); border: 1px solid var(--rule-firm);
  border-radius: var(--radius-buttons); cursor: pointer; font: inherit; font-size: 13px; font-weight: 500;
  line-height: 1.4;
}
button:hover { background: var(--sunken); border-color: var(--ink-faint); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
/* Primary action button — the one solid Sprout fill per view */
button.primary {
  padding: 9px 20px; background: var(--accent); color: #FFFFFF; border: none;
  border-radius: var(--radius-buttons); font-weight: 500; font-size: 13px;
}
button.primary:hover { background: var(--good); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.danger:hover { background: var(--danger-bg); }
button.small { padding: 4px 10px; font-size: 12px; }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-mid); }
button.ghost:hover { background: var(--sunken); color: var(--ink); }

/* Tooltip on hover */
.tip-wrap { position: relative; display: inline-block; }
.tip-wrap[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 100%; left: 0; margin-bottom: 8px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  padding: 7px 11px; border-radius: 6px; font-size: 12px; line-height: 1.4;
  white-space: normal; width: max-content; max-width: 260px;
  box-shadow: 0 8px 20px rgba(19, 32, 26, 0.20); z-index: 50; pointer-events: none;
}

.config-meta { font-size: 12px; color: var(--ink-faint); margin-top: 4px; margin-bottom: 8px; }
.config-meta span { background: var(--sunken); padding: 2px 8px; border-radius: 4px; margin-right: 4px; color: var(--ink-mid); }

/* Marks a score that's still climbing (run in progress) — amber = running,
   per this file's own status vocabulary. Not a full Status column (removed
   by design), just enough to keep a live number from reading as final. */
.live-tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--warn); background: var(--warn-bg);
  border-radius: 4px; padding: 1px 6px; vertical-align: middle; margin-left: 2px;
}
/* clay = fail, per this file's own status vocabulary */
.live-tag.fail-tag { color: var(--danger); background: var(--danger-bg); }
.progress {
  margin-top: 12px; padding: 12px; background: var(--color-console); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap; max-height: 240px; overflow-y: auto;
  border: 1px solid var(--color-console-line); color: var(--color-console-ink);
}
.bar { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; margin: 10px 0; }
.bar > div { height: 100%; background: var(--accent); transition: width 0.3s; border-radius: 3px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--ink); }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); }
th { font-weight: 500; color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.score { font-family: var(--mono); }
.score-100 { color: var(--good); font-weight: 600; }
.score-90 { color: var(--accent); }
.score-50 { color: var(--warn); }
.score-0 { color: var(--danger); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--sunken); }
th.clickable { cursor: pointer; user-select: none; }
th.clickable:hover { color: var(--ink); }
.best { font-weight: 600; border-top: 1px solid var(--rule-firm); }
.best td { font-size: 16px; padding-top: 12px; padding-bottom: 12px; color: var(--ink); }
.best td:first-child { font-weight: 600; }
/* the composite "overall score" emphasis — bigger, Sprout Deep, no second hue */
.best .num { font-size: 18px; font-weight: 600; color: var(--good); }
.muted { color: var(--ink-faint); }
.fail-row { color: var(--danger); }
.ok-row { color: var(--good); }
.modal-bg {
  position: fixed; inset: 0; background: rgba(19, 32, 26, 0.45);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-bg.active { display: flex; }
/* the modal is one of the two surfaces allowed a shadow — it actually floats */
.modal {
  background: var(--raised); border: 1px solid var(--rule-firm); border-radius: 16px; padding: 24px;
  max-width: 800px; width: 90%; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 50px rgba(19, 32, 26, 0.18);
}
.modal h3 { margin: 0 0 12px; font-family: var(--display); font-size: 18px; font-weight: 500; color: var(--ink); }
.modal pre {
  background: var(--color-console); padding: 14px; border-radius: 6px;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap;
  word-break: break-word; max-height: 400px; overflow-y: auto;
  border: 1px solid var(--color-console-line); color: var(--color-console-ink);
}
.modal .choice { padding: 5px 0; font-family: var(--mono); font-size: 12px; color: var(--ink); }
.modal .choice.correct { color: var(--good); font-weight: 600; }
.modal .meta { font-size: 12px; color: var(--ink-mid); margin-bottom: 12px; }
.close { float: right; cursor: pointer; color: var(--ink-faint); font-size: 22px; line-height: 1; padding: 0 4px; }
.close:hover { color: var(--danger); }
.tag {
  display: inline-block; padding: 4px 12px; background: transparent; color: var(--ink-mid);
  border: 1px solid var(--rule-firm); border-radius: var(--radius-pills); font-size: 11px;
  font-family: var(--sans); font-weight: 500;
}
/* --good, not --accent: link text needs AA contrast on white, which the
   brighter --accent falls just short of at small sizes — --accent stays
   reserved for fills/borders/icons, where the 3:1 UI-component threshold applies */
a { color: var(--good); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
.hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.divider { height: 1px; background: var(--rule); margin: 14px 0; }
.admin-box { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rm-lb, .rm-team { border: none; background: transparent; color: var(--danger); cursor: pointer; font-weight: 700; padding: 0 4px; }
.rm-lb:hover, .rm-team:hover { color: var(--ink); }
.hl { font-weight: 700; color: var(--good); background: var(--accent-bg); }
tr.me { background: var(--accent-bg); }
tr.me td { font-weight: 600; }
.toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
/* the toast is the other surface allowed a shadow — it floats above the page */
.toast {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--raised); border: 1px solid var(--rule-firm); color: var(--ink);
  box-shadow: 0 10px 24px rgba(19, 32, 26, 0.15);
  animation: toast-in 0.15s ease-out;
}
.toast.ok { border-color: var(--good); color: var(--good); }
.toast.error { border-color: var(--danger); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
button.loading { position: relative; color: transparent !important; pointer-events: none; }
button.loading::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.45); border-top-color: currentColor;
  animation: spin 0.6s linear infinite;
}
button:not(.primary).loading::after { border-color: var(--rule-firm); border-top-color: var(--ink-mid); }
@keyframes spin { to { transform: rotate(360deg); } }

/* status badge — PASS / RUNNING / BELOW, the load-bearing color system now
   that gold is retired as a brand accent (see design.md, Status Badge) */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: var(--radius-pills); font-size: 11px; font-weight: 500; font-family: var(--sans);
}
.badge-pass { color: var(--good); background: var(--accent-bg); }
.badge-running { color: var(--warn); background: var(--warn-bg); }
.badge-below { color: var(--danger); background: var(--danger-bg); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-running .badge-dot { animation: badge-pulse 1.2s ease-in-out infinite; }
@keyframes badge-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) {
  .badge-running .badge-dot { animation: none; }
}

/* task-set selector (Run Evaluation page) */
.set-toggle { display: flex; gap: 8px; }
.set-toggle label {
  display: flex; align-items: center; gap: 6px; min-width: 0; padding: 8px 14px;
  background: var(--sunken); border: 1px solid var(--rule-firm); border-radius: var(--radius-buttons);
  cursor: pointer; font-weight: 500; color: var(--ink);
}
.set-toggle input { margin: 0; }
.set-toggle label:has(input:checked) { background: var(--accent-bg); border-color: var(--accent); color: var(--good); }

/* leaderboard sub-nav (Validation / Final Test tabs) — folder-tab convention,
   unchanged in shape from v1/v2, recolored for a white table surface */
.subnav { display: flex; gap: 6px; margin-bottom: 14px; }
.subnav button {
  padding: 8px 16px; font-weight: 600; border-radius: 6px 6px 0 0;
  border: 1px solid var(--rule); border-bottom: none; background: var(--sunken); color: var(--ink-mid);
}
.subnav button.active { background: var(--raised); color: var(--good); border-color: var(--rule-firm); }

/* page lede — the one-line orientation under a top-level heading */
.lede {
  font-size: 16px; line-height: 1.5; color: var(--ink-mid); max-width: 640px;
  margin: -4px 0 18px;
}

/* rank column — top 3 get a left-border accent and heavier weight instead
   of a colored badge or medal glyph */
td.rank {
  font-family: var(--mono); color: var(--ink-faint); font-variant-numeric: tabular-nums;
  width: 1%; white-space: nowrap;
}
tr:nth-child(-n+3) td.rank { color: var(--good); font-weight: 600; }
tr:nth-child(-n+3) td:first-child { border-left: 2px solid var(--good); }

/* numbered step flow — used only where the content genuinely is a sequence
   (Run Evaluation: configure -> verify -> submit) */
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 16px; padding: 20px 0; }
.step:not(:last-child) { border-bottom: 1px solid var(--rule); }
.step-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--rule-firm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; color: var(--ink-mid);
}
.step.done .step-num { border-color: var(--good); color: var(--good); }
.step-body { flex: 1; min-width: 0; }
.step-title { font-family: var(--display); font-size: 16px; font-weight: 500; color: var(--ink); margin: 0 0 4px; }

/* responsive field grid — replaces cramped single-line rows of 3+ inputs */
.field-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  margin-bottom: 12px;
}
.field-grid .field { display: flex; flex-direction: column; gap: 6px; }
.field-grid label { min-width: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-faint); }
.field-grid input { min-width: 0; width: 100%; }

/* API key fields: censored by default, eye button reveals in place */
.key-field { position: relative; display: flex; }
.key-field input { flex: 1; padding-right: 32px; }
.key-toggle {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--ink-faint); cursor: pointer;
}
.key-toggle:hover { color: var(--ink); background: transparent; }
.key-toggle svg { display: block; }

@media (max-width: 640px) {
  main { padding: 12px; }
  header { padding: 10px 14px; gap: 10px; }
  nav { gap: 2px; }
  nav button { padding: 6px 9px; font-size: 12px; }
  .row { flex-direction: column; align-items: stretch; gap: 6px; }
  .row label { min-width: auto; }
  select, input[type="text"], input[type="number"], input[type="password"] { min-width: 0; width: 100%; }
  table { font-size: 12px; }
  th, td { padding: 7px 6px; }
  .admin-box { margin-left: 0; width: 100%; justify-content: space-between; }
  .set-toggle { flex-direction: column; }
}

tr.baseline-row td { color: var(--ink-faint); font-style: italic; border-top: 1px dashed var(--rule-firm); }

.sub-status { padding: 8px 12px; border-radius: 6px; margin: 0 0 12px; font-weight: 600; }
.sub-status.open { color: var(--good); background: var(--accent-bg); }
.sub-status.closed { color: var(--danger); background: var(--danger-bg); }
button.danger { color: var(--danger); border-color: var(--danger); }
