:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #182230;
  --muted: #667085;
  --line: #cfd8e3;
  --brand-navy: #111827;
  --brand-navy-2: #263042;
  --brand-blue: #2563eb;
  --brand-blue-2: #1749b8;
  --brand-orange: #0f766e;
  --brand-orange-2: #0a5f59;
  --brand-soft: #eef4ff;
  --brand-soft-2: #e6eefb;
  --surface-dark: #111827;
  --surface-dark-2: #263042;
  --surface-dark-3: #354157;
  --accent: var(--brand-blue);
  --accent-2: var(--brand-navy);
  --accent-3: var(--brand-orange);
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 10px 28px rgba(23, 32, 38, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 208px 1fr;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, var(--brand-soft-2) 0, var(--bg) 280px),
    var(--bg);
  color: var(--ink);
  overflow: hidden;
}

.admin-page.logged-out {
  display: block;
  background: var(--bg);
  height: auto;
  overflow: auto;
}
.admin-page.logged-out .sidebar,
.admin-page.logged-out .main,
.admin-page.logged-in .admin-login {
  display: none;
}
.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.admin-login-box {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .22);
}
.admin-login-box .full-logo,
.phone-login-box .full-logo {
  justify-self: center;
  max-width: 190px;
}
.admin-login-box h1 {
  font-size: 16px;
  text-align: center;
}
.admin-login-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}
.admin-login-error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 650;
}
.admin-mfa-panel {
  display: grid;
  gap: 8px;
}
.admin-mfa-panel.hidden,
.admin-mfa-setup.hidden {
  display: none;
}
.admin-mfa-setup {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}
.admin-mfa-setup strong {
  color: var(--ink);
  font-size: 13px;
}
.admin-mfa-setup p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.admin-mfa-setup code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: rgba(0,0,0,.24);
  padding: 6px;
  color: var(--ink);
  font-size: 12px;
}
.admin-mfa-setup a {
  color: var(--accent);
  font-size: 12px;
}

.sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-dark);
  color: #f8fafc;
  padding: 0;
  height: 100vh;
  min-height: 0;
  overflow: visible;
  box-shadow: 5px 0 18px rgba(0, 0, 80, .22);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: var(--brand-navy-2);
  font-size: 16px;
  font-weight: 750;
  margin: 0;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
}
.brand-logo {
  display: inline-block;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  object-fit: contain;
  flex: 0 0 auto;
}
.full-logo {
  width: 170px;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.sidebar-nav {
  min-height: 0;
  overflow: visible;
  padding: 0;
}
.nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid rgba(255,255,255,.11);
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0 12px;
  min-height: 54px;
  margin: 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.2;
}
.nav.active, .nav:hover {
  background: var(--surface-dark-3);
  box-shadow: inset 4px 0 0 var(--brand-orange);
}
.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: #dcebff;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
}
.nav-group {
  position: relative;
  margin: 0;
  padding: 0;
  border-left: 0;
}
.nav-group::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: 10px;
  height: 100%;
}
.nav-group-title {
  margin: 0;
  color: inherit;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.nav-group:hover .nav-group-title,
.nav-group:focus-within .nav-group-title,
.nav-group.active .nav-group-title {
  background: var(--surface-dark-3);
  color: #fff;
}
.nav-group-title::after {
  content: "›";
  margin-left: auto;
  color: var(--brand-orange);
  font-size: 18px;
  line-height: 1;
}
.submenu {
  position: absolute;
  z-index: 60;
  top: 0;
  left: calc(100% + 8px);
  display: none;
  min-width: 212px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  background: var(--surface-dark-2);
  box-shadow: 12px 18px 34px rgba(0, 0, 0, .28);
}
.submenu::before {
  content: "";
  position: absolute;
  top: 15px;
  left: -6px;
  width: 10px;
  height: 10px;
  border-left: 1px solid rgba(255,255,255,.14);
  border-bottom: 1px solid rgba(255,255,255,.14);
  background: var(--surface-dark-2);
  transform: rotate(45deg);
}
.sub-nav {
  display: flex;
  margin-left: 0;
  min-height: 36px;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #f8fbff;
  font-size: 12px;
}
.sub-nav .nav-icon {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  color: #d9ecff;
}
.sub-nav.active,
.sub-nav:hover {
  background: var(--surface-dark-3);
  box-shadow: inset 3px 0 0 var(--brand-blue);
}
.nav-group:hover .submenu,
.nav-group:focus-within .submenu,
.nav-group.open .submenu {
  display: grid;
  gap: 2px;
}
.sidebar-account {
  margin: auto 0 0;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.12);
  background: var(--brand-navy-2);
  display: grid;
  gap: 8px;
}
.sidebar-user {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.sidebar-user span {
  color: rgba(234, 242, 244, .58);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}
.sidebar-user strong {
  color: #fff;
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-logout {
  width: 100%;
  justify-content: center;
}

.logo-home-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.logo-home-link:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 4px;
  border-radius: 8px;
}
.mobile-menu-toggle {
  display: none;
}
.project-version {
  color: rgba(234, 242, 244, .68);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.version-history-panel {
  display: grid;
  gap: 10px;
}
.version-history-list {
  display: grid;
  gap: 8px;
}
.version-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--brand-soft);
}
.version-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.version-card header div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.version-card strong {
  color: var(--ink);
  font-size: 13px;
}
.version-card span,
.version-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}
.version-card ul {
  margin: 0;
  padding-left: 18px;
}
.version-card li {
  margin: 2px 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
}

.main {
  height: 100vh;
  min-width: 0;
  overflow-y: auto;
  padding: 10px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}
h1 { margin: 0; font-size: 18px; }
h2 { margin: 0 0 6px; font-size: 12px; }
p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.auth { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.department-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.department-admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.department-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.department-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.department-card header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.department-member-list,
.department-user-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.department-user-option {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-soft);
}
.department-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 5px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-soft);
}
.department-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.compact-empty {
  margin: 0;
  padding: 6px 0;
}

input, select, button {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 4px;
  font: inherit;
  font-size: 11px;
}
input, select, textarea {
  background: var(--surface-dark-3);
  color: #f8fbff;
  caret-color: #f8fbff;
}
input::placeholder,
textarea::placeholder {
  color: #c7d2df;
  opacity: 1;
}
select option {
  background: var(--surface-dark-3);
  color: #f8fbff;
}
input:disabled,
select:disabled,
textarea:disabled {
  background: #4b525a;
  color: #eef6ff;
  -webkit-text-fill-color: #eef6ff;
  opacity: 1;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand-blue);
}
input[type="color"] {
  background: transparent;
  padding: 1px;
}
textarea {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  font: inherit;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(48, 128, 255, .2);
  border-color: var(--brand-blue);
}
button {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset;
}
button.secondary { background: var(--brand-navy); border-color: var(--brand-navy); }
button.success { background: #15803d; border-color: #15803d; }
button.danger { background: var(--danger); border-color: var(--danger); }
button:hover { filter: brightness(.96); }
.compact-button {
  min-height: 24px;
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1.15;
}
button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 32, 39, .45);
}
.modal-panel {
  position: relative;
  width: min(620px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(23, 32, 38, .28);
}
.extension-modal-panel {
  width: min(760px, 100%);
}
.modal-heading h2 {
  margin: 0;
}
.modal-heading p {
  margin-bottom: 4px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
}
.provision-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  padding: 24px;
}
.provision-qr {
  width: 240px;
  height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.provision-info {
  display: grid;
  align-content: start;
  gap: 10px;
}
.provision-info textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
}
.extension-edit-form {
  display: grid;
  gap: 16px;
  padding: 24px;
}
.extension-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}
.extension-edit-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}
.extension-edit-grid .check {
  align-content: center;
  color: var(--ink);
}
.phone-provision-details {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(48, 128, 255, .22);
  border-radius: 4px;
  background: rgba(48, 128, 255, .06);
  color: var(--ink);
  font-size: 11px;
}
.phone-provision-details strong {
  color: var(--brand-navy);
  font-size: 12px;
}
.phone-provision-details span,
.phone-provision-details small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.users-filter-select,
.users-search-row,
.users-table-wrap,
.dashboard-live-row,
.m365-picker,
.m365-folder-list,
.agent-lead-card {
  background: var(--panel);
}

.users-list-table th {
  background: var(--brand-soft-2);
  color: var(--ink);
}

.users-list-table tbody tr:hover td,
.users-list-table tbody tr.selected td,
.dashboard-live-row:hover,
.dashboard-live-menu button:hover,
.m365-folder-row:hover {
  background: var(--brand-soft);
}

.users-row-actions .icon-button {
  border-color: var(--line);
  background: var(--brand-soft);
  color: var(--ink);
}

.users-row-actions .icon-button:hover {
  background: var(--brand-soft-2);
}

.view { display: none; }
.view.active { display: block; }
.admin-dashboard-console {
  display: grid;
  gap: 14px;
  color: #eef5ff;
}
.admin-dash-panel {
  border: 1px solid rgba(48, 128, 255, .24);
  border-radius: 3px;
  background: var(--surface-dark);
  box-shadow: none;
}
.admin-dash-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.admin-dash-heading h2 {
  margin: 0;
  color: #f8fafc;
  font-size: 16px;
}
.admin-dash-heading h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  margin-right: 9px;
  border-radius: 99px;
  background: var(--brand-orange);
  vertical-align: -2px;
}
.system-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}
.system-row,
.maintenance-row,
.tool-row {
  min-width: 0;
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.12);
  border-right: 1px solid rgba(255,255,255,.12);
  border-radius: 0;
  background: transparent;
  color: #f8fafc;
  text-align: left;
  box-shadow: none;
}
.system-row:nth-child(4n),
.maintenance-list .maintenance-row:last-child {
  border-right: 0;
}
.system-row > span,
.maintenance-row > span,
.tool-row > span {
  display: block;
  color: #bcd2ff;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}
.system-row strong,
.maintenance-row strong,
.tool-row strong {
  display: inline-block;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.system-row em,
.maintenance-row em {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #91a9dd;
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.system-link:hover,
.maintenance-row.dashboard-action:hover,
.tool-row:hover {
  background: var(--surface-dark-3);
  filter: none;
}
.system-row .gauge,
.maintenance-row .gauge {
  margin-top: 7px;
  background: rgba(255,255,255,.12);
}
.system-row .gauge span,
.maintenance-row .gauge span {
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-orange));
}
.maintenance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.maintenance-list {
  min-width: 0;
}
.maintenance-list + .maintenance-list {
  border-left: 1px solid rgba(255,255,255,.12);
}
.maintenance-row {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-right: 0;
}
.maintenance-row span,
.maintenance-row strong,
.maintenance-row em {
  margin: 0;
}
.maintenance-row .compact-button {
  justify-self: end;
}
.gauge-row {
  grid-template-columns: minmax(120px, .8fr) minmax(72px, auto) minmax(120px, .8fr) minmax(160px, 1fr);
}
.troubleshooting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}
.tool-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 48px;
}
.tool-row strong {
  margin: 0;
  color: #8bb9ff;
}
.event-actions {
  display: flex;
  gap: 6px;
}
.event-log-table {
  overflow-x: auto;
}
.event-table {
  min-width: 900px;
  color: #f8fafc;
}
.event-table th,
.event-table td {
  height: 32px;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  color: #f8fafc;
  background: transparent;
}
.event-table th {
  color: #d8e6ff;
  background: var(--brand-navy-2);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}
.event-table td:nth-child(5) {
  max-width: 760px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-table tr:hover td {
  background: var(--surface-dark-3);
}
.event-severity {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand-orange);
  font-weight: 800;
}
.event-severity::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
}
.event-severity.error {
  color: #f87171;
}
.event-id-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8bb9ff;
  box-shadow: none;
}
.event-inspect {
  color: #91a9dd;
}
.users-console {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: calc(100vh - 86px);
  margin: -10px;
  background: var(--brand-soft);
  color: var(--ink);
}
.users-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--brand-soft-2);
}
.user-toolbar-button {
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--brand-blue);
  border-radius: 4px;
  background: var(--brand-blue);
  color: #fff;
  box-shadow: none;
  font-size: 12px;
  font-weight: 750;
}
.user-toolbar-button.primary {
  background: var(--brand-blue);
}
.user-toolbar-button.danger {
  border-color: var(--brand-orange-2);
  background: var(--brand-orange-2);
}
.user-toolbar-button:disabled {
  opacity: .58;
  background: #dce9ff;
  border-color: #c7d9f8;
  color: #53617d;
}
.users-filter-select {
  margin-left: auto;
  min-width: 84px;
  min-height: 32px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}
