:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #14171c; --muted: #5d6673; --line: #dfe3e8;
  --go: #16a34a; --go-ink: #ffffff; --danger: #dc2626; --accent: #16a34a; --warn: #b45309;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --card: #171b21; --ink: #e8ebef; --muted: #9aa4b1; --line: #2a3038;
    --go: #22c55e; --go-ink: #04140a; --danger: #ef4444; --accent: #22c55e; --warn: #f59e0b;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --card: #171b21; --ink: #e8ebef; --muted: #9aa4b1; --line: #2a3038;
  --go: #22c55e; --go-ink: #04140a; --danger: #ef4444; --accent: #22c55e; --warn: #f59e0b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
  max-width: 640px; margin: 0 auto; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.me { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; text-align: right; }
main { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
h1 { font-size: 1.35rem; margin: 0 0 4px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input:not([type]) { width: 100%; font: inherit; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.row input { flex: 1 1 180px; }
.gap { gap: 10px; }
.center { justify-content: center; }
.ways { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.btn { font: inherit; font-weight: 600; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--go); color: var(--go-ink); border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.small { padding: 7px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; margin-top: 12px; }
.go { flex: 1 1 140px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.msg { min-height: 1.2em; margin: 10px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--go); }
.msg.warn { color: var(--warn); }
.alt { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.alt summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.pairbox { margin-top: 12px; }
.pairbox img, #pair-qr { display: block; border-radius: 10px; background: #fff; margin-top: 8px; max-width: 100%; height: auto; }
.step { font-weight: 600; }
.status { margin-top: 14px; display: grid; gap: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: .9rem; }
.ringing { border: 2px solid var(--go); text-align: center; }
.ringing .who { font-size: 1.5rem; font-weight: 700; overflow-wrap: anywhere; }
.call { padding: 10px; }
.stage { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; }
#remote { width: 100%; height: 100%; object-fit: cover; }
#local { position: absolute; right: 8px; bottom: 8px; width: 28%; max-width: 160px; border-radius: 8px;
  border: 2px solid rgba(255,255,255,.6); background: #222; }
.peer { position: absolute; left: 10px; top: 8px; color: #fff; font-weight: 700; text-shadow: 0 1px 3px #000; }
#call-status { text-align: center; margin: 10px 0 4px; }
footer { max-width: 640px; margin: 0 auto; padding: 0 16px 28px; }
/* 2026-10-17: in-call chat (the agent front desk talks here), recent calls, a note after a missed call */
textarea { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); resize: vertical; }
.notebox { margin-top: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.notebox label { margin-top: 0; color: var(--ink); font-weight: 600; }
.recent { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.recent li { display: flex; align-items: center; gap: 8px; font-size: .9rem; border-bottom: 1px solid var(--line); padding: 4px 0 6px; }
.recent .nm { font-weight: 600; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; }
.recent .wh { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.recent .mk { font-size: .78rem; border-radius: 999px; padding: 1px 7px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.recent .mk.missed, .recent .mk.no-answer, .recent .mk.declined, .recent .mk.failed { color: var(--danger); }
.recent .mk.talked { color: var(--go); }
.chat { margin-top: 8px; }
.chat-log { max-height: 180px; overflow-y: auto; display: grid; gap: 4px; font-size: .9rem; padding: 6px 2px; }
.chat-log .m { padding: 6px 10px; border-radius: 12px; background: var(--bg); max-width: 92%; overflow-wrap: anywhere; }
.chat-log .m.me { justify-self: end; background: color-mix(in srgb, var(--go) 18%, var(--card)); }
.chat-log .m.sys { justify-self: center; background: transparent; color: var(--muted); font-size: .8rem; }
.chat-log .m b { font-size: .78rem; display: block; color: var(--muted); }
body.embed .top { padding: 8px 12px; }
body.embed footer { display: none; }
body.embed main { padding: 0 8px 8px; }
body.parent-dials #dial > label[for="callee"], body.parent-dials #dial > .row:has(#callee),
body.parent-dials #dial > .row:has(#call-voice), body.parent-dials #recent-box, body.parent-dials #note { display: none; }

/* mail (2026-10-19) */
.mail-head { align-items: center; justify-content: space-between; }
.mail-head h2 { margin: 0; font-size: 1.1rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.mail-badge { font-size: .8rem; color: var(--muted); }
.mail-badge.on { color: var(--go); font-weight: 600; }
.mail-list { list-style: none; margin: 10px 0 0; padding: 0; }
.mail-row { padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.mail-row:hover, .mail-row:focus { background: var(--bg); outline: none; }
.mail-row.unread .mail-subj { font-weight: 700; }
.mail-top { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.mail-top .wh { color: var(--muted); white-space: nowrap; }
.mail-subj { overflow-wrap: anywhere; }
.mail-from { font-size: .85rem; overflow-wrap: anywhere; }
.mail-from.proved { color: var(--go); }
.mail-from.checked { color: var(--ink); }
.mail-from.claim { color: var(--warn); }
.mail-v-subj { font-weight: 700; font-size: 1.05rem; margin: 10px 0 2px; overflow-wrap: anywhere; }
.mail-v-text { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin: 10px 0; max-height: 50vh; overflow: auto; }

/* ---- "How a call finds you" (2026-10-27) ----------------------------------------------
   The explainer section and its hand-drawn diagram. Everything here is a token or
   currentColor, so the dark theme at the top of this file recolours it with no second copy.

   NO `white-space: nowrap` IN HERE, deliberately. The sibling app's shared stylesheet grew
   one line of it on a trailing table cell and made a page scroll sideways by 33px at 390px.
   A row of step chips and a figure caption are exactly where that reflex strikes. */
.how h2 { font-size: 1.1rem; margin: 0 0 10px; }
.how h3 { font-size: .95rem; margin: 18px 0 6px; }
.how p { margin: 0 0 8px; }

.call-figure { margin: 0; max-width: 100%; }
.call-figure svg { max-width: 100%; height: auto; display: block; color: var(--ink); }
.call-figure figcaption {
  font-size: .82rem; color: var(--muted); margin-top: 8px; overflow-wrap: anywhere;
}

.how .steps { margin: 0; padding-left: 1.2em; }
.how .steps li { margin: 0 0 12px; font-size: .88rem; }
.how .steps li b { display: inline; }
.how .steps li span { display: block; margin-top: 3px; }
.how .steps li .not { color: var(--muted); }

/* One chip per answer to "is this on the chain?" — the question the whole section exists
   for, so it is a label rather than a colour alone. */
.how .kind {
  display: inline-block; font-size: .7rem; font-weight: 700; line-height: 1;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px;
  vertical-align: 1px; overflow-wrap: anywhere;
}
.how .kind.chain { border-color: var(--accent); color: var(--accent); }
.how .kind.sig { border-color: var(--warn); color: var(--warn); }
.how .kind.none { color: var(--muted); }
