/* Voice memory playground: white / black / one blue. */
:root {
  --bg: #ffffff;
  --fg: #111;
  --accent: #1a56db;
  --border: #e5e7eb;
  --muted: #6b7280;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 var(--font);
  display: flex;
  flex-direction: column;
}

h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
h4 { font-size: 12px; font-weight: 600; margin: 10px 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
a { color: var(--accent); }

/* ---------- layout ---------- */
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
}
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.brand { font-weight: 600; }
.top .spacer { flex: 1; }
.grid {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 440px;
}
.col { min-height: 0; overflow-y: auto; }
#left { border-right: 1px solid var(--border); padding: 12px 14px; }
#right { border-left: 1px solid var(--border); padding: 12px 14px; }
#middle { display: flex; flex-direction: column; padding: 0; overflow: hidden; }

/* the left panel can be collapsed (header toggle); the middle column takes its room */
body.left-collapsed #left { display: none; }
body.left-collapsed .grid { grid-template-columns: minmax(0, 1fr) 440px; }
@media (max-width: 1100px) {
  .grid { grid-template-columns: 280px minmax(0, 1fr); }
  body.left-collapsed .grid { grid-template-columns: minmax(0, 1fr); }
  #right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 760px) {
  body { display: block; }
  .grid { display: block; }
  .col { overflow: visible; }
  #left, #right { border: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  #middle { min-height: 70vh; }
}