.users-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.users-search-icon {
  color: var(--muted);
  font-size: 12px;
}
.users-search-row input {
  flex: 1;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.users-table-wrap {
  min-height: 0;
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}
.users-list-table {
  min-width: 960px;
  color: var(--ink);
  font-size: 13px;
}
.users-list-table th,
.users-list-table td {
  height: 34px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-transform: none;
  letter-spacing: 0;
}
.users-list-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--brand-soft-2);
  color: var(--brand-navy);
  font-size: 13px;
}
.users-list-table tbody tr:hover td,
.users-list-table tbody tr.selected td {
  background: #e8f1ff;
}
.users-list-table .select-col {
  width: 38px;
  text-align: center;
}
.users-list-table input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  accent-color: var(--brand-blue);
}
.user-name-cell {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  min-width: 230px;
}
.user-name-cell strong,
.user-name-cell small,
.did-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-name-cell strong {
  color: var(--brand-navy);
  font-size: 13px;
}
.user-name-cell small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
}
.user-presence {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #71717a;
}
.user-presence.online {
  background: #42b72f;
}
.user-status-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #71717a;
}
.user-status-dot.ok {
  background: #42b72f;
}
.provider-pill {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.provider-pill.google {
  background: #4285f4;
}
.provider-pill.m365 {
  background: #f97316;
}
.provider-pill.teams {
  background: #6366f1;
}
.users-row-actions {
  justify-content: flex-end;
}
.users-row-actions .icon-button {
  border-color: #cfe0fa;
  background: #f8fbff;
  color: var(--brand-navy);
}
.users-row-actions .icon-button:hover {
  background: #e8f1ff;
}
.desk-phone-cell {
  display: grid;
  gap: 2px;
}
.desk-phone-cell .device-chip {
  display: inline-flex;
  margin: 1px 2px 1px 0;
}
.desk-phone-cell small {
  color: #64748b;
  font-size: 10px;
}
.modal-subheading {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  font-size: 13px;
}
.provision-info.full {
  width: min(760px, 100%);
}
.provision-config-text {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.metric, .panel, .phone-shell, .table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.dashboard-action {
  width: 100%;
  appearance: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.dashboard-action:hover {
  border-color: var(--brand-blue);
  box-shadow: 0 10px 24px rgba(52, 120, 246, .14);
  transform: translateY(-1px);
}
.dashboard-action:focus-visible {
  outline: 2px solid rgba(52, 120, 246, .35);
  outline-offset: 2px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.panel-heading h2 {
  margin: 0;
}
.warning-panel {
  margin-top: 12px;
}
.warning-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.warning-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: 6px;
  padding: 2px 2px;
  background: #fffaf0;
}
.warning-item.error {
  border-left-color: var(--danger);
  background: #fff5f4;
}
.warning-item p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
.warning-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.warning-topline strong {
  color: var(--ink);
}
.warning-topline time {
  margin-left: auto;
}
.warning-level {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  background: #fde68a;
  color: #92400e;
  font-weight: 800;
  text-transform: uppercase;
}
.warning-item.error .warning-level {
  background: #fecaca;
  color: var(--danger);
}
.metric span { display: block; font-size: 16px; font-weight: 800; letter-spacing: 0; }
.metric label { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 750; }
.dashboard-live-panel {
  margin-bottom: 8px;
}
.dashboard-live-calls {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}
.dashboard-live-row {
  display: grid;
  grid-template-columns: minmax(85px, 1fr) 72px 54px minmax(80px, .8fr) minmax(140px, 1.6fr);
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fbff;
  padding: 3px 5px;
  cursor: context-menu;
}
.dashboard-live-row:hover {
  border-color: var(--brand-blue);
  background: #eff6ff;
}
.dashboard-live-row strong,
.dashboard-live-row span,
.dashboard-live-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-live-row small {
  color: var(--muted);
}
.dashboard-live-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  min-width: 122px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .18);
}
.dashboard-live-menu button {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
}
.dashboard-live-menu button:last-child {
  border-bottom: 0;
  color: var(--danger);
}
.dashboard-live-menu button:hover {
  background: #eef6ff;
}
.recording-storage-panel {
  margin-top: 8px;
}
.security-toolbar input {
  max-width: 220px;
}
.service-control-row {
  grid-template-columns: minmax(80px, .55fr) minmax(85px, .5fr) minmax(220px, 1.8fr);
}
.service-control-row em {
  grid-column: 2 / -1;
}
.service-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  min-width: 0;
}
.service-actions .compact-button {
  min-height: 24px;
  padding: 3px 6px;
  font-size: 11px;
}
.security-table td:nth-child(7) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-log-table td:nth-child(7),
.action-log-table td:nth-child(7) {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-log-table td:nth-child(5) {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.backup-panel {
  display: grid;
  gap: 8px;
}
.backup-actions,
.restore-backup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.restore-backup-form input {
  max-width: 260px;
}
.storage-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.storage-summary div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfb;
  padding: 6px;
  min-width: 0;
}
.storage-summary span {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.storage-summary label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}
.log-metric {
  position: relative;
}
.log-metric .icon-button {
  position: absolute;
  top: 10px;
  right: 10px;
}
.gauge-card {
  display: grid;
  align-content: start;
  gap: 8px;
}
.gauge {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecef;
}
.gauge span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}
.form-grid, .phone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 5px;
  margin-bottom: 6px;
}
.list-toolbar {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-bottom: 6px;
}
.list-toolbar input {
  flex: 1;
}
.form-grid button { align-self: stretch; }
.wide-field {
  grid-column: 1 / -1;
}
.form-header-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.form-header-row h2 {
  margin: 0;
  font-size: 16px;
}
.ai-agent-form textarea {
  width: 100%;
}
.ai-openai-config-form,
.ai-agent-form,
#ai-agents-table {
  margin-bottom: 10px;
}
.ai-openai-config-form {
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.ai-openai-config-form textarea {
  width: 100%;
  min-height: 78px;
}
.check { display: flex; align-items: center; gap: 8px; }
.check input { min-height: 0; }
.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
  max-width: 980px;
}
.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-form .setting-row {
  flex-direction: row;
  align-items: center;
}
.settings-form button {
  justify-self: start;
}
.settings-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px 10px;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}
.settings-section h3 {
  margin: 0 0 2px;
  font-size: 13px;
  grid-column: 1 / -1;
}
.theme-settings-section {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}
.color-setting {
  display: grid;
  grid-template-columns: 34px minmax(82px, 1fr);
  gap: 5px;
  align-items: center;
}
.color-setting input[type="color"] {
  width: 34px;
  min-height: 28px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}
.color-setting input[type="text"],
.color-setting input:not([type="color"]) {
  min-height: 28px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
}
.settings-section-head,
.settings-actions,
.settings-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.settings-section-head {
  justify-content: space-between;
}
.settings-status {
  color: var(--muted);
  font-size: 11px;
}
.m365-picker {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
}
.m365-picker input,
.m365-picker select {
  min-height: 28px;
  flex: 1;
}
.m365-archive-status,
.m365-saved-folder {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(48, 128, 255, .28);
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--ink);
}
.m365-archive-status.running {
  border-color: var(--brand-blue);
  box-shadow: inset 3px 0 0 var(--brand-blue);
}
.m365-archive-status.error {
  border-color: rgba(180, 35, 24, .55);
  box-shadow: inset 3px 0 0 var(--danger);
}
.m365-archive-status strong,
.m365-saved-folder strong {
  color: var(--ink);
  font-size: 12px;
}
.m365-archive-status span,
.m365-saved-folder span,
.m365-saved-folder small {
  color: var(--muted);
  font-size: 11px;
}
.m365-archive-status ul {
  margin: 2px 0 0;
  padding-left: 16px;
}
.m365-archive-status li {
  margin: 2px 0;
  color: var(--ink);
  font-size: 11px;
}
.m365-copy-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.m365-folder-list {
  display: grid;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
}
.m365-folder-row {
  min-height: 28px;
  padding: 4px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}
