:root {
  --bg: #0f172a;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --key: #f1f5f9;
  --key-hover: #e2e8f0;
  --primary: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.phone {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  padding: 20px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.brand { font-weight: 700; font-size: 18px; }

.status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--key);
  color: var(--muted);
}
.status::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: currentColor;
  vertical-align: 1px;
}
.status.ok { color: var(--green); background: #dcfce7; }
.status.pending { color: var(--amber); background: #fef3c7; }
.status.error { color: var(--red); background: #fee2e2; }

[hidden] { display: none !important; }

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

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); }

input[type=text], input:not([type]), input[type=password], .number {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  color: #fff;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.primary { background: var(--primary); }
.btn.call { background: var(--green); }
.btn.hang { background: var(--red); }
.btn.toggle { background: var(--key); color: var(--text); }
.btn.toggle[aria-pressed=true] { background: var(--amber); color: #fff; }

.link {
  background: none; border: 0; padding: 0;
  color: var(--primary); font: inherit; font-size: 13px; cursor: pointer;
}

.error { color: var(--red); font-size: 14px; margin: 0; }

.me {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--muted); margin-bottom: 14px;
}
.me strong { color: var(--text); }

.call-info {
  text-align: center;
  background: var(--key);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}
.peer { font-size: 20px; font-weight: 700; word-break: break-all; }
.state { font-size: 14px; color: var(--muted); margin-top: 2px; }
.timer { font-variant-numeric: tabular-nums; font-size: 14px; margin-top: 4px; }

.number-row { display: flex; gap: 8px; margin-bottom: 14px; }
.number { flex: 1; min-width: 0; font-size: 22px; text-align: center; letter-spacing: 1px; }
.back {
  border: 0; background: var(--key); border-radius: 10px;
  width: 52px; font-size: 20px; cursor: pointer; color: var(--muted);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.key {
  border: 0;
  background: var(--key);
  border-radius: 14px;
  height: 58px;
  cursor: pointer;
  font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  user-select: none;
}
.key:hover { background: var(--key-hover); }
.key:active { transform: scale(.97); }
.key .d { font-size: 22px; font-weight: 600; line-height: 1; }
.key .l { font-size: 10px; letter-spacing: 2px; color: var(--muted); margin-top: 3px; min-height: 12px; }

.actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
#incomingActions { grid-template-columns: 1fr 1fr; }
.actions.three { grid-template-columns: 1fr 1fr 1.3fr; }

.msg { min-height: 20px; font-size: 13px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.msg.error { color: var(--red); }

.me-actions { display: flex; gap: 14px; }

.settings { display: flex; flex-direction: column; gap: 12px; }
.settings .me { margin-bottom: 2px; }
.settings .title { color: var(--text); font-size: 16px; }
.settings select {
  font: inherit; font-size: 15px; font-weight: 400;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text); width: 100%;
}
.settings input[type=range] { width: 100%; accent-color: var(--primary); }
.settings .val { font-weight: 400; color: var(--muted); }
.settings label { flex-direction: column; }
.settings label.check { flex-direction: row; }

.meter { height: 8px; background: var(--key); border-radius: 999px; overflow: hidden; margin-top: -4px; }
.meter div { height: 100%; width: 0; background: var(--green); transition: width .08s linear; }

.note { font-size: 12px; color: var(--muted); margin: -4px 0 0; line-height: 1.4; }

.opts { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.opts legend { font-size: 13px; font-weight: 600; padding: 0 4px; }

.foot { color: #94a3b8; font-size: 13px; margin-top: 14px; }
.foot strong { color: #e2e8f0; }
