:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --border: #d1d5db;
  --primary: #2563eb;
  --primary-text: #ffffff;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --secondary-bg: #e5e7eb;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --focus: #1d4ed8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --secondary-bg: #334155;
    --error-bg: #450a0a;
    --error-text: #fecaca;
    --focus: #93c5fd;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

.shell {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.agent-name {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-text {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.dot-offline { background: var(--muted); }
.dot-connecting { background: var(--warning); }
.dot-registered { background: var(--success); }
.dot-break { background: var(--warning); }

.banner-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.9rem;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel[hidden],
[hidden] {
  display: none !important;
}

.center {
  align-items: center;
  text-align: center;
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.caller-id {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  word-break: break-all;
}

.did-label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.timer {
  margin: 0;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.dial-row {
  display: flex;
  gap: 8px;
}

.dial-input {
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.keypad button {
  padding: 14px 0;
  font-size: 1.2rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--secondary-bg);
  color: var(--text);
  cursor: pointer;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-success { background: var(--success); color: #ffffff; }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-secondary { background: var(--secondary-bg); color: var(--text); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }

.btn-secondary[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-text);
}

.btn-lg { padding: 14px 18px; font-size: 1.05rem; }
.btn-xl { padding: 16px 22px; font-size: 1.1rem; min-width: 130px; }
.full-width { width: 100%; }

.call-actions,
.control-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.actions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