.m365-folder-row:hover {
  background: #eaf3ff;
}
.m365-instructions {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 11px;
}
.m365-instructions h4 {
  margin: 0;
  font-size: 13px;
}
.m365-instructions ol {
  margin: 0;
  padding-left: 18px;
}
.m365-instructions li {
  margin: 2px 0;
}
.m365-instructions p {
  margin: 0;
  color: var(--muted);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  font-size: 11px;
}
.status-pill.ok {
  color: #6ee37e;
  border-color: rgba(110,227,126,.35);
}
.status-pill.warn {
  color: #f3c669;
  border-color: rgba(243,198,105,.35);
}
.table { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 11px;
}
th, td {
  text-align: left;
  padding: 3px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: #f8fbfb;
  position: sticky;
  top: 0;
  z-index: 1;
}
td input, td select {
  min-height: 22px;
  padding: 2px 4px;
  font-size: 11px;
  width: 100%;
  min-width: 76px;
}
td input[type="checkbox"] {
  width: 14px;
  min-width: 14px;
  min-height: 14px;
}
tbody tr:hover td { background: #fbfefe; }
.call-log-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.call-log-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.call-log-toolbar select {
  min-height: 24px;
  padding: 2px 4px;
}
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pager button {
  min-width: 30px;
}
.call-log-table {
  font-size: 11px;
}
.extension-list-table {
  min-width: 1080px;
}
.call-log-table th,
.call-log-table td {
  padding: 3px 4px;
}
.row-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  white-space: nowrap;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 6px;
  font-weight: 800;
  font-size: 10px;
  line-height: 1;
}
#ai-agents-table .icon-button {
  width: auto;
  padding: 0 6px;
}
.muted-mini {
  color: var(--muted);
  font-size: 10px;
}
.transcript-cell {
  min-width: 220px;
  max-width: 360px;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f3f6f7;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.status-chip.ok {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: var(--ok);
}
.status-chip.bad {
  background: #fee2e2;
  border-color: #fecaca;
  color: var(--danger);
}
.status-chip.warn {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}
.status-chip.muted {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}
.trunk-edit-row td { background: #f8fbfb; }
.trunk-editor {
  display: grid;
  gap: 5px;
  padding: 2px 0;
}
.trunk-edit-grid, .trunk-sms-grid, .trunk-did-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 5px;
}
.trunk-sms-grid { grid-template-columns: 2fr 2fr 1fr; }
.trunk-editor label {
  display: grid;
  gap: 3px;
  color: var(--muted);
}
.inline-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.mini-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.mini-table table { min-width: 560px; }
.mini-table p { padding: 6px; }
.did-route-table input,
.did-route-table select {
  min-height: 22px;
  padding: 2px 4px;
  font-size: 11px;
}
.did-destination-edit {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(120px, 1fr);
  gap: 3px;
}
.did-edit-row td {
  background: #f8fbfb;
}
.notice {
  border-radius: 8px;
  padding: 4px 6px;
  margin-bottom: 6px;
  background: #e8f5f2;
  border: 1px solid #b7ddd5;
}
.notice.error {
  color: var(--danger);
  background: #fff0ee;
  border-color: #ffc8c0;
}
.hidden { display: none; }
.phone-shell { max-width: 900px; }
.phone-display {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #cdd8dd;
  border-radius: 8px;
  background: #f8fbfb;
}
.phone-status {
  font-size: 24px;
  font-weight: 750;
}
.phone-call-duration {
  width: max-content;
  padding: 2px 8px;
  border: 1px solid rgba(47, 155, 215, .28);
  border-radius: 999px;
  color: var(--primary);
  background: rgba(47, 155, 215, .08);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
}
.phone-caller {
  color: var(--muted);
  font-size: 15px;
}
.phone-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 10px;
}
.phone-active-actions {
  display: grid;
  grid-template-columns: minmax(88px, .7fr) minmax(160px, 1.6fr) minmax(96px, .8fr);
  gap: 8px;
  margin-top: 10px;
}
.phone-active-actions button,
.phone-active-actions input {
  min-height: 34px;
}
.phone-page {
  display: block;
  min-height: 100vh;
  background: #edf1f3;
}
.phone-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.phone-login-box {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgba(23, 32, 38, .12);
}
.phone-login-box h1 { font-size: 26px; }
.phone-login-box label, .phone-grid label { display: grid; gap: 6px; color: var(--muted); }
.phone-login-box .login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px;
  color: #dce7f3;
  font-size: 13px;
}
.phone-login-box .login-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.phone-login-error { min-height: 20px; color: var(--danger); font-weight: 650; }
.phone-console {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.phone-nav {
  min-height: 100vh;
  background: #13252b;
  color: #eaf2f4;
  padding: 16px 12px;
}
.phone-brand.compact { margin: 0 6px 20px; }
.phone-brand.compact h1 { font-size: 20px; }
.phone-tab {
  width: 100%;
  display: block;
  margin: 4px 0;
  text-align: left;
  background: transparent;
  border-color: transparent;
  color: inherit;
}
.phone-tab.active, .phone-tab:hover { background: rgba(255,255,255,.12); }
.phone-tab.logout { margin-top: 22px; color: #ffd6d2; }
.phone-workspace {
  min-width: 0;
  padding: 20px;
}
.phone-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.phone-topbar h2 { font-size: 26px; margin: 0; }
.phone-presence {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel);
  font-weight: 750;
}
.presence-control {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px 5px 10px;
  background: var(--panel);
  font-weight: 750;
}
.presence-control select {
  min-height: 28px;
  padding: 2px 22px 2px 6px;
  border-radius: 999px;
  font-size: 12px;
}
.presence-control[data-presence="available"] #phone-presence { color: #56d364; }
.presence-control[data-presence="away"] #phone-presence { color: #f5b342; }
.presence-control[data-presence="dnd"] #phone-presence { color: #ff6b6b; }
.phone-panel { display: none; }
.phone-panel.active { display: grid; }
#panel-dialer {
  grid-template-columns: minmax(320px, 520px) 1fr;
  gap: 16px;
  align-items: start;
}
.phone-softphone, .phone-side, .phone-table-wrap, .contact-tools, .status-grid {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.dial-input {
  width: 100%;
  min-height: 52px;
  margin-bottom: 12px;
  font-size: 22px;
  text-align: center;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.keypad button {
  min-height: 54px;
  background: #f7fafb;
  color: var(--ink);
  border-color: var(--line);
  font-size: 22px;
}
.phone-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.standalone-phone {
  width: min(760px, 100%);
  padding: 22px;
}
.phone-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.phone-brand h1 {
  font-size: 24px;
}
.contact-list, .contact-grid {
  display: grid;
  gap: 8px;
}
.contact-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.contact-row, .contact-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f9fbfb;
}
.contact-row span, .contact-card span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.contact-tools {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.contact-tools input { flex: 1; }
.phone-table-wrap { overflow-x: auto; }
.phone-table { min-width: 720px; }
.phone-table button, .contact-row button, .contact-card button {
  min-height: 34px;
  padding: 6px 10px;
}
.live-panel-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 14px;
}
.live-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}
.live-card.wide {
  grid-column: 1 / -1;
}
.live-calls-card {
  grid-column: 1 / -1;
}
.live-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.live-card h3 {
  margin: 0;
}
.live-card p {
  margin: 3px 0 0;
}
.live-list {
  display: grid;
  gap: 8px;
}
.live-row {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f9fbfb;
}
.live-call-row {
  grid-template-columns: minmax(90px, 1fr) minmax(70px, .7fr) minmax(70px, .8fr) minmax(180px, 1.8fr) auto auto;
  align-items: center;
  cursor: context-menu;
  padding: 7px 10px;
}
.live-call-row strong,
.live-cell,
.live-channel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-call-row:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}
.live-row > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.live-row span, .live-row small {
  color: var(--muted);
}
.live-duration {
  font-weight: 750;
}
.queue-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}
.team-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f9fbfb;
}
.team-card.online {
  box-shadow: inset 3px 0 0 #10b981;
}
.team-card span, .team-card small {
  color: var(--muted);
}
.team-card button {
  min-height: 30px;
  padding: 5px 8px;
}
.team-chip {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 750;
}
.team-chip.online {
  background: #dcfce7;
  color: #166534;
}
.live-action-menu {
  position: fixed;
  z-index: 100;
  display: grid;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(23, 32, 38, .22);
}
.live-action-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}
.live-action-menu button:hover {
  background: #eef7ff;
}
.live-action-menu .danger-menu {
  color: var(--danger);
}
.live-action-menu .danger-menu:hover {
  background: #fee2e2;
}
.call-popup {
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 150;
  width: min(360px, calc(100vw - 28px));
}
.call-popup.has-lead {
  width: min(520px, calc(100vw - 28px));
}
.call-popup-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #b8cbd4;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 55px rgba(23, 32, 38, .26);
}
.call-popup-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.call-popup-top span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 750;
}
.call-popup-top strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}
.call-popup-status {
  color: var(--muted);
  font-weight: 650;
}
.call-popup-duration {
  width: max-content;
  padding: 2px 8px;
  border: 1px solid rgba(47, 155, 215, .28);
  border-radius: 999px;
  color: var(--primary);
  background: rgba(47, 155, 215, .08);
  font-size: 12px;
  font-weight: 750;
}
.call-popup-lead {
  display: grid;
  gap: 8px;
  max-height: 42vh;
  overflow: auto;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 8%, var(--panel));
}
.call-popup-lead-head {
  display: grid;
  gap: 2px;
}
.call-popup-lead-head strong {
  color: var(--ink);
  font-size: 15px;
}
.call-popup-lead-head span {
  color: var(--muted);
  font-size: 12px;
}
.call-popup-script,
.call-popup-notes {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.call-popup-script strong,
.call-popup-notes strong {
  color: var(--primary);
  font-size: 12px;
  text-transform: uppercase;
}
.call-popup-script p,
.call-popup-notes p {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.4;
}
.call-popup-transfer input {
  width: 100%;
}
.call-popup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.call-popup-actions.active-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.call-popup-actions button {
  min-height: 34px;
  padding: 6px 8px;
}
.message-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  align-items: start;
}
.message-composer, .message-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.message-composer {
  display: grid;
  gap: 10px;
}
.message-composer textarea {
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
}
.message-list, .conversation-list {
  display: grid;
  gap: 10px;
}
.conversation-active {
  display: grid;
  gap: 10px;
}
.conversation-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.conversation-header span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.conversation-thread {
  display: grid;
  gap: 8px;
  align-content: start;
}
.message-bubble {
  max-width: min(560px, 86%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f9fbfb;
}
.message-bubble.outbound {
  justify-self: end;
  background: #eef7ff;
}
.message-bubble.inbound {
  justify-self: start;
}
.message-bubble p {
  margin: 0 0 6px;
  color: var(--ink);
  white-space: pre-wrap;
}
.message-bubble span {
  color: var(--muted);
  font-size: 12px;
}
.conversation-list {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.conversation-list h3 { margin: 0; }
.conversation-row {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: auto;
  text-align: left;
  color: var(--ink);
  background: #f9fbfb;
  border-color: var(--line);
  font-weight: 500;
}
.conversation-row.unread {
  border-color: #2563eb;
  background: #eef7ff;
}
.conversation-row.unanswered {
  box-shadow: inset 3px 0 0 #b45309;
}
.conversation-row > span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-flags {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.message-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 7px;
  margin-left: 6px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 750;
}
.message-badge.warning {
  background: #fef3c7;
  color: #92400e;
}
.message-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfb;
}
.message-item.outbound {
  background: #eef7ff;
}
.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}
.message-meta strong { color: var(--ink); }
.message-item p {
  margin: 8px 0 10px;
  color: var(--ink);
  white-space: pre-wrap;
}
.chat-console {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: calc(100vh - 108px);
  max-height: calc(100vh - 108px);
  overflow: hidden;
}
.chat-toolbar {
  display: grid;
  grid-template-columns: 42px minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 18px;
}
.chat-layout {
  display: grid;
  grid-template-columns: clamp(280px, 28vw, 430px) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid #4f4f4f;
}
.chat-conversation-list {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  border-right: 1px solid #4f4f4f;
  padding: 8px 8px 8px 0;
}
.chat-thread-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.chat-thread-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 82px;
  padding: 16px 24px;
  border-bottom: 1px solid #4f4f4f;
}
.chat-person {
  display: flex;
  gap: 12px;
  align-items: center;
}
.chat-person strong {
  display: block;
  font-size: 16px;
}
.chat-person span {
  color: #c5cbd2;
}
.chat-header-actions {
  display: flex;
  gap: 10px;
}
.chat-header-actions button {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: #dbe2ea;
  box-shadow: none;
}
.conversation-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 68px;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #f8fafc;
  text-align: left;
  box-shadow: none;
}
.conversation-row:hover,
.conversation-row.active {
  background: #56565a;
}
.conversation-row.unread {
  background: #344b63;
  box-shadow: inset 4px 0 0 #2d98d4;
}
.conversation-summary {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.conversation-summary strong,
.conversation-summary small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-summary small,
.conversation-side time {
  color: #b9c0c8;
  font-size: 12px;
}
.conversation-number {
  margin-right: 6px;
  color: #e2e8f0;
  font-weight: 750;
}
.conversation-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}
.conversation-side em {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #2d98d4;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.chat-thread {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 44px;
}
.chat-date-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 8px 0 14px;
  color: #b9c0c8;
}
.chat-date-divider::before,
.chat-date-divider::after {
  content: "";
  height: 1px;
  background: #4f4f4f;
}
.message-bubble {
  max-width: min(560px, 72%);
  border: 0;
  border-radius: 5px;
  padding: 10px 12px;
  background: #59595f;
  color: #fff;
}
.message-bubble.outbound {
  justify-self: end;
  background: #627386;
}
.message-bubble.inbound {
  justify-self: start;
}
.message-bubble.unread {
  box-shadow: inset 4px 0 0 #2d98d4;
}
.message-bubble.failed {
  outline: 1px solid #ef4444;
}
.message-bubble p {
  margin: 0 0 6px;
  color: #fff;
  white-space: pre-wrap;
}
.message-bubble span {
  color: #f1f5f9;
  font-size: 12px;
}
.message-meta-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.message-receipt {
  color: #cbd5e1;
  font-weight: 750;
}
.message-receipt.read {
  color: #7dd3fc;
}
.message-bubble strong {
  display: block;
  margin-top: 6px;
  color: #ff5252;
  font-size: 12px;
}
.chat-composer {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px 20px;
  border-top: 1px solid #4f4f4f;
  background: #383838;
}
.chat-composer textarea {
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
}
.call-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e8f5f2;
  color: #0f766e;
  font-weight: 750;
  font-size: 12px;
}
.transcript-status {
  display: inline;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  margin-right: 6px;
  text-transform: capitalize;
}
.transcript-text {
  display: inline;
  max-width: 460px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink);
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}
.status-grid div,
.status-theme-choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}
.status-grid span,
.status-theme-choice span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}
.notification-status-card .compact-button {
  margin-top: 8px;
}
.status-theme-choice select {
  width: 100%;
  min-height: 30px;
}
.lead-upload-form {
  margin-bottom: 10px;
}
.lead-upload-progress {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.lead-upload-progress.hidden {
  display: none;
}
.lead-upload-progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce8ec;
}
.lead-upload-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .2s ease;
}
.lead-upload-progress strong {
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
}
#leads.view.active {
  display: flex;
  min-height: calc(100vh - 92px);
  flex-direction: column;
  overflow: hidden;
}
.lead-workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-rows: minmax(160px, 28vh) minmax(240px, 1fr) minmax(150px, 24vh);
  gap: 8px;
  overflow: hidden;
}
.lead-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.lead-panel-heading,
.lead-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.lead-panel-heading h2 {
  margin: 0;
  font-size: 15px;
}
.lead-panel-heading p,
.lead-pager span {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.lead-panel-heading label,
.lead-pager label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}
.lead-panel .table {
  min-height: 0;
  flex: 1;
  border: 0;
  border-radius: 0;
  overflow: auto;
}
.lead-dnc-form {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.lead-dnc-form input {
  width: 100%;
}
.lead-pager {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.lead-list-table input,
.lead-list-table select {
  width: 100%;
  min-width: 90px;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
}
.leads-data-table .lead-list-table {
  font-size: 11px;
}
.leads-data-table .lead-list-table th,
.leads-data-table .lead-list-table td {
  padding: 3px 5px;
  line-height: 1.2;
  vertical-align: middle;
}
.lead-readonly-row td {
  white-space: nowrap;
}
.lead-readonly-row .status-chip {
  padding: 1px 5px;
  font-size: 10px;
}
.lead-campaigns-table {
  margin-bottom: 0;
}
.lead-campaigns-table input,
.lead-campaigns-table select,
.lead-campaigns-table textarea {
  width: 100%;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
}
.lead-count-stack,
.lead-timing-stack {
  display: grid;
  gap: 3px;
  min-width: 110px;
}
.lead-count-stack span,
.lead-timing-stack span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.campaign-status-stack {
  display: grid;
  gap: 3px;
  min-width: 150px;
}
.campaign-status-stack span:not(.status-chip) {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.campaign-status-stack .warn-text {
  color: #c56a00;
  white-space: normal;
}
.lead-route-summary {
  display: grid;
  gap: 3px;
  min-width: 170px;
}
.lead-route-summary strong {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
}
.lead-route-summary span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}
.lead-route-grid {
  display: grid;
  min-width: 180px;
  gap: 4px;
}
.lead-rule-grid,
.lead-hours-grid {
  display: grid;
  min-width: 150px;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  gap: 4px;
}
.lead-rule-grid label,
.lead-hours-grid label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
}
.lead-hours-grid .mini-check {
  display: flex;
  gap: 4px;
  align-items: center;
}
.campaign-script-input {
  min-width: 220px;
  min-height: 70px;
  resize: vertical;
}
.lead-list-table .tiny-input {
  min-width: 58px;
}
.lead-id-cell {
  display: inline-flex;
  min-width: 34px;
  font-weight: 800;
  color: var(--ink);
}
.lead-name-edit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.lead-campaigns-table tr[data-select-campaign] {
  cursor: pointer;
}
.lead-campaigns-table tr.selected-row td {
  background: rgba(34, 172, 195, .14);
  box-shadow: inset 3px 0 0 var(--accent);
}
.campaign-name-actions {
  display: grid;
  gap: 6px;
  min-width: 150px;
}
.campaign-name-actions strong {
  overflow: hidden;
  text-overflow: ellipsis;
}
.campaign-name-actions span {
  color: var(--muted);
  font-size: 10px;
}
.campaign-settings-panel {
  width: min(860px, 96vw);
  max-height: 92vh;
  overflow: auto;
}
.campaign-settings-panel .modal-heading {
  padding: 20px 24px 0;
}
.campaign-settings-form {
  display: grid;
  gap: 14px;
  padding: 0 24px 24px;
}
.campaign-settings-form section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--brand-blue) 22%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 86%, var(--bg));
}
.campaign-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}
.campaign-settings-grid.compact {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}
.campaign-settings-grid label,
.campaign-settings-form section > label,
.campaign-recording-check {
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.campaign-settings-form .modal-subheading {
  color: color-mix(in srgb, var(--ink) 88%, var(--brand-blue));
}
.campaign-recording-check {
  display: flex;
  align-items: center;
  align-self: end;
  min-height: 32px;
}
.campaign-settings-form .campaign-script-input {
  width: 100%;
  min-height: 120px;
}
.lead-agent-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.lead-agent-toolbar .compact-button {
  min-height: 28px;
  padding: 3px 8px;
}
.agent-leads-list {
  display: grid;
  gap: 6px;
}
.agent-lead-card {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(320px, 2fr);
  gap: 5px 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.agent-lead-card header,
.agent-lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}
.agent-lead-card header {
  justify-content: space-between;
}
.agent-lead-card header span,
.agent-lead-meta span {
  color: var(--muted);
  font-size: 12px;
}
.agent-lead-card p {
  margin: 0;
  color: var(--ink);
}
.agent-script-card {
  grid-column: 1 / -1;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 9%, var(--panel));
}
.agent-script-card summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}
.agent-script-card strong {
  color: var(--ink);
}
.agent-script-card p {
  white-space: pre-wrap;
}
.lead-disposition {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(140px, 1fr) auto minmax(160px, 1fr) minmax(220px, 2fr) auto;
  gap: 5px;
  align-items: center;
}
.lead-callback-input {
  min-height: 32px;
}
.lead-disposition textarea {
  min-height: 30px;
  max-height: 58px;
  resize: vertical;
}
.lead-disposition-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 10, 18, .72);
}
.lead-disposition-dialog {
  display: grid;
  width: min(560px, 96vw);
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.lead-disposition-dialog header,
.lead-disposition-dialog footer {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.lead-disposition-dialog header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.lead-disposition-dialog label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.lead-disposition-dialog label.check {
  display: flex;
}
.lead-disposition-dialog select,
.lead-disposition-dialog input,
.lead-disposition-dialog textarea {
  width: 100%;
  min-height: 34px;
  color: var(--ink);
  background: var(--input-bg, #fff);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.lead-disposition-dialog textarea {
  min-height: 80px;
  resize: vertical;
}
.modal-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 12px;
  border-bottom: 1px solid var(--line);
}
.modal-tab {
  min-height: 30px;
  padding: 4px 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 6px 6px 0 0;
  box-shadow: none;
}
.modal-tab.active {
  color: #fff;
  background: var(--accent);
}
.user-tab-panel {
  display: none;
}
.user-tab-panel.active {
  display: block;
}
.user-rights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.user-right {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
}
.department-rights-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.department-rights-table {
  min-width: 720px;
}
.department-rights-table th,
.department-rights-table td {
  text-align: center;
}
.department-rights-table th:first-child,
.department-rights-table td:first-child {
  text-align: left;
}
.department-rights-table input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}
.empty-state {
  color: var(--muted);
  padding: 12px;
}
.hidden { display: none !important; }

.phone-page {
  background: #3b3b3b;
  color: #f3f4f6;
}
.phone-page .phone-console {
  grid-template-columns: 92px 1fr;
  min-height: 100vh;
  background: #3b3b3b;
}
.phone-page .phone-nav {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  height: 100vh;
  min-height: 100vh;
  padding: 12px 4px 8px;
  background: #25292d;
  color: #f8fafc;
}
.phone-page .phone-brand.compact {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0 0 10px;
}
.phone-page .phone-brand.compact .brand-logo {
  width: 46px;
  height: 46px;
}
.phone-page .phone-brand.compact h1 {
  margin: 0;
  font-size: 11px;
  line-height: 1;
}
.phone-nav-main,
.phone-nav-bottom {
  display: grid;
  gap: 6px;
  align-content: start;
}
.phone-nav-bottom {
  align-content: end;
}
.phone-page .phone-tab {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  width: 84px;
  min-height: 66px;
  margin: 0;
  padding: 6px 2px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}
.phone-page .phone-tab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.phone-page .phone-tab span {
  color: inherit;
  font-size: 12px;
  font-weight: 750;
}
.phone-page .phone-tab.active,
.phone-page .phone-tab:hover {
  background: #2d98d4;
  color: #fff;
}
.phone-page .phone-tab.logout {
  margin-top: 0;
  color: #ffd6d2;
}
.phone-page .phone-workspace {
  min-height: 100vh;
  padding: 0;
  background: #3f3f3f;
}
.phone-page .phone-topbar {
  min-height: 72px;
  margin: 0;
  padding: 0 16px 0 24px;
  align-items: center;
  border-bottom: 1px solid #4f4f4f;
  background: #292d31;
}
.phone-page .phone-topbar h2 {
  color: #fff;
  font-size: 22px;
}
.phone-page .phone-topbar p {
  color: #cbd5e1;
}
.phone-top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.webphone-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 190px;
  max-width: 280px;
  padding: 6px 10px 6px 6px;
  border: 1px solid #56616e;
  border-radius: 999px;
  background: #333941;
  color: #f8fafc;
}
.webphone-user-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2d98d4;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}
.webphone-user-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}
.webphone-user-text strong,
.webphone-user-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.webphone-user-text strong {
  font-size: 12px;
  line-height: 1.15;
}
.webphone-user-text small {
  color: #cbd5e1;
  font-size: 10px;
}
.todo-wrap {
  position: relative;
}
.todo-toggle {
  position: relative;
}
.todo-toggle.has-items {
  border-color: #2d98d4;
  background: #28435a;
}
.todo-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 850;
}
.todo-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 160;
  width: min(380px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 96px));
  overflow: hidden;
  border: 1px solid #505050;
  border-radius: 6px;
  background: #343434;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .32);
}
.todo-menu header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid #4f4f4f;
  color: #f8fafc;
}
.todo-menu header span {
  color: #b9c0c8;
  font-size: 12px;
}
.todo-list {
  display: grid;
  gap: 4px;
  max-height: 440px;
  overflow-y: auto;
  padding: 8px;
}
.todo-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  border-radius: 5px;
}
.todo-main {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 58px;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #f8fafc;
  text-align: left;
  box-shadow: none;
}
.todo-main:hover,
.todo-main:focus {
  background: #44464a;
}
.todo-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #415061;
  color: #dceeff;
}
.todo-item.message .todo-icon {
  background: #244f67;
  color: #7dd3fc;
}
.todo-item.missed .todo-icon {
  background: #5a3434;
  color: #fecaca;
}
.todo-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.todo-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.todo-text strong,
.todo-text em,
.todo-text small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo-text strong {
  color: #f8fafc;
  font-size: 13px;
}
.todo-text em,
.todo-text small,
.todo-main time {
  color: #b9c0c8;
  font-size: 11px;
  font-style: normal;
}
.todo-done {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #505050;
  border-radius: 5px;
  background: #3b3b3b;
  color: #f8fafc;
  box-shadow: none;
  font-size: 11px;
}
.todo-done:hover {
  border-color: #2d98d4;
  background: #44464a;
}
.phone-icon-action {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background: #414852;
  color: #f8fafc;
  box-shadow: none;
}
.phone-icon-action.primary {
  background: #2497d3;
  border-color: #2497d3;
}
.phone-page .phone-presence {
  max-width: 180px;
  border: 0;
  border-radius: 6px;
  background: #28435a;
  color: #e5f4ff;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phone-page .phone-panel {
  min-height: calc(100vh - 72px);
  background: #3f3f3f;
}
.phone-page .phone-panel.active {
  display: grid;
}
.panel-console {
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr) auto;
  min-height: calc(100vh - 72px);
}
.panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 0 18px;
  border-bottom: 1px solid #505050;
  background: #383838;
  color: #eef2f7;
}
.panel-toolbar-actions {
  display: flex;
  gap: 8px;
}
.panel-table-section {
  min-height: 0;
  border-bottom: 1px solid #505050;
}
.live-calls-section {
  min-height: 420px;
}
.panel-table-section h3 {
  margin: 0;
  padding: 10px 18px;
  color: #f8fafc;
  font-size: 14px;
}
.panel-table-wrap {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.panel-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: #f8fafc;
  font-size: 14px;
}
.panel-table th,
.panel-table td {
  height: 31px;
  padding: 4px 20px;
  border-bottom: 1px solid #4d4d4d;
  color: #f8fafc;
  background: transparent;
  white-space: nowrap;
}
.panel-table th {
  position: static;
  color: #f8fafc;
  background: #383838;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}
.panel-table tbody tr:hover td {
  background: #474747;
}
.agent-status-table td:first-child {
  border-left: 5px solid #b7c6d2;
}
.agent-status-table tr.agent-online td:first-child {
  border-left-color: #35b936;
}
.panel-link-button {
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f8fafc;
  box-shadow: none;
  font: inherit;
  font-weight: 700;
}
.panel-link-button:hover {
  color: #38bdf8;
  background: transparent;
}
.phone-page #panel-dialer,
.phone-page #panel-team,
.phone-page #panel-messages,
.phone-page #panel-calls,
.phone-page #panel-recording,
.phone-page #panel-contacts,
.phone-page #panel-status,
.phone-page #panel-leads {
  padding: 18px;
}
.phone-page #panel-messages {
  height: calc(100vh - 72px);
  min-height: 0;
  overflow: hidden;
}
.phone-page .phone-softphone,
.phone-page .phone-side,
.phone-page .phone-table-wrap,
.phone-page .contact-tools,
.phone-page .status-grid,
.phone-page .message-composer,
.phone-page .message-list,
.phone-page .agent-lead-card {
  border-color: #505050;
  background: #343434;
  color: #f8fafc;
}
.phone-page input,
.phone-page textarea,
.phone-page select {
  border-color: #525252;
  background: #2f2f2f;
  color: #f8fafc;
}
.phone-page .keypad button,
.phone-page .contact-row,
.phone-page .contact-card,
.phone-page .message-item,
.phone-page .conversation-row,
.phone-page .status-grid div,
.phone-page .status-theme-choice {
  border-color: #505050;
  background: #3b3b3b;
  color: #f8fafc;
}
.phone-page .conversation-row:hover,
.phone-page .conversation-row.active {
  background: #56565a;
}
.phone-page .conversation-row.unread {
  background: #274968;
  box-shadow: inset 4px 0 0 #2d98d4;
}
.phone-page .conversation-row.unread.active {
  background: #315b7f;
}
.team-console {
  display: grid;
  align-content: start;
  gap: 18px;
}
.team-toolbar {
  display: grid;
  grid-template-columns: 42px minmax(260px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
}
.team-square-button,
.team-toolbar-button,
.team-view-buttons button {
  min-height: 42px;
  border: 1px solid #505050;
  border-radius: 6px;
  background: #3b3b3b;
  color: #f8fafc;
  box-shadow: none;
}
.team-square-button {
  font-size: 22px;
}
.team-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #238cca;
  border-radius: 6px;
  background: #3b3b3b;
}
.team-search svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #aeb8c2;
  stroke-width: 2;
}
.team-search input {
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
}
.team-view-buttons {
  display: flex;
  gap: 0;
}
.team-view-buttons button {
  min-width: 42px;
  border-radius: 0;
}
.team-view-buttons button:first-child {
  border-radius: 6px 0 0 6px;
}
.team-view-buttons button:last-child {
  border-radius: 0 6px 6px 0;
}
.team-view-buttons button.active {
  background: #55565a;
}
.team-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 18px;
}
.team-person-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 174px;
  padding: 18px 14px;
  border: 1px solid #4e4e4e;
  border-radius: 5px;
  background: #383838;
  color: #f8fafc;
}
.team-person-card:hover {
  border-color: #5f6d7d;
  background: #3d3d3d;
}
.team-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: #aab4c0;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
}
.team-presence-dot {
  position: absolute;
  top: 70px;
  left: calc(50% + 22px);
  width: 12px;
  height: 12px;
  border: 2px solid #383838;
  border-radius: 999px;
  background: #9ca3af;
}
.team-presence-dot.online {
  background: #36b837;
}
.team-presence-dot.online.presence-away {
  background: #f5b342;
}
.team-presence-dot.online.presence-dnd {
  background: #ff5d5d;
}
.status-chip.presence-available {
  color: #0f5132;
  background: #d1f7dc;
}
.status-chip.presence-away {
  color: #6a4300;
  background: #ffebb7;
}
.status-chip.presence-dnd {
  color: #7f1d1d;
  background: #ffd6d6;
}
.team-card-menu {
  position: absolute;
  top: 8px;
  right: 9px;
  min-height: 20px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: #d5d8dd;
  box-shadow: none;
}
.team-person-card strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.team-person-card > span:not(.team-presence-dot) {
  color: #c5cbd2;
  font-size: 13px;
}
.team-card-actions {
  display: flex;
  gap: 7px;
  margin-top: 2px;
}
.team-card-actions button {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid #535353;
  border-radius: 6px;
  background: #414141;
  color: #dbe2ea;
  box-shadow: none;
}
.team-card-actions button:hover {
  border-color: #2d98d4;
  color: #fff;
}
.team-card-actions svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.team-card-actions span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.quick-dial-card .team-avatar {
  background: #238cca;
}
.calls-console {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 108px);
}
.calls-toolbar {
  display: grid;
  grid-template-columns: 42px minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 18px;
}
.calls-history-layout {
  display: grid;
  grid-template-columns: minmax(320px, 31vw) 1fr;
  min-height: 0;
  border-top: 1px solid #4f4f4f;
}
.call-history-list {
  min-height: calc(100vh - 180px);
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  border-right: 1px solid #4f4f4f;
  padding: 8px 8px 8px 0;
}
.call-history-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #f8fafc;
  text-align: left;
  box-shadow: none;
}
.call-history-item:hover,
.call-history-item.active {
  background: #56565a;
}
.call-history-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #aab4c0;
  color: #fff;
  font-weight: 800;
}
.call-history-avatar.large {
  width: 58px;
  height: 58px;
  font-size: 20px;
}
.call-history-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.call-history-main strong,
.call-history-main small,
.call-history-main em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-history-main strong {
  font-size: 14px;
}
.call-history-main small,
.call-history-main em {
  color: #b9c0c8;
  font-size: 12px;
  font-style: normal;
}
.call-history-actions {
  display: flex;
  gap: 12px;
  color: #dbe2ea;
  font-size: 12px;
}
.call-history-detail {
  min-height: calc(100vh - 180px);
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 22px 24px;
}
.call-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid #4f4f4f;
}
.call-detail-person {
  display: flex;
  gap: 12px;
  align-items: center;
}
.call-detail-person strong {
  display: block;
  font-size: 18px;
}
.call-detail-person span {
  color: #c5cbd2;
}
.call-detail-links,
.call-detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.call-detail-links button,
.call-detail-actions button {
  min-height: 38px;
  padding: 7px 16px;
  border: 1px solid #4f4f4f;
  border-radius: 5px;
  background: #383838;
  color: #f8fafc;
  box-shadow: none;
}
.call-detail-actions {
  justify-content: flex-end;
  margin: 12px 0 18px;
}
.call-history-timeline h3 {
  margin: 0 0 18px;
  font-size: 18px;
}
.call-day-group {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.call-day-group h4 {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 0;
  color: #b9c0c8;
  font-size: 14px;
}
.call-day-group h4::after {
  content: "";
  height: 1px;
  background: #4f4f4f;
}
.call-history-event {
  display: grid;
  grid-template-columns: 18px auto auto 1fr;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #4b4b4b;
  border-radius: 5px;
  background: #373737;
}
.call-history-event time {
  justify-self: end;
  color: #b9c0c8;
}
.call-history-event span {
  color: #b9c0c8;
}
.call-incoming {
  color: #2d98d4 !important;
}
.call-outgoing {
  color: #41b83e !important;
}
.call-missed {
  color: #ef4444 !important;
}
.recording-toolbar {
  grid-template-columns: 42px minmax(260px, 1fr) auto;
}
.recording-list-item .recording-list-actions svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.recording-detail-header {
  align-items: center;
}
.recording-top-actions button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.recording-top-actions svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.recording-detail-body {
  display: grid;
  gap: 16px;
  padding-top: 28px;
}
.recording-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.recording-section-heading h3 {
  margin: 0;
  font-size: 18px;
}
.recording-section-heading time {
  color: #b9c0c8;
  font-size: 14px;
}
.recording-player {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 36px;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 5px;
  background: #4b4e61;
}
.recording-play-button,
.recording-download-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: #2d98d4;
  color: #fff;
  box-shadow: none;
}
.recording-download-button {
  background: #3f4959;
}
.recording-play-button svg,
.recording-download-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.recording-waveform {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  height: 34px;
  overflow: hidden;
}
.recording-waveform span {
  flex: 0 0 3px;
  border-radius: 999px;
  background: #707285;
}
.recording-player.playing .recording-waveform span {
  background: #b9e6ff;
}
.recording-duration {
  color: #e5edf6;
  font-size: 12px;
  font-weight: 750;
}
.recording-meta-row {
  display: flex;
  gap: 12px;
  color: #b9c0c8;
  font-size: 13px;
}
.recording-transcript {
  display: grid;
  gap: 8px;
  max-width: 900px;
  padding: 12px;
  border: 1px solid #4b4b4b;
  border-radius: 5px;
  background: #373737;
}
.recording-transcript div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.recording-transcript span {
  color: #b9c0c8;
}
.recording-transcript p {
  margin: 0;
  color: #f8fafc;
}
.recording-transcript button {
  justify-self: start;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #4f4f4f;
  border-radius: 5px;
  background: #383838;
  color: #f8fafc;
  box-shadow: none;
}

