/* Switchboard admin console. Tokens come from /ui/tokens.css, shared components from /ui/base.css.
   Legacy class names used by the page modules are mapped onto the design tokens here. */
:root {
  --paper: var(--bg);
  --white: var(--surface-2);
  --ink: var(--text);
  --muted: var(--text-2);
  --line: var(--border);
  --deep: var(--text);
  --warm: var(--primary-soft);
  --focus: var(--primary);
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  min-width: 300px;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
select,
summary {
  cursor: pointer;
}
button {
  line-height: 1.24;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
a,
button {
  touch-action: manipulation;
}
[hidden] {
  display: none !important;
}
svg {
  display: block;
  flex: none;
}
::selection {
  background: var(--primary-soft);
}
.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 100;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
}
h1,
h2,
h3,
p,
dl {
  margin: 0;
}
h1,
h2,
h3 {
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 24px;
}
h2 {
  font-size: 16px;
}
h3 {
  font-size: 14px;
}
strong {
  font-weight: 600;
}
small,
.cell-sub {
  font-size: 12px;
}
.muted,
.cell-sub {
  color: var(--text-2);
}
.number,
.metric-value,
.metric-card p,
.mono,
time {
  font-variant-numeric: tabular-nums;
}
.mono,
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

/* Shell */
#shell {
  min-height: 100vh;
}
.workspace {
  margin-left: var(--sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--ease-panel);
}
#sidebar {
  width: var(--sidebar);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  background: var(--surface);
  border-right: 1px solid var(--border);
  color: var(--text);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  transition:
    width var(--ease-panel),
    transform var(--ease-panel),
    visibility var(--ease-panel);
}
.brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text);
}
#sidebar > .brand {
  margin: 4px 8px 22px;
  min-height: 32px;
  border-radius: 8px;
}
.brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 7px 0;
  border-radius: 9px;
  background: var(--brand-gradient);
  flex: none;
}
.brand-mark b {
  width: 3px;
  background: #fff;
  border-radius: 2px;
  height: 8px;
  display: block;
  opacity: 0.95;
}
.brand-mark b:nth-child(2) {
  height: 14px;
}
.brand-mark b:nth-child(3) {
  height: 18px;
}
.brand-mark b:nth-child(4) {
  height: 11px;
}
#nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.nav-group > p {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin: 0 10px 6px;
}
.nav-item,
.desk-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-2);
  margin: 1px 0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  transition:
    background var(--ease),
    color var(--ease);
}
.nav-item svg {
  color: var(--text-3);
  transition: color var(--ease);
}
.nav-item:hover,
.desk-link:hover {
  background: var(--surface-3);
  color: var(--text);
}
.nav-item:hover svg,
.desk-link:hover svg {
  color: var(--text-2);
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active svg {
  color: var(--primary);
}
.sidebar-end {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.desk-link {
  font-size: 13px;
}
.vendor-mark {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 2px;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.vendor-mark b {
  font-weight: 600;
  color: var(--text-2);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  min-width: 36px;
  height: 36px;
  padding: 7px;
  color: var(--text-2);
  transition:
    background var(--ease),
    color var(--ease),
    border-color var(--ease);
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  height: var(--topbar);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
}
.crumb,
.top-meta {
  display: flex;
  align-items: center;
  font-size: 13px;
  gap: 8px;
  min-width: 0;
}
.crumb {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
}
.crumb b {
  font-weight: 400;
  color: var(--text-3);
}
.crumb strong {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-meta {
  gap: 6px;
  color: var(--text-2);
}
.top-divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 6px;
}
.health,
.tenant-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.health:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.health:empty {
  display: none;
}
.health.up:before {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.health.degraded:before {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.tenant-chip {
  max-width: 220px;
}
.tenant-chip svg {
  color: var(--text-3);
}
#tenant-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-toggle .theme-sun,
[data-theme="light"] .theme-toggle .theme-moon {
  display: none;
}
[data-theme="light"] .theme-toggle .theme-sun {
  display: block;
}
.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 2px 8px 2px 2px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  max-width: 240px;
}
.account-button:hover,
.account-button[aria-expanded="true"] {
  background: var(--surface-3);
  border-color: var(--border);
}
.account-button > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-button > svg {
  color: var(--text-3);
}
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
#menu-button {
  display: none;
}
#content {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 56px;
  outline: none;
  min-height: 65vh;
}
#content:focus {
  outline: none;
}
.page,
.overview-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.page[aria-busy="true"]:empty:after {
  content: "Loading…";
  color: var(--text-2);
  margin: 20px 0;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.section-head h1 {
  font-size: 24px;
}
.section-head p,
.login-card > p,
.dialog-head p {
  color: var(--text-2);
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.actions:empty {
  display: none;
}

/* Buttons */
.btn,
.range-control,
.tab {
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-weight: 500;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  min-height: 36px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  transition:
    background var(--ease),
    border-color var(--ease),
    color var(--ease);
}
.btn:hover,
.range-control:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}
.btn.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.quiet:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: transparent;
}
.btn.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}
.icon-btn.refresh {
  border-color: var(--border-strong);
  background: var(--surface-3);
}
.range-control {
  position: relative;
  padding: 0 11px;
  gap: 0;
  color: var(--text);
}
.range-control > svg {
  pointer-events: none;
  color: var(--text-2);
}
.range-control > svg:first-child {
  position: absolute;
  left: 10px;
}
.range-control > svg:last-child {
  position: absolute;
  right: 10px;
}
.range-control select {
  width: 144px;
  max-width: none;
  border: 0;
  min-height: 34px;
  appearance: none;
  background: transparent;
  padding: 5px 30px 5px 34px;
  margin: 0 -11px;
  font-size: 13px;
  color: var(--text);
}
.range-control select:focus-visible {
  box-shadow: none;
}
.range-control:focus-within {
  box-shadow: var(--ring);
}

