*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

h2 {
  font-size: 1.4em;
  text-align: center;
}

code {
  word-break: break-word;
}

audio {
  width: 100%;
  margin: 8px 0;
}

button {
  min-width: 100px;
  min-height: 44px;
  margin: 4px;
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 8px;
}

/* 16px stops iOS from zooming in when a field is focused */
input,
select {
  max-width: 100%;
  min-height: 44px;
  margin: 4px 0;
  padding: 8px;
  font-size: 16px;
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  vertical-align: middle;
}

ol {
  padding-left: 1.4em;
}

ol li {
  margin-bottom: 8px;
}

#jwt_token {
  width: 100%;
}

.dtmf {
  margin: 8px 0;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 320px;
}

.keypad-grid > div {
  display: contents;
}

.keypad {
  min-width: 0;
  height: 64px;
  margin: 0;
  font-size: 24px;
}

@media (max-width: 600px) {
  div.select,
  div.select label,
  .field label {
    display: block;
    width: auto;
  }

  select,
  #phonenumber {
    width: 100%;
  }

  .keypad-grid {
    max-width: none;
  }
}

.page-header {
  position: relative;
}

.page-header h2 {
  padding: 0 48px;
}

.icon-btn {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #444;
  cursor: pointer;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: #eee;
}

dialog {
  width: min(92vw, 420px);
  padding: 20px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

dialog h3 {
  margin: 0 0 12px;
}

dialog div.select,
dialog div.select label,
dialog .field label {
  display: block;
  width: auto;
}

dialog div.select,
dialog .field {
  margin-bottom: 12px;
}

dialog select {
  width: 100%;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.dialog-actions button {
  margin: 0;
}