/* VoIPTele logo theme polish */
.metric,
.panel,
.phone-shell,
.table,
.department-card,
.settings-panel,
.ai-agent-panel {
  border-color: var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 80, .08);
}
.status-chip.ok,
.user-status-dot.ok,
.user-presence.online {
  background: #36b837;
}
.status-chip.muted {
  background: #edf4ff;
  color: var(--muted);
}
.phone-page,
.chat-console,
.calls-console,
.recording-console {
  background: var(--surface-dark);
  color: #f8fbff;
}
.phone-page .phone-console,
.phone-page .phone-nav,
.phone-page .phone-workspace,
.phone-page .phone-topbar,
.phone-page .phone-panel,
.phone-page .phone-softphone,
.phone-page .phone-side,
.phone-page .phone-table-wrap,
.phone-page .contact-tools,
.phone-page .status-grid,
.phone-page .message-composer,
.phone-page .message-list,
.phone-page .agent-lead-card,
.panel-console,
.chat-toolbar,
.chat-layout,
.chat-composer,
.calls-toolbar,
.calls-history-layout,
.call-history-list,
.call-history-detail,
.recording-player,
.recording-transcript {
  border-color: rgba(255,255,255,.12);
  background: var(--surface-dark-2);
  color: #f8fbff;
}
.phone-page .phone-tab.active,
.phone-page .phone-tab:hover,
.conversation-row:hover,
.conversation-row.active,
.call-history-item:hover,
.call-history-item.active,
.panel-table tbody tr:hover td {
  background: var(--surface-dark-3);
  box-shadow: inset 4px 0 0 var(--brand-orange);
}
.phone-page .phone-tab.active,
.phone-page .phone-tab:hover {
  box-shadow: inset 4px 0 0 var(--brand-blue);
}
.conversation-row.unread,
.message-bubble.unread {
  background: var(--surface-dark-3);
  box-shadow: inset 4px 0 0 var(--brand-blue);
}
.conversation-side em,
.recording-play-button,
.recording-download-button,
.panel-link-button {
  background: var(--brand-blue);
  color: #fff;
}
.message-bubble {
  background: var(--surface-dark-3);
  color: #fff;
}
.message-bubble.outbound {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-2));
}
.message-bubble strong,
.message-bubble.failed strong {
  color: var(--brand-orange);
}
.chat-date-divider,
.conversation-summary small,
.conversation-side time,
.chat-person span,
.call-history-main small,
.call-history-main em,
.recording-section-heading time,
.recording-duration,
.recording-meta-row,
.recording-transcript span {
  color: #bcd2ff;
}
.chat-date-divider::before,
.chat-date-divider::after {
  background: rgba(255,255,255,.18);
}
.phone-page input,
.phone-page textarea,
.phone-page select,
.chat-composer textarea,
.calls-toolbar input,
.recording-toolbar input {
  border-color: rgba(48,128,255,.38);
  background: var(--surface-dark);
  color: #f8fbff;
}
.phone-page input::placeholder,
.phone-page textarea::placeholder,
.calls-toolbar input::placeholder,
.recording-toolbar input::placeholder {
  color: #91a9dd;
}
.phone-page button,
.panel-toolbar-actions button,
.chat-composer button,
.calls-toolbar button,
.recording-toolbar button {
  border-color: var(--brand-blue);
  background: var(--brand-blue);
}
.phone-page button.secondary,
.calls-toolbar button.secondary,
.recording-toolbar button.secondary,
.recording-transcript button {
  border-color: var(--brand-orange);
  background: var(--brand-orange);
  color: var(--brand-navy);
}

