/* Kanu Control: an operations console. Neutral surfaces, borders and type before effects,
   radii of 6px or less, and colour only for state: green healthy, amber in progress or quiet,
   red failed, blue selected. Light by default; html[data-theme=dark] for dark. */

:root {
  --page: #f4f5f7; --panel: #ffffff; --raise: #f8f9fa; --line: #dde0e5; --line-strong: #c4c9d0;
  --ink: #15181c; --ink2: #3a4049; --muted: #5d6570; --faint: #848b95;
  --side: #111417; --side-ink: #e8eaed; --side-muted: #9aa1aa; --side-line: #262b31; --side-sel: #1d2a24;
  --good: #1d7a4a; --good-bg: #e7f5ec; --busy: #a35c00; --busy-bg: #fdf2e1;
  --bad: #b42318; --bad-bg: #fdeceb; --blue: #1f5fbf; --blue-bg: #e8f0fc; --quiet: #5d6570; --quiet-bg: #eef0f2;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --page: #0d0f11; --panel: #15181b; --raise: #1a1e22; --line: #2a2f35; --line-strong: #3a4148;
  --ink: #eceef1; --ink2: #c9ced5; --muted: #9aa2ac; --faint: #7d858f;
  --side: #0a0c0e; --side-line: #1d2126; --side-sel: #16241d;
  --good: #4cc38a; --good-bg: rgba(76,195,138,.12); --busy: #f0a43a; --busy-bg: rgba(240,164,58,.12);
  --bad: #ff6b5e; --bad-bg: rgba(255,107,94,.12); --blue: #6aa5ff; --blue-bg: rgba(106,165,255,.12);
  --quiet: #9aa2ac; --quiet-bg: rgba(154,162,172,.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 var(--sans); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.warn { color: var(--busy); }
.bad-text { color: var(--bad); }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 12px; }
.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--side) 248px, transparent 248px); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px; background: var(--side); color: var(--side-ink); border-right: 1px solid var(--side-line); }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 6px 16px; border-bottom: 1px solid var(--side-line); }
.notice .brand-row { border: 0; padding: 0 0 12px; }
.mark { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; flex: none;
  background: #e8eaed; color: #111417; font-weight: 800; font-size: 16px; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--side-muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: block; padding: 9px 12px 9px 14px; border-radius: 6px; color: var(--side-ink); font-weight: 500;
  border-left: 3px solid transparent; }
.nav a:hover { background: #181c20; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--side-sel); border-left-color: #4cc38a; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.fresh { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--side-line); border-radius: 6px; }
.fresh .dot { margin-top: 6px; }
.fresh-title { font-size: 13px; font-weight: 600; }
.fresh-sub { font-size: 12px; color: var(--side-muted); }
.who { padding: 0 4px; display: flex; flex-direction: column; gap: 6px; }
.who-email { font-size: 12px; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .btn.ghost { color: var(--side-ink); border-color: var(--side-line); background: transparent; }

.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 32px; background: var(--panel); border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.title { font-size: 22px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.content { padding: 24px 32px 48px; max-width: 1440px; }
.foot { margin-top: 16px; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); color: var(--ink);
  font: 600 13px var(--sans); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--ink2); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; margin-top: 12px; min-height: 40px; }
.input { width: 100%; min-height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--panel); color: var(--ink); font: 14px var(--sans); }
select.input { padding-right: 28px; }
.input:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.input:disabled { opacity: .55; cursor: not-allowed; }
/* A value the console derives (slug, namespace): not editable, but meant to be read. */
.input.derived:disabled { opacity: 1; cursor: default; background: var(--raise); color: var(--ink);
  -webkit-text-fill-color: var(--ink); border-style: dashed; }
.field { display: flex; flex-direction: column; gap: 6px; }
.panel.pad > .field + .field { margin-top: 12px; }
.nowrap { white-space: nowrap; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink2); }
.field small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span2 { grid-column: span 2; }
.search { max-width: 360px; }

