:root {
  color-scheme: light;
  --ink: #182230;
  --muted: #667085;
  --line: #d0d5dd;
  --surface: #fff;
  --bg: #eef1f5;
  --accent: #155eef;
  --accent-hover: #004eeb;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.site-header { min-height: 58px; display: flex; align-items: center; gap: 28px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.wordmark { font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.site-header nav { display: flex; gap: 22px; flex: 1; }
.site-header nav a, .link-button { color: #344054; text-decoration: none; }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.container { max-width: 1050px; margin: 36px auto; padding: 0 24px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-heading h1, h1 { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; }
.page-heading span, .empty { color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
th { font-size: 13px; color: #475467; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(420px, 100%); padding: 36px; background: var(--surface); border: 1px solid #d5dae1; border-radius: 10px; box-shadow: 0 10px 30px rgb(16 24 40 / 8%); }
.auth-card .wordmark { margin-bottom: 34px; }
.auth-card h1 { margin-bottom: 26px; font-size: 26px; }
.auth-card form { display: grid; gap: 7px; }
form label { display: block; margin: 12px 0 0; font-size: 14px; font-weight: 600; color: #344054; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid #98a2b3; border-radius: 6px; padding: 9px 12px; font: inherit; color: var(--ink); background: #fff; }
input:hover { border-color: #667085; }
input:focus, button:focus, a:focus { outline: 3px solid #84adff; outline-offset: 2px; }
button[type=submit]:not(.link-button) { margin-top: 20px; min-height: 44px; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font: inherit; font-weight: 650; cursor: pointer; }
button[type=submit]:not(.link-button):hover { background: var(--accent-hover); }
.auth-card button[type=submit] { width: 100%; }
.alert { margin: 0 0 10px; padding: 11px 13px; border-left: 3px solid var(--danger); background: #fef3f2; color: var(--danger); }
.narrow-form { max-width: 460px; background: var(--surface); border: 1px solid var(--line); padding: 22px; }
.check { display: flex; gap: 9px; align-items: center; }
.check input { width: auto; height: auto; }
.admin-container { max-width: 1440px; }
.admin-header { border-top: 4px solid #7f56d9; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 28px; align-items: start; margin-bottom: 30px; }
.panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel.compact { padding: 15px 18px; }
.panel h2, section h2 { margin: 0 0 14px; font-size: 18px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.metric { display: flex; flex-direction: column; padding: 22px; color: var(--ink); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.metric strong { font-size: 30px; }.metric span,.muted,.form-note { color: var(--muted); }
.subnav { display: flex; gap: 24px; margin: -8px 0 28px; overflow-x: auto; border-bottom: 1px solid var(--line); }.subnav a { flex: none; padding: 10px 1px 11px; border-bottom: 2px solid transparent; text-decoration: none; color: #475467; font-weight: 600; }.subnav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.notice { padding: 11px 14px; background: #ecfdf3; border-left: 3px solid #079455; color: #067647; }
.secret-panel { margin-bottom: 24px; padding: 20px; background: #fffaeb; border: 1px solid #fedf89; border-radius: 8px; }.secret-panel dt { font-weight: 700; }.secret-panel dd { margin: 3px 0 13px; }
.inline-form { display: inline-flex; gap: 7px; align-items: center; margin-left: 8px; }.inline-form input,.inline-form select { min-width: 105px; height: 34px; min-height: 34px; }.inline-form button,.danger-zone button { min-height: 34px; margin: 0; padding: 6px 10px; border: 1px solid #98a2b3; border-radius: 5px; background: #fff; color: var(--ink); cursor: pointer; }
.danger-zone button { color: var(--danger); border-color: #fda29b; }.status { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; font-size: 12px; background: #f2f4f7; }.status-active { background: #dcfae6; color: #067647; }.status-disabled { background: #fee4e2; color: #b42318; }.status-maintenance,.status-suspended { background: #fef0c7; color: #b54708; }
.row-between,.actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; }.actions { justify-content: flex-end; }.health-list { list-style: none; padding: 0; }.health-list li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 11px 0; }.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }.break-all { word-break: break-all; }.table-wrap { overflow: auto; }td small { display: block; color: var(--muted); }.subrow td { background: #f9fafb; }
.resource-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }.resource-card { min-height: 150px; display: grid; grid-template-columns: 1fr auto; align-content: start; gap: 12px; padding: 22px; color: var(--ink); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }.resource-card:hover { border-color: #84adff; box-shadow: 0 3px 10px rgb(16 24 40 / 7%); }.resource-card span { font-size: 18px; font-weight: 700; }.resource-card strong { font-size: 22px; color: var(--accent); }.resource-card small { grid-column: 1 / -1; color: var(--muted); }
.resource-layout { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 28px; align-items: start; }.create-panel { position: sticky; top: 20px; }.section-heading,.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }.button-secondary { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 11px; color: #344054; text-decoration: none; background: #fff; border: 1px solid #98a2b3; border-radius: 5px; }.config-form { display: grid; gap: 20px; }.form-section { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 20px; }.check-grid,.member-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px 20px; margin-top: 16px; }.choice-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0 20px; }.form-actions { display: flex; justify-content: flex-end; }.file-list { margin: 0; padding: 0; list-style: none; }.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }

@media (max-width: 680px) {
  .site-header { height: auto; padding: 14px 18px; flex-wrap: wrap; gap: 14px; }
  .site-header nav { order: 3; width: 100%; overflow: auto; gap: 18px; }
  .container { margin-top: 24px; }
  .page-heading { align-items: flex-start; gap: 10px; }
  .auth-card { padding: 28px 24px; box-shadow: none; }
  table { display: block; overflow: auto; }
  .admin-grid,.metric-grid,.resource-cards,.resource-layout,.form-grid,.check-grid,.member-grid,.choice-grid { grid-template-columns: 1fr; }
  .create-panel { position: static; }
  .row-between,.actions { align-items: stretch; flex-direction: column; }
}

/* Platform administration shell */
.admin-body { min-height: 100vh; background: #f5f7fa; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 224px; padding: 0 12px; background: #17243a; color: #fff; }
.admin-brand { display: flex; align-items: center; height: 64px; padding: 0 14px; border-bottom: 1px solid rgb(255 255 255 / 10%); color: #fff; font-size: 17px; font-weight: 700; text-decoration: none; }
.admin-sidebar nav { display: grid; gap: 4px; padding-top: 18px; }
.admin-sidebar nav a { display: block; padding: 10px 14px; border-radius: 5px; color: #cbd5e1; font-weight: 600; text-decoration: none; }
.admin-sidebar nav a:hover { color: #fff; background: rgb(255 255 255 / 7%); }
.admin-sidebar nav a[aria-current="page"] { color: #fff; background: #155eef; }
.admin-shell { min-height: 100vh; margin-left: 224px; }
.admin-topbar { height: 64px; display: flex; align-items: center; justify-content: flex-end; gap: 18px; padding: 0 32px; background: #fff; border-bottom: 1px solid #d9dee7; color: #475467; font-size: 14px; }
.admin-topbar form { margin: 0; }
.admin-topbar .link-button { font-weight: 600; }
.admin-main { width: min(1480px, 100%); margin: 0 auto; padding: 30px 36px 48px; }
.admin-main > .page-heading { margin: 0 0 20px; }
.admin-main > .page-heading h1 { font-size: 23px; }

/* Company workspace navigation */
.company-nav { gap: 4px; margin: 0 0 28px; padding: 0 2px; border-bottom-color: #d9dee7; }
.company-nav a { padding: 10px 12px 12px; border-bottom-width: 3px; font-size: 14px; font-weight: 600; }
.company-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.pbx-nav { gap: 4px; margin: -14px 0 28px; padding: 8px; border: 1px solid #d9dee7; border-radius: 6px; background: #eef2f6; }
.pbx-nav a { padding: 7px 11px; border: 0; border-radius: 4px; font-size: 13px; font-weight: 600; }
.pbx-nav a:hover { border: 0; background: #fff; }
.pbx-nav a[aria-current="page"] { border: 0; background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgb(16 24 40 / 8%); }

/* Management lists and actions */
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-toolbar > div { display: flex; align-items: baseline; gap: 10px; }
.section-toolbar h2 { margin: 0; font-size: 18px; }
.item-count, .modal-context { color: var(--muted); font-size: 13px; }
.data-panel { overflow: hidden; background: #fff; border: 1px solid #d9dee7; border-radius: 7px; box-shadow: 0 1px 2px rgb(16 24 40 / 3%); }
.management-table { border: 0; }
.management-table th { height: 44px; padding: 0 16px; background: #f8fafc; color: #475467; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.management-table td { height: 58px; padding: 10px 16px; }
.management-table tbody tr:last-child td { border-bottom: 0; }
.management-table tbody tr:hover td { background: #fbfcfe; }
.management-table .status { margin-left: 0; text-transform: capitalize; }
.status-error { background: #fee4e2; color: #b42318; }
.status-info { background: #e0f2fe; color: #075985; }
.status-warning { background: #fef0c7; color: #b54708; }
.status-available { background: #dcfae6; color: #067647; }
.status-busy { background: #fef0c7; color: #b54708; }
.status-offline { background: #fee4e2; color: #b42318; }
.status-unknown { background: #f2f4f7; color: #475467; }
.diagnostic-table { min-width: 1320px; }
.diagnostic-table small { display: block; color: #667085; margin-top: 3px; }
.diagnostic-table pre { max-width: 520px; max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 12px; }
.raw-response { max-height: 420px; margin: 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: #f8fafc; white-space: pre-wrap; word-break: break-word; }
.diagnostic-request-id { max-width: 190px; overflow-wrap: anywhere; }
.filter-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 14px 16px; background: #fff; border: 1px solid #d9dee7; border-radius: 7px; }
.filter-form label { min-width: 150px; margin: 0; }
.filter-form input, .filter-form select { min-height: 38px; margin-top: 4px; }
.filter-form button[type=submit] { min-height: 38px; margin: 0; }
.trunk-profile-editor { min-width: 330px; max-height: 70vh; overflow: auto; }
.trunk-profile-editor form { display: grid; gap: 10px; }
.create-panel { margin: 16px 0 28px; }
.create-panel > summary { display: inline-block; list-style: none; cursor: pointer; }
.create-panel > .panel { margin-top: 12px; max-width: 560px; }
.status-detail { display: block; max-width: 280px; margin-top: 5px; color: #b42318; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 800px) { .settings-grid { grid-template-columns: 1fr; } }
.actions-column { width: 1%; }
.row-actions { text-align: right; white-space: nowrap; }
.table-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.table-link:hover { text-decoration: underline; }
.empty-state { padding: 44px 20px; color: var(--muted); text-align: center; }
.empty-state.compact { padding: 24px 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

button.button-primary,
a.button-primary,
button.button-secondary,
a.button-secondary,
button.button-danger-text {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 7px 13px;
  border-radius: 5px;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
button.button-primary, a.button-primary { border: 1px solid var(--accent); background: var(--accent); color: #fff; }
button.button-primary:hover, a.button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
button.button-secondary, a.button-secondary { border: 1px solid #98a2b3; background: #fff; color: #344054; }
button.button-secondary:hover, a.button-secondary:hover { background: #f8fafc; }
button.button-danger-text { min-height: auto; padding: 7px 4px; border: 0; background: transparent; color: var(--danger); }
button.button-danger-text:hover { background: transparent; color: #912018; text-decoration: underline; }
.danger-zone button[type="submit"] { margin: 0; border: 1px solid #fda29b; background: #fff; color: var(--danger); }

/* Focused create/edit dialogs */
.modal { width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: visible; border: 0; border-radius: 8px; background: transparent; color: var(--ink); box-shadow: 0 24px 48px rgb(16 24 40 / 22%); }
.modal.modal-wide { width: min(680px, calc(100% - 32px)); }
.modal::backdrop { background: rgb(15 23 42 / 50%); }
.modal-card { overflow: hidden; background: #fff; border-radius: 8px; }
.modal-card-wide { width: min(680px, calc(100vw - 32px)); }
.modal-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 22px; border-bottom: 1px solid #e4e7ec; }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-header > div { display: grid; gap: 2px; }
.modal-close { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #667085; font: 24px/1 system-ui, sans-serif; cursor: pointer; }
.modal-close:hover { background: #f2f4f7; color: var(--ink); }
.modal-body { max-height: calc(100vh - 190px); padding: 20px 22px 24px; overflow: auto; }
.modal-body > label:first-child { margin-top: 0; }
.modal-body fieldset { margin: 20px 0 0; padding: 14px 16px 16px; border: 1px solid #d0d5dd; border-radius: 6px; }
.modal-body legend { padding: 0 5px; color: #344054; font-size: 14px; font-weight: 700; }
.modal-body fieldset .check:first-of-type { margin-top: 4px; }
.modal-footer { min-height: 66px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid #e4e7ec; background: #f8fafc; }
.modal-footer-split { justify-content: space-between; }
.modal-footer .actions { display: flex; flex-direction: row; align-items: center; }
.upload-block { padding: 0 0 20px; border-bottom: 1px solid #e4e7ec; }
.upload-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; align-items: end; }
.upload-form label { margin: 0; }
.upload-form .upload-status { grid-column: 1 / -1; min-height: 0; color: var(--muted); font-size: 13px; }
.file-table { margin-top: 10px; }
.inline-audio-form { display: flex; align-items: center; gap: 8px; min-width: 360px; }
.inline-audio-form input[type="file"] { min-width: 210px; }
.core-prompt-list { margin: 0; padding: 0 16px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 50px; padding: 7px 2px; border-bottom: 1px solid #e4e7ec; }
.file-row:last-child { border-bottom: 0; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.file-row form { flex: none; }

/* Company users, extensions, and numbers */
.company-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; padding: 12px 16px; border: 1px solid #d9dee7; border-radius: 6px; background: #fff; }
.company-summary > div { display: flex; align-items: center; gap: 9px; }
.company-slug { color: #475467; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.compact-action, .destination-form, .extension-actions { display: flex; align-items: center; gap: 8px; margin: 0; }
.compact-action select { width: auto; min-width: 120px; min-height: 36px; height: 36px; }
.management-section { margin-top: 36px; }
.extension-list { display: flex; flex-wrap: wrap; gap: 6px; }
.extension-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px; border: 1px solid #cbd5e1; border-radius: 999px; background: #f8fafc; color: #243b5a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; font-weight: 700; }
.extension-number { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 15px; }
.destination-form select { min-width: 250px; min-height: 36px; height: 36px; }
.edit-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.edit-heading h2 { margin: 6px 0 0; font-size: 20px; }
.back-link { color: #475467; font-size: 13px; font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--accent); }
.extension-actions { justify-content: flex-end; }
.extension-actions > form { margin: 0; }
.action-list { display: grid; gap: 9px; }
.action-list form { margin: 0; }
.action-list form button { width: 100%; }
.action-menu { position: relative; display: inline-block; text-align: left; }
.action-menu summary { display: inline-flex; min-height: 36px; align-items: center; padding: 7px 12px; border: 1px solid #98a2b3; border-radius: 5px; background: #fff; color: #344054; font-weight: 650; cursor: pointer; list-style: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu[open] summary { background: #f8fafc; }
.action-menu > div { position: absolute; z-index: 12; top: calc(100% + 5px); right: 0; width: 190px; padding: 5px; border: 1px solid #d0d5dd; border-radius: 6px; background: #fff; box-shadow: 0 8px 20px rgb(16 24 40 / 14%); }
.action-menu form { margin: 0; }
.action-menu button[type="submit"] { width: 100%; min-height: 34px; margin: 0; padding: 7px 9px; border: 0; border-radius: 4px; background: #fff; color: #344054; text-align: left; font: inherit; cursor: pointer; }
.action-menu button[type="submit"]:hover { background: #f2f4f7; }
.action-menu button.danger[type="submit"] { color: var(--danger); }

@media (max-width: 900px) {
  .admin-sidebar { position: static; width: auto; min-height: 0; padding: 0 16px; }
  .admin-brand { height: 56px; padding: 0 4px; }
  .admin-sidebar nav { display: flex; gap: 4px; padding: 8px 0 10px; overflow-x: auto; }
  .admin-sidebar nav a { flex: none; padding: 8px 11px; }
  .admin-shell { margin-left: 0; }
  .admin-topbar { height: 52px; padding: 0 20px; }
  .admin-main { padding: 24px 20px 40px; }
}

@media (max-width: 600px) {
  .admin-topbar span { max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .section-toolbar { align-items: flex-start; }
  .management-table th:nth-child(2), .management-table td:nth-child(2) { display: none; }
  .modal-footer-split { align-items: stretch; flex-direction: column-reverse; }
  .modal-footer-split .actions { justify-content: flex-end; }
  .upload-form { grid-template-columns: 1fr; }
  .upload-form .upload-status { grid-column: auto; }
  .company-summary, .company-summary > .actions { align-items: stretch; flex-direction: column; }
  .compact-action { align-items: stretch; flex-direction: column; }
  .destination-form select { min-width: 180px; }
  .edit-heading { align-items: flex-start; }
}
.provisioning-link{min-width:20rem}.provisioning-link label{display:block;font-size:.75rem;margin:.2rem 0}.provisioning-link input{width:100%;font-size:.75rem;padding:.35rem .45rem}.section-spaced{margin-top:2rem}.modal-danger-actions{display:flex;justify-content:space-between;gap:.75rem;padding:0 1.5rem 1.5rem}.full-width{grid-column:1/-1}
.phone-setting-editor{max-width:900px}.phone-setting-editor>form:first-of-type{display:grid;grid-template-columns:minmax(180px,1fr) minmax(320px,2fr) auto;gap:14px;align-items:end}.phone-setting-editor label{margin:0}.phone-setting-value{margin-top:24px;padding-top:24px;border-top:1px solid var(--line)}.setting-metadata{display:flex;gap:20px;margin:10px 0 20px;color:var(--muted);font-size:.85rem}.phone-setting-editor textarea{width:100%;resize:vertical}
@media(max-width:800px){.phone-setting-editor>form:first-of-type{grid-template-columns:1fr}}
