/* Konnaps auto-dev dashboard — one stylesheet, tokens on :root, light + dark. */

:root {
  --top-h: 52px;
  --gutter: 16px;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --fg: #1b1f24;
  --muted: #5f6b7d;
  --accent: #2f6fde;
  --accent-fg: #ffffff;
  --accent-soft: #e5edfc;
  --ok: #1a8a4a;
  --ok-soft: #e2f4e9;
  --warn: #a96b0c;
  --warn-soft: #fcf1dc;
  --err: #c53030;
  --err-soft: #fce8e8;
  --code-bg: #f2f3f6;
  --bubble: #ffffff;
  --mine: #e5edfc;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);

  --st-queued: #7b8494;
  --st-preparing: #7a55d3;
  --st-running: #2f6fde;
  --st-waiting_owner: #c97a00;
  --st-ready: #0e8a8c;
  --st-deploying: #7a55d3;
  --st-deployed: #1a8a4a;
  --st-blocked: #c2410c;
  --st-failed: #c53030;
  --st-cancelled: #8a8f98;
  --st-paused: #b7791f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222b;
    --border: #2b303b;
    --fg: #e5e7eb;
    --muted: #9aa3b2;
    --accent: #6d9dff;
    --accent-fg: #0b1220;
    --accent-soft: #1c2944;
    --ok: #4cc27f;
    --ok-soft: #15301f;
    --warn: #e5a53d;
    --warn-soft: #33260e;
    --err: #ff6b6b;
    --err-soft: #3a191b;
    --code-bg: #12151b;
    --bubble: #1b1f27;
    --mine: #1c2944;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);

    --st-queued: #9099a8;
    --st-preparing: #a68bff;
    --st-running: #6d9dff;
    --st-waiting_owner: #f0ad3c;
    --st-ready: #3fc6c8;
    --st-deploying: #a68bff;
    --st-deployed: #4cc27f;
    --st-blocked: #fb8a4c;
    --st-failed: #ff6b6b;
    --st-cancelled: #858b96;
    --st-paused: #e5a53d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 var(--font);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
h2, h3, h4 { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.spacer { flex: 1; }
.warn { color: var(--warn); }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); cursor: pointer; white-space: nowrap;
  line-height: 1.2; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.tiny { padding: 2px 8px; font-size: 12px; }
.btn.option { border-color: var(--accent); color: var(--accent); }
.btn.option:hover { background: var(--accent-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

input[type=text], input[type=number], input[type=password], input:not([type]), textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled { opacity: .55; }
textarea { resize: vertical; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; }
.field > span, .field > legend { font-weight: 600; font-size: 13px; padding: 0; }
fieldset.field legend { margin-bottom: 6px; }
.field-info { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-height: 1em; }
.radio-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.radio-row input[type=number] { max-width: 160px; }
.radio, .check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.form-error { color: var(--err); background: var(--err-soft); padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; }
.jira-status { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 12px; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
body[data-screen=login] .topbar, body[data-screen=loading] .topbar:empty { display: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand.big { font-size: 22px; }
.brand-dot { width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), var(--st-preparing)); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--fg); background: var(--surface-2); font-weight: 600; }
.count {
  display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; margin-left: 6px;
  background: var(--st-waiting_owner); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px;
}
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-queued); }
.conn-live .dot { background: var(--ok); }
.conn-down .dot { background: var(--err); }
.conn-connecting .dot { background: var(--warn); }
.conc-num { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- pages ---------- */
main { padding: var(--gutter); }
body[data-view=run] main { padding: 0; }
.page { max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.boot { padding: 40px; text-align: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); grid-column: 1 / -1; }
.empty-small { padding: 8px 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

/* ---------- badges ---------- */
.badge {
  --c: var(--st-queued);
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.state-queued { --c: var(--st-queued); }
.state-preparing { --c: var(--st-preparing); }
.state-running { --c: var(--st-running); }
.state-waiting_owner { --c: var(--st-waiting_owner); }
.state-ready { --c: var(--st-ready); }
.state-deploying { --c: var(--st-deploying); }
.state-deployed { --c: var(--st-deployed); }
.state-blocked { --c: var(--st-blocked); }
.state-failed { --c: var(--st-failed); }
.state-cancelled { --c: var(--st-cancelled); }
.state-paused { --c: var(--st-paused); }
.state-running .dot, .state-preparing .dot, .state-deploying .dot { animation: pulse 1.6s ease-in-out infinite; }
.badge.dstate { --c: var(--muted); }
.badge.dstate-answered { --c: var(--ok); }
.badge.dstate-rejected { --c: var(--err); }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-family: var(--mono);
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.pending-badge {
  margin-left: auto; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--st-waiting_owner); color: #fff; white-space: nowrap;
}
.pending-badge:hover { text-decoration: none; filter: brightness(1.08); }
.jira-key { font-family: var(--mono); font-weight: 700; font-size: 13px; white-space: nowrap; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.card {
  --c: var(--st-queued);
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c);
  border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow); min-width: 0;
}
.card.st-queued { --c: var(--st-queued); }
.card.st-preparing { --c: var(--st-preparing); }
.card.st-running { --c: var(--st-running); }
.card.st-waiting_owner { --c: var(--st-waiting_owner); }
.card.st-failed { --c: var(--st-failed); }
.card.st-cancelled { --c: var(--st-cancelled); opacity: .85; }
.card.st-paused { --c: var(--st-paused); }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-summary { color: var(--fg); font-weight: 600; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.card-phase { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.phase-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.now {
  font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 5px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono);
}
.now.live { color: var(--fg); font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 12px; background: var(--surface); white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st-queued); }
.chip.running .dot { background: var(--ok); animation: pulse 1.4s ease-in-out infinite; }
.chip.muted { color: var(--muted); }
.chip-model { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 2px; font-size: 13px; }
.links { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.meta { display: inline-flex; gap: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost { font-variant-numeric: tabular-nums; }

/* ---------- board as a grouped list (27 Oct 2026) ---------- */
.board-list { display: flex; flex-direction: column; gap: 12px; }
.board-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.board-group > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; padding: 9px 14px; }
.board-group > summary::-webkit-details-marker { display: none; }
.board-group > summary::before { content: "▸"; color: var(--muted); font-size: 12px; align-self: center; transition: transform .15s; }
.board-group[open] > summary::before { transform: rotate(90deg); }
.board-group[open] > summary { border-bottom: 1px solid var(--border); }
.board-group > summary h3 { font-size: 13.5px; font-weight: 700; }
.board-group > summary .count { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 7px; }
.board-group > summary .hint { margin-left: 2px; }
.board-group.g-needs_you > summary h3 { color: var(--st-waiting_owner); }
.board-group.g-paused > summary h3 { color: var(--st-paused); }
.board-group.g-active > summary h3 { color: var(--st-running); }
.board-group.g-waiting > summary h3 { color: var(--st-ready); }
.board-group.g-deploying > summary h3 { color: var(--st-deploying); }
.board-group.g-blocked > summary h3 { color: var(--st-blocked); }
.board-group.g-deployed > summary h3 { color: var(--ok); }
.board-group.g-failed > summary h3 { color: var(--err); }
.board-group.g-archived > summary h3 { color: var(--muted); }
.board-group .rows { display: flex; flex-direction: column; }
.row {
  --c: var(--st-queued);
  display: grid; grid-template-columns: minmax(92px, max-content) minmax(0, 1fr) auto; gap: 4px 12px; align-items: start;
  padding: 9px 14px 9px 11px; border-left: 3px solid var(--c); border-bottom: 1px solid var(--border); min-width: 0;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.st-queued { --c: var(--st-queued); }
.row.st-preparing { --c: var(--st-preparing); }
.row.st-running { --c: var(--st-running); }
.row.st-waiting_owner { --c: var(--st-waiting_owner); }
.row.st-ready { --c: var(--st-ready); }
.row.st-deploying { --c: var(--st-deploying); }
.row.st-deployed { --c: var(--st-deployed); }
.row.st-blocked { --c: var(--st-blocked); }
.row.st-failed { --c: var(--st-failed); }
.row.st-cancelled { --c: var(--st-cancelled); opacity: .85; }
.row.st-paused { --c: var(--st-paused); }
.row-key { padding-top: 2px; }
.row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.row-summary { color: var(--fg); font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.row-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); min-width: 0; }
.row-sub .phase-title { color: var(--fg); white-space: normal; }
.row-sub .chips { display: inline-flex; }
.row-life { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .now { margin-top: 2px; }
.row .now:empty { display: none; }
.row .now.quiet { background: none; padding: 0; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12.5px; white-space: nowrap; }
.row-side .links { justify-content: flex-end; }
@media (max-width: 760px) {
  .row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .row-key { flex-direction: row; align-items: center; }
  .row-side { flex-direction: row; align-items: center; justify-content: space-between; white-space: normal; }
  .board-group > summary .hint { display: none; }
}
.ok-text { color: var(--ok); font-weight: 600; }

/* ---------- run page ---------- */
.run-page { max-width: none; height: calc(100vh - var(--top-h) - var(--health-h, 0px)); height: calc(100dvh - var(--top-h) - var(--health-h, 0px)); display: flex; flex-direction: column; }
.run-head { padding: 10px var(--gutter); border-bottom: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.run-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.run-title h2 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.back { font-size: 18px; color: var(--muted); }
.run-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.run-sub .phase-title { color: var(--fg); }
.run-sub .sep { width: 1px; height: 14px; background: var(--border); }
.run-sub .branch { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-error { color: var(--err); background: var(--err-soft); padding: 6px 10px; border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }

.run-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 44%); }
.col-left, .col-right { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.col-right { border-left: 1px solid var(--border); background: var(--surface); }
.timeline { flex: 1; min-height: 0; overflow-y: auto; padding: 12px var(--gutter); overscroll-behavior: contain; }
.older { display: block; margin: 0 auto 10px; }

.tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border); overflow-x: auto; flex: none; }
.tab {
  border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.mobile-only { display: none; }
.tab-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px var(--gutter) 24px; }
.pane-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; position: sticky; top: -12px; background: var(--surface); padding: 6px 0; z-index: 1; }

/* timeline rows */
.events { display: flex; flex-direction: column; gap: 4px; }
.ev { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.ev-time { flex: none; margin-left: auto; font-size: 11px; color: var(--muted); padding-top: 3px; font-variant-numeric: tabular-nums; }
.ev.line { font-size: 13px; padding: 2px 0; flex-wrap: wrap; }
.ev-line { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ev.indent, .ev.sub { padding-left: 28px; }
.ev .mark { display: inline-block; width: 16px; text-align: center; color: var(--muted); }
.ev .mark.run, .ev .mark.ok { color: var(--ok); }
.ev .mark.ask { color: var(--st-waiting_owner); font-weight: 700; }
.ev .mark.warn { color: var(--warn); }
.bubble {
  flex: 1; min-width: 0; background: var(--bubble); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 12px; box-shadow: var(--shadow); overflow-wrap: anywhere; margin: 4px 0;
}
.bubble.small { font-size: 13px; background: var(--surface-2); box-shadow: none; padding: 6px 10px; }
.bubble-agent { font-size: 11px; font-weight: 700; color: var(--st-preparing); text-transform: none; margin-bottom: 2px; }
.ev.mine { justify-content: flex-end; }
.ev.mine .ev-time { margin-left: 0; order: -1; }
.bubble.mine { flex: 0 1 auto; max-width: 80%; background: var(--mine); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.ev.optimistic .bubble { opacity: .65; }
.ev.optimistic.sent .bubble { opacity: .85; }
.ev.optimistic.failed .bubble { border-color: var(--err); opacity: 1; }
.ev.optimistic.failed .bubble::after { content: "not delivered"; display: block; color: var(--err); font-size: 11px; }
.ev-details { flex: 1; min-width: 0; }
.ev-details > summary { cursor: pointer; list-style: none; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-details > summary::-webkit-details-marker { display: none; }
.ev-details > summary:hover { color: var(--fg); }
.ev-details[open] > summary { white-space: normal; color: var(--fg); }
.ev-details pre { margin: 6px 0; }
.ev.err .ev-details > summary { color: var(--err); }
.gear { color: var(--muted); }
.ev.status { padding: 6px 0; }
.ev.status .ev-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev-detail { width: 100%; padding-left: 22px; font-size: 13px; }
.ev-detail summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.bubble.notify { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--bubble)); }
.bubble.notify .bubble-agent { color: var(--accent); }
.bubble.notify.lvl-warning { border-color: var(--warn); }
.bubble.notify.lvl-warning .bubble-agent { color: var(--warn); }
.bubble.notify.lvl-error { border-color: var(--err); }
.bubble.notify.lvl-error .bubble-agent { color: var(--err); }
.ev.error { color: var(--err); background: var(--err-soft); border-radius: 6px; padding: 4px 8px; }
.ev.git.ok .ev-line code { background: var(--ok-soft); color: var(--ok); padding: 0 4px; border-radius: 4px; }
.ev.git.err { color: var(--err); }
.ev.denied { background: var(--warn-soft); border-radius: 6px; padding: 3px 8px; }
.ev.result { color: var(--muted); border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 6px; }
.ev.agent { color: var(--fg); }
.inline-md, .inline-md > p { display: inline; margin: 0; }

.live { flex: none; max-height: 30vh; overflow-y: auto; padding: 6px var(--gutter); border-top: 1px dashed var(--border); background: var(--surface-2); }
.live-row { display: flex; gap: 8px; font-size: 13px; padding: 2px 0; min-width: 0; }
.live-who { flex: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--st-preparing); }
.live-text { color: var(--muted); font-style: italic; min-width: 0; }
.dot.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 1s ease-in-out infinite; }

.composer { flex: none; border-top: 1px solid var(--border); padding: 8px var(--gutter) 10px; background: var(--surface); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 42px; max-height: 40vh; }
.run-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- decisions ---------- */
.dlist { display: flex; flex-direction: column; gap: 12px; }
.inbox-page .dlist { max-width: 900px; }
.decision {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  border-left: 3px solid var(--st-waiting_owner); box-shadow: var(--shadow); min-width: 0; transition: box-shadow .3s;
}
.col-right .decision { box-shadow: none; }
.decision.dstate-answered { border-left-color: var(--ok); }
.decision.dstate-rejected { border-left-color: var(--err); }
.decision.dstate-cancelled { border-left-color: var(--st-cancelled); opacity: .75; }
.decision.busy { opacity: .6; }
.decision.flash { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.dlist.done .decision { padding: 10px 12px; }
.decision-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-width: 0; }
.kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--st-waiting_owner); }
.kind-commit .kind, .kind.kind-commit { color: var(--st-preparing); }
.kind.kind-pr { color: var(--accent); }
.q-question { font-size: 14px; }
.q-context { margin-top: 8px; font-size: 13px; color: var(--muted); }
.q-context > summary { cursor: pointer; font-weight: 600; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: flex-start; }
.q-actions textarea { flex: 1 1 100%; }
.q-actions .attach-chips { flex: 1 1 100%; }
.answer { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.kv { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; font-size: 13px; margin: 3px 0; align-items: baseline; }
.kv > span:first-child { color: var(--muted); }
.kv code { overflow-wrap: anywhere; }
.codebox { position: relative; margin: 10px 0 6px; }
.codebox .btn { position: absolute; top: 6px; right: 6px; background: var(--surface); border-color: var(--border); }
pre.code {
  margin: 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; overflow-x: auto;
}
.codebox pre.code { padding-right: 64px; }
pre.code.small { font-size: 11.5px; max-height: 360px; overflow: auto; }
ul.files { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
ul.files li { overflow-wrap: anywhere; }

/* ---------- record / diff / site ---------- */
.record { font-size: 14px; line-height: 1.55; }
pre.diff { margin: 0; font-size: 12px; line-height: 1.45; white-space: pre; overflow-x: auto; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.d-add { color: var(--ok); }
.d-del { color: var(--err); }
.d-hunk { color: var(--accent); }
.d-file { color: var(--fg); font-weight: 700; }
.kvlist { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 13px; }
.kvlist dt { color: var(--muted); }
.kvlist dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- markdown ---------- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .45em 0; }
.md ul, .md ol { margin: .4em 0; padding-left: 1.4em; }
.md li { margin: .15em 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: .9em 0 .4em; line-height: 1.25; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.08em; } .md h4, .md h5, .md h6 { font-size: 1em; }
.bubble .md h1, .bubble .md h2, .bubble .md h3 { font-size: 1.05em; }
.md code { background: var(--code-bg); padding: .05em .35em; border-radius: 4px; overflow-wrap: anywhere; }
.md pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; overflow-wrap: normal; }
.md blockquote { margin: .5em 0; padding: .1em .9em; border-left: 3px solid var(--border); color: var(--muted); }
.md table { border-collapse: collapse; margin: .6em 0; display: block; overflow-x: auto; max-width: 100%; font-size: .95em; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.md img { max-width: 100%; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: var(--gutter); bottom: var(--gutter); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 2 * var(--gutter))); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast.lvl-warning { border-left-color: var(--warn); }
.toast.lvl-error { border-left-color: var(--err); }
.toast.lvl-success { border-left-color: var(--ok); }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- dialog, popover ---------- */
.dialog {
  width: min(540px, calc(100vw - 2 * var(--gutter))); max-height: calc(100dvh - 32px); padding: 0;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(10, 14, 20, .45); }
.start-form { padding: 16px 18px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dialog-head h3 { font-size: 17px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.popover {
  position: absolute; z-index: 50; width: min(380px, calc(100vw - 2 * var(--gutter))); padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.popover h4 { margin-bottom: 12px; }
.popover .check { margin-bottom: 14px; }

/* ---------- login ---------- */
.login { min-height: calc(100vh - 2 * var(--gutter)); display: grid; place-items: center; }
.login-card {
  width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.login-card p { margin: -6px 0 6px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .run-grid { display: flex; flex-direction: column; }
  .col-right { order: -1; border-left: 0; flex: 1; }
  .run-grid[data-mobile=timeline] .col-right { flex: none; }
  .run-grid[data-mobile=timeline] .tab-body { display: none; }
  .run-grid[data-mobile=tab] .col-left { display: none; }
  .col-left { flex: 1; }
  .mobile-only { display: inline-flex; }
  .tab.mobile-inactive.active { color: var(--muted); border-bottom-color: transparent; }
  .run-sub .branch { max-width: 100%; }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .brand-text, .conc-label, .conn-label { display: none; }
  .nav a { padding: 6px 8px; }
  .run-title h2 { font-size: 14px; }
  .run-sub .sep, .run-sub .branch { display: none; }
  .bubble.mine { max-width: 92%; }
  .ev.indent, .ev.sub { padding-left: 14px; }
  .ev-time { display: none; }
  .composer-row .btn { padding: 7px 12px; }
  .kv { grid-template-columns: 56px minmax(0, 1fr); }
}

/* ---------- health banner ---------- */
.health {
  position: sticky; top: var(--top-h); z-index: 15; display: flex; align-items: flex-start; gap: 10px;
  padding: 8px var(--gutter); background: var(--err-soft); color: var(--err); border-bottom: 1px solid color-mix(in srgb, var(--err) 35%, var(--border));
  font-size: 13px;
}
.health-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.health ul { margin: 2px 0 0; padding-left: 18px; }
.health .toast-x { color: var(--err); }
.popover .logout { margin-right: auto; }

/* ---------- Jira watcher ---------- */
.bubble.jira { flex: 0 1 auto; max-width: 80%; border-color: color-mix(in srgb, var(--st-preparing) 35%, var(--border)); background: color-mix(in srgb, var(--st-preparing) 7%, var(--bubble)); }
.bubble-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; margin-bottom: 4px; }
.jira-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--st-preparing); color: #fff; }
.ev.jira-st { color: var(--warn); }
.start-btn { position: relative; }
.cand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-waiting_owner); box-shadow: 0 0 0 2px var(--surface); position: absolute; top: -3px; right: -3px; }
.cand-list { margin-top: 6px; border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow-y: auto; background: var(--surface-2); }
.cand-title { padding: 6px 10px 4px; }
.cand { display: flex; align-items: center; gap: 4px; padding: 0 6px 0 0; border-top: 1px solid var(--border); }
.cand.selected { background: var(--accent-soft); }
.cand-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; cursor: pointer; text-align: left; font-size: 13px; }
.cand-pick:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cand-pick:disabled { opacity: .55; cursor: default; }
.cand-summary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand-src { font-size: 10.5px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--st-preparing); color: var(--st-preparing); }
.cand-x { font-size: 15px; line-height: 1; }
@media (max-width: 640px) { .cand-pick .jira-status { display: none; } .bubble.jira { max-width: 92%; } }