/* ---- state ---- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--quiet); }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); } .dot.busy { background: var(--busy); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600;
  background: var(--quiet-bg); color: var(--quiet); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.busy { background: var(--busy-bg); color: var(--busy); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.alert { padding: 10px 12px; border-radius: 6px; margin: 0 0 12px; font-size: 13px; border: 1px solid; }
.alert.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }

/* ---- layout blocks ---- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 28px 0 10px; }
.section-head:first-child { margin-top: 0; }
.section-head h2 { font-size: 17px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 16px; overflow: hidden; }
.panel.pad { padding: 18px 20px; overflow: visible; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }
.panel.narrow { max-width: 760px; }
.panel.danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.sticky { position: sticky; top: 92px; }
.empty { padding: 28px 20px; color: var(--muted); text-align: center; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); overflow: hidden; }
.stat { padding: 16px 18px; border-left: 1px solid var(--line); border-top: 3px solid transparent; }
.stat:first-child { border-left: 0; }
.stat.good { border-top-color: var(--good); } .stat.busy { border-top-color: var(--busy); }
.stat.bad { border-top-color: var(--bad); } .stat.quiet { border-top-color: var(--line-strong); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 30px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.split-main, .split-side { min-width: 0; }
.org-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  padding: 10px 14px; background: var(--raise); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--raise); }
.table td.wide { min-width: 260px; }

/* ---- filters ---- */
.filters { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--ink2); padding: 7px 12px;
  font: 600 13px var(--sans); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--blue-bg); color: var(--blue); }
.count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.seg button.on .count { color: var(--blue); }

/* ---- key/values ---- */
.kvs { margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13px; flex: none; }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

