/* Canonical Voice Inbox shell and responsive closeout. */
.tenant-voice-console-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #f7f9fc;
}

body.tenant-app-body[data-app-surface="workspace"][data-active-tab="calls"] #app-stage-calls {
  overflow: hidden !important;
  scrollbar-gutter: auto !important;
}

body.tenant-app-body[data-app-surface="workspace"][data-active-tab="calls"] .tenant-voice-console-frame {
  height: 100% !important;
  min-height: 0 !important;
}

body.tenant-call-embedded {
  background: #f7f9fc !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

body.tenant-call-embedded .tenant-call-center-sidebar,
body.tenant-call-embedded .tenant-call-center-header,
body.tenant-call-embedded > .tenant-mobile-nav {
  display: none !important;
}

body.tenant-call-embedded .tenant-call-center-shell,
body.tenant-call-embedded .tenant-app-main {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.tenant-call-embedded .tenant-call-center-grid {
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 392px) !important;
  gap: 12px !important;
}

.tenant-call-row-actions > button,
.tenant-call-row-actions > .button {
  min-height: 40px;
}

/* Voice is an inbox first: live work precedes setup and reporting. */
.tenant-call-ops-stack {
  display: flex !important;
  flex-direction: column;
}

.tenant-call-inbox-surface { order: -10; }
.tenant-live-dashboard-surface { order: 0; }
.tenant-call-history-surface { order: 10; }

/* The embedded workspace is an operator inbox, not an administration dashboard. */
body.tenant-call-embedded .tenant-live-dashboard-surface,
body.tenant-call-embedded .tenant-call-history-surface {
  display: none !important;
}

body.tenant-call-embedded .tenant-call-inbox-surface {
  width: 100% !important;
  min-width: 0 !important;
  min-height: calc(100dvh - 44px) !important;
  align-self: stretch !important;
}

body.tenant-call-embedded #app-call-panel {
  width: 100% !important;
  min-width: 0 !important;
  max-height: calc(100dvh - 44px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

body.tenant-call-embedded .tenant-live-queue-list {
  max-height: calc(100dvh - 230px);
}

.tenant-call-inbox-search {
  grid-template-columns: minmax(0, 1fr) !important;
  padding: 0 18px 14px;
}

body.tenant-voice-voicemail-filter .tenant-call-inbox-search {
  display: none !important;
}

.tenant-call-inbox-search .tenant-call-command-box {
  width: 100%;
}

/* Capacity, staffing, and stale-follow-up diagnostics belong in Voice settings. */
body.tenant-call-embedded .tenant-call-inbox-search .tenant-call-notification-rail {
  display: none !important;
}

.tenant-call-options {
  border-top: 1px solid #e8eaed;
  border-bottom: 1px solid #e8eaed;
}

.tenant-call-options > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: #3c4043;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.tenant-call-options-content {
  display: grid;
  gap: 12px;
  padding: 0 0 14px;
}

/* Routine states add noise; exceptional states remain visible. */
body.tenant-call-embedded .tenant-call-row-avatar,
body.tenant-call-embedded .tenant-call-queue-priority,
body.tenant-call-embedded .tenant-call-queue-band.is-medium,
body.tenant-call-embedded .tenant-call-queue-band.is-low {
  display: none !important;
}

body.tenant-call-embedded .tenant-call-row-identity,
body.tenant-call-embedded .tenant-call-row-copy {
  min-width: 0;
  width: 100%;
}

body.tenant-call-embedded #app-call-panel[data-browser-connected="true"][data-call-mode="ready"] .tenant-softphone-connect-row,
body.tenant-call-embedded #app-call-panel[data-browser-connected="true"][data-call-mode="ready"] .tenant-call-console-status {
  display: none;
}

@media (min-width: 981px) {
  body.tenant-call-embedded .tenant-call-empty-state > .tenant-inline-actions {
    display: none;
  }
}

body.tenant-call-embedded .tenant-call-empty-state > .tenant-inline-actions {
  align-items: center;
  justify-content: flex-start;
}

body.tenant-call-embedded .tenant-call-empty-state > .tenant-inline-actions button {
  width: auto;
  min-height: 44px;
  height: auto;
  padding: 0 16px;
}

.tenant-mobile-dialer-open,
.tenant-mobile-dialer-close {
  display: none;
}

.tenant-voice-inbox-row { cursor: pointer; }
.tenant-voice-inbox-row.is-selected { border-color: #a8c7fa; background: #f5f9ff; box-shadow: inset 3px 0 #0b57d0; }
@media (hover: hover) {
  .tenant-voice-inbox-row .tenant-call-row-actions { opacity: 0; transition: opacity .14s ease; }
  .tenant-voice-inbox-row:hover .tenant-call-row-actions,
  .tenant-voice-inbox-row:focus-within .tenant-call-row-actions,
  .tenant-voice-inbox-row.is-selected .tenant-call-row-actions { opacity: 1; }
}

.tenant-voice-thread-count {
  color: #52657c;
  font-size: 12px;
  font-weight: 700;
}

.tenant-voice-thread-history {
  display: grid;
  gap: 0;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.tenant-voice-thread-history li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid #e3e8ef;
}

.tenant-voice-thread-marker {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: #0b57d0;
}

.tenant-voice-thread-history li > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  min-width: 0;
}