/* Cards and panels */
.panel,
.metric-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 0;
  box-shadow: var(--shadow-1);
}
.panel {
  overflow: hidden;
}
.panel-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  font-size: 16px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.metric-card {
  padding: 16px;
}
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.metric-top h2 {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 500;
}
.metric-icon,
.config-row i,
.direction i,
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 8px;
}
.metric-icon {
  width: 32px;
  height: 32px;
}
.clay {
  color: var(--primary);
  background: var(--primary-soft);
}
.sage {
  color: var(--success);
  background: var(--success-soft);
}
.lilac {
  color: var(--accent);
  background: var(--accent-soft);
}
.metric-value {
  font-size: clamp(26px, 2.3vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 8px;
  white-space: nowrap;
}
.metric-card p {
  color: var(--text-2);
  font-size: 12px;
  margin-top: 6px;
}
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(215px, 1fr);
  gap: 18px;
}
.traffic,
.configuration {
  display: flex;
  flex-direction: column;
}
.traffic .panel-head {
  padding-bottom: 8px;
  border-bottom: 0;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.legend-item {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-2);
}
.legend-item:hover {
  background: var(--surface-3);
}
.legend-item i {
  width: 10px;
  height: 3px;
  border-radius: 3px;
  background: var(--primary);
}
.legend-item.outbound i {
  background: var(--accent);
}
.legend-item[aria-pressed="false"] {
  opacity: 0.62;
  text-decoration: line-through;
}
.plot {
  margin: 3px 17px 0 7px;
  min-width: 0;
}
.plot svg {
  overflow: visible;
}
.axis {
  font-family: inherit;
  fill: var(--text-3);
  font-size: 11px;
}
.guide {
  stroke: var(--chart-grid);
  stroke-dasharray: 3 4;
}
.line {
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line.inbound,
.dot.inbound {
  stroke: var(--primary);
}
.line.outbound,
.dot.outbound {
  stroke: var(--accent);
}
.dot {
  stroke-width: 1.85;
  fill: var(--surface-2);
}
.indicator {
  stroke: var(--text-3);
  stroke-dasharray: 3 4;
}
.chart-readout {
  font-size: 11px;
  color: var(--text-2);
  min-height: 19px;
  text-align: right;
  margin: 0 20px 4px;
}
.config-rows {
  padding: 0 16px;
}
.config-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.config-row:last-child {
  border: 0;
}
.config-row:hover,
.text-link:hover {
  color: var(--primary);
}
.config-row i {
  width: 28px;
  height: 28px;
  background: var(--surface-3);
  color: var(--text-2);
}
.config-row strong {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.config-row > svg {
  color: var(--text-3);
}
.config-foot {
  margin-top: auto;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
}
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
  font-weight: 500;
  font-size: 13px;
  border: 0;
  background: none;
  padding: 0;
  border-radius: 4px;
}
.text-link:hover {
  text-decoration: underline;
}

/* Tables */
.table-wrap {
  overflow: auto;
  max-width: 100%;
}
table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  text-align: left;
  font-size: 13px;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-2);
  white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  height: 36px;
}
td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow-wrap: anywhere;
  min-height: 36px;
}
tbody tr:hover td {
  background: var(--surface-3);
}
td:first-child,
thead th:first-child {
  padding-left: 16px;
}
td:last-child,
thead th:last-child {
  padding-right: 16px;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.recent td {
  padding-top: 9px;
  padding-bottom: 9px;
}
.direction {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.direction i {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
}
.direction i.outbound {
  background: var(--accent-soft);
  color: var(--accent);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  border-radius: 999px;
  padding: 2px 9px;
  min-height: 22px;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill:before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}
.pill.success {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}
.pill.warn {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: transparent;
}
.pill.info {
  color: var(--info);
  background: var(--info-soft);
  border-color: transparent;
}
.pill.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
[data-theme="light"] .pill.success {
  color: #15803d;
}
[data-theme="light"] .pill.warn {
  color: #b45309;
}
[data-theme="light"] .pill.info {
  color: #0369a1;
}
[data-theme="light"] .pill.danger {
  color: #b91c1c;
}
.time-cell {
  color: var(--text-2);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.page > .stack {
  gap: 20px;
}
.grid-2,
.cards,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.metric {
  padding: 18px;
}
.cell-title {
  font-weight: 600;
}
.cell-sub {
  display: block;
  margin-top: 2px;
}
.cell-title + .cell-sub,
.stack .cell-sub {
  line-height: 1.35;
}
.stack:has(> .cell-title) {
  gap: 0;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child {
  border: 0;
}
.panel-note {
  color: var(--text-2);
  font-size: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.panel > .panel-note:first-child,
.panel-head + .panel-note {
  border-top: 0;
}
.tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  background: var(--surface-3);
  padding: 3px;
  align-self: flex-start;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.tab {
  background: transparent;
  border-color: transparent;
  padding: 0 12px;
  min-height: 28px;
  color: var(--text-2);
  border-radius: 6px;
}
.tab.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.tab:hover {
  color: var(--text);
}
.loading {
  color: var(--text-2);
  padding: 12px 0;
}
.empty {
  padding: 36px 20px;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}
.empty-icon {
  height: 44px;
  width: 44px;
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  margin-bottom: 6px;
}
.empty strong {
  font-size: 15px;
}
.empty p {
  color: var(--text-2);
  font-size: 13px;
  max-width: 46ch;
}
.empty .btn {
  margin-top: 10px;
}
.call-facts dt {
  flex-shrink: 0;
}
.call-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}
.call-facts .list-row {
  padding: 10px 0;
}
.call-pager:not(:empty) {
  padding: 12px 16px;
}
.panel .panel-head:empty {
  display: none;
}

/* Forms */
input,
select,
textarea {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  padding: 7px 10px;
  min-height: 36px;
  max-width: 100%;
  font-size: 14px;
  transition:
    border-color var(--ease),
    background var(--ease);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--text-3);
}
input:disabled,
select:disabled,
textarea:disabled {
  color: var(--text-2);
  background: var(--surface-2);
  opacity: 0.7;
}
input[readonly],
textarea[readonly] {
  background: var(--surface);
}
textarea {
  resize: vertical;
  min-height: 76px;
}
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--primary);
  vertical-align: middle;
}
select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
}
select[multiple] {
  background-image: none;
  padding-right: 10px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > span,
.login-card label {
  font-size: 13px;
  font-weight: 500;
}
.field small {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}
.field:not(:has(> input[type="checkbox"])) > input,
.field > select,
.field > textarea {
  width: 100%;
}
fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
legend,
summary {
  font-weight: 600;
}
details.stack {
  display: block;
}
details.stack[open] > :not(summary) {
  margin-top: 12px;
}
details > summary {
  color: var(--text);
}

/* Dialogs */
.editor-dialog {
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  padding: 0;
  max-width: min(570px, calc(100vw - 28px));
  width: 100%;
  max-height: calc(100dvh - 42px);
  color: var(--text);
  background: var(--surface-2);
}
.editor-dialog::backdrop {
  background: var(--scrim);
}
.editor-dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 46px);
}
.dialog-head,
.dialog-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
  font-size: 20px;
  line-height: 1.3;
}
.dialog-head p {
  font-size: 13px;
  margin-top: 4px;
}
.dialog-head .icon-btn {
  border: 0;
  width: 30px;
  min-width: 30px;
  height: 30px;
}
.dialog-body {
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
}
.dialog-footer {
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  border-bottom: 0;
  background: var(--surface);
  border-radius: 0 0 12px 12px;
}
.error-text:not(:empty) {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  margin-top: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
[data-theme="light"] .error-text:not(:empty) {
  color: #b91c1c;
}

/* Toast */
#notice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
  color: var(--text);
  padding: 10px 14px;
  font-size: 13px;
  max-width: calc(100vw - 40px);
}
#notice > svg {
  color: var(--success);
}
#notice.visible {
  display: flex;
  animation: sb-toast-in var(--ease-panel);
}

