:root {
  --bg: #10141a;
  --panel: #171d25;
  --panel-2: #1d2530;
  --ink: #eef3f8;
  --muted: #9aa9bb;
  --line: #2c3644;
  --green: #31c48d;
  --blue: #6ea8fe;
  --yellow: #f5c451;
  --red: #ef6f6c;
  --purple: #b891ff;
  --shadow: 0 18px 40px rgba(0, 0, 0, .28);
}

.login-screen { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: var(--bg); }
.login-screen.hidden { display: none; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 22px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.login-card input { width: 100%; }
.login-error { min-height: 18px; color: var(--red); margin: 0; font-size: 13px; }
.candidate-line { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
code, pre, .terminal-output, .prompt { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #131922;
}
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 0; font-size: 24px; line-height: 1.15; }
h2 { margin: 0; font-size: 16px; }
h3 { margin: 0 0 6px; font-size: 13px; color: var(--ink); }
.status-strip { display: flex; align-items: center; gap: 10px; }
.metric { min-width: 92px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { font-size: 17px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 350px) minmax(420px, 1fr) minmax(290px, 340px);
  gap: 14px;
  padding: 14px;
  flex: 1;
  min-height: 0;
}
.briefing-panel, .terminal-panel, .card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.briefing-panel { padding: 16px; overflow: auto; }
.briefing-panel p { color: var(--muted); line-height: 1.45; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head.compact { margin-bottom: 10px; }
.pill { border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 700; }
.pill.danger { background: rgba(239, 111, 108, .14); color: #ffaaa8; border: 1px solid rgba(239, 111, 108, .42); }
.pill.ok { background: rgba(49, 196, 141, .14); color: #a4f0d0; border-color: rgba(49, 196, 141, .42); }
.inline-code { margin: 10px 0; padding: 10px; overflow: auto; border-radius: 8px; background: #0c1118; color: #dbeafe; border: 1px solid var(--line); }
.objective-list { display: grid; gap: 8px; margin: 16px 0; color: #d8e2ed; font-size: 14px; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--blue); }
.command-help { margin-top: 16px; padding: 12px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.command-help p { margin: 0; font-size: 13px; }
.terminal-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.terminal-titlebar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #0e141d; }
.traffic { display: flex; gap: 6px; }
.traffic span { width: 11px; height: 11px; border-radius: 50%; background: #ef6f6c; }
.traffic span:nth-child(2) { background: #f5c451; }
.traffic span:nth-child(3) { background: #31c48d; }
.terminal-output { flex: 1; overflow: auto; padding: 14px; background: #080d13; color: #d6f7df; font-size: 13px; line-height: 1.42; white-space: pre-wrap; }
.terminal-line { margin: 0 0 10px; }
.terminal-line.command { color: #9cc9ff; }
.terminal-line.output { color: #d6f7df; }
.terminal-line.warn { color: #ffd98a; }
.terminal-line.flag { color: #9ff2cd; font-weight: 700; }
.terminal-form { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 10px; border-top: 1px solid var(--line); background: #0e141d; }
.prompt { color: var(--green); font-weight: 700; }
.terminal-form input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #0b1118; color: var(--ink); padding: 9px 10px; outline: 0; }
.terminal-form input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(110, 168, 254, .15); }
.terminal-form button, .primary-button, .ghost-button { border: 1px solid var(--line); border-radius: 8px; min-height: 38px; padding: 8px 11px; cursor: pointer; }
.terminal-form button, .primary-button { background: var(--blue); border-color: var(--blue); color: #08111d; font-weight: 700; }
.ghost-button { background: transparent; color: var(--ink); }
.side-panel { display: grid; gap: 14px; align-content: start; overflow: auto; }
.card { padding: 14px; }
.score, #hint-count, #report-status { color: var(--muted); font-size: 12px; }
.flags-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.flags-list li { color: var(--muted); font-size: 13px; }
.flags-list li.done { color: var(--green); font-weight: 700; }
.hint-box { margin-top: 10px; padding: 10px; border-radius: 8px; background: var(--panel-2); color: var(--muted); min-height: 54px; font-size: 13px; line-height: 1.35; }
.report-card textarea { min-height: 150px; resize: vertical; }
.report-card button { margin-top: 10px; width: 100%; }
.risk { color: var(--red); }
.editor-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(5, 10, 18, .72); }
.editor-modal[hidden] { display: none; }
.editor-dialog { width: min(760px, 100%); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); padding: 14px; }
.editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
#config-editor { min-height: 260px; resize: vertical; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; line-height: 1.45; }
.editor-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.editor-actions span { color: var(--muted); font-size: 13px; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .terminal-panel { min-height: 520px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .status-strip { width: 100%; flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .workspace { padding: 8px; gap: 8px; }
  .topbar { padding: 14px; }
  h1 { font-size: 20px; }
  .metric { flex: 1; }
  .terminal-form { grid-template-columns: auto 1fr; }
  .terminal-form button { grid-column: 1 / -1; }
}
