.top-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.pbx-list {
  margin-top: 22px;
  display: grid;
  gap: 18px;
}

.pbx-card {
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.pbx-card-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.pbx-card h3 {
  margin: 0 0 5px;
  font-size: 1.3rem;
}

.pbx-address {
  color: var(--muted);
}

.connection-state {
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 750;
  background: #edf2f7;
}

.connection-state.success {
  color: #08754f;
  background: #e6f7f0;
}

.connection-state.failed {
  color: #b42318;
  background: #feeceb;
}

.pbx-stats {
  margin: 22px 0;
  display: grid;
  grid-template-columns:
    repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.pbx-stat {
  padding: 15px;
  border-radius: 12px;
  background: #f5f8fb;
}

.pbx-stat span {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
}

.pbx-stat strong {
  display: block;
  margin-top: 5px;
  color: var(--navy);
  font-size: 1.35rem;
}

.pbx-meta {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.pbx-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-muted {
  color: var(--navy);
  background: #e8eef5;
}

.button-danger {
  background: #b42318;
}

.pbx-message {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 10px;
  color: #08754f;
  background: #e6f7f0;
}

.pbx-message.error {
  color: #b42318;
  background: #feeceb;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 30px;
  display: grid;
  place-items: center;
  background: rgba(7, 25, 47, .65);
}

.modal-card {
  width: min(600px, 100%);
  max-height: calc(100vh - 60px);
  overflow: auto;
  padding: 28px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-heading h2 {
  margin: 5px 0 10px;
}

.close-button {
  padding: 2px 10px;
  color: var(--muted);
  font-size: 2rem;
  background: transparent;
}

.form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

label small {
  color: var(--muted);
  font-weight: 400;
}

.modal-actions {
  margin-top: 25px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .pbx-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}


/* ---------------------------------------------------------
   Trunks & Billing
--------------------------------------------------------- */

.pbx-trunk-panel {
  margin: 4px 0 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfd;
}

.trunk-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 14px;
}

.trunk-panel-heading > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.trunk-heading {
  color: var(--navy);
  font-size: 1rem;
  font-weight: 800;
}

.billing-status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 750;
}

.billing-status.configured {
  color: #08754f;
  background: #e6f7f0;
}

.billing-status.needs {
  color: #8a5a00;
  background: #fff3d6;
}

.billing-status.warning {
  color: #b42318;
  background: #feeceb;
}

.trunk-list {
  display: grid;
  gap: 7px;
}

.trunk-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 34px;
}

.trunk-row.muted {
  color: var(--muted);
}

.trunk-row.ai {
  color: var(--muted);
}

.trunk-provider {
  min-width: 82px;
  color: var(--navy);
  font-weight: 750;
}

.trunk-purpose {
  color: var(--muted);
  font-size: .84rem;
}

.billing-summary {
  margin-top: 15px;
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.billing-summary > div {
  padding: 11px 13px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--line);
}

.billing-summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 650;
}

.billing-summary strong {
  color: var(--navy);
}

.billing-empty {
  margin-top: 14px;
  padding: 12px;
  border-radius: 9px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
}

.entitlement-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #8a3b12;
  background: #fff4e8;
  font-size: .85rem;
}

.trunk-loading,
.trunk-error {
  color: var(--muted);
}

.trunk-error {
  color: #b42318;
}

.trunk-edit-button {
  padding: 8px 12px;
}

.entitlement-trunks {
  margin: 10px 0 20px;
  padding: 13px;
  border-radius: 10px;
  background: #f5f8fb;
}

.allowance-preview {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 10px;
  background: #f5f8fb;
  color: var(--muted);
}

.allowance-preview.configured {
  color: #08754f;
  background: #e6f7f0;
}

.allowance-preview.warning {
  color: #b42318;
  background: #feeceb;
}

.entitlement-modal-card select {
  width: 100%;
}

@media (max-width: 900px) {
  .billing-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .trunk-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

