:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-strong: #eef3f4;
  --text: #172026;
  --muted: #5b6972;
  --border: #cfd9de;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --danger: #b42318;
  --warning: #b45309;
  --ok: #15803d;
  --focus: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
}

button:hover:not(:disabled) {
  background: var(--primary-strong);
}

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

button:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 70%);
  outline-offset: 2px;
}

.app-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.call-surface {
  display: grid;
  gap: 20px;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 17px;
}

.status-badge {
  min-width: 116px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 12px;
  text-align: center;
}

.status-badge.online {
  background: #dcfce7;
  color: var(--ok);
}

.status-badge.calling {
  background: #fef3c7;
  color: var(--warning);
}

.identity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.call-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#hangupButton {
  background: var(--danger);
}

#hangupButton:hover:not(:disabled) {
  background: #8f1d14;
}

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

.audio-panel,
.event-log {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.audio-panel {
  min-height: 152px;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.audio-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.audio-state {
  min-height: 28px;
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 7px 10px;
}

.event-log {
  overflow: hidden;
}

.log-header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
}

#clearLogButton {
  min-height: 34px;
  background: #334155;
  padding: 0 12px;
}

#eventLog {
  height: 220px;
  margin: 0;
  overflow: auto;
  padding: 12px 18px 16px 34px;
}

#eventLog li {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .toolbar,
  .identity-grid,
  .audio-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
  }

  .status-badge {
    width: 100%;
  }

  .call-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 26px;
  }

  .call-controls {
    grid-template-columns: 1fr;
  }
}