.users-filter-select,
.users-search-row,
.users-table-wrap,
.dashboard-live-row,
.m365-picker,
.m365-folder-list,
.agent-lead-card {
  background: var(--panel);
}

.users-list-table th {
  background: var(--brand-soft-2);
  color: var(--ink);
}

.users-list-table tbody tr:hover td,
.users-list-table tbody tr.selected td,
.dashboard-live-row:hover,
.dashboard-live-menu button:hover,
.m365-folder-row:hover {
  background: var(--brand-soft);
}

.users-row-actions .icon-button {
  border-color: var(--line);
  background: var(--brand-soft);
  color: var(--ink);
}

.users-row-actions .icon-button:hover {
  background: var(--brand-soft-2);
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  .live-panel-grid { grid-template-columns: 1fr; }
  .live-call-row { grid-template-columns: minmax(110px, 1fr) auto auto; }
  .live-call-row .live-channel,
  .live-call-row .live-cell:nth-of-type(2) { display: none; }
  .campaign-settings-grid,
  .campaign-settings-grid.compact {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: visible;
    height: auto;
    min-height: auto;
    padding: 10px;
  }
  .brand {
    flex: 0 0 auto;
    margin: 0 8px 6px 0;
    font-size: 16px;
  }
  .brand-logo {
    width: 30px;
    height: 30px;
  }
  .sidebar .nav {
    display: inline-flex;
    flex: 0 0 auto;
    width: auto;
    min-height: 32px;
    margin: 0 0 6px;
    padding: 7px 10px;
    white-space: nowrap;
  }
  .nav-group {
    flex: 0 0 auto;
  }
  .submenu {
    top: calc(100% + 4px);
    left: 0;
    min-width: 190px;
  }
  .submenu::before {
    top: -5px;
    left: 18px;
    border-left: 1px solid rgba(255,255,255,.14);
    border-top: 1px solid rgba(255,255,255,.14);
    border-bottom: 0;
  }
  .project-version {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
  }
  .sidebar-account {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px 4px;
    padding: 0 0 0 8px;
    border-top: 0;
    border-left: 1px solid rgba(234, 242, 244, .14);
  }
  .sidebar-user {
    max-width: 180px;
  }
  .sidebar-logout {
    width: auto;
  }
  .main {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 12px;
  }
  .topbar { flex-direction: column; padding: 12px; }
  h1 { font-size: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-live-row {
    grid-template-columns: minmax(90px, 1fr) 58px 48px;
  }
  .dashboard-live-row span:nth-of-type(3),
  .dashboard-live-row small {
    display: none;
  }
  .form-grid, .phone-grid, .phone-actions, .phone-active-actions { grid-template-columns: 1fr; }
  .trunk-edit-grid, .trunk-sms-grid, .trunk-did-form { grid-template-columns: 1fr; }
  .extension-edit-grid { grid-template-columns: 1fr; }
  .system-info-grid,
  .maintenance-grid,
  .troubleshooting-grid {
    grid-template-columns: 1fr;
  }
  .system-row,
  .maintenance-list + .maintenance-list {
    border-right: 0;
    border-left: 0;
  }
  .maintenance-row,
  .gauge-row {
    grid-template-columns: 1fr;
  }
  .users-console {
    margin: 0;
    min-height: 70vh;
  }
  .users-toolbar {
    flex-wrap: wrap;
  }
  .users-filter-select {
    margin-left: 0;
  }
  .phone-console { grid-template-columns: 1fr; }
  .phone-nav { min-height: auto; }
  #panel-dialer, .status-grid, .message-shell { grid-template-columns: 1fr; }
  .calls-toolbar,
  .recording-toolbar { grid-template-columns: 42px 1fr; }
  .calls-history-layout { grid-template-columns: 1fr; }
  .chat-toolbar { grid-template-columns: 42px 1fr; }
  .chat-layout { grid-template-columns: minmax(180px, 36vw) minmax(0, 1fr); }
  .call-history-list,
  .call-history-detail {
    max-height: none;
    min-height: 0;
  }
  .chat-conversation-list,
  .chat-thread-panel {
    max-height: 100%;
    min-height: 0;
  }
  .call-history-list {
    border-right: 0;
    border-bottom: 1px solid #4f4f4f;
  }
  .chat-conversation-list {
    border-right: 1px solid #4f4f4f;
    border-bottom: 0;
  }
  .chat-thread { padding: 16px; }
  .chat-composer { grid-template-columns: 1fr; }
  .agent-lead-card { grid-template-columns: 1fr; }
  .lead-disposition { grid-template-columns: 1fr; }
  .user-rights-grid { grid-template-columns: 1fr; }
  .phone-topbar, .contact-tools { flex-direction: column; }
  .phone-top-actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }
  .webphone-user-chip {
    order: -1;
    width: 100%;
    max-width: none;
  }
  .todo-wrap {
    position: static;
  }
  .todo-menu {
    left: 12px;
    right: 12px;
    top: 68px;
    width: auto;
  }
  .list-toolbar { align-items: stretch; flex-direction: column; }
  .table {
    margin-left: -4px;
    margin-right: -4px;
    padding: 6px;
  }
  table { min-width: 820px; }
  th, td { padding: 6px; }
  .provision-card { grid-template-columns: 1fr; }
  .provision-qr { width: min(240px, 100%); height: auto; }
}

@media (max-width: 460px) {
  .phone-page #panel-messages {
    height: calc(100vh - 72px);
    min-height: 0;
    overflow: hidden;
  }
  .chat-console {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }
  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(120px, 30vh) minmax(0, 1fr);
    height: 100%;
    overflow: hidden;
  }
  .chat-conversation-list {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    border-right: 0;
    border-bottom: 1px solid #4f4f4f;
  }
  .chat-thread-panel {
    height: 100%;
    min-height: 0;
    max-height: 100%;
  }
}

@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr; }
  .auth { justify-content: stretch; }
  .auth button { flex: 1; }
  .call-log-toolbar { align-items: flex-start; flex-direction: column; }
}

/* VoIPTele identity pass: distinct product language, spacing, and surfaces. */
:root {
  --vt-ink: #f6fbff;
  --vt-muted: #aebfca;
  --vt-deep: #101820;
  --vt-rail: #14232c;
  --vt-panel: #1c2a34;
  --vt-panel-2: #243542;
  --vt-card: #f7fafb;
  --vt-card-2: #edf4f5;
  --vt-line: rgba(112, 141, 151, .34);
  --vt-cyan: #2ec4d6;
  --vt-cyan-2: #1599b2;
  --vt-amber: #ffb24a;
  --vt-green: #35b86b;
  --vt-red: #e05243;
  --bg: #15212a;
  --panel: #f7fafb;
  --ink: #15212a;
  --muted: #5f7280;
  --line: #ccd9dd;
  --brand-navy: var(--vt-deep);
  --brand-navy-2: var(--vt-rail);
  --brand-blue: var(--vt-cyan-2);
  --brand-blue-2: #0d7e96;
  --brand-orange: var(--vt-amber);
  --brand-soft: #edf4f5;
  --brand-soft-2: #dcecef;
  --surface-dark: var(--vt-deep);
  --surface-dark-2: var(--vt-panel);
  --surface-dark-3: var(--vt-panel-2);
  --accent: var(--vt-cyan-2);
  --accent-2: var(--vt-cyan);
  --accent-3: var(--vt-amber);
  --shadow: 0 16px 38px rgba(6, 18, 26, .16);
}

