/* The QA Bot console (docs/HANDOFF-ui-redesign.md, docs/ui-redesign/Console.dc.html).
   One set of tokens, light and dark. Text colours meet 4.5:1 on their
   backgrounds in both; a state is never told by colour alone (each has a
   word, and a dot or mark beside it). */
:root {
  color-scheme: light dark;
  --bg: #f4f6f9; --pane: #ffffff; --card: #eef2f7; --border: #d5dce6; --line: #c3ccd8;
  --text: #17202c; --soft: #3d4857; --muted: #56606f;
  --accent: #1d5fbf; --accent-text: #ffffff; --accent-soft: #e3edfb;
  --ok: #1a7346; --ok-soft: #e2f3ea; --warn: #8a5300; --warn-soft: #fbf0dc; --bad: #b42318; --bad-soft: #fbe6e4; --info: #1d5fbf; --info-soft: #e3edfb;
  --focus: #1d5fbf;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --pane: #131922; --card: #1a2230; --border: #263041; --line: #5a6b85;
    --text: #e6ebf2; --soft: #b6c0cd; --muted: #93a0b1;
    --accent: #5b9dff; --accent-text: #0b1220; --accent-soft: #14274a;
    --ok: #3fcf8e; --ok-soft: #0f2e22; --warn: #f2b544; --warn-soft: #33270d; --bad: #ff7b7b; --bad-soft: #3a1a1e; --info: #78aeff; --info-soft: #14274a;
    --focus: #8fbcff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
  min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--pane); color: var(--text);
}
textarea { padding: 8px 10px; min-height: 64px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 50; background: var(--pane); padding: 8px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 12px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.btn { min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.link { border: 0; padding: 0 6px; color: var(--accent); font-weight: 600; min-height: 32px; }
.btn.block { width: 100%; margin-bottom: 8px; }
.err { color: var(--bad); }
.ok-t { color: var(--ok); } .warn-t { color: var(--warn); } .bad-t { color: var(--bad); } .info-t { color: var(--info); }

/* ribbon and banners */
.ribbon { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn); padding: 6px 16px; font-weight: 600; font-size: 13px; }
#banners .banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; background: var(--bad-soft); color: var(--text); border-bottom: 1px solid var(--bad); }
#banners .banner strong { color: var(--bad); }

/* three panes, each scrolling by itself */
.shell { display: flex; height: calc(100vh - var(--top, 0px)); min-height: 560px; overflow: hidden; }
.pane { overflow-y: auto; }
.bot { flex: 0 0 290px; background: var(--pane); border-right: 1px solid var(--border); padding: 18px; }
.work { flex: 1 1 0; min-width: 0; padding: 18px 22px 48px; }
.inspect { flex: 0 0 410px; background: var(--pane); border-left: 1px solid var(--border); padding: 18px; }
@media (max-width: 1100px) {
  .shell { display: block; height: auto; overflow: visible; }
  .pane { overflow: visible; }
  .bot, .inspect { border: 0; border-bottom: 1px solid var(--border); }
}

/* left: the bot */
.brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.brand b { font-size: 18px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 18px; }
.state { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; flex: 0 0 auto; }
.dot.fill { background: currentColor; }
.bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin: 10px 0 4px; }
.bar > span { display: block; height: 6px; background: var(--accent); }
.list-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); min-height: 40px; }
.health-row { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.health-row .dot { margin-top: 5px; }
.health-row .name { flex: 1; min-width: 0; }
.health-row .what { display: block; font-size: 12px; color: var(--muted); }
.big { font-size: 22px; font-weight: 700; }

/* centre */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs a, .tabs button { padding: 8px 12px; border: 0; background: transparent; color: var(--soft); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs [aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .spacer { flex: 1; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 12px; }
.head h1 { margin: 0 8px 6px 0; font-size: 22px; }
.head label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.autopilot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; margin-bottom: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--pane); }
.autopilot.on { border-color: var(--ok); background: var(--ok-soft); }
.autopilot .what { flex: 1 1 320px; }
.autopilot .title { font-size: 16px; font-weight: 700; }
.conflict { flex-basis: 100%; font-size: 13px; color: var(--warn); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.tile { flex: 1 1 120px; min-width: 120px; min-height: 84px; text-align: left; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--pane); color: var(--text); }
.tile[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.tile .lab { display: block; font-size: 12px; font-weight: 700; color: var(--soft); }
.tile .num { display: block; font-size: 26px; font-weight: 700; line-height: 1.2; }
.tile .hint { display: block; font-size: 12px; color: var(--muted); }
.tile.needs .num { color: var(--warn); }
.readline { font-size: 12px; color: var(--muted); margin: 4px 0 2px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 16px 0 6px; }
.group h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.pill { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--card); color: var(--soft); font-size: 12px; font-weight: 700; }
.ticket { display: grid; grid-template-columns: 18px minmax(0, 1.25fr) minmax(0, 1fr) 124px; align-items: center; gap: 2px 10px; padding: 3px 8px; margin-bottom: 3px; border-radius: 10px; border: 1px solid transparent; }
.ticket:hover { background: var(--pane); }
.ticket.sel { border-color: var(--accent); background: var(--pane); }
.ticket .pick { width: 18px; height: 18px; margin: 0; }
.ticket .open { min-width: 0; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; text-align: left; }
.ticket .id { flex: 0 0 82px; font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 600; }
.ticket .t { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .note { min-width: 0; font-size: 13px; display: flex; gap: 6px; align-items: flex-start; overflow-wrap: anywhere; }
.ticket .note .mark { flex: 0 0 auto; font-weight: 700; }
.ticket .act { display: flex; justify-content: flex-end; }
.ticket .act .btn { width: 124px; padding: 0 8px; }
@media (max-width: 760px) {
  .ticket { grid-template-columns: 18px minmax(0, 1fr); }
  .ticket .note, .ticket .act { grid-column: 2; justify-content: flex-start; }
}
.empty { margin-top: 16px; padding: 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.batchbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent); margin: 8px 0; }
table.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.runs th, table.runs td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.runs th { color: var(--muted); font-size: 12px; }

/* right: the ticket */
.sel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.status-pill { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid currentColor; }
.inspect h2 { margin: 0 0 10px; font-size: 17px; line-height: 1.3; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; margin: 0 6px 6px 0; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; }
.story { font-weight: 700; }
.steps { margin-top: 10px; }
.step { display: flex; align-items: center; gap: 10px; padding: 2px 0; font-size: 13px; }
.step .m { font-size: 12px; font-weight: 700; margin-left: auto; }
.step.done { color: var(--ok); } .step.now { color: var(--info); font-weight: 700; } .step.todo { color: var(--muted); }
.event { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.event .when { flex: 0 0 78px; color: var(--muted); font-size: 12px; }
.evidence a, .evidence button { margin-right: 8px; }
.doc { font-size: 13px; }
.doc img { max-width: 100%; }
.fixture-box { border: 1px dashed var(--warn); border-radius: 10px; padding: 10px; margin: 10px 0; }

/* knowledge */
.kbody { white-space: pre-wrap; margin: 8px 0; }
.kgrid { display: grid; gap: 10px; }
.kgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.stale { color: var(--warn); }
tr.krow { cursor: pointer; }
tr.krow.sel td { background: var(--accent-soft); }

/* dialogs */
dialog { width: min(660px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 14px; background: var(--pane); color: var(--text); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h2 { margin: 0 0 6px; font-size: 19px; }
.section { padding: 10px 12px; border-radius: 10px; background: var(--card); margin: 10px 0; }
.section label.opt { display: flex; align-items: flex-start; gap: 10px; min-height: 36px; padding: 4px 0; }
.section label.opt input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid2 label, .field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
