:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #242424;
  --muted: #696865;
  --line: #d8d1c5;
  --panel: #fffdf8;
  --green: #2f8069;
  --red: #bf4739;
  --blue: #315f9f;
  --amber: #ac741f;
  --shadow: 0 18px 56px rgb(48 43 34 / 13%);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, rgb(49 95 159 / 12%), transparent 34%), linear-gradient(315deg, rgb(47 128 105 / 13%), transparent 34%), var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); min-height: 42px; padding: 0 16px; cursor: pointer; }
button:hover { border-color: #aaa195; }
button:disabled { cursor: wait; opacity: 0.64; }
.primary { background: var(--green); border-color: var(--green); color: white; }
.shell { width: min(1200px, calc(100vw - 32px)); margin: 0 auto; padding: 32px 0; }
.workspace { background: rgb(255 253 248 / 90%); border: 1px solid rgb(216 209 197 / 84%); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.topbar, .control-panel, .preview, .jobs { padding: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 5vw, 44px); line-height: 1; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: 0; }
.health { display: inline-flex; align-items: center; min-height: 34px; border-radius: 999px; border: 1px solid var(--line); padding: 0 12px; color: var(--muted); background: #fff; }
.health.ok { color: var(--green); border-color: rgb(47 128 105 / 34%); }
.health.warn { color: var(--amber); }
.control-panel { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(160px, 240px); gap: 14px; align-items: end; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.field input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); padding: 0 13px; outline: none; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(49 95 159 / 12%); }
.segmented { display: inline-grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: white; min-height: 42px; }
.segmented.mode { grid-template-columns: repeat(3, 1fr); }
.segmented label { display: grid; place-items: center; min-width: 74px; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { width: 100%; height: 100%; display: grid; place-items: center; padding: 0 12px; border-right: 1px solid var(--line); }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { color: white; background: var(--blue); }
.toggle, .attest { min-height: 42px; display: inline-flex; align-items: center; gap: 9px; color: var(--ink); white-space: nowrap; }
.toggle input, .attest input { width: 18px; height: 18px; accent-color: var(--green); }
.actions { display: flex; gap: 10px; justify-content: flex-end; }
.preview { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: center; border-bottom: 1px solid var(--line); }
.preview[hidden] { display: none; }
.preview img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #ded8cc; }
.preview h2 { font-size: 24px; margin-bottom: 10px; overflow-wrap: anywhere; }
.meta { color: var(--muted); margin-bottom: 0; }
.candidates { display: grid; gap: 8px; margin-top: 12px; }
.candidate { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.candidate code { overflow-wrap: anywhere; color: var(--muted); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.job-list { display: grid; gap: 12px; }
.job { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.job-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.job-title { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.job-status { min-width: 92px; text-align: center; border-radius: 999px; border: 1px solid var(--line); padding: 6px 10px; color: var(--muted); font-size: 13px; }
.job-status.completed { color: var(--green); border-color: rgb(47 128 105 / 36%); }
.job-status.failed, .job-status.cancelled { color: var(--red); border-color: rgb(191 71 57 / 32%); }
.progress { width: 100%; height: 10px; border-radius: 999px; background: #ebe5dc; overflow: hidden; }
.bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width 180ms ease; }
.job-meta { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); font-size: 13px; }
.job-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.log { max-height: 150px; overflow: auto; border-radius: 8px; background: #242424; color: #f3efe7; padding: 10px; font: 12px / 1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.empty { color: var(--muted); padding: 18px 0; }
@media (max-width: 820px) {
  .shell { width: min(100vw - 20px, 1200px); padding: 10px 0; }
  .topbar, .control-panel, .preview, .jobs { padding: 16px; }
  .topbar, .control-panel, .preview { grid-template-columns: 1fr; }
  .topbar { display: grid; }
  .actions { justify-content: stretch; }
  .actions button, .job-actions button { flex: 1 1 130px; }
  .segmented { width: 100%; }
  .candidate { grid-template-columns: 1fr; }
}