/* Account menu */
.sb-menu-list {
  min-width: 240px;
}

/* Login */
#login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bg);
}
.login-art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: clamp(24px, 5vw, 72px);
}
.login-art .brand {
  font-size: 19px;
}
.login-copy h2 {
  font-size: clamp(28px, 2.8vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 17ch;
}
.login-copy p {
  color: var(--text-2);
  max-width: 46ch;
  margin-top: 14px;
  font-size: 15px;
}
.login-points {
  display: grid;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 13.5px;
}
.login-points li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-points svg {
  color: var(--primary);
}
.login-glow {
  position: absolute;
  z-index: -1;
  width: 62vmin;
  height: 62vmin;
  right: -18%;
  top: 8%;
  border-radius: 50%;
  background: var(--brand-gradient);
  filter: blur(96px);
  opacity: 0.32;
}
[data-theme="light"] .login-glow {
  opacity: 0.18;
}
.vendor {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.vendor b {
  color: var(--text-2);
  font-weight: 600;
}
.login-section {
  display: grid;
  place-items: center;
  padding: 32px 24px;
}
.login-card {
  width: min(100%, 400px);
}
.login-card h1 {
  font-size: 24px;
}
.login-card > p {
  margin: 6px 0 24px;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-card input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
}
.login-submit {
  margin-top: 4px;
  min-height: 42px;
  font-size: 14px;
}
.login-advanced {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-advanced-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.login-advanced label {
  font-size: 13px;
}
.login-advanced input {
  min-height: 36px;
  font-size: 13px;
}
.login-advanced small {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.45;
}
.login-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-2);
  flex-wrap: wrap;
}
.login-brand {
  display: none;
}
.login-theme {
  position: absolute;
  top: 16px;
  right: 16px;
}
#login {
  position: relative;
}