/* ---------- controls ---------- */
.block { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.block:last-child { border-bottom: 0; }
select, input[type=text], input[type=password], input[type=number], input[type=date] {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 6px; margin: 8px 0; font-size: 13px; }
.check input { accent-color: var(--accent); margin: 0; }
.seg { display: flex; gap: 4px; margin-bottom: 6px; }
.seg.wrap { flex-wrap: wrap; }
.seg label {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 13px;
}
.seg label:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.seg label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.seg input { accent-color: var(--accent); margin: 0; }
.adv { margin: 8px 0; font-size: 13px; }
.adv summary { cursor: pointer; color: var(--accent); }
.adv-grid { display: grid; gap: 6px; margin-top: 8px; }
.adv-grid label { font-size: 12px; color: var(--muted); }
.adv-grid label.check { color: var(--fg); }

button {
  font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--fg);
  border-radius: 6px; padding: 6px 12px;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { color: #fff; opacity: .9; }
button:disabled { opacity: .45; cursor: not-allowed; }
.buttons { display: flex; gap: 8px; margin-top: 10px; }
#call-msg { margin-top: 8px; }
#call-msg.err, .err { color: var(--fg); font-weight: 600; }

/* ---------- history ---------- */
.history details { border-bottom: 1px solid var(--border); }
.history summary { cursor: pointer; padding: 6px 0; font-size: 13px; }
.history summary b { font-weight: 600; }
.history .sess { padding: 2px 0 10px; font-size: 12px; }
.history .sess p { margin: 4px 0; }
.history .hdr { color: var(--muted); font-style: italic; }
.history .spk { font-weight: 600; }
.history .spk.user { color: var(--accent); }

/* ---------- middle: the call ---------- */
.callbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.state { font-weight: 600; }
.state.live { color: var(--accent); }
#mic-note { padding: 0 16px; }
#mic-note:not(:empty) { padding-top: 8px; }
.transcript { flex: 1; overflow-y: auto; padding: 16px; }
.transcript .empty { margin-top: 40px; text-align: center; }
.msg { max-width: 760px; margin: 0 0 14px; }
.msg .who { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.msg.user .who { color: var(--accent); }
.msg .text { white-space: pre-wrap; }
.msg .interim { color: var(--muted); }
.msg.sys { color: var(--muted); font-size: 12px; }
.msg .meta { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* ---------- the voice dock: the orb ---------- */
.voice {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 12px 16px 8px; border-top: 1px solid var(--border);
}
.orb {
  position: relative; width: 72px; height: 72px; margin: 9px 0 10px; padding: 0;
  border: 0; border-radius: 50%; background: none; cursor: pointer;
}
.orb:hover:not(:disabled) { border: 0; }
.orb:disabled { opacity: 1; }
.orb[aria-disabled=true] { cursor: default; }
.orb:focus-visible { outline: none; }
.orb:focus-visible .orb-core { outline: 2px solid var(--accent); outline-offset: 4px; }
.orb-core, .orb-ring { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.orb-core {
  display: grid; place-items: center;
  border: 2px solid var(--accent); background: var(--bg);
  transition: background-color .3s ease, border-color .3s ease;
  will-change: transform;
}
.orb-ring { border: 1.5px solid var(--accent); opacity: 0; will-change: transform, opacity; }
.orb-icon { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; transition: opacity .2s; }
.orb[data-mode=idle]:hover .orb-core { background: #f3f4f6; }
.orb:not([data-mode=idle]) .orb-icon { opacity: 0; }
.orb[data-mode=listening] .orb-core,
.orb[data-mode=thinking] .orb-core,
.orb[data-mode=speaking] .orb-core { background: var(--accent); }
.orb[data-mode=muted] .orb-core { background: #9ca3af; border-color: #9ca3af; }
.orb[data-mode=thinking] .orb-core { animation: orb-breathe 4.2s ease-in-out infinite; }
.orb[data-mode=connecting] .orb-core { animation: orb-breathe 2.2s ease-in-out infinite; }
@keyframes orb-breathe { 0%, 100% { transform: scale(.9); } 50% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .orb-core { animation: none !important; transition: none; }
}
@media (max-width: 760px) {
  .orb { width: 64px; height: 64px; }
}
.orb-status { font-size: 13px; font-weight: 500; min-height: 18px; line-height: 18px; }
#call-msg:empty { display: none; }
.voice-controls { display: flex; align-items: center; gap: 6px; }
.voice-controls button { font-size: 12px; padding: 2px 9px; }
.linkish {
  border: 0; background: none; padding: 4px 6px; color: var(--muted);
  font-size: 12px; text-decoration: underline; text-underline-offset: 2px;
}
.linkish:hover:not(:disabled) { color: var(--accent); }
.say { display: flex; gap: 8px; width: 100%; max-width: 640px; margin-top: 4px; }
.say input { flex: 1; }
.say input:disabled { opacity: .45; cursor: not-allowed; }
#say-note { max-width: 640px; text-align: center; }

/* ---------- access key ---------- */
.login {
  position: fixed; inset: 0; z-index: 10; padding: 16px;
  display: grid; place-items: center; background: var(--bg);
}
.login-card { width: min(340px, 100%); display: grid; gap: 10px; }
.login-card p { margin: 0; }

/* ---------- right: details ---------- */
.right-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.right-head h2 { margin: 0; }
.json-out { width: 100%; height: 160px; font: 11px/1.3 var(--mono); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.card h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.num { font-family: var(--mono); font-size: 12px; }
.big { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.card details { margin-top: 8px; font-size: 12px; }
.card summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.card ul, .card ol { margin: 4px 0; padding-left: 18px; }
.card li { margin: 2px 0; }
.card pre { white-space: pre-wrap; font: 11px/1.4 var(--mono); margin: 6px 0 0; max-height: 360px; overflow: auto; }

.turn-head { display: flex; align-items: baseline; gap: 8px; }
.turn-head .tag { font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.turn-head .tag.accent { border-color: var(--accent); color: var(--accent); }
.turn-head .at { margin-left: auto; }
.q { margin: 4px 0 8px; }
.q .interim { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 6px 0; }
.tile { border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
.tile .l { font-size: 10px; color: var(--muted); line-height: 1.2; }
.tile .v { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.tile.key .v { color: var(--accent); }
.sub { font-size: 12px; color: var(--muted); margin: 4px 0; }
.sub b { color: var(--fg); font-weight: 600; }

table.t { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0; table-layout: fixed; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); padding: 3px 4px; }
table.t td { border-bottom: 1px solid var(--border); padding: 3px 4px; vertical-align: top; overflow-wrap: anywhere; }
table.t td.r, table.t th.r { text-align: right; font-family: var(--mono); }
table.t tr:last-child td { border-bottom: 0; }
table.t details { margin: 0; }
table.t summary { color: var(--fg); font-size: 12px; }
.late { font-weight: 600; }
.ok { color: var(--accent); }
.mems li { font-size: 12px; }
.score { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cost-table td:last-child { text-align: right; font-family: var(--mono); }
.dossier h4 { color: var(--fg); }
.dossier ul { margin: 0 0 4px; }

/* ---------- sample questions (under the orb) ---------- */
.samples { width: 100%; max-width: 760px; margin-top: 4px; }
.samples-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.samples-head .linkish { font-size: 11px; padding: 0 2px; }
/* a plain list: question on the left, expected answer on the right, one row each */
.samples-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.chip {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; padding: 5px 4px; line-height: 1.3;
  cursor: pointer;
}
.chip:hover { background: #f9fafb; }
.chip .q { font-size: 12.5px; color: var(--text, #111); flex: 1 1 auto; }
.chip .g { font-size: 11px; color: var(--muted); flex: 0 1 45%; text-align: right; }
.chip .g::before { content: "Expected: "; }
.chip.copied .q { color: var(--accent); }
.chip.copied .g::before { content: "Copied · expected: "; }

/* ---------- ingestion / sandbox (left) ---------- */
#ingest-hint { margin-top: 4px; }
.sandbox-row { margin-top: 4px; }
.sandbox-row .linkish { padding: 0 2px; }

/* ---------- memory writes, cache (right) ---------- */
button.small-btn { font-size: 12px; padding: 3px 8px; margin-top: 4px; }
.write { border-top: 1px solid var(--border); padding: 6px 0 4px; }
.card > .write:first-of-type, h4 + .write { border-top: 0; }
.write-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.write-head .sub { margin: 0; }
.tag { font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.tag.accent { border-color: var(--accent); color: var(--accent); }
ul.facts { list-style: none; padding-left: 0; margin: 4px 0 0; }
ul.facts li { font-size: 12px; margin: 2px 0; }
ul.facts li.upd s { color: var(--muted); }
ul.plain { list-style: none; padding-left: 0; margin: 4px 0; }
ul.plain li { font-size: 12px; margin: 2px 0; }
ul.plain details { margin-top: 2px; }
