/* QA hub — a work tool, not a dashboard: neutral surfaces, hairlines, dense rows, one accent (config hub.theme.accent). */
:root {
  --bg: #f6f6f4; --panel: #ffffff; --sunken: #efefec; --line: #e3e3df; --line-2: #cfcfca;
  --text: #1b1b1f; --text-2: #5c5c63; --text-3: #8c8c93;
  --accent: #2f5bd3; --ink: #1b1b1f; --on-ink: #ffffff;
  --pass: #1a7f37; --fail: #c62a2a; --blocked: #9a6700; --info: #2f5bd3; --todo: #b5b5b9;
  --pass-bg: #e8f3eb; --fail-bg: #fbeaea; --blocked-bg: #f8f0dc; --info-bg: #e9eefb;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'D2Coding', monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113; --panel: #18181b; --sunken: #1f1f23; --line: #2a2a2f; --line-2: #3a3a40;
    --text: #ececef; --text-2: #a3a3ab; --text-3: #75757d;
    --accent: #7c9cff; --ink: #ececef; --on-ink: #111113;
    --pass: #4ac26b; --fail: #f06b6b; --blocked: #d4a72c; --info: #7c9cff; --todo: #55555c;
    --pass-bg: #16281c; --fail-bg: #2e1718; --blocked-bg: #2b2412; --info-bg: #1b2440;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 system-ui, -apple-system, 'Segoe UI', 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.mono, .key { font-family: var(--mono); font-size: 12.5px; }
.key { color: var(--text-2); white-space: nowrap; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.error { color: var(--fail); font-size: 13px; margin: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }

button { font: inherit; font-size: 13px; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 5px 11px; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--sunken); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
button.primary:hover { opacity: .88; }
button.plain { border-color: transparent; background: transparent; color: var(--text-2); padding: 4px 6px; }
button.plain:hover { color: var(--text); background: var(--sunken); }
button.st-pass:hover, button.st-pass.on { border-color: var(--pass); color: var(--pass); background: var(--pass-bg); }
button.st-fail:hover, button.st-fail.on { border-color: var(--fail); color: var(--fail); background: var(--fail-bg); }
button.st-blocked:hover, button.st-blocked.on { border-color: var(--blocked); color: var(--blocked); background: var(--blocked-bg); }
input, textarea, select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r); padding: 6px 9px; width: 100%; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; }

/* status dots */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--todo); }
.dot.pass, .dot.verified { background: var(--pass); } .dot.fail, .dot.open, .dot.reopened { background: var(--fail); }
.dot.blocked { background: var(--blocked); } .dot.fix-ready { background: var(--info); } .dot.closed { background: var(--todo); }
.dot.spec { background: var(--blocked); } .dot.on { background: var(--pass); } .dot.off { background: var(--todo); }
.st-text.pass { color: var(--pass); } .st-text.fail { color: var(--fail); } .st-text.blocked { color: var(--blocked); }

/* gate */
.gate { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.gate-card { width: min(360px, 100%); }
.gate-card h1 { font-size: 18px; margin: 0 0 4px; }
.gate-card form { display: grid; gap: 12px; margin-top: 20px; }
.gate-card label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }

/* top bar */
.top { height: 48px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.meter .bar { width: 90px; height: 4px; background: var(--sunken); border-radius: 2px; overflow: hidden; display: flex; }
.meter .bar i { display: block; height: 100%; }
.summary { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.click { cursor: pointer; } .row.click:hover { background: var(--sunken); }
.row.sel { background: var(--sunken); box-shadow: inset 2px 0 0 var(--accent); }
.row.done .grow { color: var(--text-3); }
.row .meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.section-head { display: flex; align-items: baseline; gap: 8px; padding: 14px 14px 6px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: none; letter-spacing: .01em; }
.section-head .count { font-family: var(--mono); font-weight: 400; color: var(--text-3); }
.empty { padding: 10px 14px; color: var(--text-3); font-size: 13px; }

/* tester shell */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr) 380px; height: calc(100vh - 48px); height: calc(100dvh - 48px); }
.rail { border-right: 1px solid var(--line); overflow-y: auto; background: var(--panel); }
.work { overflow-y: auto; min-width: 0; display: flex; flex-direction: column; }
.work > * { flex: none; }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--text-2); padding: 6px 10px 8px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.tabs button .count { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: 3px; }
.pane { padding: 18px 22px 28px; max-width: 760px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 8px 14px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--info-bg); }
.alert .grow { flex: 1; min-width: 0; }
.target { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.case-picker { display: none; margin-bottom: 14px; }

/* the current case */
.case-head { display: flex; align-items: baseline; gap: 10px; }
.case-head h2 { font-size: 18px; margin: 0; flex: 1; }
.case-sub { margin: 2px 0 16px; font-size: 12px; color: var(--text-3); }
.block-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.steps li::before { counter-increment: s; content: counter(s); font-family: var(--mono); font-size: 12px; color: var(--text-3); width: 16px; text-align: right; padding-top: 1px; }
.steps li .box { width: 15px; height: 15px; border: 1.5px solid var(--line-2); border-radius: 3px; flex: none; margin-top: 3px; display: grid; place-items: center; font-size: 11px; color: var(--on-ink); }
.steps li.done .box { background: var(--ink); border-color: var(--ink); }
.steps li.done .txt { color: var(--text-3); text-decoration: line-through; }
.expect { margin: 0; padding-left: 18px; }
.verdict { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.verdict .note { flex: 1 1 180px; }
.nav-cases { display: flex; justify-content: space-between; margin-top: 16px; }

/* prose (guide, spec, ticket bodies) */
.prose { font-size: 14px; } .prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 16px; margin: 20px 0 6px; } .prose h3 { font-size: 14px; margin: 16px 0 4px; } .prose h4, .prose h5 { font-size: 13px; margin: 12px 0 4px; color: var(--text-2); }
.prose p { margin: 6px 0; } .prose ul, .prose ol { margin: 4px 0; padding-left: 20px; }
.prose code, .msg code { font-family: var(--mono); background: var(--sunken); padding: 0 4px; border-radius: 3px; font-size: 12.5px; }
.prose pre { background: var(--sunken); padding: 10px; border-radius: var(--r); overflow-x: auto; }
.prose img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); display: block; margin: 6px 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: 12.5px; }
th, td { border-bottom: 1px solid var(--line); padding: 5px 10px; text-align: left; white-space: nowrap; }
th { font-weight: 600; color: var(--text-2); }
table.matrix td { text-align: center; padding: 5px 6px; min-width: 44px; }
table.matrix th.case { font-family: var(--mono); font-weight: 400; text-align: center; }
.cell.pass { background: var(--pass-bg); color: var(--pass); } .cell.fail { background: var(--fail-bg); color: var(--fail); } .cell.blocked { background: var(--blocked-bg); color: var(--blocked); }

