:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f6fb;
  color: #101828;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --success: #16a34a;
  --danger: #dc2626;
  --muted: #64748b;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #f3f6fb; }
body { overscroll-behavior: none; }
button, input { font: inherit; }
button { touch-action: manipulation; }
.hidden { display: none !important; }
.sr-only { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
#ccp-container { position: fixed; left: -10000px; top: 0; width: 400px; height: 700px; opacity: .01; pointer-events: none; }
#app { min-height: 100dvh; padding-bottom: max(20px, env(safe-area-inset-bottom)); }

.topbar {
  min-height: 78px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  background: #111827;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.topbar p { margin: 2px 0 0; color: #a5b4fc; font-size: 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(145deg, #818cf8, #4338ca); display: grid; place-items: center; font-weight: 800; }
.connection-dot { margin-left: auto; width: 11px; height: 11px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 4px #f59e0b22; }
.connection-dot.ready { background: #22c55e; box-shadow: 0 0 0 4px #22c55e22; }
.connection-dot.error { background: #ef4444; }

.screen { padding: 18px; max-width: 520px; margin: 0 auto; }
.centered { min-height: calc(100dvh - 82px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.centered h2 { font-size: 20px; margin: 24px 0 5px; }
.centered p { color: var(--muted); margin: 0 0 24px; }
.spinner { width: 52px; height: 52px; border: 5px solid #c7d2fe; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: white; border-radius: 20px; padding: 18px; box-shadow: 0 10px 30px #0f172a0d; border: 1px solid #e8edf5; }
.agent-card { display: flex; align-items: center; gap: 13px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: #e0e7ff; color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; }
.agent-copy h2 { margin: 0 0 5px; font-size: 17px; }
.status-row { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; }
.status-dot.available { background: #22c55e; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 0; padding: 4px; border-radius: 14px; background: #e6eaf2; }
.segmented button { border: 0; border-radius: 11px; padding: 12px; background: transparent; color: #475569; font-weight: 700; }
.segmented button.selected { color: var(--brand-dark); background: white; box-shadow: 0 2px 8px #0f172a12; }

.eyebrow { margin: 0 0 10px; color: #475569; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
#phone-number { width: 100%; border: 1px solid #ccd5e3; border-radius: 14px; padding: 13px; text-align: center; font-size: 23px; font-weight: 750; outline: none; }
#phone-number:focus { border-color: #6366f1; box-shadow: 0 0 0 3px #6366f122; }
.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 15px 0; }
.dialpad button { min-height: 52px; border: 1px solid #d8dfeb; border-radius: 14px; background: #f8fafc; color: #1e293b; font-size: 21px; font-weight: 650; }
.dialpad button:active { background: #e0e7ff; transform: scale(.97); }
.button { width: 100%; border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 800; cursor: pointer; }
.button.primary { background: var(--brand); color: white; max-width: 320px; }
.button.call { background: var(--success); color: white; font-size: 16px; }

.overlay { position: fixed; inset: 0; z-index: 20; max-width: none; margin: 0; padding: calc(84px + env(safe-area-inset-top)) 24px max(30px, env(safe-area-inset-bottom)); background: #0f172af5; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.overlay p { color: #cbd5e1; margin: 18px 0 4px; }
.overlay h2 { font-size: 28px; margin: 4px 0; }
.caller-avatar { width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; font-size: 57px; background: #e0e7ff; }
.caller-avatar.small { width: 88px; height: 88px; font-size: 45px; }
.muted-copy { font-size: 13px; }
.incoming-actions, .call-actions { display: flex; align-items: center; justify-content: center; gap: 34px; margin-top: 44px; }
.round-button { width: 72px; height: 72px; border: 0; border-radius: 50%; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 24px; }
.round-button small { font-size: 11px; font-weight: 700; }
.round-button.success { background: var(--success); }
.round-button.danger { background: var(--danger); }
.round-button.neutral { background: #334155; }
.round-button.active { background: #d97706; }
.in-call time { color: #cbd5e1; font-size: 20px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.call-actions { gap: 20px; margin-top: 34px; }
.dtmf-panel { width: min(330px, 100%); margin-top: 20px; padding: 14px; border-radius: 18px; background: #1e293b; }
.dialpad.compact { margin: 0 0 8px; }
.dialpad.compact button { min-height: 46px; background: #334155; border-color: #475569; color: white; }
.text-button { border: 0; background: none; color: #a5b4fc; padding: 10px; font-weight: 700; }

.toast { position: fixed; left: 20px; right: 20px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 50; max-width: 480px; margin: auto; border-radius: 13px; padding: 13px 15px; background: #1e293b; color: white; box-shadow: 0 8px 30px #0004; text-align: center; }
.toast.error { background: #9f1239; }

@media (min-width: 700px) and (orientation: landscape) {
  .screen:not(.overlay) { max-width: 700px; }
  .dial-card { display: grid; grid-template-columns: 1fr 300px; gap: 12px 24px; align-items: center; }
  .dial-card .eyebrow, .dial-card #phone-number, .dial-card .button { grid-column: 1; }
  .dial-card #dialpad { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
}
