/* Call console: a light phone console. Phone-green for live calls, red to hang up.
   Light is the default; dark applies only under :root[data-theme="dark"]. */
:root {
  color-scheme: light;

  --bg:          #f3f5f2;
  --surface:     #ffffff;
  --surface2:    #eaeeea;
  --rule:        #d9e0db;
  --border:      #d9e0db;
  --border2:     #c3ccc6;

  --ink:         #15201a;
  --text:        #15201a;
  --text-mid:    #46524b;
  --text-dim:    #63706a;

  --accent:      #2f4a58;
  --call:        #15803d;
  --call-soft:   #e3f2e8;
  --hangup:      #c62828;
  --hangup-soft: #fbe5e3;
  --danger:      #c62828;
  --warn:        #8a5a00;
  --warn-soft:   #fbefd2;
  --sarah:       #15803d;

  --agent-color: #15803d;
  --agent-ink:   color-mix(in srgb, var(--agent-color) 68%, #15201a);

  --scrim:       rgba(21, 32, 26, 0.5);
  --shadow:      0 1px 2px rgba(21, 32, 26, 0.06), 0 6px 18px rgba(21, 32, 26, 0.08);

  --radius:    8px;
  --radius-sm: 5px;

  --font-ui:   'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --tour-surface: var(--surface);
  --tour-ink: var(--ink);
  --tour-body: var(--text-mid);
  --tour-muted: var(--text-dim);
  --tour-rule: var(--rule);
  --tour-scrim: var(--scrim);
  --tour-accent: var(--call);
  --tour-on-accent: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:          #0d1210;
  --surface:     #151c18;
  --surface2:    #1d2621;
  --rule:        #28332d;
  --border:      #28332d;
  --border2:     #374339;

  --ink:         #e9efeb;
  --text:        #e9efeb;
  --text-mid:    #b4c0b9;
  --text-dim:    #8a978f;

  --accent:      #8fb3c7;
  --call:        #22a455;
  --call-soft:   #14281c;
  --hangup:      #e0524d;
  --hangup-soft: #2d1716;
  --danger:      #ef6a65;
  --warn:        #e3b04a;
  --warn-soft:   #2a2210;
  --sarah:       #34c06a;

  --agent-ink:   color-mix(in srgb, var(--agent-color) 72%, #ffffff);

  --scrim:       rgba(0, 0, 0, 0.62);
  --shadow:      0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);

  --tour-on-accent: #0d1210;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

button, select { font-family: inherit; }
:focus-visible { outline: 2px solid var(--call); outline-offset: 2px; }

/* ── Disclaimer ──────────────────────────────────────────────────────────── */
.disclaimer {
  width: 100%;
  background: var(--warn-soft);
  border-bottom: 1px solid var(--rule);
  padding: 7px 16px;
  font-size: 11.5px;
  color: var(--warn);
  text-align: center;
  letter-spacing: 0.2px;
}

/* ── App shell ───────────────────────────────────────────────────────────── */
#app {
  width: 100%;
  max-width: 480px;
  min-height: calc(100dvh - 34px);
  display: flex;
  flex-direction: column;
  padding-bottom: 32px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  min-width: 0;
}
.brand .mark { width: 20px; height: 20px; color: var(--agent-ink); flex-shrink: 0; }

.header-right { display: flex; gap: 6px; align-items: center; }

.select-pill {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  max-width: 100%;
  outline: none;
}

.btn-pill {
  min-height: 36px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-pill:hover { background: var(--surface2); }
.btn-icon { width: 36px; padding: 0; justify-content: center; font-size: 16px; line-height: 1; }

.menu-wrap { position: relative; }
.menu-btn .chevron { font-size: 10px; }
.menu-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-panel[hidden] { display: none; }
.menu-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px 8px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.menu-field .select-pill { width: 100%; text-transform: none; letter-spacing: 0; }
.menu-item {
  min-height: 40px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.menu-item:hover { background: var(--surface2); }

/* ── Agent picker ────────────────────────────────────────────────────────── */
.agent-picker {
  display: flex;
  gap: 8px;
  padding: 14px 16px 4px;
  justify-content: center;
}

.agt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-width: 72px;
}
.agt-card:hover { background: var(--surface2); }
.agt-card.active {
  border: 2px solid var(--agent-color, var(--call));
  padding: 9px 15px;
  background: color-mix(in srgb, var(--agent-color, var(--call)) 8%, var(--surface));
}

.agt-monogram {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: color-mix(in srgb, var(--agent-color, var(--call)) 68%, var(--ink));
  border: 1.5px solid currentColor;
}
.agt-name  { font-size: 12px; font-weight: 600; color: var(--text); }
.agt-lang  { font-size: 10px; color: var(--text-dim); font-family: var(--font-mono); }

/* ── Agent card + call timer ─────────────────────────────────────────────── */
.agent-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 20px 14px;
  gap: 8px;
}

.avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--agent-color, var(--call));
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.r1 { inset: -6px; }
.r2 { inset: -14px; }
.r3 { inset: -22px; }

