*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #111827;
  --surface: #1F2937;
  --surface2:#374151;
  --border:  #374151;
  --accent:  #3B82F6;
  --text:    #F9FAFB;
  --muted:   #9CA3AF;
  --green:   #22C55E;
  --red:     #EF4444;
  --amber:   #F59E0B;
  --mono:    'Consolas', 'SF Mono', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen { display: flex; flex-direction: column; flex: 1; }
.hidden { display: none !important; }

/* ── Setup ─────────────────────────────────────────────────── */
#screen-setup {
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
}

.setup-logo { font-size: 48px; line-height: 1; }
.setup-title { font-size: 18px; font-weight: 700; }
.setup-sub   { font-size: 13px; color: var(--muted); }

#screen-setup select {
  width: 100%;
  max-width: 240px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  margin-top: 8px;
}

/* ── Main screen ───────────────────────────────────────────── */
#screen-main {
  padding: 0;
  position: relative;
}

/* ── Status bar ────────────────────────────────────────────── */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.statusbar-right { display: flex; align-items: center; gap: 8px; }

.ramal-badge {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: .03em;
}

/* Status dot */
.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-green { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.dot-red   { background: var(--red);   box-shadow: 0 0 0 3px rgba(239,68,68,.25); }
.dot-gray  { background: var(--muted); }
.dot-amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(245,158,11,.25); }

/* ── Overlays ──────────────────────────────────────────────── */
.overlay {
  position: absolute;
  inset: 52px 0 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  z-index: 10;
}

.call-icon  { font-size: 40px; }
.call-number {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}
.call-label { font-size: 12px; color: var(--muted); }
.call-timer {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .05em;
}

.transfer-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}

.transfer-row select {
  flex: 1;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}

/* ── Dialpad ───────────────────────────────────────────────── */
#dialpad {
  padding: 16px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

#phone-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  outline: none;
  transition: border-color .15s;
}

#phone-input:focus { border-color: var(--accent); }

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

.digit {
  padding: 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background .1s;
  line-height: 1;
  text-align: center;
}

.digit sub {
  display: block;
  font-size: 8px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: .08em;
  margin-top: 1px;
}

.digit:hover  { background: var(--surface2); }
.digit:active { background: var(--accent); color: #fff; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
}

.btn-primary, .btn-call, .btn-answer, .btn-reject,
.btn-hangup, .btn-mute, .btn-transfer {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  transition: opacity .15s, transform .1s;
}

.btn-primary:active, .btn-call:active,
.btn-answer:active, .btn-reject:active,
.btn-hangup:active { transform: scale(.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  max-width: 240px;
  padding: 12px;
}

.btn-call {
  background: var(--green);
  color: #fff;
  width: 100%;
  font-size: 15px;
  padding: 13px;
}

.btn-call:disabled {
  background: var(--surface2);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-answer  { background: var(--green); color: #fff; flex: 1; }
.btn-reject  { background: var(--red);   color: #fff; flex: 1; }
.btn-hangup  { background: var(--red);   color: #fff; flex: 1; padding: 12px 28px; }
.btn-mute    { background: var(--surface2); color: var(--text); padding: 12px 18px; }
.btn-transfer { background: var(--accent);  color: #fff; white-space: nowrap; padding: 8px 14px; font-size: 13px; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.btn-icon:hover { color: var(--text); }
.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  line-height: 1;
}
.btn-link:hover { color: var(--text); }