/* Responsive */
@media (min-width: 1550px) {
  :root {
    --sidebar: 256px;
  }
}
@media (max-width: 1100px) {
  :root {
    --sidebar: 64px;
  }
  #sidebar {
    padding: 14px 10px;
  }
  #sidebar > .brand {
    margin: 4px 6px 18px;
    font-size: 0;
    gap: 0;
  }
  .nav-group > p {
    display: none;
  }
  .nav-group {
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }
  .nav-group:first-child {
    border-top: 0;
    padding-top: 0;
  }
  .nav-item,
  .desk-link {
    justify-content: center;
    padding: 0;
    width: 44px;
    height: 40px;
    margin: 2px auto;
    font-size: 0;
    gap: 0;
  }
  .vendor-mark {
    display: none;
  }
  .overview-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(205px, 1fr);
  }
}
@media (max-width: 760px) {
  :root {
    --sidebar: 256px;
  }
  .workspace {
    margin: 0;
  }
  #sidebar {
    width: var(--sidebar);
    transform: translateX(-102%);
    visibility: hidden;
    padding: 14px 12px;
    box-shadow: var(--shadow-2);
  }
  #sidebar > .brand {
    font-size: 17px;
    gap: 10px;
    margin: 4px 8px 22px;
  }
  .nav-group > p {
    display: block;
  }
  .nav-group {
    border-top: 0;
    padding-top: 0;
  }
  .nav-item,
  .desk-link {
    justify-content: flex-start;
    padding: 7px 10px;
    width: auto;
    height: auto;
    margin: 1px 0;
    font-size: 13.5px;
    gap: 10px;
  }
  .vendor-mark {
    display: flex;
  }
  .menu-open #sidebar {
    transform: none;
    visibility: visible;
  }
  #scrim {
    position: fixed;
    inset: 0;
    z-index: 9;
    background: var(--scrim);
  }
  #menu-button {
    display: inline-flex;
    min-width: 36px;
    height: 36px;
  }
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }
  .crumb {
    margin-right: auto;
  }
  .metric-value {
    font-size: 28px;
  }
  .tenant-chip,
  .top-divider {
    display: none;
  }
  .account-button > strong,
  .account-button > svg {
    display: none;
  }
  .account-button {
    padding: 2px;
  }
}
@media (max-width: 610px) {
  #content {
    padding: 18px 14px 36px;
  }
  .crumb,
  .top-meta {
    gap: 6px;
  }
  .health {
    padding: 0 8px;
  }
  .health {
    font-size: 0;
    gap: 0;
    min-width: 28px;
    justify-content: center;
  }
  .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }
  .section-head h1 {
    font-size: 22px;
  }
  .section-head p {
    font-size: 13px;
  }
  .page,
  .overview-body {
    gap: 14px;
  }
  .stats {
    gap: 8px;
  }
  .metric-card {
    padding: 12px;
    border-radius: 10px;
  }
  .metric-top {
    flex-wrap: wrap;
    gap: 4px;
  }
  .metric-top h2 {
    font-size: 11px;
    line-height: 1.3;
  }
  .metric-icon {
    display: none;
  }
  .metric-value {
    font-size: clamp(22px, 6vw, 30px);
    margin-top: 6px;
  }
  .metric-card p {
    font-size: 11px;
    line-height: 1.35;
  }
  .overview-grid,
  .grid-2,
  .cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .config-row {
    min-height: 43px;
  }
  .content .list-row,
  .list-row {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 6px 15px;
  }
  .panel-head {
    padding: 12px 14px;
    gap: 8px;
  }
  td,
  thead th {
    padding: 8px 12px;
  }
  .recent .table-wrap table {
    min-width: 570px;
  }
  .table-wrap table {
    min-width: 500px;
  }
  .call-facts .list-row {
    flex-wrap: nowrap;
  }
  .dialog-head,
  .dialog-body,
  .dialog-footer {
    padding: 15px;
  }
  .form-grid {
    gap: 10px;
  }
  #login {
    grid-template-columns: 1fr;
  }
  .login-art {
    display: none;
  }
  .login-brand {
    display: flex;
    align-items: center;
    font-size: 18px;
    margin-bottom: 32px;
  }
  .login-section {
    align-items: start;
    padding: 72px 20px 32px;
  }
}
@media (max-width: 385px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .crumb {
    font-size: 12px;
  }
  .top-meta {
    gap: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
    animation: none !important;
  }
}
.mobile-call-time {
  display: none;
}
@media (max-width: 610px) {
  .recent .table-wrap table {
    min-width: 0;
  }
  .recent tr > :nth-child(2),
  .recent tr > :nth-child(3) {
    display: none;
  }
  .recent thead th:first-child,
  .recent td:first-child {
    padding-left: 14px;
  }
  .recent thead th:last-child,
  .recent td:last-child {
    padding-right: 14px;
  }
  .recent tr > :last-child {
    white-space: nowrap;
    text-align: right;
  }
  .mobile-call-time {
    display: block;
    color: var(--text-2);
    font-size: 10px;
    margin: 3px 0 0 0;
  }
}