body {
  grid-template-columns: 224px 1fr;
  background:
    radial-gradient(circle at 16% 0, rgba(46, 196, 214, .18), transparent 30%),
    linear-gradient(180deg, #1a2b35 0, #edf4f5 340px);
  color: var(--ink);
}

.sidebar {
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(46, 196, 214, .08), transparent 42%),
    var(--vt-rail);
  box-shadow: 8px 0 28px rgba(4, 12, 18, .25);
}

.brand {
  height: 58px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
}

.brand span {
  color: #fff;
  font-weight: 850;
}

.nav {
  min-height: 42px;
  margin: 3px 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  border-bottom: 0;
  color: #dcebf0;
  font-size: 13px;
  font-weight: 760;
}

.nav-icon {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  color: var(--vt-cyan);
}

.nav.active,
.nav:hover,
.nav-group:hover .nav-group-title,
.nav-group:focus-within .nav-group-title,
.nav-group.active .nav-group-title {
  border-color: rgba(46, 196, 214, .38);
  background: rgba(46, 196, 214, .13);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(46, 196, 214, .08);
}

.nav.active .nav-icon,
.nav:hover .nav-icon {
  background: var(--vt-cyan-2);
  color: #fff;
}

.nav-group-title::after {
  color: var(--vt-amber);
}

.submenu {
  left: calc(100% + 12px);
  padding: 8px;
  border-color: rgba(46, 196, 214, .24);
  border-radius: 12px;
  background: #182832;
}

.submenu::before {
  background: #182832;
  border-color: rgba(46, 196, 214, .24);
}

.sub-nav {
  min-height: 34px;
  border-radius: 9px;
  font-size: 12px;
}

.sidebar-account {
  margin-top: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
}

.main {
  padding: 14px;
  background: transparent;
}

.topbar,
.admin-dash-panel,
.panel,
.table,
.metric,
.department-card,
.version-card,
.modal {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(247, 250, 251, .96);
  box-shadow: var(--shadow);
}

.topbar {
  padding: 12px 14px;
}

.topbar h1,
.admin-dash-heading h2,
.panel-heading h2 {
  color: #10212a;
  font-weight: 850;
}

input,
select,
textarea {
  border-color: #b9cbd2;
  background: #ffffff;
  color: #10212a;
}

input::placeholder,
textarea::placeholder {
  color: #6f8490;
}

button,
.compact-button,
.user-toolbar-button.primary {
  border-color: var(--vt-cyan-2);
  background: linear-gradient(180deg, #22acc3, #128aa3);
  color: #fff;
}

button.secondary,
.compact-button.secondary {
  border-color: #b7cad0;
  background: #e8f1f3;
  color: #17303b;
}

button.danger {
  border-color: var(--vt-red);
  background: var(--vt-red);
  color: #fff;
}

table {
  color: #13242d;
}

th {
  background: #dcecef;
  color: #294551;
  font-weight: 850;
  text-transform: none;
}

td {
  background: rgba(255,255,255,.72);
}

tbody tr:hover td,
.users-list-table tbody tr:hover td,
.users-list-table tbody tr.selected td {
  background: #e8f6f8;
}

.system-row,
.maintenance-row,
.storage-summary div,
.dashboard-live-row {
  border-radius: 12px;
  background: #fff;
}

.system-row strong,
.maintenance-row strong,
.metric span {
  color: #10212a;
}

.status-chip.ok,
.user-status-dot.ok,
.user-presence.online {
  background: var(--vt-green);
}

.phone-page {
  background:
    radial-gradient(circle at 85% 0, rgba(255, 178, 74, .15), transparent 28%),
    linear-gradient(180deg, #101820, #15232c 52%, #111a21);
  color: var(--vt-ink);
}

.phone-page .phone-console {
  grid-template-columns: 112px 1fr;
  background: transparent;
}

.phone-page .phone-nav {
  padding: 12px 8px;
  background: rgba(8, 17, 23, .92);
  border-right: 1px solid rgba(46, 196, 214, .16);
}

.phone-page .phone-brand.compact .brand-logo {
  width: 50px;
  height: 50px;
  padding: 5px;
  border: 1px solid rgba(46, 196, 214, .22);
  border-radius: 16px;
  background: rgba(46, 196, 214, .09);
}

.phone-page .phone-tab {
  width: 96px;
  min-height: 58px;
  padding: 7px 5px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: #cfe1e7;
  font-size: 11px;
}

.phone-page .phone-tab svg {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}

.phone-page .phone-tab span {
  font-size: 11px;
}

.phone-page .phone-tab.active,
.phone-page .phone-tab:hover {
  border-color: rgba(46, 196, 214, .36);
  background: rgba(46, 196, 214, .13);
  color: #fff;
  box-shadow: none;
}

.phone-page .phone-tab.active svg,
.phone-page .phone-tab:hover svg {
  color: var(--vt-cyan);
}

.phone-page .phone-workspace {
  background: transparent;
}

.phone-page .phone-topbar {
  min-height: 76px;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(46, 196, 214, .16);
  background: rgba(16, 24, 32, .86);
}

.phone-page .phone-topbar h2 {
  color: #fff;
  font-size: 21px;
  font-weight: 860;
}

.phone-page .phone-topbar p {
  color: var(--vt-muted);
}

.phone-icon-action,
.team-square-button,
.team-toolbar-button,
.team-view-buttons button,
.call-detail-links button,
.call-detail-actions button,
.recording-top-actions button,
.panel-toolbar-actions button {
  border-radius: 12px;
  border-color: rgba(46, 196, 214, .24);
  background: rgba(46, 196, 214, .12);
  color: #eafcff;
  box-shadow: none;
}

.phone-icon-action.primary,
.recording-play-button,
.conversation-side em {
  background: var(--vt-cyan-2);
  color: #fff;
}

.phone-page .phone-panel,
.panel-console,
.chat-console,
.calls-console,
.recording-console {
  background: transparent;
}

.team-toolbar,
.chat-toolbar,
.calls-toolbar,
.recording-toolbar,
.panel-toolbar {
  padding: 14px;
  border: 1px solid rgba(46, 196, 214, .16);
  border-radius: 18px;
  background: rgba(28, 42, 52, .78);
}

.team-search,
.calls-toolbar input,
.recording-toolbar input,
.chat-toolbar input,
.phone-page input,
.phone-page textarea,
.phone-page select,
.chat-composer textarea {
  border-color: rgba(46, 196, 214, .24);
  background: rgba(10, 21, 28, .76);
  color: #f6fbff;
}

.team-search input,
.team-search input::placeholder,
.phone-page input::placeholder,
.phone-page textarea::placeholder,
.calls-toolbar input::placeholder,
.recording-toolbar input::placeholder {
  color: #95acb7;
}

.team-card-grid {
  gap: 14px;
}

.team-person-card,
.quick-dial-card,
.call-history-item,
.conversation-row {
  border: 1px solid rgba(46, 196, 214, .12);
  border-radius: 18px;
  background: rgba(28, 42, 52, .72);
}

.team-person-card:hover,
.call-history-item:hover,
.call-history-item.active,
.conversation-row:hover,
.conversation-row.active {
  border-color: rgba(46, 196, 214, .36);
  background: rgba(36, 53, 66, .95);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
}

.team-avatar,
.call-history-avatar {
  border-radius: 14px;
  background: linear-gradient(135deg, #275466, #17323e);
  color: #eaffff;
}

.team-presence-dot {
  background: #8d98a6;
}

.team-presence-dot.online,
.user-presence.online {
  background: var(--vt-green);
}

.calls-history-layout,
.chat-layout {
  gap: 14px;
  border-top: 0;
}

.call-history-list,
.call-history-detail,
.chat-conversation-list,
.chat-thread-panel {
  border: 1px solid rgba(46, 196, 214, .16);
  border-radius: 18px;
  background: rgba(20, 35, 44, .76);
}

.call-history-detail,
.chat-thread-panel {
  background: rgba(19, 31, 39, .88);
}

.call-detail-header,
.chat-thread-header {
  border-bottom-color: rgba(46, 196, 214, .16);
}

.call-history-event,
.recording-transcript,
.recording-player {
  border-color: rgba(46, 196, 214, .14);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
}

.recording-player {
  background: linear-gradient(90deg, rgba(21, 153, 178, .28), rgba(255, 178, 74, .10));
}

.recording-download-button {
  background: rgba(255, 178, 74, .22);
  color: #fff;
}

.message-bubble {
  border-radius: 16px 16px 16px 6px;
  background: rgba(255,255,255,.09);
}

.message-bubble.outbound {
  border-radius: 16px 16px 6px 16px;
  background: linear-gradient(135deg, #1599b2, #0d7488);
}

.message-bubble.unread,
.conversation-row.unread {
  box-shadow: inset 0 0 0 1px rgba(46, 196, 214, .38);
}

.panel-table {
  border-collapse: separate;
  border-spacing: 0 6px;
}

.panel-table th,
.panel-table td {
  border-bottom: 0;
}

.panel-table tbody tr td {
  background: rgba(255,255,255,.06);
}

.panel-table tbody tr td:first-child {
  border-radius: 10px 0 0 10px;
}

.panel-table tbody tr td:last-child {
  border-radius: 0 10px 10px 0;
}

@media (max-width: 900px) {
  body {
    background: #edf4f5;
  }

  .sidebar {
    border-radius: 0;
  }

  .phone-page .phone-console {
    grid-template-columns: 1fr;
  }

  .phone-page .phone-nav {
    position: sticky;
    z-index: 30;
    display: flex;
    gap: 8px;
    min-height: auto;
    height: auto;
    overflow-x: auto;
    padding: 8px;
  }

  .phone-nav-main,
  .phone-nav-bottom {
    display: flex;
    gap: 8px;
  }

  .phone-page .phone-tab {
    flex: 0 0 78px;
    width: 78px;
    min-height: 54px;
  }
}

.phone-page .phone-workspace {
  background:
    radial-gradient(circle at 95% 5%, color-mix(in srgb, var(--brand-blue) 14%, transparent), transparent 28%),
    color-mix(in srgb, var(--brand-navy) 82%, var(--bg));
}

.phone-page .phone-softphone,
.phone-page .phone-side,
.phone-page .phone-table-wrap,
.phone-page .contact-tools,
.phone-page .status-grid,
.phone-page .message-composer,
.phone-page .message-list,
.phone-page .agent-lead-card,
.team-toolbar,
.chat-toolbar,
.calls-toolbar,
.recording-toolbar,
.panel-toolbar,
.call-history-list,
.call-history-detail,
.chat-conversation-list,
.chat-thread-panel,
.panel-table-section {
  border-color: color-mix(in srgb, var(--brand-blue) 22%, var(--line));
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  color: var(--ink);
}

.phone-page .phone-panel h3,
.phone-page .phone-panel strong,
.phone-page .phone-panel label,
.phone-page .call-history-main strong,
.phone-page .chat-person strong,
.phone-page .recording-section-heading h3 {
  color: var(--ink);
}

.phone-page .phone-panel p,
.phone-page .phone-panel small,
.phone-page .phone-panel em,
.phone-page .call-history-main small,
.phone-page .call-history-main em,
.phone-page .chat-person span,
.phone-page .recording-meta-row,
.phone-page .recording-section-heading time,
.phone-page .recording-transcript span {
  color: var(--muted);
}

.phone-page .team-person-card,
.phone-page .quick-dial-card,
.phone-page .call-history-item,
.phone-page .conversation-row,
.phone-page .contact-row,
.phone-page .contact-card,
.phone-page .status-grid div,
.phone-page .status-theme-choice,
.phone-page .call-history-event,
.phone-page .recording-transcript {
  border-color: color-mix(in srgb, var(--brand-blue) 20%, var(--line));
  background: color-mix(in srgb, var(--panel) 84%, var(--bg));
  color: var(--ink);
}

.phone-page .team-person-card:hover,
.phone-page .call-history-item:hover,
.phone-page .call-history-item.active,
.phone-page .conversation-row:hover,
.phone-page .conversation-row.active {
  border-color: color-mix(in srgb, var(--brand-blue) 46%, var(--line));
  background: color-mix(in srgb, var(--brand-blue) 14%, var(--panel));
}

.phone-page .panel-table th,
.phone-page .panel-table td,
.phone-page .phone-table th,
.phone-page .phone-table td {
  color: var(--ink);
}

.phone-page .panel-table th,
.phone-page .phone-table th {
  background: color-mix(in srgb, var(--brand-soft-2) 56%, var(--panel));
  color: color-mix(in srgb, var(--ink) 88%, var(--brand-blue));
}

.phone-page .panel-table tbody tr td,
.phone-page .phone-table tbody tr td {
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}

.phone-page .panel-table tbody tr:hover td,
.phone-page .phone-table tbody tr:hover td {
  background: color-mix(in srgb, var(--brand-blue) 12%, var(--panel));
}

.phone-page .message-bubble {
  background: color-mix(in srgb, var(--panel) 78%, var(--bg));
  color: var(--ink);
}

.phone-page .message-bubble.outbound {
  background: var(--brand-blue);
  color: #ffffff;
}

.phone-page .recording-player {
  background: color-mix(in srgb, var(--brand-soft-2) 48%, var(--panel));
}

.admin-page .modal-heading {
  padding-right: 42px;
}

.admin-page .modal-actions {
  padding-top: 2px;
}

.admin-page .modal-close,
.admin-page .modal-actions button,
.admin-page .provision-card button {
  min-height: 28px;
}

/* Business theme refresh: final variable-based surface pass for admin, webphone, and popups. */
.main {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand-soft-2) 58%, var(--bg)) 0, var(--bg) 320px),
    var(--bg);
}

.topbar,
.main .topbar,
.admin-dash-panel,
.panel,
.table,
.metric,
.department-card,
.version-card,
.mini-table,
.backup-panel,
.recording-storage-panel,
.warning-panel,
.settings-section,
.ai-openai-config-form,
.m365-picker,
.m365-instructions,
.m365-archive-status,
.m365-saved-folder,
.modal,
.modal-panel,
.main .modal-panel {
  border: 1px solid color-mix(in srgb, var(--brand-blue) 24%, var(--line));
  background: color-mix(in srgb, var(--panel) 96%, var(--bg));
  color: var(--ink);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--brand-navy) 18%, transparent);
}

