/* Global call preparation stays usable at phone and desktop widths. */

.native-standalone-dialer {
  position: fixed;
  inset: 72px 20px auto auto;
  z-index: 1200;
  width: min(360px, calc(100vw - 24px));
  display: none;
  padding: 0;
  background: transparent;
  pointer-events: none;
}

.native-message-console.has-native-dialer-open .native-standalone-dialer {
  display: block;
}

body.has-global-native-dialer-open [data-global-native-dialer] .native-standalone-dialer {
  display: block;
}

.native-standalone-dialer-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-height: calc(100dvh - 92px);
  overflow: auto;
  gap: 12px;
  border: 1px solid #d7e2ea;
  border-radius: 18px;
  padding: 12px 12px 10px;
  background: #fff;
  pointer-events: auto;
  box-shadow: 0 24px 60px rgba(11, 33, 47, 0.22);
}

.native-standalone-dialer-card > *,
.native-dialer-display > * {
  min-width: 0;
}

.native-dialer-meta em {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .native-standalone-dialer {
    inset: auto 10px calc(10px + var(--safe-bottom)) 10px;
    width: auto;
  }
  .native-standalone-dialer-card {
    max-height: calc(100dvh - 32px - var(--safe-bottom));
    border-radius: 14px 14px 10px 10px;
    padding: 12px;
  }
}

[data-native-dial-customer] { display: block; font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
[data-native-dial-customer][hidden] { display: none; }

.native-dialer-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.native-dialer-number input { font-size: 18px; }
.native-dialer-number input::placeholder { font-size: 14px; }
.native-cell-audio { display: grid; gap: 4px; text-align: left; }
.native-cell-audio :is(input, select) { width: 100%; min-height: 44px; font-size: 16px; }
[data-native-cell-help] { display: block; text-align: left; line-height: 1.4; }
.native-cell-audio[hidden], [data-native-cell-check][hidden] { display: none; }
.is-cell-call :is(.native-dialer-keypad, .native-dialer-keypad-actions, .native-dialer-nav) { display: none; }
.native-dialer-mode-panel { padding: 12px; text-align: left; place-items: stretch; }
[data-native-dialer-results] { display: grid; gap: 6px; max-height: 250px; overflow-y: auto; }
[data-native-dialer-choice] {
  display: grid; gap: 4px; padding: 10px; width: 100%; min-width: 0;
  border: 1px solid #d7e2ea; border-radius: 8px; background: #fff;
  text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
[data-native-dialer-choice]:disabled { opacity: .65; cursor: default; }
[data-native-dialer-choice]:focus-visible { outline: 2px solid #073d64; outline-offset: -2px; }
[data-native-dialer-results]:empty { display: none; }
[data-native-dialer-retry][hidden], [data-native-dialer-more][hidden] { display: none; }

@media (max-width: 760px) {
  body[data-role="technician"] .topbar-actions > .global-call-button:not([hidden]),
  body[data-role="crew_lead"] .topbar-actions > .global-call-button:not([hidden]) {
    display: inline-flex !important;
  }
}

/* A compact phone sheet keeps the full keypad and primary action together. */
@media (max-width: 760px) {
  .native-standalone-dialer {
    inset: auto 8px calc(8px + var(--safe-bottom, 0px)) 8px;
  }
  .native-standalone-dialer-card {
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - var(--safe-bottom, 0px));
    gap: 8px;
    padding: 12px 16px;
    border-radius: 22px;
    overscroll-behavior: contain;
  }
  .native-dialer-head { grid-template-columns: minmax(0, 1fr) 44px; }
  .native-dialer-grip { display: none; }
  .native-dialer-head .button { width: 44px; height: 44px; min-height: 44px; }
  .native-dialer-display { gap: 6px; }
  .native-dialer-from { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
  .native-dialer-from-button { justify-self: end; min-height: 24px; }
  .native-dialer-from-button svg { display: none; }
  .native-dialer-number { gap: 4px; }
  .native-dialer-keypad { gap: 6px; }
  .native-dialer-key { width: 52px; height: 52px; }
  .native-dialer-key strong { font-size: 24px; }
  .native-dialer-key small { font-size: 9px; letter-spacing: .08em; margin-top: -4px; }
  .native-dialer-keypad-actions { grid-template-columns: 52px 56px 52px; gap: 18px; }
  .native-dialer-call { width: 56px; min-width: 56px; height: 56px; min-height: 56px; }
  .native-dialer-nav { padding-top: 6px; }
  .native-dialer-nav button { min-height: 44px; }
  [data-native-app-audio-help] { font-size: 12px; line-height: 1.3; }
}
