* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: #ffffff;
  background: #0c2b49;
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 10%, rgb(255 255 255 / 8%), transparent 28%),
    linear-gradient(145deg, #09233d, #0b6c68 70%, #073e43);
}

.softphone {
  width: min(390px, 100%);
  min-height: min(760px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 3px;
  background: linear-gradient(160deg, #06363f, #006d6b 58%, #003c45);
  box-shadow: 0 24px 80px rgb(0 0 0 / 38%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: #283648;
  background: #ffffff;
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0aa2a8;
  font-weight: 700;
  color: #ffffff;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

p {
  margin: 4px 0 0;
  color: #687386;
  font-size: 13px;
  white-space: nowrap;
}

.window-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.bottom-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  color: #304050;
  background: transparent;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.dialer {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px 36px 20px;
}

.status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 26px;
  padding: 0;
  color: rgb(255 255 255 / 82%);
  font-size: 13px;
  word-break: break-word;
}

.status > span:last-child {
  flex: 1;
  line-height: 1.35;
}

.status.status-end {
  padding: 8px 10px;
  border-radius: 6px;
  color: #ffffff;
  background: rgb(220 80 90 / 30%);
}

.status.status-end .status-dot {
  margin-top: 4px;
  background: #ff7a85;
}

.status-dot,
.presence-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f35d6a;
  box-shadow: 0 0 0 4px rgb(243 93 106 / 12%);
}

.status-online .status-dot,
.presence-dot.online {
  background: #38c449;
  box-shadow: 0 0 0 4px rgb(56 196 73 / 18%);
}

.display {
  position: relative;
}

.display input {
  width: 100%;
  height: 58px;
  padding: 0 48px 0 20px;
  border: 0;
  border-radius: 4px;
  outline: none;
  color: #4b5563;
  font-size: 24px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgb(0 0 0 / 18%);
}

.clear-button {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  transform: translateY(-50%);
  color: #9aa3ad;
  background: #edf1f5;
  cursor: pointer;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 32px;
  justify-items: center;
  padding: 2px 0 18px;
}

.key {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 50%;
  color: #ffffff;
  background: rgb(255 255 255 / 16%);
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 18%);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.key:active {
  transform: scale(0.96);
  background: rgb(255 255 255 / 24%);
}

.key span {
  font-size: 44px;
  line-height: 0.95;
}

.key small {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.bottom-bar {
  position: relative;
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr 92px 1fr 1fr 1fr 34px;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  color: #26384a;
  background: #ffffff;
}

.call-button,
.hangup-button {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 6px solid #f2f2f2;
  border-radius: 50%;
  color: #ffffff;
  background: #43aa43;
  box-shadow: 0 3px 12px rgb(0 0 0 / 24%);
  cursor: pointer;
  font-size: 34px;
  transform: translateY(-20px);
}

.hangup-button {
  display: none;
  background: #d94b4b;
  transform: translateY(-20px) rotate(135deg);
}

.in-call .call-button {
  display: none;
}

.in-call .hangup-button {
  display: grid;
}

.bottom-icon {
  font-size: 27px;
}

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

.incoming {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 6px;
  color: #ffffff;
  background: rgb(255 255 255 / 18%);
}

.incoming-actions {
  display: flex;
  gap: 8px;
}

.answer-small,
.reject-small {
  flex: 1;
  border: 0;
  border-radius: 4px;
  padding: 10px;
  color: #ffffff;
  cursor: pointer;
}

.answer-small {
  background: #43aa43;
}

.reject-small {
  background: #d94b4b;
}

.log {
  min-height: 76px;
  max-height: 112px;
  overflow: auto;
  margin: 0;
  padding: 10px 14px;
  border: 0;
  color: rgb(255 255 255 / 78%);
  background: rgb(0 0 0 / 22%);
  font-size: 11px;
  white-space: pre-wrap;
}

@media (max-width: 420px) {
  .shell {
    padding: 0;
  }

  .softphone {
    width: 100%;
    min-height: 100vh;
    border: 0;
  }

  .dialer {
    padding-inline: 24px;
  }

  .keypad {
    gap: 22px 24px;
  }

  .key {
    width: 78px;
    height: 78px;
  }
}

/* ===== Log modal ===== */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(960px, 94vw);
  height: min(680px, 86vh);
  background: #11212f;
  color: #e7eef5;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgb(0 0 0 / 45%);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #0c1924;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  flex-wrap: wrap;
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  flex: 0 0 auto;
}

.modal-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.modal-tools input,
.modal-tools select {
  height: 32px;
  padding: 0 10px;
  background: #0a1620;
  color: #e7eef5;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.modal-tools input {
  min-width: 220px;
}

.modal-tools input:focus,
.modal-tools select:focus {
  border-color: #2aa39a;
}

.modal-auto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgb(231 238 245 / 80%);
}

.modal-btn {
  height: 32px;
  padding: 0 12px;
  background: #1d6f6a;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.modal-btn:hover {
  background: #258680;
}

.modal-btn.modal-close {
  background: #3b4a58;
}

.modal-btn.modal-close:hover {
  background: #4a5b6c;
}

.modal-body {
  margin: 0;
  padding: 14px 16px;
  background: #0a141d;
  color: #d6e2ee;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}

.modal-body .hl-warn {
  color: #ffb454;
}

.modal-body .hl-err {
  color: #ff6b6b;
}

.modal-body .hl-notice {
  color: #6dd0c5;
}

.modal-body .hl-amd {
  color: #ffd166;
  font-weight: 600;
}

.modal-foot {
  padding: 8px 16px;
  font-size: 11px;
  color: rgb(231 238 245 / 60%);
  background: #0c1924;
  border-top: 1px solid rgb(255 255 255 / 8%);
}