.avatar-wrap.speaking .ring { animation: ring-out 1.8s ease-out infinite; }
.avatar-wrap.speaking .r1   { animation-delay: 0s; }
.avatar-wrap.speaking .r2   { animation-delay: 0.35s; }
.avatar-wrap.speaking .r3   { animation-delay: 0.7s; }

@keyframes ring-out {
  0%   { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.15); }
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--agent-color, var(--call)) 12%, var(--surface));
  border: 2px solid var(--agent-color, var(--call));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  color: color-mix(in srgb, var(--agent-color, var(--call)) 68%, var(--ink));
  position: relative;
  z-index: 1;
}

.agent-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin-top: 2px;
}

.call-timer {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.call-timer.live { color: var(--ink); }

.agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--agent-ink);
  background: color-mix(in srgb, var(--agent-color, var(--call)) 12%, var(--surface));
  padding: 4px 12px 4px 9px;
  border-radius: 100px;
  border: 1px solid color-mix(in srgb, var(--agent-color, var(--call)) 30%, var(--surface));
  transition: color 0.3s, background 0.3s;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Transcript ──────────────────────────────────────────────────────────── */
.transcript-wrap {
  flex: 1;
  min-height: 0;
  padding: 0 16px;
  margin-bottom: 4px;
}

.transcript {
  height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.transcript::-webkit-scrollbar { width: 4px; }
.transcript::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}

.transcript-empty {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  margin: auto;
  padding: 40px 0;
}

/* Call-log lines */
.bubble {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.55;
  animation: slide-in 0.18s ease-out;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble.assistant {
  background: color-mix(in srgb, var(--agent-color, var(--call)) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--agent-color, var(--call)) 28%, var(--surface));
  border-left: 3px solid var(--agent-color, var(--call));
  align-self: flex-start;
}

.bubble.user {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-right: 3px solid var(--accent);
  align-self: flex-end;
  text-align: right;
}

.bubble-sender {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 3px;
  font-family: var(--font-mono);
}

.bubble.assistant .bubble-sender { color: var(--agent-ink); }
.bubble.user .bubble-sender       { color: var(--accent); }
.bubble-text { color: var(--text); word-break: break-word; }

/* Tool call line */
.bubble.tool {
  background: var(--surface2);
  border: 1px dashed var(--border2);
  border-radius: var(--radius-sm);
  align-self: flex-start;
  max-width: 96%;
  padding: 8px 12px;
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  font-family: var(--font-mono);
}

.tool-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.tool-check { font-size: 13px; }

.tool-result {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-mid);
  line-height: 1.5;
  border-top: 1px solid var(--rule);
  padding-top: 6px;
}

.tool-result-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 0;
}

.tool-result-key   { color: var(--text-dim); }
.tool-result-value { color: var(--text); font-weight: 500; text-align: right; font-family: var(--font-mono); font-size: 11px; }

/* Cursor */
.cursor {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--agent-ink);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 0.7s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ── Collapsible sections ────────────────────────────────────────────────── */
.collapsible-section {
  margin: 0 16px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  overflow: hidden;
}

.section-header {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--text-mid);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-align: left;
  transition: background 0.15s;
}
.section-header:hover { background: var(--surface2); }