/* ---- jobs ---- */
.job { padding: 18px 20px; border-top: 3px solid var(--line-strong); }
.job.good { border-top-color: var(--good); } .job.busy { border-top-color: var(--busy); } .job.bad { border-top-color: var(--bad); }
.job-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.job-head h2 { font-size: 18px; display: flex; gap: 10px; align-items: center; margin: 2px 0 4px; }
.job-line { font-size: 15px; font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 24px; margin: 0; }
.facts dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 0; font-size: 15px; }
.bar { height: 6px; border-radius: 3px; background: var(--quiet-bg); overflow: hidden; margin: 4px 0; }
.bar span { display: block; height: 100%; background: var(--busy); transition: width .4s ease; }
.job.good .bar span { background: var(--good); } .job.bad .bar span { background: var(--bad); }
.bar.big { height: 8px; margin: 16px 0 8px; }
.job-sub { display: flex; gap: 16px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.error-tail { margin: 12px 0 0; padding: 10px 12px; background: var(--bad-bg); color: var(--bad); border-radius: 6px;
  font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.timeline { margin-top: 18px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tl-row { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr) 64px; gap: 12px; align-items: center;
  padding: 5px 12px; font-size: 13px; }
.tl-axis { background: var(--raise); border-bottom: 1px solid var(--line); padding-top: 8px; padding-bottom: 8px; }
.tl-stage + .tl-stage { border-top: 1px solid var(--line); }
.tl-stage-label { padding: 6px 12px 0; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.tl-label { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 6px; min-width: 0; }
.tl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row.running .tl-name { font-weight: 600; } .tl-row.pending .tl-name { color: var(--muted); }
.tl-row.skipped .tl-name { color: var(--faint); }
.tl-note { grid-column: 2; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row.failed .tl-note { color: var(--bad); white-space: normal; overflow-wrap: anywhere; }
.tl-track { position: relative; height: 14px; background: var(--raise); border-radius: 3px; }
.tl-axis .tl-track { background: none; height: 16px; }
.tl-tick { position: absolute; top: 0; transform: translateX(-50%); font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.tl-tick:first-child { transform: none; }
.tl-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; background: var(--quiet); min-width: 0; transition: width .6s linear; }
.tl-row.succeeded .tl-bar { background: var(--good); } .tl-row.failed .tl-bar { background: var(--bad); }
.tl-row.skipped .tl-bar { background: var(--line-strong); }
.tl-row.running .tl-bar { background: repeating-linear-gradient(45deg, var(--busy) 0 6px, color-mix(in srgb, var(--busy) 70%, white) 6px 12px); }
.tl-time { text-align: right; color: var(--muted); font-size: 12px; }
.tl-row .step-icon { text-align: center; color: var(--faint); }
.tl-row.succeeded .step-icon { color: var(--good); } .tl-row.running .step-icon { color: var(--busy); }
.tl-row.failed .step-icon { color: var(--bad); }
.step { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 8px; align-items: baseline; padding: 4px 0; font-size: 13px; }
.step-icon { text-align: center; color: var(--faint); }
.step.succeeded .step-icon { color: var(--good); } .step.running .step-icon { color: var(--busy); }
.step.failed .step-icon { color: var(--bad); }
.step.pending .step-name { color: var(--muted); } .step.skipped .step-name { color: var(--faint); }
.step.running .step-name { font-weight: 600; }
.step-time { color: var(--muted); font-size: 12px; }
.step-detail { grid-column: 2 / 4; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.step.failed .step-detail { color: var(--bad); }

/* ---- choice groups: every option on show, one checked ---- */
.choice-group { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.choice-group legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.seg.radios { flex-wrap: wrap; align-self: flex-start; }
.seg.radios label { display: inline-flex; align-items: center; padding: 7px 14px; border-left: 1px solid var(--line);
  font: 600 13px var(--sans); color: var(--ink2); cursor: pointer; position: relative; }
.seg.radios label:first-child { border-left: 0; }
.seg.radios label.on { background: var(--blue-bg); color: var(--blue); }
.choice-group input[type=radio], .choice-group input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.choice-group label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 4px; }
.radio-list { display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--panel); max-height: 280px; overflow-y: auto; }
.radio-list label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line);
  cursor: pointer; font-size: 14px; position: relative; }
.radio-list label:first-child { border-top: 0; }
.radio-list label::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  flex: none; box-sizing: border-box; }
.radio-list label.on { background: var(--blue-bg); }
.radio-list label.on::before { border: 4px solid var(--blue); }
.choice-group .filter { max-width: 320px; }

/* ---- create ---- */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice { position: relative; display: grid; gap: 4px; padding: 14px 16px 14px 44px; border: 1px solid var(--line-strong);
  border-radius: 6px; cursor: pointer; background: var(--panel); }
.choice input { position: absolute; left: 16px; top: 16px; margin: 0; width: 16px; height: 16px; accent-color: var(--blue); }
.choice.on { border-color: var(--blue); background: var(--blue-bg); box-shadow: inset 0 0 0 1px var(--blue); }
.choice-title { font-weight: 600; }
.choice-about { font-size: 13px; color: var(--ink2); }
.hint { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 8px;
  border-radius: 50%; border: 1px solid var(--line-strong); color: var(--muted); font: 600 11px var(--sans);
  cursor: help; vertical-align: 1px; }
.hint:hover, .hint:focus-visible { color: var(--blue); border-color: var(--blue); outline: none; }
.hint-text { display: none; position: absolute; z-index: 20; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  width: 320px; padding: 10px 12px; border-radius: 6px; background: var(--ink); color: var(--panel);
  font: 400 13px/1.5 var(--sans); text-align: left; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.hint:hover .hint-text, .hint:focus .hint-text { display: block; }

/* ---- splash and notices ---- */
.splash { min-height: 100vh; display: flex; gap: 12px; align-items: center; justify-content: center; color: var(--muted); }
.splash.inline { min-height: 160px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--ink); border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--side); }
.notice { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 28px; }
.notice h1 { font-size: 20px; margin-bottom: 6px; }
.notice p { color: var(--muted); margin: 0 0 18px; }

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sticky { position: static; }
}
@media (max-width: 760px) {
  .tl-row { grid-template-columns: minmax(0, 1fr) 56px; }
  .tl-row .tl-track { grid-column: 1 / 3; grid-row: 2; }
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { position: static; height: auto; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
  .grid, .choices { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table { display: block; overflow-x: auto; }
}