/* ---------- Jira comment gate, start errors ---------- */
.kind.kind-jira_comment { color: var(--st-preparing); }
.jc-label { margin: 8px 0 4px; }
.jc-preview { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; }
.jc-editor { margin-top: 10px; }
.jc-editor > summary { cursor: pointer; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.jc-edit { font-family: var(--mono); font-size: 12.5px; }
.subtask-chips { margin-top: 8px; }
.chip-btn { cursor: pointer; color: var(--fg); }
.chip-btn:hover { border-color: var(--accent); }
.cand.blocked .cand-pick { opacity: .5; }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.popover .check-row .check { margin-bottom: 0; white-space: normal; }

/* ---------- re-open, archive ---------- */
.ev.reopened { margin: 10px 0; }
.reopen-line { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--st-waiting_owner); font-weight: 700; font-size: 13px; }
.reopen-line::before, .reopen-line::after { content: ""; flex: 1; height: 2px; background: var(--st-waiting_owner); opacity: .55; border-radius: 2px; }
.watching { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.watching .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
.card.archived { opacity: .55; filter: grayscale(.6); }
.archived-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.archived-toggle { color: var(--muted); }
.archived-toggle.on { color: var(--fg); background: var(--surface-2); }
@media (max-width: 640px) { .archived-toggle { display: none; } }

/* ---------- structured questions ---------- */
.q-block { margin: 0 0 10px; }
.q-label { margin: 0 0 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.q-scenario > .md { padding-left: 12px; border-left: 3px solid var(--border); color: var(--fg); font-size: 13.5px; }
.q-recommend .q-rec { background: var(--accent-soft); color: var(--fg); border-radius: 8px; padding: 6px 10px; }
.q-recommend .q-rec { font-weight: 600; }
.q-block .md > p:first-child { margin-top: 0; }
.q-block .md > :last-child { margin-bottom: 0; }
.q-why > .md { font-size: 13.5px; }
.btn.option.recommended { color: var(--accent-fg); border-color: var(--accent); }
.rec-line { font-size: 13px; margin: -2px 0 8px; }
.btn.disabled { opacity: .45; cursor: not-allowed; text-decoration: none; }
.btn.option.recommended:hover { background: var(--accent); color: var(--accent-fg); filter: brightness(1.08); }

.count-hint { align-self: flex-end; font-variant-numeric: tabular-nums; }
.count-hint.warn { color: var(--warn); }
.mode-help { margin: -6px 0 14px; }

/* timeline: re-open lines */
.ev.reopened .reopen-line code { font-size: 11.5px; background: var(--code-bg); padding: 0 5px; border-radius: 4px; overflow-wrap: anywhere; }
.ev.reopened { flex-wrap: wrap; }
.kvlist.small { font-size: 12px; }

/* settings */
select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); outline: none; }
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Claude usage limits (header widget, banner, paused runs, timeline) ---------- */
.usage {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; cursor: help; line-height: 1;
}
.usage:hover { background: var(--surface-2); }
.usage .sep { opacity: .5; }
.usage-brand { font-weight: 600; color: var(--fg); }
.usage-nums { display: inline-flex; gap: 6px; align-items: center; }
.usage-num b { font-weight: 600; color: var(--fg); }
.usage-num.warn b, .usage.warn .usage-brand { color: var(--warn); }
.usage-num.bad b, .usage.bad .usage-brand, .usage-limit { color: var(--err); font-weight: 600; }
.usage.bad { background: var(--err-soft); }
.usage.warn { background: var(--warn-soft); }
.usage-meter { display: inline-flex; flex-direction: column; gap: 2px; margin-left: 2px; }
.usage-bar { display: block; width: 40px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--fg) 12%, transparent); overflow: hidden; }
.usage-fill { display: block; height: 100%; background: var(--ok); border-radius: 2px; transition: width .4s; }
.usage-bar.warn .usage-fill { background: var(--warn); }
.usage-bar.bad .usage-fill { background: var(--err); }
.usage.nodata .usage-brand { color: var(--muted); }
/* phone width: the meter alone (its colours carry the level), or « resumes 15:00 » in red when a limit is reached */
@media (max-width: 640px) {
  .usage-nums, .usage .sep, .usage-brand, .usage-limit-label, .usage.nodata { display: none; }
  .usage { padding: 4px 6px; gap: 4px; }
  .usage.bad .usage-limit + .usage-meter { display: none; }
}