.tenant-voice-thread-history time,
.tenant-voice-thread-history p,
.tenant-voice-thread-history small,
.tenant-voice-thread-evidence {
  color: #5f6368;
  font-size: 12px;
}

.tenant-voice-thread-history p,
.tenant-voice-thread-history small,
.tenant-voice-thread-evidence {
  grid-column: 1 / -1;
  margin: 0;
}

.tenant-voice-thread-evidence {
  display: flex;
  gap: 10px;
}

.tenant-voice-number-marketplace {
  margin-top: 14px;
  border: 1px solid #d8e1ec;
  border-radius: 16px;
  background: #fff;
}

.tenant-voice-number-marketplace-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.tenant-voice-number-marketplace-summary::-webkit-details-marker {
  display: none;
}

.tenant-voice-number-marketplace-summary > span:first-child,
.tenant-voice-number-review-head > div,
.tenant-voice-number-review-costs > span {
  display: grid;
  gap: 3px;
}

.tenant-voice-number-marketplace-summary small,
.tenant-voice-number-package small {
  color: #5f6f82;
}

.tenant-voice-number-marketplace-action {
  color: #0b57d0;
  font-weight: 700;
}

.tenant-voice-number-marketplace-body {
  display: grid;
  gap: 16px;
  padding: 0 18px 18px;
  border-top: 1px solid #edf1f6;
}

.tenant-voice-number-package {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.tenant-voice-number-package article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e1e7ef;
  border-radius: 12px;
  background: #f8fafc;
}

.tenant-voice-number-package article > span,
.tenant-voice-number-review-head span,
.tenant-voice-number-review-costs small {
  color: #607086;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.tenant-voice-number-package article.is-ready {
  border-color: #b9dec7;
  background: #f2fbf5;
}

.tenant-voice-number-package article.is-blocked {
  border-color: #f1c7bc;
  background: #fff6f3;
}

.tenant-voice-number-search-grid {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(140px, 1fr) minmax(150px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.tenant-voice-number-search-grid label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.tenant-voice-number-review {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #a8c7fa;
  border-radius: 14px;
  background: #f5f9ff;
}

.tenant-voice-number-review-head,
.tenant-voice-number-review-costs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tenant-voice-number-current {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

@media (max-width: 980px) {
  .tenant-voice-number-package {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tenant-voice-number-search-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  body.tenant-call-embedded .tenant-app-main {
    padding-bottom: 18px !important;
  }

  body.tenant-call-embedded .tenant-call-center-grid {
    grid-template-columns: 1fr !important;
  }

  body.tenant-call-embedded .tenant-call-ops-stack {
    display: flex !important;
    flex-direction: column !important;
  }

  body.tenant-call-embedded .tenant-call-mobile-action-bar {
    display: none !important;
  }

  body.tenant-call-embedded button,
  body.tenant-call-embedded .button,
  body.tenant-call-embedded select,
  body.tenant-call-embedded input {
    min-height: 44px;
  }

  .tenant-voice-number-package,
  .tenant-voice-number-search-grid {
    grid-template-columns: 1fr;
  }

  .tenant-voice-number-review-head,
  .tenant-voice-number-review-costs {
    align-items: stretch;
    flex-direction: column;
  }

  body.tenant-app-body[data-app-surface="calls"] #app-call-panel {
    display: none !important;
    order: 2 !important;
  }

  body.tenant-app-body[data-app-surface="calls"].voice-dialer-open #app-call-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1700 !important;
    display: block !important;
    overflow: auto;
    padding: 10px 10px calc(18px + env(safe-area-inset-bottom));
    background: #f7f9fc;
  }

  .tenant-mobile-dialer-open {
    position: fixed;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 1200;
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    border-radius: 24px;
    box-shadow: 0 5px 18px rgb(15 23 42 / 22%);
  }

  .tenant-mobile-dialer-close { display: inline-flex; }
  body.voice-dialer-open { overflow: hidden; }

  .tenant-call-ops-stack > .tenant-call-inbox-surface {
    min-height: calc(100dvh - 150px);
  }

  body.tenant-call-embedded .tenant-live-queue-list {
    max-height: none;
  }
}

/* Keep the four Voice tabs on one row: the heading and summary shrink instead of pushing
   "History" onto a second line. The phone layout below switches to a 4-column grid. */
.tenant-call-inbox-surface > .tenant-section-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.tenant-call-inbox-surface > .tenant-section-head > [role="tablist"] {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

@media (max-width: 720px) {
  body.tenant-call-embedded .tenant-call-inbox-surface > .tenant-section-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  body.tenant-call-embedded .tenant-call-inbox-surface > .tenant-section-head .tenant-inline-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
  }

  body.tenant-call-embedded .tenant-call-inbox-surface > .tenant-section-head .tenant-filter-btn {
    min-width: 0;
    padding-inline: 4px;
    font-size: 11px;
  }
}
