:root {
  --bg: #1d1b26;
  --panel: #262433;
  --panel-2: #2f2c3f;
  --text: #ece8f5;
  --muted: #a39db8;
  --accent: #d97757;
  --busy: #4cd964;
  --waiting: #f5b83d;
  --idle: #6fb7ff;
  --offline: #7a7590;
  --border: #3a3650;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; }
header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel); }
h1 { font: 18px Silkscreen, monospace; margin: 0; color: var(--accent); letter-spacing: 1px; }
#stats { display: flex; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
#stats .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.spacer { flex: 1; }
button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: var(--accent); }
.zoom button { width: 32px; font-weight: 600; }

main { display: flex; height: calc(100% - 53px); }
#viewport { flex: 1; min-width: 0; overflow: auto; position: relative; }
#office { display: block; margin: 0 auto; image-rendering: pixelated; cursor: default; }

#panel { flex: none; width: 440px; max-width: 100%; border-left: 1px solid var(--border); background: var(--panel); overflow-y: auto; overflow-x: hidden; padding: 18px 18px 28px; display: flex; flex-direction: column; gap: 14px; }
#panel[hidden] { display: none; }
.panel-head { display: flex; gap: 14px; align-items: flex-start; }
#avatar { image-rendering: pixelated; background: var(--panel-2); border-radius: 8px; flex: none; }
.who { flex: 1; min-width: 0; }
.name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h2 { margin: 0; font: 20px Silkscreen, monospace; }
.title { font-weight: 600; margin-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.icon { background: none; border: none; font-size: 16px; color: var(--muted); }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .5px; color: #111; font-weight: 600; }
.chip.busy { background: var(--busy); } .chip.waiting { background: var(--waiting); } .chip.idle { background: var(--idle); } .chip.offline { background: var(--offline); color: #eee; }
.copy { display: flex; gap: 8px; align-items: center; text-align: left; width: 100%; padding: 8px 10px; }
.copy code { font: 12px ui-monospace, Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 6px 10px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab h3 { font: 12px Silkscreen, monospace; color: var(--muted); margin: 16px 0 6px; letter-spacing: .5px; }
.tab h3:first-child { margin-top: 4px; }
.item { background: var(--panel-2); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; white-space: pre-wrap; word-break: break-word; font-size: 13px; max-height: 160px; overflow: auto; }
.item time { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kv div { background: var(--panel-2); border-radius: 6px; padding: 6px 8px; }
.kv b { display: block; font-size: 16px; }
.kv span { font-size: 11px; color: var(--muted); }
.files { font: 12px ui-monospace, Menlo, monospace; margin: 0; padding-left: 16px; color: var(--muted); }
.files li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a { color: var(--idle); }

.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { font-size: 12px; }
#chat { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.msg { padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.msg.me { background: #3b3553; align-self: flex-end; max-width: 85%; }
.msg.them { background: var(--panel-2); border-left: 3px solid var(--accent); }
.msg.them.thinking { color: var(--muted); font-style: italic; }
#askForm, .row { display: flex; gap: 6px; }
input, textarea, select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; width: 100%; }
#askForm input { flex: 1; }
#personaForm { display: flex; flex-direction: column; gap: 10px; }
#personaForm label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
#personaForm label.inline { flex-direction: row; align-items: center; }
#personaForm label.inline input { width: auto; }
fieldset { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
legend { color: var(--muted); font-size: 12px; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.swatches::before { content: attr(data-field); width: 40px; font-size: 11px; color: var(--muted); }
.swatches button { width: 20px; height: 20px; padding: 0; border-radius: 4px; border: 2px solid transparent; }
.swatches button.sel { border-color: #fff; }
.ghost { background: none; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111; border: 1px solid var(--accent); padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 10; max-width: 90vw; }
#toast code { font: 12px ui-monospace, Menlo, monospace; color: var(--accent); }

@media (max-width: 800px) {
  main { flex-direction: column; }
  #panel { width: 100%; border-left: none; border-top: 1px solid var(--border); max-height: 55%; }
}

.primary { background: var(--accent); border-color: var(--accent); color: #1d1b26; font-weight: 600; }
.primary:hover { filter: brightness(1.08); }
.danger:hover { border-color: #e5534b; color: #ff8a84; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { font-size: 12px; }
.actions button[hidden] { display: none; }
.modal { position: fixed; inset: 0; background: rgba(10, 9, 15, 0.65); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: min(520px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.card h2 { color: var(--accent); }
.card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card.help { width: min(860px, 100%); }
.help .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.help h3 { font: 12px Silkscreen, monospace; color: var(--muted); margin: 8px 0 6px; }
.help p { margin: 0 0 8px; }
.help ul { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
kbd { font: 11px ui-monospace, Menlo, monospace; background: var(--panel-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; }
code { font: 12px ui-monospace, Menlo, monospace; }
.chip.your-turn { background: #c792ff; }
@media (max-width: 800px) { .help .cols, .row2 { grid-template-columns: 1fr; } }

.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { width: auto; accent-color: var(--accent); }
.level-card { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border-radius: 8px; padding: 10px; }
.level-card .lv { font: 18px Silkscreen, monospace; background: #ffe066; color: #1d1b26; border-radius: 8px; padding: 8px 10px; white-space: nowrap; }
.lv-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.lv-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 99px; overflow: hidden; }
.bar.big { height: 10px; margin-bottom: 4px; }
.bar div { height: 100%; border-radius: 99px; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.badge { background: var(--panel-2); border-radius: 6px; padding: 6px; font-size: 11px; text-align: center; opacity: 0.35; filter: grayscale(1); }
.badge span { display: block; font-size: 18px; }
.badge.got { opacity: 1; filter: none; border: 1px solid #ffe06655; }
.quirks { display: flex; flex-direction: column; gap: 6px; }
.card.board { width: min(760px, 100%); }
.board table { width: 100%; border-collapse: collapse; font-size: 13px; }
.board th { text-align: left; color: var(--muted); font-weight: 400; font-size: 11px; padding: 4px 6px; }
.board td { padding: 4px 6px; border-top: 1px solid var(--border); }
.board tr { cursor: pointer; }
.board tr:hover td { background: var(--panel-2); }
.board canvas { image-rendering: pixelated; display: block; }

.card.board { width: min(1100px, 100%); max-height: 88vh; }
.board-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.board-head .tabs { flex: 1; border-bottom: none; }
.board .kv { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.board .kv b { font-size: 20px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.hbar { display: grid; grid-template-columns: 120px 1fr 70px; gap: 8px; align-items: center; font-size: 12px; margin-bottom: 6px; }
.hbar .bar { height: 10px; }
.feed { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.feed div { background: var(--panel-2); border-radius: 6px; padding: 6px 8px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.feed div:hover { outline: 1px solid var(--accent); }
.feed .what { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board table th[data-sort] { cursor: pointer; }
.board table th[data-sort]:hover { color: var(--text); }
.board td .bar { width: 70px; }
.mot { white-space: nowrap; }
.settings { display: flex; flex-direction: column; gap: 14px; }
.settings select { width: auto; }
.settings label { font-size: 13px; color: var(--text); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.matrix h1, body.matrix #stats { color: #00ff66; text-shadow: 0 0 6px #00ff6699; font-family: monospace; }
@media (max-width: 800px) { .two { grid-template-columns: 1fr; } .board table { font-size: 11px; } }

.workstyle { background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: 6px; padding: 6px 8px; }
.workstyle:empty { display: none; }
.card label.inline { flex-direction: row; align-items: center; gap: 8px; }
.card label.inline input { width: auto; }

.mode { gap: 6px; }
.mode label { color: var(--text) !important; font-size: 13px !important; }
.report { background: #1f2a22; border: 1px solid #4cd96455; border-radius: 8px; padding: 10px; white-space: pre-wrap; word-break: break-word; font-size: 13px; max-height: 320px; overflow: auto; }
.report.failed { background: #2a1f1f; border-color: #ff6b6b55; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.role-chip { font-size: 11px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; margin-left: 6px; }

.ask-mode { display: flex; flex-direction: column; gap: 4px; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.ask-mode label { display: flex; gap: 6px; align-items: baseline; font-size: 13px; cursor: pointer; }
.ask-mode input { width: auto; }

.pack { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.pack p { margin: 0; }

.doing { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 2px; }

/* ---- agent panel layout ---- */
#panel h2 { font-size: 22px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.pill { font-size: 11px; line-height: 1; padding: 5px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.pill.lv { background: #ffe06622; border-color: #ffe06666; color: #ffe9a0; }
.badge-row .chip { line-height: 1; padding: 5px 8px; }
.meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-box { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: 64px 1fr; gap: 6px 10px; align-items: baseline; }
.status-box .label { font: 10px Silkscreen, monospace; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.status-box .doing { margin: 0; font-size: 14px; }
.status-box .title { margin: 0; font-weight: 600; }
.status-box .doing, .status-box .title { word-break: break-word; }
.panel-actions { display: flex; flex-direction: column; gap: 8px; }
.panel-actions .copy { min-width: 0; }
.panel-actions .copy code { min-width: 0; flex: 1; }
.actions:empty, .actions:not(:has(button:not([hidden]))) { display: none; }
.tab { display: flex; flex-direction: column; gap: 4px; }
.tab[hidden] { display: none; }
.tab h3 { margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.tab > h3:first-child, .tab > .report-head:first-child h3 { margin-top: 4px; padding-top: 0; border-top: none; }
.tab .kv { margin: 6px 0; }
.kv div { padding: 8px 10px; }
.kv b { font-size: 15px; }
.level-card { margin: 10px 0 4px; }
.report-head { display: flex; align-items: center; justify-content: space-between; }
.report-head h3 { border-top: none; padding-top: 0; margin: 4px 0 8px; }
.report { margin-bottom: 4px; line-height: 1.5; }
.item { line-height: 1.5; padding: 10px 12px; margin-bottom: 8px; }
.item time { margin-bottom: 4px; }
.badges { gap: 8px; }
.badge { padding: 8px 6px; line-height: 1.3; }
.files li { padding: 2px 0; }
button.small, .report-head button { font-size: 11px; padding: 3px 10px; }

.md code { font: 12px ui-monospace, Menlo, monospace; background: rgba(255,255,255,0.08); border-radius: 4px; padding: 1px 5px; }
.md pre { font: 12px ui-monospace, Menlo, monospace; background: rgba(0,0,0,0.3); border-radius: 6px; padding: 8px 10px; margin: 6px 0; white-space: pre-wrap; }
.md b { color: #fff; }
.md .md-h { display: inline-block; margin-top: 4px; font-size: 14px; }

.floating-card { position: fixed; left: 16px; bottom: 16px; width: min(460px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 12px; padding: 14px 16px; box-shadow: 0 12px 40px rgba(0,0,0,0.45); z-index: 15; display: flex; flex-direction: column; gap: 10px; }
.floating-card[hidden] { display: none; }
.fc-head { display: flex; align-items: center; gap: 10px; }
.fc-head b { font: 14px Silkscreen, monospace; color: var(--accent); }
.fc-head .icon { margin-left: auto; }
#standupText { white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
#standupText.thinking { color: var(--muted); font-style: italic; }

[draggable=true] { cursor: grab; }
.handoff-btn { font-size: 11px; padding: 3px 10px; }
.drag-hint { font-size: 11px; color: var(--muted); }
#office.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }

.timeline { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; width: min(900px, calc(100vw - 32px)); display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.45); z-index: 14; flex-wrap: wrap; }
.timeline[hidden] { display: none; }
.tl-badge { font: 11px Silkscreen, monospace; color: #1d1b26; background: #c792ff; border-radius: 6px; padding: 3px 8px; }
.tl-track { position: relative; flex: 1; min-width: 200px; height: 28px; }
.tl-track canvas { position: absolute; inset: 0; width: 100%; height: 28px; border-radius: 6px; background: var(--panel-2); }
.tl-track input { position: absolute; inset: 0; width: 100%; height: 28px; margin: 0; background: transparent; padding: 0; border: none; accent-color: var(--accent); }
.tl-time { font: 12px ui-monospace, Menlo, monospace; min-width: 150px; }
.timeline select { width: auto; }
body.replaying #office { filter: sepia(0.25) saturate(0.9); }

.overview-cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important; gap: 10px !important; }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px !important; }
.stat-card .desc { margin: 6px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.stat-card .desc code { font-size: 11px; }
.section-desc { margin: -2px 0 10px; font-size: 12px; color: var(--muted); }
.board h3 { margin-bottom: 4px; }

#tip { position: fixed; z-index: 50; max-width: 320px; background: #111018; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.4; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
#tip[hidden] { display: none; }
[data-tip] { cursor: help; }
button[data-tip], .feed [data-tip], th[data-sort][data-tip], label[data-tip] { cursor: pointer; }

/* settings rows: label, then control, on one line (overrides the stacked dialog labels) */
.settings label, .settings .toggle { flex-direction: row !important; align-items: center !important; justify-content: flex-start; gap: 8px; text-align: left; color: var(--text); font-size: 13px; flex-wrap: wrap; }
.settings label input[type=checkbox] { width: auto; margin: 0; }
.settings select { width: auto; }
.settings .pack .row { align-items: center; flex-wrap: wrap; }
.settings details { margin-top: 2px; }
.settings details code { display: block; white-space: pre-wrap; word-break: break-all; margin-top: 6px; }

/* ---- TODO board ---- */
.card.kanban { width: min(1180px, 100%); max-height: 90vh; }
.todo-add { display: flex; gap: 8px; }
.todo-add input { flex: 1; }
.todo-add select { width: 200px; }
.columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; min-height: 300px; }
.col { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col h3 { margin: 0 0 2px; font: 12px Silkscreen, monospace; color: var(--muted); display: flex; justify-content: space-between; }
.col[data-col=todo] h3 { color: #f5d76e; } .col[data-col=doing] h3 { color: #7fd1ff; } .col[data-col=done] h3 { color: #4cd964; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; flex: 1; }
.todo { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; cursor: grab; }
.todo.dragging { opacity: 0.4; }
.todo .t { font-weight: 600; font-size: 13px; line-height: 1.35; word-break: break-word; }
.todo.done .t { text-decoration: line-through; color: var(--muted); }
.todo .notes { font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 90px; overflow: auto; }
.todo .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); }
.todo .who { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text); }
.todo .who canvas { image-rendering: pixelated; }
.todo .acts { display: flex; flex-wrap: wrap; gap: 4px; }
.todo .acts button { font-size: 11px; padding: 2px 7px; }
.todo input, .todo textarea { font-size: 12px; }
@media (max-width: 800px) { .columns { grid-template-columns: 1fr; } .todo-add { flex-wrap: wrap; } }

.stat-card .info { font-size: 11px; opacity: 0.55; }
.stat-card:hover .info { opacity: 1; color: var(--accent); }
.board-head .icon { margin-left: auto; }

/* ---- Product Manager ---- */
.pm-only { display: none !important; }
body.pm-selected .pm-only { display: flex !important; }
body.pm-selected .not-pm, body.pm-selected .ask-mode, body.pm-selected .panel-actions { display: none !important; }
.pm-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.plan { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.plan p { margin: 0; font-size: 13px; }
.plan-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 8px; font-size: 13px; }
.plan-item button { flex: none; }

.rel { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.chat-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.chat-tools span { margin-right: auto; }
.chat-tools button { font-size: 11px; padding: 3px 9px; }
#chatArchived { margin: 4px 0 10px; font-size: 12px; }
#chatArchived summary { cursor: pointer; color: var(--muted); }
.archived { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
.archived-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.archived-head button { font-size: 11px; padding: 2px 8px; }
.archived .msg { margin-top: 6px; font-size: 12px; }
button.danger.primary { background: #c0392b; border-color: #c0392b; color: #fff; }

/* ---- onboarding ---- */
#tour { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#tour[hidden] { display: none; }
#tourSpot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10, 9, 15, 0.66); outline: 2px solid var(--accent); outline-offset: 2px; transition: all .25s ease; pointer-events: none; }
#tourCard { position: fixed; width: min(380px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px; box-shadow: 0 16px 50px rgba(0,0,0,.5); pointer-events: auto; transition: left .25s ease, top .25s ease; }
#tourCard h3 { margin: 4px 0 6px; font: 15px Silkscreen, monospace; color: var(--accent); }
#tourCard p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; }
.tour-head { display: flex; justify-content: space-between; align-items: center; }
.tour-head .icon { font-size: 12px; }
#tourCard .row { justify-content: flex-end; }
.setup-card { left: auto; right: 16px; width: min(420px, calc(100vw - 32px)); }
#setupList { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
#setupList li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
#setupList li .txt { flex: 1; }
#setupList li.ok .txt { color: var(--muted); }
#setupList li button { flex: none; font-size: 11px; padding: 3px 10px; }
.empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(29, 27, 38, 0.82); }
.empty-state[hidden] { display: none; }
.empty-emoji { font-size: 48px; }
.empty-state h2 { font: 22px Silkscreen, monospace; color: var(--accent); margin: 8px 0; }
.empty-state p { max-width: 520px; color: var(--muted); }
.empty-state .row { justify-content: center; flex-wrap: wrap; align-items: center; }
.btn-link { color: var(--text); text-decoration: none; border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; }

/* ---- PRs & MRs ---- */
.count-badge { background: var(--accent); color: #1d1b26; border-radius: 99px; padding: 0 6px; font-size: 11px; font-weight: 700; margin-left: 2px; }
.count-badge[hidden] { display: none; }
.card.prs { width: min(1100px, 100%); max-height: 90vh; }
.tabs button span { color: var(--muted); font-size: 11px; }
.pr-list { display: flex; flex-direction: column; gap: 6px; overflow: auto; min-height: 200px; }
.pr { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; }
.pr input[type=checkbox] { width: auto; }
.pr .t { font-weight: 600; font-size: 13px; }
.pr .t a { color: var(--text); text-decoration: none; }
.pr .t a:hover { color: var(--accent); }
.pr .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); margin-top: 3px; }
.pr .chip-warn { color: #ffb3a7; } .pr .chip-ok { color: #9be7a5; }
.pr .rev { grid-column: 2 / 4; background: var(--panel); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; white-space: pre-wrap; }
.pr .side { display: flex; gap: 6px; align-items: center; }
.pr .side button { font-size: 11px; padding: 3px 9px; }
.allhands { border-top: 1px solid var(--border); padding-top: 10px; }
.ah-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ah-row label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text) !important; flex-direction: row !important; }
.ah-row select { width: auto; }
.ah-row #ahStart { margin-left: auto; }

/* header: labels collapse to icons when space runs out (tooltips explain them) */
header { flex-wrap: nowrap; }
header button, header .toggle { white-space: nowrap; flex: none; }
header #stats { flex-wrap: nowrap; overflow: hidden; min-width: 0; }
@media (max-width: 1500px) { header .lbl { display: none; } header #stats span { font-size: 12px; } }
@media (max-width: 1100px) { header #stats { display: none; } }

.card.review-done { width: min(760px, 100%); max-height: 90vh; }
#rvHead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.verdict { font-weight: 700; padding: 4px 10px; border-radius: 99px; font-size: 12px; }
.verdict.good { background: #4cd96433; color: #9be7a5; } .verdict.warn { background: #f5b83d33; color: #ffd98a; } .verdict.bad { background: #ff6b6b33; color: #ffb3a7; }
.rv-summary { background: var(--panel-2); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; }
.rv-author { background: var(--panel-2); border-left: 3px solid #c792ff; border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; font-size: 13px; margin-top: 6px; }
#rvAuthorBox summary { cursor: pointer; font-weight: 600; }
.rv-people { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.rv-people .pill { cursor: pointer; color: var(--text); }

/* ---- brainstorm ---- */
.card.brain { width: min(760px, 100%); max-height: 90vh; }
.brain-parts-head { display: flex; align-items: center; gap: 8px; }
.brain-parts-head .spacer { flex: 1; }
.brain-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; }
.brain-parts label { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text) !important; font-size: 12px !important; cursor: pointer; }
.brain-parts label input { width: auto; }
.brain-parts label canvas { image-rendering: pixelated; flex: none; }
.brain-parts label .who { display: flex; flex-direction: column; min-width: 0; }
.brain-parts label .who span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-opts { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.brain-feed { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; max-height: 40vh; overflow: auto; }
.brain-feed div { background: var(--panel-2); border-radius: 6px; padding: 6px 8px; }
.br-topic { font-weight: 600; font-size: 15px; }
#brIdeas .idea { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 12.5px; white-space: pre-wrap; }
#brainHistoryList div { cursor: pointer; padding: 4px 0; font-size: 12.5px; }
#brainHistoryList div:hover { color: var(--accent); }
#brainLive { left: auto; right: 16px; }
