:root {
  --bg: #0b0f14; --panel: #11161d; --card: #151c25; --line: #1f2933;
  --text: #dce4ee; --dim: #8494a7; --accent: #4fc3f7;
  --fast: #ffb74d; --grounded: #66bb6a; --bare: #64b5f6;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
header {
  display: flex; align-items: baseline; gap: 16px; padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.brand span { color: var(--accent); }
.tagline { color: var(--dim); font-size: 12.5px; }
.conn { margin-left: auto; font-size: 12px; color: var(--dim); }
.conn.ok { color: var(--grounded); }
.conn.bad { color: #ef5350; }

main {
  display: grid; grid-template-columns: 1.15fr 0.85fr;
  gap: 14px; padding: 14px 22px; max-width: 1280px; margin: 0 auto;
}
.panel.inputs { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px;
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.hint { font-size: 11.5px; color: var(--dim); }
.row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.row.wide { width: 100%; }

textarea, input[type=text], input:not([type]) {
  width: 100%; background: #0d1319; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font: inherit; resize: vertical;
}
textarea:focus, input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

button {
  font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--line);
  background: #1a232e; color: var(--text); padding: 9px 16px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: #14384d; border-color: #1d5a7a; color: #bfe9ff; }
button.primary.wide { flex: 1; }
button.ghost { background: transparent; color: var(--dim); }
.file-btn {
  display: inline-block; padding: 8px 14px; border: 1px dashed var(--line);
  border-radius: 8px; color: var(--dim); cursor: pointer; font-size: 12.5px;
}
.file-btn input { display: none; }
.file-btn:hover { color: var(--text); border-color: var(--accent); }

.microw { margin-top: 10px; }
.mic {
  flex: 1; background: #1d1626; border-color: #3a2a4d; color: #d7b8ff; font-size: 14px;
}
.mic.on { background: #2b1b3d; border-color: #7e57c2; }
.mic.live { animation: pulse 1s infinite alternate; }
@keyframes pulse { from { box-shadow: 0 0 0 0 #7e57c288; } to { box-shadow: 0 0 0 8px #7e57c200; } }
select {
  background: #0d1319; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; font: inherit;
}

/* path gate */
.paths { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.path {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  text-align: center; opacity: 0.55; transition: all 0.18s;
}
.path b { display: block; font-size: 14px; letter-spacing: 1px; }
.path i { display: block; font-style: normal; font-size: 10.5px; color: var(--dim); margin-top: 3px; }
.path em { display: block; font-style: normal; font-size: 20px; font-weight: 800; margin-top: 6px; }
#badge-FAST b { color: var(--fast); }
#badge-GROUNDED b { color: var(--grounded); }
#badge-BARE b { color: var(--bare); }
.path.hot { opacity: 1; transform: translateY(-2px); }
#badge-FAST.hot { border-color: var(--fast); box-shadow: 0 0 18px #ffb74d33; }
#badge-GROUNDED.hot { border-color: var(--grounded); box-shadow: 0 0 18px #66bb6a33; }
#badge-BARE.hot { border-color: var(--bare); box-shadow: 0 0 18px #64b5f633; }

/* latency bars */
.bars { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 64px; gap: 10px; align-items: center; font-size: 12px; }
.bar-row span { color: var(--dim); }
.bar { height: 10px; background: #0d1319; border-radius: 6px; overflow: hidden; }
.bar > div {
  height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, #2e7d32, #66bb6a);
  transition: width 0.25s ease;
}
.bar-row b { text-align: right; font-size: 11.5px; color: var(--dim); }

.pstats { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.pstat {
  display: flex; gap: 14px; font-size: 11.5px; color: var(--dim);
  border-top: 1px dashed var(--line); padding-top: 4px;
}
.pstat b { color: var(--text); width: 70px; }

/* transcript */
.transcript-wrap { grid-column: 1 / -1; }
.transcript {
  max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
}
.transcript div { padding: 8px 12px; border-radius: 8px; max-width: 78%; }
.transcript .user { background: #1a2b3c; align-self: flex-end; }
.transcript .agent { background: #16321f; align-self: flex-start; }
.transcript .sys { color: var(--dim); font-size: 11.5px; align-self: center; background: transparent; padding: 2px; }
.transcript .err { color: #ff8a80; font-size: 12px; align-self: center; }

footer {
  padding: 12px 22px 26px; color: var(--dim); font-size: 12px;
  border-top: 1px solid var(--line); text-align: center;
}
footer a { color: var(--accent); text-decoration: none; }

@media (max-width: 900px) { main { grid-template-columns: 1fr; } }
