/* Call Session (web), written on the Smoked Glass tokens (tokens.css and brands.css are verbatim copies of the
   source in C:/BB Projects/design-language/smoked-glass). Layout only: no colour of its own. Phone first; the
   three-column call desk is in the min-width block at the end. */
*, *::before, *::after { box-sizing: border-box; }
body { font-size: var(--sg-text); line-height: 1.45; }
[hidden] { display: none !important; }
.muted { color: var(--sg-muted); }
p { margin: 0 0 10px; }
a { color: var(--sg-action); text-decoration: underline; text-decoration-color: var(--sg-line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.sg-btn.small { min-height: 34px; padding: 0 12px; font-size: var(--sg-text-sm); }
.linkbtn { margin: 0; padding: 0; border: 0; background: none; color: var(--sg-action); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--sg-line-strong); text-underline-offset: 3px; }
@media (pointer: coarse) { .linkbtn { min-height: var(--sg-tap); padding: 0 4px; } }

/* ---------- sign-in ---------- */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.signin-card { width: min(420px, 100%); padding: 24px; }
.signin-card .sg-title { margin: 4px 0 14px; }
.signin-card .sg-input { width: 100%; }
.signin-card .field { margin-top: 14px; }
.signin-card .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.signin-card .row .primary { flex: 1; }
.code-input { font: 400 24px/1.2 var(--sg-mono); letter-spacing: 0.3em; text-align: center; min-height: 52px; }

/* ---------- header ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top)); }
.brand { font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.session-info { order: 5; flex: 1 0 100%; color: var(--sg-muted); font-size: var(--sg-text-sm); }
.session-info b { color: var(--sg-ink); font-weight: 500; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--sg-muted); }
.dot.yes { background: var(--sg-yes); }
.dot.warn { background: var(--sg-warn); }
.dot.no { background: var(--sg-no); }
.pc-state { display: inline-flex; align-items: center; font: 400 var(--sg-text-xs)/1.4 var(--sg-mono); color: var(--sg-muted); white-space: nowrap; margin-left: auto; }
.mic { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mic .sg-select { max-width: 150px; min-height: 34px; font-size: var(--sg-text-sm); }
.meter { flex: none; width: 48px; height: 6px; border-radius: 3px; background: var(--sg-line-strong); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--sg-yes); transition: width 0.08s linear; }

/* ---------- the call desk (one column on a phone) ---------- */
.call-view { flex: 1; display: grid; gap: 12px; padding: 12px 16px; align-content: start; }
.lead { display: flex; flex-direction: column; padding: 20px 18px 18px; }
.name { margin: 0; font-weight: 300; font-size: 32px; line-height: 1.08; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.company { margin-top: 6px; color: var(--sg-muted); font-size: var(--sg-text-lg); }
.handle { display: inline-block; margin-top: 10px; margin-right: 14px; font-size: var(--sg-text); }
.phone-row { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.phone { font-weight: 300; font-size: 30px; letter-spacing: 0; font-variant-numeric: tabular-nums; color: var(--sg-ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.qr { flex: none; width: 92px; height: 92px; padding: 5px; border-radius: 8px; background: #ffffff; }
.qr svg { display: block; width: 100%; height: 100%; }
.phone-edit input { width: 230px; font-size: 20px; }
.source { margin-top: 6px; color: var(--sg-muted); font-size: 12.5px; overflow-wrap: anywhere; }
.source a { color: inherit; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.facts .sg-chip { white-space: normal; height: auto; min-height: 26px; padding-block: 4px; }
.bio { margin-top: 14px; color: var(--sg-muted); font-size: 13.5px; white-space: pre-line; max-height: 90px; overflow: hidden; }
.bio.callnotes { max-height: 120px; overflow-y: auto; padding: 8px 10px; border-radius: var(--sg-r-tag); background: var(--sg-warn-soft); color: var(--sg-warn-ink); }

.actions { display: flex; gap: 10px; margin-top: auto; padding-top: 22px; }
.actions .big { flex: 1; min-height: 64px; font-size: 20px; font-weight: 500; }
.actions .side { min-height: 64px; padding: 0 18px; font-size: 16px; }
kbd { margin-left: 8px; padding: 0 5px; border: 1px solid currentColor; border-radius: 4px; font: 400 11px/1.5 var(--sg-mono); opacity: 0.65; }
@media (pointer: coarse) { kbd { display: none; } }
.minor { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; }

.start { margin: auto 0; }
.start h1 { margin: 0 0 8px; font-weight: 300; font-size: 30px; letter-spacing: -0.03em; }
.start p { color: var(--sg-muted); margin: 0 0 6px; }
.start .note { margin-top: 12px; padding: 8px 10px; border-radius: var(--sg-r-tag); background: var(--sg-warn-soft); color: var(--sg-warn-ink); font-size: var(--sg-text-sm); }

.talk { display: flex; flex-direction: column; padding: 0; min-height: 260px; }
.talk-head { display: flex; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--sg-line); color: var(--sg-muted); font: 400 var(--sg-text-xs)/1.4 var(--sg-mono); letter-spacing: 0.06em; text-transform: uppercase; }
#timer { color: var(--sg-ink); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.transcript { flex: 1; overflow-y: auto; padding: 16px 18px; font-size: 16px; line-height: 1.5; max-height: 52dvh; }
.line { display: grid; grid-template-columns: 62px 1fr; gap: 10px; margin: 0 0 12px; }
.line .who { padding-top: 5px; font: 400 11.5px/1.4 var(--sg-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--sg-muted); }
.line.them .who { color: var(--sg-ink); }
.line.me .what { color: var(--sg-muted); }
.line.low .who::after { content: " ?"; }
.line.partial .what { color: var(--sg-muted); font-style: italic; }
.empty { color: var(--sg-muted); font-size: var(--sg-text); }
.upnext { margin-top: 18px; }
.upnext div { padding: 8px 0; border-bottom: 1px solid var(--sg-line); }
.upnext span { margin-left: 8px; color: var(--sg-muted); }
.notes-wrap { padding: 10px 18px 16px; border-top: 1px solid var(--sg-line); }

.ig { display: flex; align-items: flex-start; justify-content: center; padding: 10px; overflow: auto; }
.ig:empty { display: none; }
.ig img { display: block; width: 100%; height: auto; border-radius: 10px; }
.ig .empty { margin: auto; padding: 24px; text-align: center; }

.prep { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 4px 16px calc(14px + env(safe-area-inset-bottom)); color: var(--sg-muted); font-size: var(--sg-text-sm); }
.prep .running { color: var(--sg-yes-ink); cursor: pointer; }
.prep .waiting { color: var(--sg-warn-ink); cursor: pointer; }

/* ---------- voice set-up ---------- */
.enroll { width: min(620px, calc(100vw - 32px)); }
.enroll h2 { margin: 0 0 10px; font-weight: 400; font-size: var(--sg-text-title); letter-spacing: -0.02em; }
.enroll blockquote { margin: 16px 0; padding: 16px 18px; border-radius: var(--sg-r-control); background: var(--sg-panel-2); font-size: 18px; line-height: 1.55; }
.enroll-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }

/* ---------- Leads table ---------- */
.leads-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar .sg-input { flex: 1 1 260px; max-width: 360px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { min-height: 30px; margin: 0; padding: 0 12px; border: 1px solid var(--sg-line-strong); border-radius: 999px; background: transparent; color: var(--sg-muted); font: 400 var(--sg-text-sm)/1 var(--sg-font); cursor: pointer; }
.filters button:hover { color: var(--sg-ink); }
.filters button.on { background: var(--sg-selected); border-color: var(--sg-muted); color: var(--sg-ink); }
.filters button b { margin-left: 5px; font: 400 11.5px/1 var(--sg-mono); }
.shown { margin-left: auto; color: var(--sg-muted); font: 400 var(--sg-text-xs)/1.4 var(--sg-mono); }
.grid-wrap { flex: 1; min-height: 50dvh; padding: 0; overflow: auto; }
#grid { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
#grid th { position: sticky; top: 0; z-index: 2; padding: 10px 12px; background: var(--sg-panel-solid); border-bottom: 1px solid var(--sg-line-strong); text-align: left; font: 400 var(--sg-text-xs)/1.4 var(--sg-mono); color: var(--sg-muted); white-space: nowrap; cursor: pointer; user-select: none; }
#grid th.sorted { color: var(--sg-ink); }
#grid td { max-width: 320px; padding: 8px 12px; border-bottom: 1px solid var(--sg-line); vertical-align: top; }
#grid td.edit { cursor: text; }
#grid td.edit:hover { background: var(--sg-hover); }
#grid th:first-child, #grid td:first-child { position: sticky; left: 0; z-index: 1; background: var(--sg-panel-solid); border-right: 1px solid var(--sg-line); }
#grid th:first-child { z-index: 3; }
#grid td.nm { min-width: 120px; max-width: 44vw; font-weight: 500; cursor: pointer; overflow-wrap: anywhere; }
#grid td.nm:hover { text-decoration: underline; }
#grid td.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#grid td.wrap { min-width: 220px; white-space: normal; }
#grid td input, #grid td select, #grid td textarea { width: 100%; min-width: 120px; min-height: 32px; padding: 4px 8px; font-size: 13.5px; }
#grid td textarea { min-width: 240px; min-height: 64px; }
#grid tr.more td { padding: 14px; text-align: center; color: var(--sg-action); cursor: pointer; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--sg-r-tag); background: var(--sg-panel-2); color: var(--sg-muted); font-size: 12px; white-space: nowrap; }
.pill.s-Talked, .pill.s-Client, .pill.s-Partner { color: var(--sg-ink); }
.pill.s-Interested, .pill.s-Booked { background: var(--sg-yes-soft); color: var(--sg-yes-ink); }
.pill.s-Notinterested, .pill.s-Wrongnumber, .pill.s-Dontcall { background: var(--sg-no-soft); color: var(--sg-no-ink); }
.overdue { color: var(--sg-no-ink); }

/* ---------- person drawer ---------- */
.drawer { position: fixed; inset: 0 0 0 auto; z-index: var(--sg-z-overlay); width: min(460px, 100vw); padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; background: var(--sg-overlay); border-left: 1px solid var(--sg-panel-edge); box-shadow: var(--sg-overlay-shadow); }
.drawer .close { position: absolute; top: 12px; right: 12px; }
.drawer h2 { margin: 0 44px 4px 0; font-weight: 300; font-size: 28px; letter-spacing: -0.03em; }
.drawer .sub { margin-bottom: 14px; color: var(--sg-muted); }
.drawer dl { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; margin: 18px 0; font-size: 14px; }
.drawer dt { color: var(--sg-muted); }
.drawer dd { margin: 0; overflow-wrap: anywhere; }
.drawer h3 { margin: 24px 0 8px; font: 400 var(--sg-text-xs)/1.4 var(--sg-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--sg-muted); }
.drawer .call { padding: 10px 0; border-top: 1px solid var(--sg-line); font-size: 14px; }
.drawer .call span { color: var(--sg-muted); }
.drawer img { width: 100%; margin-top: 8px; border-radius: 10px; border: 1px solid var(--sg-line); }
.drawer .wide { width: 100%; margin-top: 8px; }
.drawer .notes { font-size: 14px; white-space: pre-line; }

/* ---------- desktop: the three-column call desk fills the window ---------- */
@media (min-width: 761px) {
  .app { height: 100dvh; }
  .head { flex-wrap: nowrap; gap: 20px; padding: 12px 28px; }
  .session-info { order: 0; flex: 1 1 auto; font-size: 14px; }
  .pc-state { margin-left: 0; }
  .mic .sg-select { max-width: 220px; }
  .meter { width: 70px; }
  .call-view { min-height: 0; grid-template-columns: minmax(340px, 1fr) minmax(400px, 1.35fr); gap: 20px; padding: 20px 28px; align-content: stretch; }
  .call-view > section { min-height: 0; }
  .lead { padding: 28px 28px 22px; overflow: auto; }
  .name { font-size: 40px; }
  .phone { font-size: 34px; }
  .talk { min-height: 0; }
  .transcript { max-height: none; font-size: 17px; padding: 18px 22px; }
  .line { grid-template-columns: 74px 1fr; }
  .ig { grid-column: 1 / -1; max-height: 34vh; }
  .prep { padding: 0 28px 14px; }
  .leads-view { padding: 16px 28px 10px; }
  .grid-wrap { min-height: 0; }
  #grid td.nm { min-width: 170px; max-width: 320px; }
}
@media (min-width: 1180px) {
  .call-view { grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.35fr) minmax(300px, 0.9fr); }
  .ig { grid-column: auto; max-height: none; }
  .call-view:has(.ig:empty) { grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.35fr); }
}