.health.warning { background: var(--warn-soft); color: var(--warn); border-bottom-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.health.warning .toast-x { color: var(--warn); }

.paused-line { display: inline-flex; align-items: center; gap: 4px; color: var(--st-paused); font-weight: 600; white-space: nowrap; }
.paused-line .mark { font-size: 1.05em; }
.card .paused-line { font-size: 12.5px; }
.run-paused { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; background: var(--warn-soft); border-radius: 6px; padding: 5px 10px; }
.run-paused .paused-why { flex: 1 1 200px; max-width: 100%; }
.run-paused .resume-now { margin-left: auto; }

.ev.rate-limit { color: var(--muted); }
.ev.rate-limit.lvl-allowed_warning { color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 3px 8px; }
.ev.rate-limit.lvl-allowed_warning .mark, .ev.rate-limit.lvl-allowed_warning .muted { color: inherit; }
.ev.rate-limit.lvl-rejected { color: var(--err); background: var(--err-soft); border-radius: 6px; padding: 3px 8px; }
.ev.rate-limit.lvl-rejected .mark, .ev.rate-limit.lvl-rejected .muted { color: inherit; }
.ev.system.warning { color: var(--warn); }
.ev.system.warning .mark { color: var(--warn); font-weight: 700; }
.ev.claude-error b { font-family: var(--mono); font-weight: 600; }
.ev.reopened.paused .reopen-line { color: var(--st-paused); }
.ev.reopened.paused .reopen-line::before, .ev.reopened.paused .reopen-line::after { background: var(--st-paused); }
.ev.reopened.resumed .reopen-line { color: var(--ok); }
.ev.reopened.resumed .reopen-line::before, .ev.reopened.resumed .reopen-line::after { background: var(--ok); }

/* ---------- data tables (deploys page) ---------- */
.ev.reopened.prod .reopen-line { color: var(--ok); }
.ev.reopened.prod .reopen-line::before, .ev.reopened.prod .reopen-line::after { background: var(--ok); }
.ev.reopened.prod .reopen-line .muted, .ev.reopened.prod .reopen-line a { font-weight: 400; }
.nav .count.dep { background: var(--st-deploying); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table .c-app, .data-table .c-sha, .data-table .c-date, .data-table .c-status, .data-table .c-smoke, .data-table .c-act { white-space: nowrap; width: 1%; }
.data-table .c-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.data-table tr.rowlink { cursor: pointer; }
.clip-helper { position: fixed; left: -9999px; top: 0; opacity: 0; }
/* phone width: one stacked block per row instead of a cramped table */
@media (max-width: 640px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody { display: block; }
  .data-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td, .data-table td.c-app, .data-table td.c-sha, .data-table td.c-date, .data-table td.c-status, .data-table td.c-smoke, .data-table td.c-act { display: inline; padding: 0; border: 0; width: auto; white-space: normal; }
  .data-table td.c-summary { flex: 1 1 100%; order: 3; }
  .data-table td.c-act { flex: 1 1 100%; order: 5; }
  .data-table td.c-date { order: 4; font-size: 12px; }
  .data-table tbody tr:hover td { background: none; }
}
/* phone width: the top bar must never scroll the page (Board · Inbox · Deploys · usage · live · n/m · Start) */
@media (max-width: 640px) {
  .topbar { gap: 6px; }
  .nav { gap: 2px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 6px; flex: none; }
  .start-long { display: none; }
  .btn.start-btn { padding: 5px 8px; }
  .usage { padding: 4px 4px; }
}

/* attachments (14 Oct 2026) */
.attach { display: inline-flex; align-items: center; }
.attach-btn.has-files { color: var(--accent); }
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 6px 3px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 12px; }
.attach-chip .attach-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.attach-rm { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; }
.attach-rm:hover { color: var(--err); }
.attach-field { gap: 6px; }
.composer.dropping { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 8px; }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.att-img img { max-width: 240px; max-height: 160px; border-radius: 6px; border: 1px solid var(--border); display: block; }
.att-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 12px; text-decoration: none; color: inherit; }
.usage-reset { margin-left: 8px; vertical-align: middle; font-size: 11px; padding: 1px 7px; }
.usage-model { font-family: var(--mono, ui-monospace, monospace); font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft, #e3ecfb); color: var(--accent, #2554a3); margin-left: 6px; vertical-align: middle; }
.usage-acct { font-family: var(--mono, ui-monospace, monospace); font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--warn-soft, #f6ead4); color: var(--warn, #8a5a12); margin-left: 6px; vertical-align: middle; }
/* Second Claude account switch (header, next to the usage widget) */
.acct-toggle { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex-shrink: 0; margin-left: 6px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; line-height: 1.4; }
.acct-toggle:hover { background: var(--surface-2); }
.acct-toggle:disabled { opacity: .5; cursor: progress; }
.acct-toggle-label { font-family: var(--mono, ui-monospace, monospace); font-size: 10px; }
.acct-toggle-track { position: relative; display: inline-block; width: 24px; height: 13px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 18%, transparent); transition: background .2s; }
.acct-toggle-knob { position: absolute; top: 1.5px; left: 1.5px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg, #fff); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.acct-toggle.on .acct-toggle-track { background: var(--ok); }
.acct-toggle.on .acct-toggle-knob { transform: translateX(11px); }
.acct-toggle.on .acct-toggle-state { color: var(--ok); font-weight: 600; }
.acct-toggle-state { min-width: 1.6em; }

/* ---------- run files (Gate log tab): gate logs and the ticket's scratch files ---------- */
.files-filter { flex: 1; min-width: 160px; max-width: 320px; }
.files-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.files-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.files-table tr:hover td, .files-table tr.active td { background: var(--surface-2); }
.files-table .f-name { overflow-wrap: anywhere; }
.files-table .f-size { width: 64px; text-align: right; white-space: nowrap; }
.files-table .f-time { width: 120px; white-space: nowrap; }
.files-table .f-dl { width: 36px; text-align: right; }
.f-kind { display: inline-block; width: 18px; color: var(--muted); }
.f-kind.k-image { color: var(--accent); }
.file-preview { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; background: var(--surface); }
.file-preview-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.file-preview-bar code { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview pre.file-text { max-height: 60vh; white-space: pre; overflow: auto; }
.file-img { display: block; max-width: 100%; margin-top: 8px; border: 1px solid var(--border); border-radius: 6px; }
@media (max-width: 640px) { .files-table .f-time { display: none; } }

/* ---------- Konnaps: apps, risk, cost, approvals, deploys ---------- */
:root {
  --app-school: #0284c7;   /* sky */
  --app-ticket: #059669;   /* emerald */
  --app-pos: #d97706;      /* amber */
}
@media (prefers-color-scheme: dark) {
  :root { --app-school: #38bdf8; --app-ticket: #34d399; --app-pos: #fbbf24; }
}
.app-badge { --c: var(--muted); display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); white-space: nowrap; line-height: 17px; }
.app-badge.app-school { --c: var(--app-school); }
.app-badge.app-ticket { --c: var(--app-ticket); }
.app-badge.app-pos { --c: var(--app-pos); }
.row-key { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.run-title .app-badge { flex: none; }
.risk-tag { font-size: 11px; padding: 0 7px; border-radius: 999px; white-space: nowrap; line-height: 17px; border: 1px solid var(--border); color: var(--muted); }
.risk-tag.high { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, var(--border)); background: var(--err-soft); font-weight: 700; }
.cost-model { color: var(--muted); font-size: .92em; }
.sep-dot { color: var(--muted); }
.site-link { font-weight: 600; white-space: nowrap; }
.pill.phase-question { background: var(--warn-soft); color: var(--warn); }
.pill.phase-dev, .pill.phase-fixing { background: color-mix(in srgb, var(--st-running) 14%, transparent); color: var(--st-running); }
.pill.phase-review { background: color-mix(in srgb, var(--st-preparing) 14%, transparent); color: var(--st-preparing); }
.pill.phase-ready { background: color-mix(in srgb, var(--st-ready) 14%, transparent); color: var(--st-ready); }
.pill.phase-deploying { background: color-mix(in srgb, var(--st-deploying) 14%, transparent); color: var(--st-deploying); }
.pill.phase-deployed { background: var(--ok-soft); color: var(--ok); }
.pill.phase-blocked { background: var(--err-soft); color: var(--err); }
.deploy-line { font-weight: 600; color: var(--st-deploying); white-space: nowrap; }
.deploy-line.ok { color: var(--ok); }
.deploy-line.dst-failed { color: var(--err); }
.deploy-line.dst-env_hold, .deploy-line.dst-window_hold { color: var(--warn); }
.show-older { margin: 6px 14px 8px; align-self: flex-start; }

/* approve / reject (board card, run header, inbox) */
.row-approve { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.approve-controls { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 260px; }
.approve-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.approve-controls.compact .approve-btns { justify-content: flex-start; }
.reject-row { display: flex; gap: 8px; align-items: flex-end; }
.reject-row textarea { flex: 1; min-height: 40px; }
.run-ready { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: color-mix(in srgb, var(--st-ready) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--st-ready) 35%, var(--border)); border-radius: 8px; padding: 6px 10px; }
.run-ready .approve-controls { flex: 0 1 auto; }
.kind.kind-approve { color: var(--st-ready); }
.decision.kind-approve { border-left-color: var(--st-ready); }
.kind.kind-env { color: var(--st-blocked); }
.decision.kind-env { border-left-color: var(--st-blocked); }
.kind.kind-merge { color: var(--st-preparing); }
pre.env-keys { font-weight: 700; }
.tab-ok { color: var(--ok); }

/* inbox sections */
.inbox-body { display: flex; flex-direction: column; gap: 18px; max-width: 900px; }
.inbox-section-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.inbox-section-head h3 { font-size: 14px; }
.inbox-section-head .count { margin-left: 0; }
.inbox-section.is-approve h3 { color: var(--st-ready); }
.inbox-section.is-env h3 { color: var(--st-blocked); }

/* deploy steps, smoke, log */
.deploy-steps { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.deploy-steps .step { display: grid; grid-template-columns: 20px max-content minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 3px 6px; border-radius: 6px; font-size: 13px; }
.step-mark { text-align: center; font-weight: 700; }
.step-label { font-weight: 600; }
.step.s-ok .step-mark { color: var(--ok); }
.step.s-active { background: color-mix(in srgb, var(--st-deploying) 10%, transparent); }
.step.s-active .step-mark { color: var(--st-deploying); animation: pulse 1.4s ease-in-out infinite; }
.step.s-hold { background: var(--warn-soft); }
.step.s-hold .step-mark { color: var(--warn); }
.step.s-fail { background: var(--err-soft); }
.step.s-fail .step-mark, .step.s-fail .step-label { color: var(--err); }
.step.s-todo, .step.s-skipped { color: var(--muted); }
.step.s-todo .step-label, .step.s-skipped .step-label { font-weight: 400; }
.step.s-skipped .step-label { text-decoration: line-through; }
.smoke-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.smoke-list li.ok .mark { color: var(--ok); }
.smoke-list li.bad { color: var(--err); }
pre.deploy-log { max-height: 420px; white-space: pre; overflow: auto; }
.deploy-actions.compact { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.deploy-actions.compact .btn { padding: 2px 8px; font-size: 12px; }
.dep-state { --c: var(--muted); display: inline-block; font-size: 11.5px; font-weight: 700; padding: 0 8px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; }
.dst-merging, .dst-sweeping, .dst-squashed, .dst-deploying, .dst-smoke, .dst-queued { --c: var(--st-deploying); }
.dst-env_hold, .dst-window_hold { --c: var(--warn); }
.dst-done { --c: var(--ok); }
.dst-failed { --c: var(--err); }
.dep-error { color: var(--err); margin-top: 2px; }
.deploys-page { max-width: 1200px; }
.nav .count.dep.dst-failed { background: var(--err); }

/* header chips, settings */
.chip.jira-missing { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-soft); cursor: pointer; font: inherit; font-size: 12px; }
.chip.deploy-off { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, var(--border)); background: var(--err-soft); font-weight: 600; }
@media (max-width: 640px) { .chip.jira-missing, .chip.deploy-off { display: none; } }
.num-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jira-audit { display: flex; flex-direction: column; gap: 4px; }
.status-list { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px 10px; }
.status-list li.ok { color: var(--muted); }
.status-list li.missing { color: var(--warn); font-weight: 600; }
.popover { max-height: calc(100dvh - var(--top-h) - 16px); overflow-y: auto; }
.files-table tr.gate-log .f-kind { color: var(--st-deploying); }
.cand-pick .app-badge { flex: none; }