.main h1,
.main h2,
.main h3,
.main h4,
.main label,
.main strong,
.main .panel-heading h2,
.main .admin-dash-heading h2,
.modal-heading h2,
.extension-edit-form h2,
.provision-info h3 {
  color: var(--ink);
}

.main p,
.main small,
.main em,
.main .muted,
.main .settings-status,
.modal-heading p,
.extension-edit-form p,
.provision-info p,
.provision-info small {
  color: var(--muted);
}

.main input,
.main select,
.main textarea,
.main td input,
.main td select,
.modal-panel input,
.modal-panel select,
.modal-panel textarea,
.extension-modal-panel input,
.extension-modal-panel select,
.extension-modal-panel textarea,
.provision-card input,
.provision-card select,
.provision-card textarea,
.phone-page input,
.phone-page textarea,
.phone-page select {
  border-color: color-mix(in srgb, var(--brand-blue) 30%, var(--line));
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  color: var(--ink);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white 18%, transparent);
}

.main input::placeholder,
.main textarea::placeholder,
.modal-panel input::placeholder,
.modal-panel textarea::placeholder,
.phone-page input::placeholder,
.phone-page textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, var(--panel));
}

.main input:disabled,
.main select:disabled,
.main textarea:disabled,
.modal-panel input:disabled,
.modal-panel input[readonly],
.modal-panel textarea[readonly] {
  border-color: color-mix(in srgb, var(--muted) 34%, var(--line));
  background: color-mix(in srgb, var(--panel) 72%, var(--bg));
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

.main table,
.main th,
.main td,
.main .users-list-table th,
.main .users-list-table td,
.main .event-table th,
.main .event-table td,
.main .call-log-table th,
.main .call-log-table td {
  color: var(--ink);
}

.main th,
.main .users-list-table th,
.main .event-table th,
.main .call-log-table th {
  border-bottom-color: color-mix(in srgb, var(--brand-blue) 22%, var(--line));
  background: color-mix(in srgb, var(--brand-soft-2) 64%, var(--panel));
  color: color-mix(in srgb, var(--ink) 88%, var(--brand-blue));
}

.main td,
.main .users-list-table td,
.main .event-table td,
.main .call-log-table td {
  border-bottom-color: color-mix(in srgb, var(--line) 82%, var(--bg));
  background: color-mix(in srgb, var(--panel) 94%, var(--bg));
}

.main tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--panel) 84%, var(--bg));
}

.main tbody tr:hover td,
.main .users-list-table tbody tr:hover td,
.main .users-list-table tbody tr.selected td {
  background: color-mix(in srgb, var(--brand-blue) 12%, var(--panel));
}

.main .system-row,
.main .maintenance-row,
.main .storage-summary div,
.main .dashboard-live-row,
.main .warning-item,
.main .department-user-option,
.main .department-pill,
.main .m365-folder-list,
.main .m365-folder-row,
.main .trunk-edit-row td,
.main .did-edit-row td,
.phone-provision-details,
.user-right,
.department-member-editor,
.department-rights-wrap,
.department-rights-table th,
.department-rights-table td {
  border-color: color-mix(in srgb, var(--brand-blue) 22%, var(--line));
  background: color-mix(in srgb, var(--panel) 86%, var(--bg));
  color: var(--ink);
}

.modal-backdrop,
.admin-page .modal-backdrop,
.lead-disposition-modal {
  background: color-mix(in srgb, var(--brand-navy) 74%, transparent);
  backdrop-filter: blur(3px);
}

.admin-page .modal-panel,
.admin-page .extension-modal-panel,
.admin-page #extension-modal .modal-panel,
.admin-page #provision-modal .modal-panel,
.lead-disposition-dialog,
.call-popup-card {
  border-color: color-mix(in srgb, var(--brand-blue) 34%, var(--line));
  background: color-mix(in srgb, var(--panel) 94%, var(--bg));
  color: var(--ink);
  box-shadow: 0 24px 70px color-mix(in srgb, var(--brand-navy) 34%, transparent);
}

.admin-page .extension-edit-form,
.admin-page .provision-card,
.admin-page .extension-edit-grid label,
.admin-page .extension-edit-form label,
.admin-page .provision-info label,
.admin-page .department-member-editor label,
.admin-page .user-right,
.admin-page .department-rights-table th,
.admin-page .department-rights-table td,
.lead-disposition-dialog label,
.call-popup-card {
  color: var(--ink);
}

.admin-page .modal-tabs {
  border-bottom-color: color-mix(in srgb, var(--brand-blue) 28%, var(--line));
}

.admin-page .modal-tab,
.modal-tab {
  color: var(--muted);
  background: transparent;
}

.admin-page .modal-tab:hover,
.modal-tab:hover {
  background: color-mix(in srgb, var(--brand-blue) 10%, var(--panel));
  color: var(--ink);
}

.admin-page .modal-tab.active,
.modal-tab.active {
  background: var(--brand-blue);
  color: #ffffff;
}

.admin-page .modal-actions button.secondary,
.admin-page .provision-card button.secondary,
.main .icon-button.secondary,
.main .users-row-actions .icon-button,
.compact-button.secondary,
button.secondary {
  border-color: color-mix(in srgb, var(--brand-blue) 24%, var(--line));
  background: color-mix(in srgb, var(--panel) 72%, var(--bg));
  color: var(--ink);
}

.phone-page {
  background:
    radial-gradient(circle at 86% 0, color-mix(in srgb, var(--brand-orange) 20%, transparent), transparent 28%),
    linear-gradient(180deg, var(--brand-navy), var(--bg));
  color: var(--ink);
}

.phone-page .phone-workspace,
.phone-page .phone-softphone,
.phone-page .phone-side,
.phone-page .phone-table-wrap,
.phone-page .contact-tools,
.phone-page .status-grid,
.phone-page .message-composer,
.phone-page .message-list,
.phone-page .agent-lead-card,
.phone-page .panel,
.phone-page .table {
  border-color: color-mix(in srgb, var(--brand-blue) 22%, var(--line));
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  color: var(--ink);
}

.main .users-list-table,
.main .event-table,
.main .call-log-table,
.main .lead-list-table,
.main .lead-campaigns-table,
.main .panel-table,
.main .department-rights-table {
  font-size: 13px;
}

