/* Layout: one phone-width column; each view replaces the last, like screens in a dialer.
   Look: the re·call brand board. Dark midnight everywhere, teal for actions and good news,
   cream for the wordmark and highlights; Inter for text, JetBrains Mono for labels and numbers. */
:root {
  --bg: #0b1020;          /* midnight */
  --surface: #131a2e;
  --sunk: #1a2238;
  --ink: #edf0f7;
  --muted: #8f99b4;
  --line: #252f4a;
  --call: #3be3c4;        /* teal */
  --call-ink: #0b1020;
  --cream: #f4e6b5;
  --lavender: #b9a7f4;
  --hang: #ff6f61;
  --hang-ink: #0b1020;
  --amber: #f2c86b;
  --tint-call: #133536;
  --tint-amber: #3a3222;
  --tint-hang: #3b2028;
  --tint-ink: #1e2742;
  --deck: #070b17;
  --deck-2: #161e34;
  --deck-ink: #edf0f7;
  --deck-muted: #8f99b4;
  --shadow: rgb(0 0 0 / 0.45);
  --display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); margin: 0; }
body {
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.app { max-width: 600px; margin: 0 auto; }
h1, h2, h3, p { margin: 0; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
code { font-family: var(--mono); font-size: 0.82em; background: var(--sunk); padding: 1px 6px; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--call); outline-offset: 2px; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; font-size: 0.95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--sunk); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--call); border-color: var(--call); color: var(--call-ink); }
.btn-primary:hover { background: var(--call); filter: brightness(1.07); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); padding-inline: 6px; }
.btn-quiet:hover { background: transparent; color: var(--ink); }
.btn-danger { color: var(--hang); }
.btn-solid-danger { background: var(--hang); border-color: var(--hang); color: var(--hang-ink); }
.btn-solid-danger:hover { background: var(--hang); filter: brightness(1.07); }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--sunk); color: var(--ink); }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* Header, setup note and command bar */
.top { display: flex; align-items: center; gap: 12px; padding-block: 4px 18px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--call); box-shadow: 0 0 0 4px var(--tint-call); }
.setup { display: flex; flex-direction: column; gap: 6px; background: var(--tint-amber); color: var(--ink); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-size: 0.92rem; }
.setup strong { color: var(--amber); }
.cmd { position: relative; }
.cmd svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--call); pointer-events: none; }
.cmd input[type="text"] {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink);
  padding: 15px 16px 15px 48px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: 0 1px 2px var(--shadow);
}
.cmd input::placeholder { color: var(--muted); }
.cmd input:focus { outline: 2px solid var(--call); outline-offset: 0; border-color: transparent; }
.hint { font-size: 0.86rem; color: var(--muted); margin: 8px 4px 0; }