/* chat */
.chat { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; position: relative; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 41px; border-bottom: 1px solid var(--line); font-size: 13px; }
.chat-head b { font-weight: 600; }
.agent-status { font-size: 12px; color: var(--text-2); min-height: 0; padding: 0 14px; }
.agent-status:not(:empty) { padding: 6px 14px; border-bottom: 1px solid var(--line); }
.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.msg { max-width: 92%; font-size: 13.5px; word-break: break-word; }
.msg p { margin: 2px 0; } .msg ul, .msg ol { margin: 2px 0; padding-left: 18px; }
.msg.tester { align-self: flex-end; background: var(--sunken); padding: 7px 11px; border-radius: 10px 10px 2px 10px; }
.msg.agent { align-self: flex-start; padding: 2px 0 2px 10px; border-left: 2px solid var(--line-2); }
.msg.system { align-self: center; color: var(--text-3); font-size: 12px; }
.ctx { display: inline-flex; gap: 4px; align-items: center; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; margin-right: 4px; }
.shots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; } .shots img { max-width: 150px; max-height: 100px; border-radius: 4px; border: 1px solid var(--line); display: block; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 8px; }
.composer .ctx-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.composer .ctx-line .ctx { margin: 0; }
.composer .ctx-line button { padding: 0 4px; }
.composer textarea { resize: none; min-height: 64px; }
.composer .actions { display: flex; align-items: center; gap: 8px; }
.composer .actions .hint { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachments { display: flex; gap: 6px; flex-wrap: wrap; } .attachments:empty { display: none; }
.thumb { position: relative; } .thumb img { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; border-radius: 50%; font-size: 12px; line-height: 16px; background: var(--ink); color: var(--on-ink); border: 0; }
.chat.dragging::after { content: attr(data-drop); position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--panel) 85%, transparent); border: 2px dashed var(--text-2); font-weight: 600; pointer-events: none; }

/* developer view */
.admin-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 44%); height: calc(100vh - 48px); height: calc(100dvh - 48px); }
.admin-list { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); }
.detail { overflow-y: auto; padding: 18px 22px 28px; }
.detail h2 { font-size: 17px; margin: 0; }
.detail .meta-line { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin: 6px 0 14px; }
.detail .actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.detail .conv { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); }
.comment { border-top: 1px solid var(--line); padding: 10px 0; }
.comment .who { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.answer-form { display: grid; gap: 8px; margin-top: 14px; }
.answer-form .choices { display: flex; flex-wrap: wrap; gap: 6px; }
.answer-form .choices label { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r); padding: 5px 10px; font-size: 13px; cursor: pointer; }
.answer-form .choices input { width: auto; margin: 0; }
.answer-form .choices label:has(input:checked) { border-color: var(--ink); background: var(--sunken); }
.filters { display: flex; gap: 4px; padding: 0 14px 6px; flex-wrap: wrap; }
.filters button { padding: 2px 9px; font-size: 12px; border-radius: 999px; }
.filters button.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.context-box { background: var(--sunken); border-radius: var(--r); padding: 10px 12px; font-size: 13px; color: var(--text-2); margin-top: 10px; white-space: pre-wrap; }

/* medium: no case rail */
@media (max-width: 1180px) {
  .shell { grid-template-columns: minmax(0, 1fr) 360px; }
  .rail { display: none; }
  .case-picker { display: block; }
}
/* narrow: the hub sits next to the app — current work on top, chat below */
@media (max-width: 760px) {
  .top { gap: 10px; padding: 0 12px; }
  .meter .bar { width: 50px; }
  .shell { display: flex; flex-direction: column; height: calc(100vh - 48px); height: calc(100dvh - 48px); }
  .work { flex: 0 1 auto; max-height: 52vh; border-bottom: 1px solid var(--line); }
  .pane { padding: 14px 14px 18px; }
  .verdict { position: sticky; bottom: 0; background: var(--bg); padding-bottom: 10px; margin-top: 14px; }
  .target .faint { display: none; }
  .chat { flex: 1 1 auto; border-left: 0; min-height: 240px; }
  .admin-shell { display: block; height: auto; }
  .admin-list { border-right: 0; }
  .detail { border-top: 1px solid var(--line); }
}

/* keyboard focus on clickable rows, steps and tabs; the message box that replaces alert() */
.row.click:focus-visible, .steps li:focus-visible, .tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px;
  border-radius: 8px; background: var(--ink); color: var(--on-ink); font-size: 13px; box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
.toast.on { opacity: 1; pointer-events: auto; }