/* Page modules (checkbox fields, wholesale, voice tools, platform configuration, carrier ledger) */
.field:has(> input[type="checkbox"]) {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  column-gap: 9px;
  row-gap: 3px;
  cursor: pointer;
}
.field:has(> input[type="checkbox"]) > input {
  grid-column: 1;
  grid-row: 1;
  margin: 1px 0;
}
.field:has(> input[type="checkbox"]) > span,
.field:has(> input[type="checkbox"]) > small {
  grid-column: 2;
}
.field:has(> input[type="checkbox"]) > span {
  grid-row: 1;
}
.wholesale-form {
  padding: 16px 20px;
}
.wholesale-candidate {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.wholesale-candidate legend {
  font-weight: 600;
}
.wholesale-candidate > button {
  justify-self: start;
}

.script-copy {
  white-space: pre-wrap;
}

.voice-tools-body { padding: 18px 20px; }
.voice-tools-body > :not(:first-child):not(:empty) { margin-top: 16px; }
.voice-tool-controls, .voice-tool-group { min-width: 0; margin: 0; border: 0; padding: 0; }
.voice-tool-controls { display: grid; gap: 20px; }
.voice-tool-group { display: grid; gap: 12px; }
.voice-tool-group > legend { margin-bottom: 8px; font-size: 15px; font-weight: 650; }
.voice-tool-group .field { margin: 0; }
/* Platform configuration */
.cfg-search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 27rem;
  padding: 0 0.85rem;
  color: var(--muted);
}
.cfg-search input {
  width: 100%;
  padding: 0.72rem 0;
  border: 0;
  background: transparent;
}
.cfg-search:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.cfg-search input:focus-visible {
  outline: none;
}
.cfg-groups {
  display: grid;
  gap: 1.8rem;
}
.cfg-groups h2 {
  margin-bottom: 0.8rem;
}
.cfg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 0.75rem;
}
.cfg-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
}
.cfg-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-1);
}
.cfg-card-icon {
  padding: 0.5rem;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}