.chevron { transition: transform 0.2s; font-size: 12px; }
.section-header[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.section-body { padding: 10px 14px 12px; background: var(--surface); }

/* Sentiment chart */
.chart-wrap {
  height: 90px;
  position: relative;
}

/* ── Insight strip ───────────────────────────────────────────────────────── */
.dash-strip {
  display: flex;
  gap: 7px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.dash-strip::-webkit-scrollbar { display: none; }

.dash-chip {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  min-width: 76px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-label {
  font-size: 9.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
}

.dash-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.dash-esc { border-color: var(--danger); background: var(--hangup-soft); }
.dash-esc .dash-val { color: var(--danger); }

/* ── Mic area ────────────────────────────────────────────────────────────── */
.mic-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px 20px 0;
}

.waveform {
  display: none;
  align-items: center;
  gap: 3px;
  height: 44px;
}
.waveform.active { display: flex; }
.waveform span {
  display: inline-block;
  width: 3px;
  min-height: 4px;
  background: var(--call);
  border-radius: 2px;
  transition: height 0.04s ease;
}
.waveform.fallback span { animation: wave 1s ease-in-out infinite; }
.waveform.fallback span:nth-child(1) { animation-delay: 0.00s; }
.waveform.fallback span:nth-child(2) { animation-delay: 0.12s; }
.waveform.fallback span:nth-child(3) { animation-delay: 0.24s; }
.waveform.fallback span:nth-child(4) { animation-delay: 0.36s; }
.waveform.fallback span:nth-child(5) { animation-delay: 0.24s; }
.waveform.fallback span:nth-child(6) { animation-delay: 0.12s; }
.waveform.fallback span:nth-child(7) { animation-delay: 0.00s; }

@keyframes wave {
  0%,100% { height: 4px; }
  50%      { height: 36px; }
}

/* Call button: green to call, red to hang up */
.mic-btn {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: none;
  background: var(--call);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.25s;
  box-shadow: var(--shadow);
  position: relative;
  outline: none;
}
.mic-btn:focus-visible { outline: 2px solid var(--call); outline-offset: 4px; }
.mic-btn:not(:disabled):hover { transform: scale(1.05); }
.mic-btn:not(:disabled):active { transform: scale(0.96); }

.mic-btn.recording {
  background: var(--hangup);
  animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.mic-btn.processing {
  background: var(--border2);
  box-shadow: none;
  cursor: not-allowed;
  animation: none;
}

/* ConvAI: session active, always listening: the call is live, so the button hangs up */
.mic-btn.active {
  background: var(--hangup);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--hangup) 16%, transparent),
              0 0 0 12px color-mix(in srgb, var(--hangup) 7%, transparent);
  animation: pulse-agent 2s ease-in-out infinite;
}
.mic-btn.speaking {
  background: var(--hangup);
  cursor: pointer;
  animation: none;
}
@keyframes pulse-agent {
  0%, 100% { box-shadow: 0 0 0 6px  color-mix(in srgb, var(--hangup) 16%, transparent),
                         0 0 0 12px color-mix(in srgb, var(--hangup) 7%, transparent); }
  50%       { box-shadow: 0 0 0 9px  color-mix(in srgb, var(--hangup) 20%, transparent),
                         0 0 0 18px color-mix(in srgb, var(--hangup) 8%, transparent); }
}

.mic-btn.playing {
  background: var(--agent-color, var(--call));
  cursor: pointer;
  animation: none;
}

.icon-mic, .icon-stop, .icon-interrupt { width: 30px; height: 30px; }

.spin {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mic-label {
  font-size: 13.5px;
  color: var(--text-mid);
  font-weight: 500;
  letter-spacing: 0.1px;
  min-height: 20px;
  text-align: center;
}

.customer-card {
  margin: 0 auto 6px;
  max-width: 340px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.customer-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  white-space: nowrap;
}
.customer-card-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.customer-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.customer-card-detail {
  font-size: 11px;
  color: var(--text-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.try-saying {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  transition: opacity 0.3s;
}
.try-saying.hidden { display: none; }
.try-saying-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.try-saying-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.try-chip {
  font-size: 12px;
  color: var(--text-mid);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 4px 12px;
  font-style: italic;
}

.mic-options {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.opt-btn {
  min-height: 36px;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text-mid);
  border-radius: var(--radius-sm);
  padding: 0 13px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.opt-btn:hover { background: var(--surface2); color: var(--text); }
.opt-btn.active {
  background: var(--call-soft);
  border-color: var(--call);
  color: var(--call);
}

.opt-btn.vad-active {
  background: var(--hangup-soft);
  border-color: var(--hangup);
  color: var(--hangup);
  animation: vad-ring 1.8s ease-in-out infinite;
}
@keyframes vad-ring {
  0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hangup) 25%, transparent); }
  50%      { box-shadow: 0 0 0 5px transparent; }
}

/* ── Call history ────────────────────────────────────────────────────────── */
.history-empty {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px 0;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
}
.history-item:last-child { border-bottom: none; }

.history-monogram {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
  border: 1.5px solid currentColor;
}

.history-info { flex: 1; min-width: 0; }
.history-top {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}
.history-name  { font-weight: 600; color: var(--text); white-space: nowrap;
                 overflow: hidden; text-overflow: ellipsis; }
.history-time  { color: var(--text-dim); font-size: 11px; flex-shrink: 0; font-family: var(--font-mono); }
.history-sub   { color: var(--text-mid); }
.history-pills { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

.history-pill {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 100px;
  border: 1px solid var(--border2);
  color: var(--text-dim);
}
.history-pill.resolved { border-color: var(--call); color: var(--call); }
.history-pill.escalated { border-color: var(--danger); color: var(--danger); }
.history-stars { color: var(--warn); font-size: 11px; }

/* ── Survey modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 28px 32px;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  animation: slide-up 0.25s ease;
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

.stars {
  display: flex;
  gap: 6px;
}

.star {
  background: none;
  border: none;
  font-size: 30px;
  color: var(--border2);
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
  padding: 2px;
  line-height: 1;
}
.star.lit   { color: var(--warn); }
.star:hover { transform: scale(1.15); }

.survey-q {
  font-size: 14px;
  color: var(--text-mid);
  text-align: center;
}

.survey-resolve-btns { display: flex; gap: 10px; }

.survey-resolve {
  min-height: 40px;
  padding: 0 24px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border2);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  color: var(--text-mid);
}
.survey-resolve.yes:hover { background: var(--call-soft); border-color: var(--call); color: var(--call); }
.survey-resolve.no:hover  { background: var(--hangup-soft); border-color: var(--danger); color: var(--danger); }
.survey-resolve.selected-yes { background: var(--call-soft); border-color: var(--call); color: var(--call); }
.survey-resolve.selected-no  { background: var(--hangup-soft); border-color: var(--danger); color: var(--danger); }

.survey-skip {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 32px;
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */
#loadOverlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 50;
  transition: opacity 0.4s;
}

.load-logo { color: var(--call); animation: spin 2s linear infinite; }
.load-logo .mark { width: 40px; height: 40px; display: block; }
.load-text  { font-size: 15px; color: var(--text-mid); }

/* ── Keyboard hint ───────────────────────────────────────────────────────── */
.kbd-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0 0;
  letter-spacing: 0.2px;
}

kbd {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
}

/* ── Crash screen ────────────────────────────────────────────────────────── */
.crash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--ink);
}
.crash-card {
  width: 100%;
  max-width: 420px;
  padding: 26px 22px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-top: 4px solid var(--hangup);
  border-radius: var(--radius);
}
.crash-card h1 { font-size: 22px; font-weight: 600; }
.crash-card p { margin-top: 8px; font-size: 14px; line-height: 1.55; color: var(--text-mid); }
.crash-card .crash-detail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  overflow-wrap: anywhere;
}
.crash-card button {
  margin-top: 18px;
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--call);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ── Guided tour ─────────────────────────────────────────────────────────── */
.tour-layer { position: fixed; inset: 0; z-index: 900; }
.tour-spot {
  position: fixed;
  border-radius: var(--radius);
  box-shadow: 0 0 0 9999px var(--tour-scrim), 0 0 0 2px var(--tour-accent);
  pointer-events: none;
  transition: top 0.2s, left 0.2s, width 0.2s, height 0.2s;
}
.tour-card {
  position: fixed;
  width: min(340px, calc(100vw - 24px));
  background: var(--tour-surface);
  color: var(--tour-ink);
  border: 1px solid var(--tour-rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px 14px;
}
.tour-card.sheet {
  top: auto !important;
  left: 12px !important;
  right: 12px;
  bottom: 12px;
  width: auto;
}
.tour-count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--tour-muted);
}
.tour-title { margin-top: 4px; font-size: 17px; font-weight: 600; }
.tour-body { margin-top: 6px; font-size: 14px; line-height: 1.55; color: var(--tour-body); }
.tour-actions { margin-top: 14px; display: flex; align-items: center; gap: 8px; }
.tour-gap { flex: 1; }
.tour-actions button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--tour-rule);
  background: transparent;
  color: var(--tour-ink);
  font-size: 13.5px;
  cursor: pointer;
}
.tour-actions button[hidden] { display: none; }
.tour-actions .tour-skip { border-color: transparent; color: var(--tour-muted); padding: 0 6px; }
.tour-actions .tour-next {
  background: var(--tour-accent);
  border-color: var(--tour-accent);
  color: var(--tour-on-accent);
  font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .agent-name { font-size: 18px; }
  .call-timer { font-size: 34px; }
  .mic-btn    { width: 70px; height: 70px; }
  .icon-mic, .icon-stop, .icon-interrupt { width: 26px; height: 26px; }
  .agt-card   { padding: 8px 12px; min-width: 60px; }
  .agt-card.active { padding: 7px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
