:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --bg: #06100e;
  --surface: #0d1a17;
  --surface-raised: #13231f;
  --line: rgba(174, 225, 205, .14);
  --text: #f2faf7;
  --muted: #8fa9a0;
  --green: #52e1ad;
  --green-deep: #147d5d;
  --red: #ff6f75;
  --shadow: 0 30px 80px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 5%, rgba(40, 158, 116, .20), transparent 32rem),
    radial-gradient(circle at 85% 90%, rgba(26, 91, 74, .18), transparent 35rem),
    var(--bg);
}

button, input { font: inherit; }
button { color: inherit; }

.shell {
  width: min(100% - 32px, 560px);
  margin: 0 auto;
  padding: 34px 0 26px;
}

.brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand p, .eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 750;
  letter-spacing: .14em;
}

.brand h1 { margin: 0; font-size: 1.42rem; letter-spacing: -.03em; }

.mark {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(82, 225, 173, .3);
  border-radius: 14px;
  background: rgba(82, 225, 173, .08);
}

.mark span {
  position: absolute;
  width: 11px;
  height: 16px;
  border: 2px solid var(--green);
  border-radius: 100% 0 100% 0;
}
.mark span:nth-child(1) { left: 10px; top: 7px; transform: rotate(-30deg); }
.mark span:nth-child(2) { right: 10px; top: 7px; transform: rotate(120deg); }
.mark span:nth-child(3) { left: 10px; bottom: 7px; transform: rotate(-120deg); }
.mark span:nth-child(4) { right: 10px; bottom: 7px; transform: rotate(30deg); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  font-size: .75rem;
  font-weight: 700;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #67766f; }
.status-pill.online { color: #baf7de; border-color: rgba(82,225,173,.3); }
.status-pill.online .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(82,225,173,.12); }
.status-pill.connecting .status-dot { background: #ffc66e; animation: pulse 1s infinite; }
.status-pill.ringing .status-dot { background: var(--green); animation: pulse .6s infinite; }

.phone {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(155deg, rgba(19, 35, 31, .98), rgba(8, 19, 16, .98));
  box-shadow: var(--shadow);
}

.login-panel, .dialer-panel { padding: 30px; }
.login-panel h3 { margin: 3px 0 8px; font-size: 1.65rem; letter-spacing: -.035em; }
.muted-copy { margin: 0 0 25px; color: var(--muted); line-height: 1.55; }
.muted-copy strong { color: var(--text); }

.password-field { display: grid; gap: 8px; color: #c8d9d3; font-size: .83rem; font-weight: 650; }
.input-wrap { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: rgba(2, 9, 7, .55); }
.input-wrap:focus-within { border-color: rgba(82, 225, 173, .65); box-shadow: 0 0 0 3px rgba(82, 225, 173, .1); }
.input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 13px 14px; color: var(--text); background: transparent; }
.input-action { border: 0; padding: 0 14px; color: var(--green); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 700; }

.button {
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-radius: 13px;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 800;
}
.button.primary { color: #04110d; background: var(--green); box-shadow: 0 12px 28px rgba(82, 225, 173, .17); }
.button.primary:hover { filter: brightness(1.06); }
.form-error { min-height: 1.25em; margin: 12px 0 0; color: #ff9ca1; font-size: .8rem; }

.call-display { padding: 12px 0 20px; text-align: center; }
.call-display input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 5px 0;
  color: var(--text);
  background: transparent;
  text-align: center;
  font-size: clamp(2rem, 9vw, 3.1rem);
  font-weight: 500;
  letter-spacing: .035em;
}
.call-display input::placeholder { color: rgba(143, 169, 160, .45); }
.call-display input:disabled { opacity: 1; }
.timer { margin: 6px 0 2px; color: var(--green); font-variant-numeric: tabular-nums; font-size: .92rem; }
.peer { min-height: 1.2em; margin: 0; color: var(--muted); font-size: .78rem; }

.incoming {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid rgba(82,225,173,.25);
  border-radius: 18px;
  padding: 14px 15px;
  background: rgba(82,225,173,.07);
}
.incoming span { display: block; margin-bottom: 3px; color: var(--muted); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; }
.incoming strong { font-size: 1rem; }
.incoming-actions { display: flex; gap: 8px; }
.round { width: 42px; height: 42px; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.15rem; font-weight: 900; }
.round.answer { color: #04110d; background: var(--green); }
.round.danger { color: white; background: var(--red); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.keypad button {
  min-height: 62px;
  border: 1px solid rgba(174,225,205,.1);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255,255,255,.035);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.keypad button:hover { background: rgba(82,225,173,.1); }
.keypad button:active { transform: scale(.96); }
.keypad strong { display: block; font-size: 1.32rem; font-weight: 600; }
.keypad span { display: block; min-height: 1em; color: var(--muted); font-size: .55rem; letter-spacing: .12em; }
.keypad.in-call button { border-color: rgba(82,225,173,.16); }

.primary-actions {
  display: grid;
  grid-template-columns: 1fr 86px 1fr;
  align-items: center;
  gap: 13px;
  margin: 24px 0 16px;
}
.tool-button {
  display: grid;
  justify-items: center;
  gap: 5px;
  border: 0;
  padding: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: .7rem;
}
.tool-button:disabled { opacity: .35; cursor: not-allowed; }
.tool-button.active { color: var(--green); }
.tool-icon { display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-weight: 750; }
.call-button { width: 78px; height: 78px; border: 0; border-radius: 50%; color: #03100c; background: var(--green); cursor: pointer; box-shadow: 0 14px 36px rgba(82,225,173,.23); font-size: 1.8rem; }
.call-button:disabled { opacity: .35; cursor: not-allowed; }
.call-button.hangup { color: white; background: var(--red); transform: rotate(135deg); box-shadow: 0 14px 36px rgba(255,111,117,.2); }

.session-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 15px; color: var(--muted); font-size: .68rem; }
.link-button { border: 0; padding: 5px 0; color: #c5dad2; background: transparent; cursor: pointer; font-size: .72rem; text-decoration: underline; text-underline-offset: 3px; }

.diagnostics { border-top: 1px solid var(--line); padding: 14px 30px 18px; color: var(--muted); font-size: .72rem; }
.diagnostics summary { cursor: pointer; user-select: none; }
.diagnostics pre { max-height: 150px; overflow: auto; margin: 12px 0 0; border-radius: 12px; padding: 12px; color: #b7cdc5; background: rgba(0,0,0,.2); white-space: pre-wrap; font: .68rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }

footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 15px; padding: 0 5px; color: #607a70; font-size: .66rem; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@keyframes pulse { 50% { opacity: .35; transform: scale(.85); } }

@media (max-width: 500px) {
  .shell { width: 100%; padding: 20px 12px; }
  .brand { padding: 0 4px; }
  .brand p { display: none; }
  .brand h1 { font-size: 1.2rem; }
  .mark { width: 38px; height: 38px; }
  .phone { border-radius: 24px; }
  .login-panel, .dialer-panel { padding: 24px 20px; }
  .diagnostics { padding-inline: 20px; }
  footer { display: grid; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