/* Contact list */
.list-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 26px 4px 8px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
.rows { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border: 0; border-top: 1px solid var(--line);
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--sunk); }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 1rem;
  background: var(--tint-ink); color: var(--ink);
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-name { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-next { font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.due { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; }
.due.bad { color: var(--hang); }
.due.wait { color: var(--amber); }
.empty { padding: 28px 22px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty strong { color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 0.72rem; font-weight: 600; line-height: 1.2;
  padding: 3px 9px; border-radius: 999px; background: var(--tint-ink); color: var(--muted);
}
.chip.good { background: var(--tint-call); color: var(--call); }
.chip.wait { background: var(--tint-amber); color: var(--amber); }
.chip.bad { background: var(--tint-hang); color: var(--hang); }

/* Contact view */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 4px; }
.who { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-block: 4px 22px; }
.avatar.big { width: 76px; height: 76px; font-size: 1.6rem; margin-bottom: 6px; }
.who h1, .view-title { font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 6vw, 2.05rem); line-height: 1.1; letter-spacing: -0.015em; text-wrap: balance; }
.view-title { margin-bottom: 16px; }
.org { color: var(--muted); }
.phone { display: inline-flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: 0.98rem; }
.phone .num { user-select: all; }
.call-cta { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; font-weight: 600; font-size: 0.9rem; }
.call-btn {
  width: 70px; height: 70px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--call); color: var(--call-ink);
  display: grid; place-items: center;
  box-shadow: 0 10px 24px -10px var(--call);
}
.call-btn:hover { filter: brightness(1.07); }
.call-btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card h2 { font-family: var(--display); font-weight: 700; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; }
.count { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.k { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.lead { font-size: 1.04rem; font-weight: 500; }
ul.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.say { background: var(--sunk); border-radius: 12px; padding: 12px 14px; }
.say p { font-size: 1.02rem; }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--call); animation: pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pulse, .live-dot { animation: none; } }
.hist { border-top: 1px solid var(--line); padding-top: 12px; }
.hist:first-of-type { border-top: 0; padding-top: 0; }
.hist summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.hist summary::-webkit-details-marker { display: none; }
.hist-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-when { font-family: var(--mono); font-size: 0.85rem; font-weight: 500; }
.hist-dur { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-left: auto; }
.hist-sum { font-size: 0.93rem; }
.hist-more-label { font-size: 0.82rem; color: var(--call); font-weight: 600; }
.hist[open] .hist-more-label { display: none; }
.hist-more { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.hist-plain { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.hist-plain:first-of-type { border-top: 0; padding-top: 0; }
.danger { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 4px; font-size: 0.9rem; }

/* Results */
.result-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.score { font-family: var(--mono); font-size: 0.9rem; color: var(--muted); }
.score b { font-size: 1.35rem; color: var(--ink); font-weight: 500; }
.next { background: var(--tint-call); border-radius: 12px; padding: 12px 14px; }
.next .k { color: var(--call); }
.talk-bar { height: 10px; border-radius: 999px; background: var(--sunk); overflow: hidden; display: flex; margin: 6px 0 4px; }
.talk-bar span { background: var(--call); }
.talk-legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.obj { padding-block: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.obj:first-of-type { border-top: 0; padding-top: 2px; }
.obj-q { font-weight: 500; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.obj-a { font-size: 0.94rem; color: var(--muted); }
.obj-a b { color: var(--ink); font-weight: 600; }
.msg { white-space: pre-wrap; background: var(--sunk); border-radius: 12px; padding: 12px 14px; }
.subj { font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
.follow { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.follow .msg { align-self: stretch; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--call); border-color: var(--call); }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active::before { display: none; }
.transcript summary { cursor: pointer; font-weight: 600; color: var(--call); }
.lines { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; font-size: 0.94rem; }
.lines b { font-weight: 600; }

/* In-call deck */
.deck {
  background: var(--deck); color: var(--deck-ink);
  border-radius: 28px; padding: 18px 20px 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
}
.deck-top { align-self: stretch; display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.deck-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--deck-muted); display: inline-flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--call); animation: pulse 1.6s ease-in-out infinite; }
.deck .btn { background: var(--deck-2); border-color: transparent; color: var(--deck-ink); }
.deck .btn:hover { filter: brightness(1.15); }
.deck .btn[aria-pressed="true"] { background: var(--deck-ink); color: var(--deck); }
.deck .avatar { background: var(--deck-2); color: var(--deck-ink); width: 64px; height: 64px; font-size: 1.4rem; margin-top: 10px; }
.deck h1 { font-family: var(--display); font-weight: 700; font-size: clamp(1.6rem, 6vw, 2rem); line-height: 1.1; text-wrap: balance; }
.deck-num { font-family: var(--mono); color: var(--deck-muted); }
.call-status { font-size: 0.95rem; color: var(--deck-muted); min-height: 1.5em; }
.call-status.problem { color: var(--deck-ink); background: var(--deck-2); border-radius: 10px; padding: 8px 12px; }
.timer { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 2.6rem; font-weight: 400; letter-spacing: 0.02em; margin: 4px 0 8px; }
.tips { align-self: stretch; text-align: left; background: var(--deck-2); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.tips .k { color: var(--deck-muted); }
.deck-field { align-self: stretch; text-align: left; display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.deck-field label { font-size: 0.86rem; font-weight: 600; color: var(--deck-muted); }
.deck textarea { background: var(--deck-2); color: var(--deck-ink); border-color: transparent; min-height: 110px; }
.deck textarea::placeholder { color: var(--deck-muted); }
.hangup {
  width: 70px; height: 70px; border-radius: 50%; border: 0; cursor: pointer; margin-top: 18px;
  background: var(--hang); color: var(--hang-ink); display: grid; place-items: center;
}
.hangup svg { transform: rotate(135deg); }
.hangup:hover { filter: brightness(1.08); }
.deck-small { font-size: 0.86rem; font-weight: 600; color: var(--deck-muted); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.9rem; }
input[type="text"], input[type="tel"], input[type="password"], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
textarea { resize: vertical; line-height: 1.45; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
#manual-text { min-height: 190px; }
input:focus, textarea:focus { outline: 2px solid var(--call); outline-offset: 0; border-color: transparent; }
.form-err { color: var(--hang); font-size: 0.9rem; font-weight: 500; }
.seg { display: inline-flex; align-self: flex-start; background: var(--sunk); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 0.9rem; padding: 7px 14px; border-radius: 9px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }
.login { max-width: 380px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 18px; }
select {
  font: inherit; font-size: 0.9rem; color: var(--ink); max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
#f-owner { font-size: 16px; padding: 12px 14px; border-radius: 12px; }
.row-btns input.grow { min-width: 0; flex: 1 1 180px; }

/* Team member home */
.me { font-size: 0.9rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.next-card { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.next-card h2 { font-size: 1.25rem; }

/* Admin */
.tabs { display: flex; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { flex: 1 1 auto; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile b { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.7rem; font-weight: 500; line-height: 1.2; }
.tile span { font-size: 0.8rem; color: var(--muted); }
.table-wrap { overflow-x: auto; margin-inline: -4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
th { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }
.item-row { display: flex; align-items: center; gap: 12px; padding-block: 12px; border-top: 1px solid var(--line); }
.item-row:first-child { border-top: 0; padding-top: 0; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-main .sub { color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }
.row-link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; align-self: flex-start; }
.row-link:hover b { text-decoration: underline; }
.item-side { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
@media (max-width: 480px) { .item-row { flex-direction: column; align-items: stretch; } .item-side { justify-content: flex-start; } }
.pin-note { background: var(--tint-call); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pin { font-family: var(--mono); font-size: 1.6rem; letter-spacing: 0.18em; font-weight: 500; }
.import-result { background: var(--sunk); border-radius: 12px; padding: 12px 14px; font-size: 0.92rem; display: flex; flex-direction: column; gap: 6px; }
.import-result ul { margin: 0; padding-left: 18px; }
#import-text { min-height: 130px; font-family: var(--mono); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 0.92rem; font-weight: 500;
  box-shadow: 0 8px 24px var(--shadow); z-index: 20;
}

/* "Put the app on a phone" card. The QR code stays dark on white in both themes so cameras can read it. */
.install { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.qr { flex: none; width: 168px; height: 168px; padding: 8px; border-radius: 14px; background: #ffffff; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: 100%; }
.install-text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
#install-url { overflow-wrap: anywhere; }

/* The re·call mark beside the product name. */
.brand-mark { flex: none; width: 30px; height: 30px; display: block; }

/* re·call wordmark, tagline and the board's mono labels. */
.wordmark { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; color: var(--cream); }
.wordmark b { color: var(--call); font-weight: 800; }
.tagline { font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-top: -8px; }
.k, .list-head, th, .deck-label, .count { font-family: var(--mono); letter-spacing: 0.08em; }
.who h1, .view-title, .deck h1, .card h2 { font-weight: 700; letter-spacing: -0.02em; }
.login .brand { font-size: 2rem; }
.login .brand-mark { width: 40px; height: 40px; }
