/* Call Bridge console — read as a one-line telephone switchboard panel: lamps for status, a
   patch-code field for the token, real toggle switches, and one copper tally light on the live
   call. Tokens match operator-shell's own panel (preload.js) so the two feel like one product. */
:root {
  --bg: #eef0ec; --card: #ffffff; --fg: #15171a; --muted: #5b6269; --line: #d7dbe0; --field: #f4f5f7;
  --green: #1f8a4c; --amber: #e8a33d; --danger: #c0392b; --live: #b5651d;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11; --card: #15171a; --fg: #eceeef; --muted: #868d95; --line: #2c3036; --field: #121417;
    --green: #3fae6a; --amber: #e8a33d; --danger: #d8574b; --live: #d98a4a;
  }
}
* { box-sizing: border-box; }
/* The icon sprite's `hidden` attribute isn't reliably honored on an <svg> root in every engine. */
svg[hidden] { display: none; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); }
main { max-width: 420px; margin: 0 auto; padding: 14px 14px 20px; }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
/* The wordmark carries a small power lamp of its own — the one thing on the page that isn't a status
   readout, so it earns a little personality instead of plain text. */
h1 { display: flex; align-items: center; gap: 8px; font: 700 18px/1.2 var(--sans); margin: 0; letter-spacing: -.01em; }
h1::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.muted { color: var(--muted); }

/* Every function lives in its own bordered panel, each a clear step down from the one before. */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px 14px; margin-bottom: 14px;
}
.panel:last-child { margin-bottom: 0; }
form.panel { padding-top: 14px; }

/* A section label reads as a panel divider, not a decorative eyebrow: a rule the text sits on. */
h2 {
  display: flex; align-items: center; gap: 7px; font: 12px/1.2 var(--mono); color: var(--muted);
  margin: -2px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
h2 .ic { opacity: .8; }

/* ---- Lamps: every status line is a dot (currentColor) plus plain-language text ---- */
.stations, .mic {
  display: flex; align-items: center; gap: 8px; margin: 2px 0; color: var(--muted); font: 13px/1.4 var(--mono);
}
.stations::before, .mic::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none;
}
.stations[data-ok=true], .mic[data-ok=true] { color: var(--green); }
.stations[data-ok=false], .mic[data-ok=false] { color: var(--danger); font-weight: 600; }
.mic:empty { display: none; }
#serverAddress { font: 13px/1.4 var(--mono); color: var(--muted); margin: 0 0 2px; }
.status { color: var(--muted); min-height: 1.4em; font: 13px var(--sans); margin: 8px 0; }

/* ---- Form controls: flat, small radius, bordered — panel switchgear, not SaaS chrome ---- */
label { display: block; margin: 10px 0 4px; font: 12px var(--mono); color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
input {
  flex: 1; min-width: 0; font: 14px/1.3 var(--mono); padding: 8px 10px; border-radius: 3px;
  border: 1px solid var(--line); background: var(--field); color: var(--fg);
}
input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
button {
  display: inline-flex; align-items: center; gap: 7px; font: 13px var(--mono); padding: 8px 12px;
  border-radius: 3px; border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer;
}
.ic { width: 15px; height: 15px; flex: none; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
button.link .ic { width: 14px; height: 14px; }
button:hover { border-color: var(--muted); }
button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--green); border-color: var(--green); color: #fff; }
button.danger { color: var(--danger); border-color: var(--danger); }
button[aria-pressed=true] { background: var(--danger); border-color: var(--danger); color: #fff; }
button[aria-pressed=true]#camera { background: var(--green); border-color: var(--green); }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; font: 13px var(--sans); }

select {
  appearance: none; font: 13px var(--mono); padding: 7px 28px 7px 10px; border-radius: 3px;
  border: 1px solid var(--line); background-color: var(--field); color: var(--fg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235b6269'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
select:disabled { opacity: .5; }

/* Real toggle switches, standing in for checkboxes — matches the app's own Start-at-login switch. */
label.check { display: flex; gap: 10px; align-items: center; margin-top: 8px; font: 13px var(--sans); color: var(--fg); }
label.check input[type=checkbox] {
  appearance: none; width: 34px; height: 20px; flex: none; margin: 0; position: relative; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--line); background: var(--field); transition: background .15s ease;
}
label.check input[type=checkbox]::before {
  content: ""; position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s ease;
}
label.check input[type=checkbox]:checked { background: var(--green); border-color: var(--green); }
label.check input[type=checkbox]:checked::before { transform: translateX(14px); }
label.check input[type=checkbox]:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---- Panels ---- */
/* The one bold accent in the whole page: a tally light down the side of the panel actually live. */
.panel.live { border-left: 3px solid var(--live); padding-left: 12px; }
#activeCaller { font: 15px/1.3 var(--mono); }
#activeClock, #micSource, #cameraStatus { font: 13px var(--mono); color: var(--muted); }

.calls { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.calls li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.calls li.card { background: var(--field); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.calls li.card.ring { border-color: var(--amber); }
.calls li.card.ring .row { margin-top: 0; }

.preview[hidden] { display: none; }
.preview { margin-top: 10px; width: 100%; max-width: 240px; border-radius: 4px; background: #000; display: block; border: 1px solid var(--line); }
