/* Console (host app) styles. The embedded voip-* components are shadow-isolated and themed only
   through the --voip-* custom properties declared here. */
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --fg: #1b1f24;
  --muted: #59636e;
  --border: #d8dee4;
  --accent: #0b6bcb;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #c62828;
  --radius: 8px;

  --voip-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --voip-bg: var(--card);
  --voip-fg: var(--fg);
  --voip-accent: var(--accent);
  --voip-danger: var(--bad);
  --voip-radius: var(--radius);
  --voip-gap: 10px;
  --voip-border: var(--border);
  --voip-muted-fg: var(--muted);
  --voip-surface: #f1f4f7;
  --voip-ok: var(--ok);
  --voip-warn: var(--warn);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

button {
  font: inherit; font-weight: 600; font-size: 13px;
  min-height: 32px; padding: 0 12px;
  color: var(--fg); background: #f1f4f7;
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button.danger.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small { min-height: 26px; padding: 0 8px; font-size: 12px; }
input, select {
  font: inherit; color: var(--fg); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  min-height: 32px; padding: 4px 8px;
}
input[type="checkbox"] { min-height: 0; accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }

/* layout */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--border);
}
.brand { font-size: 15px; }
.mainnav { display: flex; gap: 4px; }
.nav { padding: 6px 10px; border-radius: var(--radius); color: var(--fg); text-decoration: none; font-weight: 600; }
.nav[aria-current="true"] { background: #e8f0fb; color: var(--accent); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.who { margin-left: auto; color: var(--muted); font-size: 13px; }
.content { padding: 16px 20px 40px; max-width: 1440px; margin: 0 auto; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }

/* rep view */
.rep { display: flex; flex-direction: column; gap: 14px; }
.rep-grid { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 900px) { .rep-grid { grid-template-columns: 1fr; } }
.eventlog { margin: 0; padding: 0; list-style: none; max-height: 220px; overflow: auto; font-size: 12px; }
.eventlog li { display: grid; grid-template-columns: 80px 120px 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px solid #eef1f4; }
.eventlog li span { overflow-wrap: anywhere; }
.eventlog li.bad code, .eventlog li.bad span { color: var(--bad); }

/* admin */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid #eef1f4; vertical-align: middle; overflow-wrap: anywhere; }
.empty { color: var(--muted); margin: 6px 0; }
.status { margin: 6px 0; font-size: 13px; color: var(--muted); min-height: 0; }
.status:empty { display: none; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); color: var(--muted); background: #f6f8fa; white-space: nowrap; margin-right: 4px; }
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.badge.bad { color: var(--bad); border-color: currentColor; }
.badge.info { color: var(--accent); border-color: currentColor; }
.q.ok { color: var(--ok); } .q.warn { color: var(--warn); font-weight: 600; } .q.bad { color: var(--bad); font-weight: 700; }
.kpi { font-size: 14px; margin-bottom: 8px; }
.kpi strong { font-size: 28px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.meter { height: 10px; background: #eef1f4; border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--muted); transition: width .3s ease; }
.meter-fill.ok { background: var(--ok); } .meter-fill.warn { background: var(--warn); } .meter-fill.bad { background: var(--bad); }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; margin-bottom: 12px; font-size: 13px; }
.meter-row .meter { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field input, .field select { font-size: 14px; color: var(--fg); }
.roles { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border: 0; padding: 0; margin: 0; }
.roles legend { font-size: 12px; color: var(--muted); padding: 0; margin-bottom: 4px; }
.check { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: var(--fg); }
.hold { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hold .reason { min-height: 26px; width: 180px; }
.callout { background: #fff8e1; border: 1px solid #f0d27a; border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.callout:has(> pre) { flex-direction: column; align-items: stretch; }
.callout > p { margin: 0; }
.callout .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.daemon-config { margin: 0; padding: 8px 10px; background: #fff; color: #1b1b1b; border: 1px solid #e2cf8f; border-radius: var(--radius);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; user-select: all; }
/* "Set up desktop app" page */
.setup .card { max-width: 860px; }
.setup h3 { font-size: 14px; margin: 18px 0 6px; }
.os-tabs { display: flex; gap: 6px; margin: 10px 0 4px; }
.steps { margin: 4px 0; padding-left: 22px; line-height: 1.6; }
.steps li { margin: 2px 0; }
pre.cmd { margin: 6px 0; padding: 8px 10px; background: #0f1720; color: #e6edf3; border-radius: var(--radius); overflow-x: auto; user-select: all; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
a.button { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: var(--radius); font-weight: 600; font-size: 13px; text-decoration: none; border: 1px solid var(--border); color: var(--fg); background: #f1f4f7; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.warn-text { color: var(--warn); }
.setup-hint { margin: 0 0 8px; font-size: 13px; }
.oneliner { display: flex; gap: 8px; align-items: stretch; }
.oneliner pre.cmd { flex: 1; margin: 0; font-size: 13px; white-space: pre-wrap; word-break: break-all; }
.setup kbd { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 2px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: #fff; }
.byhand { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.byhand summary { cursor: pointer; font-weight: 600; font-size: 13px; }

/* page headers (People, Phone numbers) */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin: 2px 0 14px; }
.page-head h1 { font-size: 20px; }
.page-head p { margin: 4px 0 0; max-width: 720px; }
.row.spread { justify-content: space-between; }
.row h2 { margin: 0; }

/* People: one row per person, "Manage" opens a panel under the row */
.people { display: flex; flex-direction: column; }
.person-row { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(110px, 1fr) minmax(130px, 1fr) minmax(150px, 1.4fr) 96px; gap: 10px; align-items: center; padding: 9px 8px; border-bottom: 1px solid #eef1f4; }
.person-row.head { font-size: 12px; color: var(--muted); font-weight: 600; border-bottom-color: var(--border); padding-top: 2px; }
.person-row.open { background: #f3f7fc; border-bottom-color: transparent; }
.who-cell { display: flex; flex-direction: column; min-width: 0; }
.actions-cell { justify-self: end; }
.person-panel { background: #f3f7fc; border-bottom: 1px solid var(--border); padding: 0 16px 12px; }
.panel-section { border-top: 1px solid #e3eaf3; padding-top: 2px; }
.panel-section:first-child { border-top: 0; }
.panel-section h3 { font-size: 13px; margin: 10px 0 4px; }
.panel-section p { margin: 2px 0 6px; }
.panel-section input[name="newPassword"] { width: 260px; }
.role-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.role-option { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.role-option input { margin-top: 3px; }
.phone-option { margin: 8px 0 6px; }
fieldset.plain { border: 0; padding: 0; margin: 10px 0 6px; }
fieldset.plain legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 4px; }
.ext-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0 0 6px 24px; }
.ext-row p { margin: 0 0 8px; }
.ext-input { width: 110px; }
.callout.credentials { flex-direction: column; align-items: stretch; margin: 0 0 14px; }
pre.welcome { margin: 0; padding: 10px 12px; background: #fff; color: #1b1b1b; border: 1px solid #e2cf8f; border-radius: var(--radius); white-space: pre-wrap;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; user-select: all; }
@media (max-width: 760px) {
  .person-row { grid-template-columns: 1fr 1fr; }
  .person-row.head { display: none; }
  .actions-cell { justify-self: start; }
}

/* Dashboard: getting started + tucked-away technical panels */
.getting-started { border-color: #b6d3f2; background: #f5f9fe; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.checklist li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); background: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); }
.checklist li.done strong { color: var(--muted); }
.checklist p { margin: 2px 0 0; }
a.small-link { min-height: 26px; padding: 0 10px; font-size: 12px; margin-left: 4px; }
details.tech { padding: 10px 16px; }
details.tech > summary, .tech-inline > summary, details.dev-events > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
details.tech[open] > summary { margin-bottom: 10px; }
details.tech .grid2 > .card { margin-bottom: 0; }
.tech-inline { margin-top: 8px; }
.tech-inline[open] > summary { margin-bottom: 6px; }

/* My voice (AI hand-off) */
.voice .card { max-width: 860px; }
.voice .consent { align-items: flex-start; font-size: 13px; }
.voice .consent input { margin-top: 3px; }
.voice .field textarea, .voice .field input[type="text"], .voice .field select { font: inherit; font-size: 14px; color: var(--fg); padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); width: 100%; }
.voice .field input[type="range"] { width: 100%; }
.voice .field { margin-bottom: 10px; }
.voice .script { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.voice .script-line { font-size: 13px; }
.voice .script-line > button { margin-right: 8px; min-width: 64px; }
.voice .script-line.free > span { font-style: italic; }
.voice .voice-meter { width: 220px; }
.voice .meter-fill { background: var(--accent); }
.voice .samples, .voice .handoffs { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.voice .sample { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.voice .transcript { font-size: 13px; max-height: 320px; overflow: auto; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.voice .transcript li.them strong { color: var(--ok); }
.voice .transcript li.prior, .voice .transcript.prior { color: var(--muted); }
.voice .transcript li.note { list-style: none; color: var(--muted); font-style: italic; }
.voice .handoffs summary { cursor: pointer; }

/* practice: hand the sales call to your AI voice */
button.handoff { border-color: var(--accent, #0b6bcb); color: var(--accent, #0b6bcb); font-weight: 600; }
