:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #667085;
  --line: #d7dde5;
  --blue: #2f6fed;
  --green: #11845b;
  --red: #c73535;
  --amber: #b97914;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.phone-shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.phone-panel,
.log-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(25, 35, 50, 0.08);
}

.phone-panel {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #98a2b3;
}

.state-dot.ok {
  background: var(--green);
}

.state-dot.busy {
  background: var(--amber);
}

.state-dot.error {
  background: var(--red);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span,
.log-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(47, 111, 237, 0.24);
  border-color: var(--blue);
}

.dial-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 112px 112px;
  align-items: end;
  gap: 12px;
  margin: 22px 0 14px;
}

.actions {
  display: flex;
  gap: 12px;
}

.audio-row {
  display: grid;
  grid-template-columns: 150px 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.audio-row audio {
  width: 100%;
  height: 42px;
}

.reference-audio {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.reference-audio span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.reference-audio audio {
  width: 100%;
  height: 42px;
}

.check-row {
  width: fit-content;
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  color: var(--muted);
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

button.secondary {
  background: #475467;
}

button.call {
  background: var(--green);
}

button.hangup {
  background: var(--red);
}

button.answer {
  background: var(--green);
}

button.reject {
  background: var(--red);
}

.incoming-bar {
  display: none;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #f6c94e;
  border-radius: 8px;
}

.incoming-bar.active {
  display: flex;
}

.incoming-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  white-space: nowrap;
}

.caller-id {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.log-panel {
  min-height: 420px;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

pre {
  margin: 0;
  min-height: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: #344054;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 860px) {
  .phone-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .phone-shell {
    width: min(100vw - 20px, 1080px);
    padding: 10px 0;
  }

  .phone-panel {
    padding: 18px;
  }

  .topbar,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-grid,
  .dial-row,
  .audio-row,
  .reference-audio {
    grid-template-columns: 1fr;
  }
}