.cfg-card-main {
  flex: 1;
  min-width: 0;
}
.cfg-card-main p {
  color: var(--muted);
  margin: 0.35rem 0 0.75rem;
}
.cfg-card > svg {
  margin-top: 0.6rem;
  color: var(--muted);
}
.cfg-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  font-size: 0.9rem;
  color: var(--muted);
}
.cfg-back:hover {
  text-decoration: underline;
}
.cfg-panel {
  overflow: visible;
}
.cfg-panel-head,
.cfg-version,
.cfg-tabs,
.cfg-actions,
.cfg-caption,
.cfg-options,
.cfg-inactive {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.cfg-panel-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.25rem;
}
.cfg-tabs {
  gap: 0.25rem;
}
.cfg-tabs .btn[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--deep);
}
.cfg-panel-body {
  padding: 1.25rem;
}
.cfg-controls {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.cfg-controls > .cfg-field > .cfg-caption:first-child {
  display: none;
}
.cfg-field {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-width: 0;
}
.cfg-field input,
.cfg-field textarea,
.cfg-field select,
.cfg-options select,
.cfg-variant > select {
  width: 100%;
  font-size: 0.95rem;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.58rem 0.65rem;
  min-height: 2.5rem;
}
.cfg-field textarea {
  resize: vertical;
}
.cfg-field select,
.cfg-options select {
  padding-right: 2rem;
}
.cfg-caption {
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.93rem;
  font-weight: 600;
}
.cfg-help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.cfg-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  padding: 0;
}
.field:has(> .field-context) {
  position: relative;
}
.field > .field-context,
.cfg-tip {
  display: none;
  position: absolute;
  z-index: 5;
  bottom: 100%;
  left: 0;
  width: max-content;
  max-width: min(18rem, 64vw);
  font-size: 0.85rem;
  line-height: 1.45;
  font-weight: 400;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-2);
}
.field > .field-context {
  pointer-events: none;
  max-width: min(18rem, 100%);
}
.field:focus-within > .field-context,
.cfg-help-wrap:hover > .cfg-tip,
.cfg-help-wrap:focus-within > .cfg-tip,
.cfg-help-wrap.show-help > .cfg-tip {
  display: block;
}
.cfg-children,
.cfg-rows,
.cfg-variant {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
}
.cfg-variant {
  margin-top: 0.4rem;
}
.cfg-option {
  display: flex;
  align-items: start;
  gap: 0.45rem;
  min-width: 0;
}
.cfg-option > .cfg-field {
  flex: 1;
  min-width: 0;
}
.cfg-option:has(> .cfg-field > .cfg-children) {
  border-left: 2px solid var(--line);
  padding-left: 0.8rem;
}
.cfg-option > .cfg-remove {
  align-self: start;
  margin-top: 1.62rem;
}
.cfg-options {
  margin-top: 0.35rem;
}
.cfg-options select {
  max-width: 20rem;
  width: fit-content;
}
.cfg-collection {
  display: grid;
  gap: 0.6rem;
  justify-items: start;
  min-width: 0;
}
.cfg-rows {
  width: 100%;
  gap: 0.45rem;
}
.cfg-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-3);
  min-width: 0;
}
.cfg-row > summary {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  list-style: none;
  padding: 0.7rem 0.85rem;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.cfg-row > summary::-webkit-details-marker {
  display: none;
}
.cfg-row[open] > summary {
  background: var(--surface-3);
  border-radius: 7px 7px 0 0;
}
.cfg-row[open] > summary svg {
  transform: rotate(90deg);
}
.cfg-row-body {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  min-width: 0;
}
.cfg-row-actions {
  display: flex;
  justify-content: end;
}
.cfg-empty {
  color: var(--muted);
  font-size: 0.9rem;
}
.cfg-actions {
  justify-content: end;
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.cfg-actions span {
  margin-right: auto;
}
.cfg-history-footer {
  margin-top: 0.75rem;
}
.cfg-history-data {
  display: grid;
  gap: 0.5rem;
}
.cfg-history-data > div {
  padding: 0.3rem 0.5rem;
  border-left: 2px solid var(--line);
  overflow-wrap: anywhere;
}
.cfg-history-data dt {
  font-weight: 600;
}
.cfg-history-data dd {
  margin: 0.15rem 0 0.3rem 0.35rem;
}
.cfg-history-preview > .panel-note {
  margin-bottom: 0.75rem;
}
@media (max-width: 640px) {
  .cfg-panel-head,
  .cfg-panel-body {
    padding: 0.8rem;
  }
  .cfg-options select {
    width: 100%;
    max-width: none;
  }
  .cfg-option > .cfg-remove {
    margin-top: 1.5rem;
    padding: 0.4rem;
  }
  .cfg-tip {
    left: auto;
    right: -1rem;
    max-width: min(13rem, 65vw);
  }
}
.cfg-service-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  font-weight: 600;
}
.cfg-controls > small {
  display: block;
  color: var(--muted);
}
.cfg-enabled-fields {
  margin-top: 1rem;
}
.cfg-enabled-fields > .cfg-field > .cfg-caption:first-child {
  display: none;
}
@media (max-width: 640px) {
  .field > .field-context,
  .cfg-tip {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
  }
}

.carrier-ledger > summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 650;
}

