:root {
  --bg: #f4f3ee;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #555c68;
  --line: #dedcd3;
  --accent: #2742d6;
  --accent-soft: #e6eaff;
  --ok: #0c6b40;
  --ok-soft: #dcf3e6;
  --warn: #8a4b00;
  --warn-soft: #fdf0d8;
  --bad: #a3231a;
  --bad-soft: #fbe3e0;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 4px 14px rgba(20, 20, 30, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1116; --panel: #181b22; --ink: #f1f2f4; --muted: #a9b0bc; --line: #2b303a;
    --accent: #8595ff; --accent-soft: #232a4d; --ok: #5fd39a; --ok-soft: #173427;
    --warn: #f3b35b; --warn-soft: #3a2a12; --bad: #ff8a80; --bad-soft: #3b1c1a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1116; --panel: #181b22; --ink: #f1f2f4; --muted: #a9b0bc; --line: #2b303a;
  --accent: #8595ff; --accent-soft: #232a4d; --ok: #5fd39a; --ok-soft: #173427;
  --warn: #f3b35b; --warn-soft: #3a2a12; --bad: #ff8a80; --bad-soft: #3b1c1a; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh; padding-inline: 16px;
}
button { font: inherit; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; gap: 3px; }
.logo span { width: 4px; border-radius: 2px; background: #fff; height: 10px; }
.logo span:nth-child(2) { height: 20px; }
.status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { padding: 5px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.pill.live { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.replay { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pace { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--panel); }
.pace-btn { border: 0; background: transparent; color: var(--ink); padding: 6px 12px; cursor: pointer; font-size: 14px; }
.pace-btn[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.pace-btn.bump { animation: bump 1.2s ease; }
.pace-note { color: var(--muted); font-size: 14px; min-width: 120px; }
.toggle { color: var(--muted); font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }

.grid { flex: 1; display: grid; grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); gap: 14px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.panel h2 { margin: 0 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mic-state { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.mic-state.on::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1.2s infinite; }
.live { min-height: 92px; border-radius: 14px; background: var(--bg); padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live-text { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 600; }
.live-text.placeholder { font-size: 17px; font-weight: 400; color: var(--muted); }
.w-partial { color: var(--muted); }
.w-low { text-decoration: underline dotted var(--warn); text-underline-offset: 4px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; padding: 9px 13px; cursor: pointer; font-weight: 600; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:focus-visible, .pace-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.switch { flex-shrink: 0; align-self: flex-end; }
.btn.switch.pressed { background: var(--warn-soft); border-color: var(--warn); }
.btn:disabled { opacity: .5; cursor: default; }
kbd { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; margin-left: 4px; }
.names { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.names summary { cursor: pointer; }
.names label { display: block; margin: 4px 0; }
.names input { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.notice { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.convo { list-style: none; margin: 0; padding: 0 2px 0 0; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 14px; animation: rise .25s ease; }
.msg p { margin: 0; font-size: 17px; }
.msg .meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.msg.user { align-self: flex-end; background: var(--accent-soft); }
.msg.user.fragment { background: transparent; border: 2px dashed var(--warn); }
.msg.agent { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel); border: 1px solid var(--line); color: var(--ink); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.tasks .count { color: var(--muted); font-size: 14px; }
.pending { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-weight: 600; margin-bottom: 8px; }
.board { flex: 1; overflow-y: auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; align-content: start; }
.bucket h3 { margin: 4px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.bucket ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: grid; grid-template-columns: 22px 1fr; gap: 8px; background: var(--panel); }
.task .box { width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--muted); margin-top: 3px; }
.task.done .box { background: var(--ok); border-color: var(--ok); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .title { font-weight: 600; font-size: 16.5px; }
.task .sub { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; align-items: center; }
.task.high { border-left: 5px solid var(--bad); }
.task.flash-add { animation: flashAdd 2.4s ease; }
.task.flash-update { animation: flashUpdate 2.4s ease; }
.task.flash-complete, .task.flash-reopen { animation: flashAdd 2.4s ease; }
.empty { color: var(--muted); font-size: 16px; }
.wire { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.wire h3 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.wire ol { list-style: none; margin: 0; padding: 0; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); min-height: 54px; }
.wire li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: rise .25s ease; }
.wire li b { color: var(--accent); font-weight: 700; }

.stats { display: grid; grid-template-columns: minmax(0, 1.15fr) repeat(4, minmax(0, 1fr)) minmax(0, 1.5fr); gap: 10px; padding-block: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 7px 12px; display: flex; flex-direction: column; min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.bump { animation: bumpText 1.2s ease; }
.chips { display: flex; gap: 5px; flex-wrap: nowrap; overflow: hidden; }
.chips .tag { font-size: 13px; }

.callouts { position: fixed; right: 30px; bottom: 170px; display: flex; flex-direction: column; gap: 8px; z-index: 5; max-width: min(520px, calc(100vw - 32px)); pointer-events: none; align-items: flex-end; }
.callout { background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); animation: rise .3s ease; }
.callout strong { display: block; font-size: 16px; }
.callout span { font-size: 14px; opacity: .92; }
.callout.fade { opacity: 0; transition: opacity .5s; }

@keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes flashAdd { 0%, 40% { background: var(--ok-soft); border-color: var(--ok); } 100% { background: var(--panel); } }
@keyframes flashUpdate { 0%, 40% { background: var(--accent-soft); border-color: var(--accent); } 100% { background: var(--panel); } }
@keyframes bump { 0%, 50% { box-shadow: inset 0 0 0 3px var(--warn); } }
@keyframes bumpText { 0%, 50% { color: var(--warn); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat.wide { grid-column: 1 / -1; }
  .callouts { bottom: 16px; right: 16px; }
}