.main td,
.main .users-list-table td,
.main .event-table td,
.main .call-log-table td,
.main .lead-list-table td,
.main .lead-campaigns-table td,
.main .panel-table td,
.main .department-rights-table td {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

.main th,
.main .users-list-table th,
.main .event-table th,
.main .call-log-table th,
.main .lead-list-table th,
.main .lead-campaigns-table th,
.main .panel-table th,
.main .department-rights-table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.admin-page .modal-panel,
.admin-page .extension-modal-panel,
.admin-page .extension-edit-form,
.admin-page .provision-card,
.lead-disposition-dialog {
  font-size: 13px;
}

.admin-page .extension-edit-grid label,
.admin-page .extension-edit-form label,
.admin-page .provision-info label,
.admin-page .department-member-editor label,
.admin-page .user-right,
.admin-page .department-rights-table th,
.admin-page .department-rights-table td,
.lead-disposition-dialog label {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

.admin-page .modal-panel input,
.admin-page .modal-panel select,
.admin-page .modal-panel textarea,
.admin-page .extension-modal-panel input,
.admin-page .extension-modal-panel select,
.admin-page .extension-modal-panel textarea,
.admin-page .extension-edit-form input,
.admin-page .extension-edit-form select,
.admin-page .extension-edit-form textarea,
.admin-page .provision-card input,
.admin-page .provision-card select,
.admin-page .provision-card textarea,
.lead-disposition-dialog input,
.lead-disposition-dialog select,
.lead-disposition-dialog textarea {
  font-size: 13px;
  font-weight: 400;
}

.admin-page .modal-heading p,
.admin-page .extension-edit-form p,
.admin-page .provision-info p,
.admin-page .provision-info small,
.lead-disposition-dialog header span {
  font-size: 13px;
  font-weight: 400;
}

/* Final theme pass: ensure preset choice wins across all webphone surfaces. */
.phone-page,
.chat-console,
.calls-console,
.recording-console {
  background:
    radial-gradient(circle at 86% 0, color-mix(in srgb, var(--brand-orange) 16%, transparent), transparent 28%),
    linear-gradient(180deg, var(--brand-navy), var(--bg));
  color: var(--ink);
}

.phone-page .phone-console,
.phone-page .phone-nav,
.phone-page .phone-workspace,
.phone-page .phone-topbar,
.phone-page .phone-panel,
.phone-page .phone-softphone,
.phone-page .phone-side,
.phone-page .phone-table-wrap,
.phone-page .contact-tools,
.phone-page .status-grid,
.phone-page .message-composer,
.phone-page .message-list,
.phone-page .agent-lead-card,
.panel-console,
.chat-toolbar,
.chat-layout,
.chat-composer,
.calls-toolbar,
.calls-history-layout,
.call-history-list,
.call-history-detail,
.recording-player,
.recording-transcript,
.team-toolbar,
.chat-thread-panel,
.chat-conversation-list,
.panel-toolbar,
.panel-table-section {
  border-color: color-mix(in srgb, var(--brand-blue) 22%, var(--line));
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  color: var(--ink);
}

.phone-page .phone-tab,
.team-square-button,
.team-toolbar-button,
.team-view-buttons button,
.phone-page .contact-row,
.phone-page .contact-card,
.phone-page .message-item,
.phone-page .conversation-row,
.phone-page .status-grid div,
.phone-page .status-theme-choice,
.phone-page .team-person-card,
.phone-page .quick-dial-card,
.phone-page .call-history-item,
.phone-page .call-history-event {
  border-color: color-mix(in srgb, var(--brand-blue) 20%, var(--line));
  background: color-mix(in srgb, var(--panel) 84%, var(--bg));
  color: var(--ink);
}

.phone-page .phone-tab.active,
.phone-page .phone-tab:hover,
.conversation-row:hover,
.conversation-row.active,
.call-history-item:hover,
.call-history-item.active,
.panel-table tbody tr:hover td,
.phone-page .team-person-card:hover,
.phone-page .quick-dial-card:hover {
  background: color-mix(in srgb, var(--brand-blue) 14%, var(--panel));
  box-shadow: inset 4px 0 0 var(--brand-blue);
}

.conversation-row.unread,
.message-bubble.unread {
  background: color-mix(in srgb, var(--brand-blue) 18%, var(--panel));
  box-shadow: inset 4px 0 0 var(--brand-blue);
}

.phone-page .conversation-row.unread.active {
  background: color-mix(in srgb, var(--brand-blue) 24%, var(--panel));
}

.panel-toolbar,
.phone-page .phone-topbar {
  border-bottom-color: color-mix(in srgb, var(--brand-blue) 22%, var(--line));
  background: color-mix(in srgb, var(--panel) 90%, var(--bg));
  color: var(--ink);
}

.panel-table,
.phone-page .panel-table,
.phone-page .phone-table {
  color: var(--ink);
}

.panel-table th,
.panel-table td,
.phone-page .panel-table th,
.phone-page .panel-table td,
.phone-page .phone-table th,
.phone-page .phone-table td {
  border-bottom-color: color-mix(in srgb, var(--line) 82%, var(--bg));
  color: var(--ink);
}

.panel-table th,
.phone-page .panel-table th,
.phone-page .phone-table th {
  background: color-mix(in srgb, var(--brand-soft-2) 56%, var(--panel));
  color: color-mix(in srgb, var(--ink) 88%, var(--brand-blue));
}

.panel-table tbody tr td,
.phone-page .panel-table tbody tr td,
.phone-page .phone-table tbody tr td {
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
}

.message-bubble {
  background: color-mix(in srgb, var(--panel) 78%, var(--bg));
  color: var(--ink);
}

.message-bubble.outbound,
.conversation-side em,
.recording-play-button,
.recording-download-button,
.panel-link-button {
  background: var(--brand-blue);
  color: #ffffff;
}

.message-bubble strong,
.message-bubble.failed strong,
.phone-page .phone-panel h3,
.phone-page .phone-panel strong,
.phone-page .phone-panel label,
.phone-page .call-history-main strong,
.phone-page .chat-person strong,
.phone-page .recording-section-heading h3,
.panel-table-section h3 {
  color: var(--ink);
}

.conversation-summary small,
.conversation-side time,
.chat-person span,
.call-history-main small,
.call-history-main em,
.recording-section-heading time,
.recording-duration,
.recording-meta-row,
.recording-transcript span,
.phone-page .phone-panel p,
.phone-page .phone-panel small,
.phone-page .phone-panel em {
  color: var(--muted);
}

/* True-final admin mobile corrections after all theme passes. */
@media (max-width: 900px) {
  body.admin-page.logged-in {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .admin-page .sidebar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: auto minmax(92px, auto) minmax(0, 1fr);
    gap: 0 8px;
    align-items: center;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 8px;
  }

  .admin-page .brand {
    grid-column: 1;
    height: 40px;
    min-width: 40px;
    margin: 0;
    padding: 5px 6px;
  }

  .admin-page .brand span,
  .admin-page .project-version {
    display: none;
  }

  .admin-page .mobile-menu-toggle {
    grid-column: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    min-width: 92px;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 7px;
    background: var(--surface-dark-3);
    color: #fff;
    font-size: 13px;
    font-weight: 750;
    box-shadow: none;
  }

  .admin-page .mobile-menu-toggle::before {
    content: "";
    width: 14px;
    height: 10px;
    margin-right: 7px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    box-shadow: 0 4px 0 currentColor;
  }

  .admin-page .mobile-menu-toggle[aria-expanded="true"] {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
  }

  .admin-page .sidebar-nav {
    grid-column: 1 / -1;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
    max-height: calc(100dvh - 118px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 0 0;
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,.12);
  }

  .admin-page .sidebar.mobile-menu-open .sidebar-nav {
    display: grid;
  }

  .admin-page .sidebar .nav {
    width: 100%;
    min-height: 38px;
    margin: 0;
    padding: 7px 9px;
    border-radius: 7px;
    font-size: 13px;
    white-space: normal;
  }

  .admin-page .nav-icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .admin-page .nav-group {
    position: relative;
    display: grid;
    grid-column: span 2;
    gap: 6px;
  }

  .admin-page .submenu {
    position: static;
    z-index: 120;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 5px;
    max-width: none;
    overflow: visible;
    padding: 0 0 0 12px;
    border: 0;
    border-left: 3px solid var(--brand-orange);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .admin-page .submenu::before,
  .admin-page .nav-group::after {
    display: none;
  }

  .admin-page .nav-group:not(.open) .submenu {
    display: none;
  }

  .admin-page .nav-group.open .submenu {
    display: grid;
  }

  .admin-page .sidebar-account {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border-top: 0;
    border-left: 0;
    background: transparent;
  }

  .admin-page .sidebar-user {
    display: none;
  }

  .admin-page .sidebar-user strong {
    max-width: 56vw;
  }

  .admin-page .main {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 10px;
  }

  .admin-page .topbar,
  .admin-page .system-info-grid,
  .admin-page .maintenance-grid,
  .admin-page .troubleshooting-grid,
  .admin-page .metrics,
  .admin-page .storage-summary,
  .admin-page .settings-form,
  .admin-page .settings-section,
  .admin-page .theme-settings-section,
  .admin-page .department-admin-list,
  .admin-page .extension-edit-grid,
  .admin-page .form-grid,
  .admin-page .phone-grid,
  .admin-page .trunk-edit-grid,
  .admin-page .trunk-sms-grid,
  .admin-page .trunk-did-form,
  .admin-page .maintenance-row,
  .admin-page .gauge-row,
  .admin-page .service-control-row,
  .admin-page .dashboard-live-row {
    grid-template-columns: 1fr;
  }

  .admin-page .topbar {
    display: grid;
    gap: 8px;
  }

  .admin-page .service-actions,
  .admin-page .event-actions,
  .admin-page .backup-actions,
  .admin-page .restore-backup-form,
  .admin-page .list-toolbar,
  .admin-page .users-toolbar,
  .admin-page .call-log-toolbar,
  .admin-page .form-header-row,
  .admin-page .settings-actions,
  .admin-page .settings-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-page .auth button,
  .admin-page .service-actions .compact-button,
  .admin-page .event-actions .compact-button,
  .admin-page .backup-actions button,
  .admin-page .restore-backup-form button,
  .admin-page .list-toolbar button,
  .admin-page .list-toolbar input,
  .admin-page .users-toolbar button,
  .admin-page .users-filter-select,
  .admin-page .call-log-toolbar button,
  .admin-page .call-log-toolbar select,
  .admin-page .settings-actions button {
    width: 100%;
    max-width: none;
    min-height: 34px;
  }

  .admin-page .users-table-wrap,
  .admin-page .table,
  .admin-page .event-log-table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding: 8px;
  }

  .admin-page table,
  .admin-page .users-list-table,
  .admin-page .extension-list-table,
  .admin-page .event-table,
  .admin-page .call-log-table,
  .admin-page .lead-list-table,
  .admin-page .lead-campaigns-table,
  .admin-page .panel-table,
  .admin-page .department-rights-table {
    width: max-content;
    min-width: 760px;
  }

  .admin-page .modal-backdrop,
  .lead-disposition-modal {
    place-items: stretch;
    padding: 8px;
    overflow-y: auto;
  }

  .admin-page .modal-panel,
  .admin-page .extension-modal-panel,
  .lead-disposition-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 16px);
    overflow: auto;
  }

  .admin-page .modal-actions,
  .lead-disposition-actions {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    background: var(--panel);
  }

  .admin-page .modal-actions button,
  .lead-disposition-actions button {
    width: 100%;
    min-height: 36px;
  }

  .admin-page #users .users-console {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .admin-page #users .users-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    align-items: center;
    min-height: 0;
    padding: 6px;
  }

  .admin-page #users .users-toolbar .user-toolbar-button,
  .admin-page #users .users-filter-select {
    width: 100%;
    min-width: 0;
    min-height: 28px;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 1.1;
  }

  .admin-page #users #create-extension-button {
    grid-column: span 2;
  }

  .admin-page #users .users-filter-select {
    grid-column: span 2;
    margin-left: 0;
  }

  .admin-page #users .users-search-row {
    min-height: 34px;
    padding: 5px 8px;
  }

  .admin-page #users .users-search-row input {
    min-height: 26px;
    font-size: 13px;
  }

  .admin-page #users .users-search-icon {
    font-size: 11px;
  }

  .admin-page #users .users-table-wrap {
    padding: 0;
  }

  .admin-page #users .extension-list-table,
  .admin-page #users .users-list-table {
    min-width: 520px;
    width: 100%;
    table-layout: fixed;
  }

  .admin-page #users .users-list-table th,
  .admin-page #users .users-list-table td {
    height: 36px;
    padding: 5px 6px;
    font-size: 12px;
  }

  .admin-page #users .users-list-table th:nth-child(3),
  .admin-page #users .users-list-table td:nth-child(3),
  .admin-page #users .users-list-table th:nth-child(5),
  .admin-page #users .users-list-table td:nth-child(5),
  .admin-page #users .users-list-table th:nth-child(6),
  .admin-page #users .users-list-table td:nth-child(6),
  .admin-page #users .users-list-table th:nth-child(7),
  .admin-page #users .users-list-table td:nth-child(7) {
    display: none;
  }

  .admin-page #users .users-list-table th:nth-child(1),
  .admin-page #users .users-list-table td:nth-child(1) {
    width: 34px;
  }

  .admin-page #users .users-list-table th:nth-child(2),
  .admin-page #users .users-list-table td:nth-child(2) {
    width: 210px;
  }

  .admin-page #users .users-list-table th:nth-child(4),
  .admin-page #users .users-list-table td:nth-child(4) {
    width: 68px;
  }

  .admin-page #users .users-list-table th:nth-child(8),
  .admin-page #users .users-list-table td:nth-child(8) {
    position: sticky;
    right: 0;
    z-index: 3;
    width: 198px;
    background: var(--panel);
    box-shadow: -8px 0 14px rgba(15, 23, 42, .08);
  }

  .admin-page #users .users-list-table th:nth-child(8) {
    z-index: 4;
    background: var(--brand-soft-2);
  }

  .admin-page #users .user-name-cell {
    min-width: 0;
    grid-template-columns: 10px minmax(0, 1fr);
    column-gap: 6px;
  }

  .admin-page #users .user-presence {
    width: 9px;
    height: 9px;
  }

  .admin-page #users .user-name-cell strong {
    font-size: 12px;
  }

  .admin-page #users .user-name-cell small {
    font-size: 10px;
  }

  .admin-page #users .users-row-actions {
    display: grid;
    grid-template-columns: repeat(6, 28px);
    gap: 3px;
    justify-content: end;
  }

  .admin-page #users .users-row-actions .icon-button {
    width: 28px;
    height: 28px;
    min-height: 28px;
    border-radius: 5px;
    font-size: 10px;
  }
}

@media (max-width: 520px) {
  .admin-page .main {
    padding: 8px;
  }

  .admin-page .sidebar .nav {
    min-height: 36px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .admin-page .nav-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    display: inline-grid;
  }

  .admin-page .mobile-menu-toggle {
    min-width: 82px;
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
  }

  .admin-page .sidebar-nav,
  .admin-page .submenu {
    grid-template-columns: 1fr;
  }

  .admin-page table,
  .admin-page .users-list-table,
  .admin-page .extension-list-table,
  .admin-page .event-table,
  .admin-page .call-log-table,
  .admin-page .lead-list-table,
  .admin-page .lead-campaigns-table,
  .admin-page .panel-table,
  .admin-page .department-rights-table {
    min-width: 680px;
  }

  .admin-page #users .users-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
  }

  .admin-page #users .users-toolbar .user-toolbar-button,
  .admin-page #users .users-filter-select {
    min-height: 26px;
    padding: 2px 4px;
    font-size: 10px;
  }

  .admin-page #users .extension-list-table,
  .admin-page #users .users-list-table {
    min-width: 490px;
  }

  .admin-page #users .users-list-table th:nth-child(2),
  .admin-page #users .users-list-table td:nth-child(2) {
    width: 182px;
  }

  .admin-page #users .users-list-table th:nth-child(4),
  .admin-page #users .users-list-table td:nth-child(4) {
    width: 58px;
  }

  .admin-page #users .users-list-table th:nth-child(8),
  .admin-page #users .users-list-table td:nth-child(8) {
    width: 174px;
  }

  .admin-page #users .users-row-actions {
    grid-template-columns: repeat(6, 24px);
    gap: 2px;
  }

  .admin-page #users .users-row-actions .icon-button {
    width: 24px;
    height: 24px;
    min-height: 24px;
    font-size: 9px;
  }
}

/* True-final mobile popup corrections. */
@media (max-width: 900px) {
  .admin-page .modal-backdrop,
  .lead-disposition-modal {
    align-items: start;
    justify-items: stretch;
    place-items: start stretch;
    z-index: 1000;
    padding: max(14px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    overflow: auto;
  }

  .admin-page .modal-panel,
  .admin-page .extension-modal-panel,
  .admin-page #extension-modal .modal-panel,
  .admin-page #provision-modal .modal-panel,
  .admin-page #campaign-settings-modal .modal-panel,
  .lead-disposition-dialog {
    position: relative;
    display: grid;
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 16px);
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
  }

  .admin-page .modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 30;
    display: inline-grid;
    place-items: center;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, .18);
    border-radius: 999px;
    background: var(--brand-navy);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .24);
  }

  .admin-page .extension-edit-form,
  .admin-page .provision-card,
  .admin-page .campaign-settings-panel,
  .admin-page .campaign-settings-form,
  .lead-disposition-dialog {
    min-height: 0;
    max-height: calc(100dvh - 16px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-page .extension-edit-form,
  .admin-page .provision-card {
    padding: 50px 14px 14px;
  }

  .admin-page .campaign-settings-panel {
    padding-top: 42px;
  }

  .admin-page .campaign-settings-form {
    padding: 0 14px 14px;
  }

  .admin-page .modal-heading {
    padding-right: 46px;
  }

  .admin-page .provision-card {
    grid-template-columns: 1fr;
    gap: 12px;
    justify-items: stretch;
  }

  .admin-page .provision-qr {
    justify-self: center;
    width: min(210px, 62vw);
    height: auto;
    max-height: min(210px, 38dvh);
    object-fit: contain;
  }

  .admin-page .provision-info {
    min-width: 0;
    gap: 8px;
  }

  .admin-page .provision-info h2 {
    margin: 0;
    padding-right: 38px;
    font-size: 16px;
    line-height: 1.25;
  }

  .admin-page .provision-info textarea,
  .admin-page .provision-config-text {
    width: 100%;
    min-height: 72px;
    max-height: 26dvh;
  }

  .admin-page .provision-config-text {
    min-height: 150px;
  }

  .admin-page .department-rights-wrap,
  .admin-page .department-user-grid {
    max-width: 100%;
    overflow-x: auto;
  }

  .admin-page .modal-tabs {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .admin-page .modal-actions,
  .lead-disposition-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin: 8px -14px -14px;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--panel);
  }

  .admin-page #provision-modal .modal-panel {
    display: block;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-page #provision-modal .provision-card {
    max-height: none;
    overflow: visible;
    padding-top: 68px;
  }

  .admin-page #provision-modal .modal-close {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    float: none;
    margin: 0;
    z-index: 1200;
  }

  .admin-page #provision-modal .provision-qr {
    margin-top: 0;
  }
}

@media (max-width: 520px) {
  .admin-page .modal-backdrop,
  .lead-disposition-modal {
    padding: 6px;
  }

  .admin-page .modal-panel,
  .admin-page .extension-modal-panel,
  .admin-page #extension-modal .modal-panel,
  .admin-page #provision-modal .modal-panel,
  .admin-page #campaign-settings-modal .modal-panel,
  .lead-disposition-dialog {
    max-height: calc(100dvh - 12px);
  }

  .admin-page .extension-edit-form,
  .admin-page .provision-card {
    padding: 48px 10px 10px;
  }

  .admin-page .provision-qr {
    width: min(180px, 58vw);
    max-height: min(180px, 32dvh);
  }

  .admin-page #provision-modal .provision-card {
    padding-top: 64px;
  }

  .admin-page #provision-modal .modal-close {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    margin: 0;
  }

  .admin-page .modal-actions,
  .lead-disposition-actions {
    margin: 8px -10px -10px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  }
}