/* Module overrides for the token palette */
.cfg-card,
.cfg-row {
  background: var(--surface-2);
}
.cfg-tabs .btn[aria-pressed="true"] {
  color: var(--primary);
}

/* H4: outbound, people, queues */
.h4-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.h4-pad { padding: 16px; display: grid; gap: 12px; }
.h4-progress { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.h4-progress-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.h4-progress-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width 200ms ease; }
.h4-progress-text { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.h4-sub { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.h4-days { display: flex; flex-wrap: wrap; gap: 6px; }
.h4-day, .h4-check { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-3); font-size: 13px; cursor: pointer; }
.h4-check { border: 0; background: transparent; padding: 4px 0; border-radius: 0; }
.h4-day:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.h4-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.h4-facts { margin: 0; padding: 12px 16px 16px 32px; display: grid; gap: 6px; color: var(--text-2); }
.editor-dialog td input[type="text"], .editor-dialog td input[type="number"] { width: 100%; min-width: 72px; }
.page[data-page="dispositions"] td input[type="text"], .page[data-page="dispositions"] td input[type="number"], .page[data-page="dispositions"] td select { width: 100%; min-width: 80px; }
@media (max-width: 1100px) { .h4-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .h4-stats { grid-template-columns: 1fr; } }
.h4-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px; }
.h4-row > input { width: 260px; max-width: 100%; }
