:root {
  color-scheme: dark;
  --bg: #141414;
  --surface: #242424;
  --surface-2: #303030;
  --disc: #3a3a3a;
  --text: #ffffff;
  --muted: #9aa0a6;
  --accent: #ffd400;
  --green: #2e9e4f;
  --red: #d93025;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { min-height: 44px; border: 0; color: var(--text); background: transparent; cursor: pointer; }
.hidden { display: none !important; }
.login {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 28px;
}
.brand {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #101010;
  font-size: 28px;
  font-weight: 800;
}
.login h1 { margin: 0; font-size: 40px; letter-spacing: 0; }
.login form { display: grid; gap: 12px; max-width: 420px; }
.login input, .login button, .search, .dial-input, .composer input {
  border-radius: 8px;
  border: 1px solid #3b3b3b;
  background: var(--surface);
  color: var(--text);
  min-height: 50px;
  padding: 0 14px;
}
.login button, .composer button {
  background: var(--accent);
  color: #101010;
  font-weight: 750;
}
.error, .notice { color: #ffb4ab; min-height: 22px; margin: 0; text-align: center; }
.shell {
  min-height: 100vh;
  padding-bottom: 78px;
  max-width: 560px;
  margin: 0 auto;
}
.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 52px 1fr 48px;
  align-items: center;
  padding: env(safe-area-inset-top) 16px 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: 0; }
.avatar-wrap { position: relative; width: 44px; height: 44px; }
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  font-weight: 800;
}
.dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 13px;
  height: 13px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: #777;
}
.dot.online { background: var(--green); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); font-size: 22px; }
.menu {
  position: absolute;
  right: 12px;
  top: 62px;
  background: var(--surface);
  border: 1px solid #3b3b3b;
  border-radius: 8px;
  overflow: hidden;
  z-index: 30;
}
.menu button { display: block; min-width: 136px; text-align: left; padding: 0 14px; }
.subtabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 0 10px;
}
.subtabs button {
  color: var(--muted);
  border-bottom: 3px solid transparent;
  font-size: 14px;
}
.subtabs button.active { color: var(--text); border-color: var(--accent); }
.subtabs button:disabled { color: #5d6267; }
.caller-id {
  color: var(--muted);
  padding: 12px 20px;
  font-size: 14px;
}
.bottom-view, .phone-view { padding: 0 16px; }
.dial-input-row {
  display: grid;
  grid-template-columns: 1fr 50px;
  gap: 10px;
  align-items: center;
}
.dial-input { width: 100%; text-align: center; font-size: 20px; background: transparent; border-color: transparent; }
.suggestions { min-height: 44px; }
.suggestion, .row {
  display: grid;
  gap: 4px;
  padding: 12px 4px;
  border-bottom: 1px solid #2e2e2e;
}
.suggestion button, .row button { text-align: left; padding: 0; }
.meta { color: var(--muted); font-size: 13px; }
.dialpad {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 1fr));
  gap: 13px;
  justify-items: center;
  margin: 8px auto 18px;
  max-width: 360px;
}
.key {
  width: clamp(74px, 22vw, 92px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--disc);
  display: grid;
  place-items: center;
}
.digit { display: block; font-size: 31px; line-height: 30px; letter-spacing: 0; }
.letters { display: block; height: 14px; color: var(--muted); font-size: 10px; letter-spacing: 1px; }
.call-btn, .hang, .answer {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto;
  background: var(--green);
  font-size: 28px;
}
.hang { background: var(--red); width: 76px; font-size: 16px; padding: 0 10px; }
.answer { font-size: 16px; }
.list { display: grid; gap: 2px; }
.empty { color: var(--muted); text-align: center; padding: 70px 0; }
.bottom-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #1b1b1b;
  border-top: 1px solid #2e2e2e;
  z-index: 12;
}
.bottom-bar button { color: var(--muted); font-size: 12px; position: relative; }
.bottom-bar button.active { color: var(--accent); }
.badge {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-size: 11px;
}
.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.97);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}
.call-card { width: min(420px, 100%); text-align: center; display: grid; gap: 20px; }
.call-name { font-size: 31px; min-height: 39px; }
.call-number, .call-state { color: var(--muted); }
.incoming-actions, .call-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; justify-items: center; }
.call-actions { grid-template-columns: repeat(3, 1fr); }
.call-actions button, .plain, .settings button {
  background: var(--surface);
  border-radius: 8px;
  padding: 0 14px;
}
.compact { max-width: 270px; gap: 8px; }
.compact .key { width: 64px; }
.thread { display: grid; gap: 12px; }
.messages { min-height: 45vh; display: grid; align-content: end; gap: 8px; }
.bubble { max-width: 82%; padding: 10px 12px; border-radius: 8px; background: var(--surface); }
.bubble.outbound { justify-self: end; background: #4a4210; }
.composer { display: grid; grid-template-columns: 1fr 82px; gap: 8px; position: sticky; bottom: 82px; background: var(--bg); padding: 8px 0; }
.search { width: 100%; margin: 8px 0 12px; }
.settings { display: grid; gap: 18px; color: var(--muted); }
.settings h2 { margin: 10px 0 0; color: var(--text); font-size: 18px; }
@media (max-width: 360px) {
  .bottom-view, .phone-view { padding: 0 10px; }
  .dialpad { gap: 9px; }
  .key { width: 70px; }
}

/* review 9/20: phone sub-tabs + caller-ID only on the Phone tab; keep tab labels on one line */
body.not-phone .subtabs, body.not-phone .caller-id { display: none; }
.subtabs button { white-space: nowrap; }
