:root {
  color-scheme: light;
  --canvas: #f3f5f7;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --surface-raised: #ffffff;
  --ink: #172026;
  --ink-strong: #0c1419;
  --muted: #62717a;
  --muted-2: #89969d;
  --line: #dfe5e8;
  --line-strong: #ccd5d9;
  --sidebar: #172127;
  --sidebar-2: #202d34;
  --sidebar-text: #dce6ea;
  --teal: #087d7b;
  --teal-dark: #075f5e;
  --teal-soft: #e4f4f2;
  --blue: #2463a6;
  --blue-soft: #e9f1fb;
  --coral: #c75242;
  --coral-soft: #faece9;
  --magenta: #a7356d;
  --magenta-soft: #f8eaf1;
  --green: #267851;
  --green-soft: #e7f4ed;
  --amber: #9a6518;
  --amber-soft: #fbf1df;
  --red: #b83943;
  --red-soft: #fae9eb;
  --violet: #6747a4;
  --violet-soft: #f0ebf9;
  --shadow-sm: 0 1px 2px rgba(18, 31, 38, 0.07);
  --shadow-md: 0 12px 36px rgba(18, 31, 38, 0.13);
  --sidebar-width: 236px;
  --topbar-height: 68px;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(8, 125, 123, 0.24);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.hidden {
  display: none !important;
}

.platform-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid #26353d;
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.brand-lockup {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-lockup img {
  display: block;
  width: 116px;
  max-height: 32px;
  object-fit: contain;
}

.brand-lockup span {
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  color: #9fb0b8;
  font-size: 12px;
  font-weight: 700;
}

.primary-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 24px;
}

.nav-label {
  margin: 15px 10px 6px;
  color: #7f939d;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-label:first-child {
  margin-top: 3px;
}

.nav-button {
  position: relative;
  display: grid;
  min-height: 38px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #b9c9d0;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f4f8fa;
}

.nav-button.active {
  border-color: rgba(108, 214, 207, 0.14);
  background: #26373e;
  color: #ffffff;
}

.nav-button.active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #6cd6cf;
  content: "";
}

.nav-button svg {
  width: 17px;
  height: 17px;
}

.nav-count,
.nav-alert,
.nav-live {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: #9fb0b8;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.nav-alert {
  background: #77303a;
  color: #ffdbe0;
}

.nav-live {
  background: rgba(58, 172, 119, 0.2);
  color: #88dfb4;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  padding: 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.environment-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
}

.environment-state div {
  display: grid;
  gap: 2px;
}

.environment-state strong {
  color: #eef4f6;
  font-size: 12px;
}

.environment-state span:last-child {
  color: #869aa4;
  font-size: 10px;
}

.topbar-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

#identityRole {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 750;
}

#identityName {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-controls .button {
  white-space: nowrap;
  min-height: 36px;
}

.customer-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#customerSelect {
  min-height: 34px;
  min-width: 140px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.status-dot.healthy {
  background: #46c784;
  box-shadow: 0 0 0 4px rgba(70, 199, 132, 0.12);
}

.help-link {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #9eb0b8;
  font-size: 12px;
}

.help-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.main-column {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  min-height: var(--topbar-height);
  grid-template-columns: minmax(190px, 0.8fr) minmax(280px, 1.2fr) auto;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.topbar-leading,
.topbar-actions,
.heading-actions,
.header-actions,
.toolbar-group,
.profile-button,
.run-title,
.agent-editor-header > div:last-child {
  display: flex;
  align-items: center;
}

.topbar-leading {
  min-width: 0;
  gap: 10px;
}

.page-identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.page-identity span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.page-identity strong {
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.global-search svg {
  width: 16px;
  height: 16px;
  color: var(--muted-2);
}

.global-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.global-search input::placeholder {
  color: #8c989e;
}

.global-search kbd {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-bottom-color: #bbc5ca;
  border-radius: 4px;
  background: #ffffff;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 8px;
}

.environment-picker {
  display: grid;
  gap: 1px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.environment-picker span {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.environment-picker select {
  max-width: 112px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.icon-button {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  background: #edf1f3;
  color: var(--ink);
}

.icon-button.bordered {
  border: 1px solid var(--line);
  background: #ffffff;
}

.icon-button.subtle {
  width: 30px;
  height: 30px;
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  background: var(--coral);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.primary-button {
  border-color: var(--teal-dark);
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(5, 80, 79, 0.16);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  border-color: var(--line-strong);
  background: #ffffff;
  color: #344149;
}

.secondary-button:hover {
  border-color: #aebcc2;
  background: var(--surface-subtle);
}

.primary-button.compact,
.secondary-button.compact {
  min-height: 34px;
  padding: 6px 10px;
}

.full-button {
  width: 100%;
}

.profile-button {
  gap: 8px;
  min-height: 40px;
  padding: 3px 4px 3px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.profile-button:hover {
  background: var(--surface-subtle);
}

.avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #243a43;
  color: #ffffff;
  font-size: 10px;
  font-weight: 850;
}

.profile-copy {
  display: grid;
  gap: 1px;
}

.profile-copy strong {
  font-size: 11px;
}

.profile-copy small {
  color: var(--muted);
  font-size: 9px;
}

.profile-button > svg {
  width: 14px;
  height: 14px;
}

.mobile-menu {
  display: none;
}

.preview-notice {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  margin: 20px 28px 0;
  padding: 7px 9px 7px 12px;
  border: 1px solid #c4dcda;
  border-radius: 6px;
  background: var(--teal-soft);
  color: #215f5e;
}

.preview-notice > svg {
  flex: 0 0 auto;
}

.preview-notice p {
  flex: 1;
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.preview-notice .icon-button:hover {
  background: rgba(8, 125, 123, 0.1);
}

.source-contract {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 14px;
}

.source-contract > span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 9px;
}

.source-contract svg {
  width: 14px;
  height: 14px;
  color: var(--teal);
}

.source-contract strong {
  color: var(--ink);
}

.data-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 8px;
  font-weight: 800;
}

.data-badge.live-data {
  border-color: #b8d7d3;
  background: var(--teal-soft);
  color: #176360;
}

.data-badge.sample-data {
  border-color: #e6cf9e;
  background: #fff8e7;
  color: #8a6415;
}

.search-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 7px;
  margin: 24px 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.search-empty svg {
  width: 28px;
  height: 28px;
}

.search-empty strong {
  color: var(--ink);
}

.workspace-view {
  display: none;
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 28px;
}

.workspace-view.active-view {
  display: block;
}

.view-heading {
  display: flex;
  min-height: 70px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.view-heading h1 {
  margin: 2px 0 5px;
  color: var(--ink-strong);
  font-size: 25px;
  font-weight: 740;
  line-height: 1.2;
}

.view-heading > div:first-child > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.heading-actions,
.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric-card.attention {
  border-top: 3px solid var(--amber);
  padding-top: 15px;
}

.metric-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.metric-topline svg {
  width: 17px;
  height: 17px;
  color: #829097;
}

.metric-card > strong {
  display: block;
  margin: 11px 0 4px;
  color: var(--ink-strong);
  font-size: 25px;
  font-weight: 750;
}

.metric-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.trend {
  margin-right: 4px;
  font-weight: 800;
}

.trend.positive,
.positive-text {
  color: var(--green) !important;
}

.trend.neutral {
  color: var(--blue);
}

.trend.warning {
  color: var(--amber);
}

.spark-bars {
  position: absolute;
  right: 17px;
  bottom: 16px;
  left: 17px;
  display: flex;
  height: 25px;
  align-items: flex-end;
  gap: 5px;
}

.spark-bars i {
  flex: 1;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: #cfe3e2;
}

.spark-bars i:last-child {
  background: var(--teal);
}

.metric-detail {
  position: absolute;
  right: 17px;
  bottom: 16px;
  left: 17px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.metric-detail span {
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.text-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.text-action:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

.text-action svg {
  width: 13px;
  height: 13px;
}

.metric-card > .text-action {
  position: absolute;
  bottom: 17px;
  left: 17px;
}

.surface {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.surface-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
}

.surface-header h2,
.run-title h2,
.trace-detail-header h2,
.agent-editor-header h2,
.integration-card h2,
.security-posture h2 {
  margin: 3px 0 0;
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 750;
}

.service-list {
  display: grid;
}

.service-row {
  display: grid;
  min-height: 74px;
  grid-template-columns: 36px minmax(150px, 1fr) minmax(110px, 0.6fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 17px;
  border-bottom: 1px solid var(--line);
}

.service-row:last-child {
  border-bottom: 0;
}

.service-icon,
.direction-icon,
.node-icon,
.sync-source-icon,
.integration-logo,
.activity-icon,
.device-icon,
.agent-avatar,
.tool-icon,
.banner-icon,
.run-icon,
.control-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.service-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
}

.service-icon svg {
  width: 16px;
  height: 16px;
}

.service-icon.voice {
  background: var(--teal-soft);
  color: var(--teal);
}

.service-icon.sms {
  background: var(--blue-soft);
  color: var(--blue);
}

.service-icon.ai {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.service-icon.sim {
  background: var(--amber-soft);
  color: var(--amber);
}

.service-row > div:nth-child(2),
.service-measure {
  display: grid;
  gap: 3px;
}

.service-row strong {
  color: var(--ink);
  font-size: 11px;
}

.service-row span {
  color: var(--muted);
  font-size: 9px;
}

.service-measure {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.state-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 20px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.state-pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.state-pill.healthy {
  background: var(--green-soft);
  color: var(--green);
}

.state-pill.pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.state-pill.review {
  background: var(--red-soft);
  color: var(--red);
}

.state-pill.muted {
  background: #eef1f2;
  color: #69777e;
}

.activity-list {
  display: grid;
  margin: 0;
  padding: 11px 17px 15px;
  list-style: none;
}

.activity-list li {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
}

.activity-list li:not(:last-child)::after {
  position: absolute;
  top: 39px;
  bottom: -9px;
  left: 14px;
  width: 1px;
  background: var(--line);
  content: "";
}

.activity-icon {
  position: relative;
  z-index: 1;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--teal);
}

.activity-icon svg {
  width: 13px;
  height: 13px;
}

.activity-list li > div {
  display: grid;
  gap: 2px;
}

.activity-list strong {
  font-size: 10px;
}

.activity-list span,
.activity-list time {
  color: var(--muted);
  font-size: 9px;
}

.activity-list time {
  margin-top: 2px;
}

.invoice-surface {
  overflow: hidden;
}

.cutoff-copy {
  color: var(--muted);
  font-size: 10px;
}

.billing-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
}

.billing-summary-strip div {
  display: grid;
  gap: 4px;
  padding: 12px 17px;
  border-right: 1px solid var(--line);
}

.billing-summary-strip div:last-child {
  border-right: 0;
}

.billing-summary-strip span {
  color: var(--muted);
  font-size: 9px;
}

.billing-summary-strip strong {
  color: var(--ink-strong);
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  height: 52px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: #39484f;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr[data-customer-id],
tbody tr[data-device-id] {
  cursor: pointer;
}

tbody tr:hover td {
  background: #fafcfc;
}

td strong {
  color: var(--ink);
}

.cell-subtitle,
td small.cell-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.table-toolbar {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.table-search {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  width: min(340px, 100%);
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.table-search.full {
  flex: 1;
  width: auto;
}

.table-search svg {
  width: 15px;
  height: 15px;
  color: var(--muted-2);
}

.table-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 11px;
}

.toolbar-group {
  flex-wrap: wrap;
  gap: 4px;
}

.filter-button {
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.filter-button:hover,
.filter-button.active {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--ink);
}

.filter-button span {
  color: var(--muted-2);
}

.table-footer {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.table-footer div {
  display: flex;
  gap: 5px;
}

.did-inventory-surface {
  margin-top: 14px;
}

.customer-table,
.did-inventory-table {
  min-width: 980px;
}

.entity-cell,
.device-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-cell > span:last-child,
.device-cell > span:last-child {
  display: grid;
  gap: 2px;
}

.entity-cell small,
.device-cell small {
  color: var(--muted);
  font-size: 9px;
}

.entity-avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 9px;
  font-weight: 850;
}

.entity-avatar.coral {
  background: var(--coral-soft);
  color: var(--coral);
}

.entity-avatar.green {
  background: var(--green-soft);
  color: var(--green);
}

.entity-avatar.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.entity-avatar.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.service-tag {
  display: inline-block;
  margin-right: 3px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 750;
}

.voice-tag {
  background: var(--teal-soft);
  color: var(--teal);
}

.ai-tag {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.sms-tag {
  background: var(--blue-soft);
  color: var(--blue);
}

.sim-tag {
  background: var(--amber-soft);
  color: var(--amber);
}

.billing-metrics .metric-card {
  min-height: 120px;
}

.billing-run {
  margin-bottom: 18px;
  overflow: hidden;
}

.run-header {
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.run-title {
  gap: 12px;
}

.run-icon {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
}

.run-title span {
  color: var(--muted);
  font-size: 9px;
}

.run-progress {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 24px 20px;
  overflow-x: auto;
}

.run-step {
  display: grid;
  min-width: 95px;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}

.run-step > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #ffffff;
  font-size: 9px;
  font-weight: 800;
}

.run-step > span svg {
  width: 13px;
  height: 13px;
}

.run-step strong {
  font-size: 9px;
}

.run-step small {
  font-size: 8px;
}

.run-step.complete > span {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.run-step.active > span {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
}

.run-step.active strong {
  color: var(--ink);
}

.run-line {
  width: 60px;
  height: 1px;
  flex: 0 0 auto;
  margin-top: 13px;
  background: var(--line);
}

.run-line.complete {
  background: var(--green);
}

.trace-layout {
  display: grid;
  grid-template-columns: minmax(350px, 0.72fr) minmax(600px, 1.4fr);
  gap: 18px;
}

.trace-list-surface {
  align-self: start;
  overflow: hidden;
}

.trace-list {
  display: grid;
}

.trace-row {
  display: grid;
  min-height: 72px;
  grid-template-columns: 32px minmax(130px, 1fr) minmax(80px, 0.5fr) auto 36px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.trace-row:last-child {
  border-bottom: 0;
}

.trace-row:hover {
  background: var(--surface-subtle);
}

.trace-row.active {
  background: #edf7f6;
  box-shadow: inset 3px 0 0 var(--teal);
}

.trace-row > span:nth-child(2),
.trace-row > span:nth-child(3) {
  display: grid;
  gap: 3px;
}

.trace-row small,
.trace-row time {
  color: var(--muted);
  font-size: 8px;
}

.trace-row strong {
  font-size: 10px;
}

.trace-row time {
  text-align: right;
}

.direction-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}

.direction-icon.inbound {
  background: var(--green-soft);
  color: var(--green);
}

.direction-icon.outbound {
  background: var(--blue-soft);
  color: var(--blue);
}

.direction-icon svg {
  width: 14px;
  height: 14px;
}

.trace-detail {
  min-width: 0;
  overflow: hidden;
}

.trace-detail-header {
  display: flex;
  min-height: 75px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
}

.trace-detail-header span {
  color: var(--muted);
  font-size: 9px;
}

.trace-facts,
.trace-costs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.trace-facts div,
.trace-costs div {
  display: grid;
  gap: 4px;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
}

.trace-facts div:last-child,
.trace-costs div:last-child {
  border-right: 0;
}

.trace-facts span,
.trace-costs span {
  color: var(--muted);
  font-size: 8px;
}

.trace-facts strong,
.trace-costs strong {
  font-size: 11px;
}

.trace-costs small {
  color: var(--muted);
  font-size: 8px;
}

.trace-path {
  display: flex;
  min-height: 255px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px 18px;
  overflow-x: auto;
}

.trace-hop {
  display: grid;
  min-width: 116px;
  justify-items: center;
  gap: 10px;
  padding: 14px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  text-align: center;
}

.trace-hop.ai-hop {
  border-color: #dfcce8;
  background: #fcf8fe;
}

.trace-hop .hop-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}

.trace-hop.ai-hop .hop-icon {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.trace-hop .hop-icon svg {
  width: 16px;
  height: 16px;
}

.trace-hop div {
  display: grid;
  gap: 3px;
}

.trace-hop strong {
  font-size: 10px;
}

.trace-hop small {
  color: var(--muted);
  font-size: 8px;
}

.trace-hop code {
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
}

.trace-connector {
  display: grid;
  min-width: 40px;
  justify-items: center;
  gap: 4px;
  color: var(--muted-2);
}

.trace-connector small {
  color: var(--muted);
  font-size: 7px;
  white-space: nowrap;
}

.trace-costs {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.route-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(210px, 1.25fr) minmax(160px, 1fr) auto;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.route-toolbar label {
  display: grid;
  gap: 5px;
}

.route-toolbar label > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.route-toolbar select {
  min-width: 0;
  min-height: 35px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  font-size: 10px;
}

.route-status {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 4px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.route-status small {
  color: var(--muted);
  font-size: 8px;
}

.route-drift-banner {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #e6cf9e;
  border-radius: 7px;
  background: #fff8e7;
  color: #725315;
  font-size: 9px;
  line-height: 1.45;
}

.route-drift-banner > svg {
  width: 18px;
  height: 18px;
}

.route-drift-banner[hidden] {
  display: none;
}

.route-canvas {
  min-height: 450px;
  overflow: auto;
  background-color: #f8fafb;
  background-image:
    linear-gradient(#e8edef 1px, transparent 1px),
    linear-gradient(90deg, #e8edef 1px, transparent 1px);
  background-size: 22px 22px;
}

.canvas-controls {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  display: flex;
  min-width: 1080px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.canvas-controls > div:first-child {
  display: flex;
  gap: 5px;
}

.route-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
}

.route-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 8px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.observed {
  background: var(--teal);
}

.legend-dot.managed {
  background: var(--magenta);
}

.legend-dot.external {
  background: #7d8b91;
}

.route-graph {
  display: flex;
  min-width: 900px;
  align-items: center;
  gap: 2px;
  padding: 30px 20px 24px;
}

.route-stage {
  display: grid;
  min-width: 165px;
  flex: 1 0 165px;
  gap: 6px;
}

.route-stage > p {
  margin: 0 0 0 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.route-node {
  display: grid;
  min-width: 165px;
  min-height: 73px;
  grid-template-columns: 36px minmax(100px, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid #cdd7da;
  border-left: 3px solid #7c8d95;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 3px 9px rgba(18, 31, 38, 0.08);
  text-align: left;
}

.route-node:hover {
  border-color: var(--teal);
  border-left-color: var(--teal);
  box-shadow: 0 5px 16px rgba(18, 31, 38, 0.12);
  transform: translateY(-1px);
}

.route-node .node-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #edf1f3;
  color: #65757c;
}

.route-node .node-icon svg {
  width: 16px;
  height: 16px;
}

.route-node > span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.route-node strong {
  color: var(--ink);
  font-size: 10px;
}

.route-node small {
  color: var(--muted);
  font-size: 8px;
}

.route-node em {
  align-self: start;
  padding: 3px 5px;
  border-radius: 4px;
  background: #eef1f2;
  color: var(--muted);
  font-size: 7px;
  font-style: normal;
  font-weight: 800;
}

.route-node.edge-node,
.route-node.did-node,
.route-node.decision-node,
.route-node.action-node,
.route-node.voicemail-node {
  border-left-color: var(--teal);
}

.route-node.edge-node .node-icon,
.route-node.did-node .node-icon,
.route-node.decision-node .node-icon,
.route-node.action-node .node-icon,
.route-node.voicemail-node .node-icon {
  background: var(--teal-soft);
  color: var(--teal);
}

.route-node.ai-node,
.route-node.transfer-node {
  border-left-color: var(--magenta);
}

.route-node.ai-node .node-icon,
.route-node.transfer-node .node-icon {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.route-arrow {
  display: grid;
  min-width: 54px;
  flex: 0 0 54px;
  justify-items: center;
  gap: 3px;
  color: #8a989e;
}

.route-arrow small {
  color: var(--muted);
  font-size: 7px;
  white-space: nowrap;
}

.route-branches {
  display: grid;
  min-width: 900px;
  gap: 14px;
  padding: 12px 20px 45px;
}

.branch-lane {
  display: grid;
  grid-template-columns: 170px 50px minmax(260px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.86);
}

.branch-label {
  display: grid;
  gap: 3px;
  padding-left: 9px;
  border-left: 3px solid var(--green);
}

.branch-label.closed {
  border-left-color: var(--magenta);
}

.branch-label span {
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
}

.branch-label small {
  color: var(--muted);
  font-size: 8px;
}

.branch-line {
  height: 1px;
  background: var(--line-strong);
}

.route-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.route-meta-grid div {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border-right: 1px solid var(--line);
}

.route-meta-grid div:last-child {
  border-right: 0;
}

.route-meta-grid span,
.route-meta-grid small {
  color: var(--muted);
  font-size: 8px;
}

.route-meta-grid strong {
  font-size: 10px;
}

.direction-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 750;
}

.direction-label svg {
  width: 12px;
  height: 12px;
}

.direction-label.inbound {
  color: var(--green);
}

.direction-label.outbound {
  color: var(--blue);
}

.independence-banner {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #c9dedc;
  border-radius: 8px;
  background: var(--teal-soft);
}

.banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--teal);
}

.independence-banner strong {
  display: block;
  color: #145c5a;
  font-size: 11px;
}

.independence-banner p {
  margin: 3px 0 0;
  color: #4b7473;
  font-size: 9px;
  line-height: 1.45;
}

.device-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
}

.device-icon svg {
  width: 15px;
  height: 15px;
}

.agent-workspace {
  display: grid;
  grid-template-columns: 250px minmax(560px, 1fr) 240px;
  gap: 14px;
  align-items: start;
}

.agent-list {
  overflow: hidden;
}

.agent-list-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.agent-list-header strong {
  font-size: 12px;
}

.agent-row {
  display: grid;
  min-height: 64px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  text-align: left;
}

.agent-row:last-child {
  border-bottom: 0;
}

.agent-row:hover {
  background: var(--surface-subtle);
}

.agent-row.active {
  background: #edf7f6;
  box-shadow: inset 3px 0 0 var(--teal);
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--magenta-soft);
  color: var(--magenta);
}

.agent-avatar.teal {
  background: var(--teal-soft);
  color: var(--teal);
}

.agent-avatar.coral {
  background: var(--coral-soft);
  color: var(--coral);
}

.agent-avatar.green {
  background: var(--green-soft);
  color: var(--green);
}

.agent-avatar svg {
  width: 15px;
  height: 15px;
}

.agent-row > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.agent-row strong,
.agent-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-row strong {
  font-size: 9px;
}

.agent-row small {
  color: var(--muted);
  font-size: 8px;
}

.agent-editor {
  min-width: 0;
  overflow: hidden;
}

.agent-editor-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.agent-editor-header > div:first-child {
  display: grid;
  gap: 3px;
}

.agent-editor-header > div:first-child > span:last-child {
  color: var(--muted);
  font-size: 8px;
}

.agent-editor-header > div:last-child {
  gap: 6px;
}

.editor-tabs {
  display: flex;
  gap: 1px;
  overflow-x: auto;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.editor-tabs button {
  min-height: 41px;
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.editor-tabs button.active {
  border-bottom-color: var(--teal);
  color: var(--teal);
}

.agent-form {
  display: grid;
}

.form-section {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 22px;
  padding: 20px 17px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.form-section-heading > span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 8px;
  font-weight: 850;
}

.form-section-heading h3 {
  margin: 1px 0 4px;
  font-size: 10px;
}

.form-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.agent-form label {
  display: grid;
  gap: 6px;
}

.agent-form label > span {
  color: #46545b;
  font-size: 9px;
  font-weight: 750;
}

.agent-form input,
.agent-form select,
.agent-form textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: 0;
  background: #ffffff;
  font-size: 10px;
}

.agent-form textarea {
  resize: vertical;
  line-height: 1.55;
}

.agent-form .instruction-box {
  min-height: 225px;
  padding: 12px;
  background: #fcfdfd;
  font-family: inherit;
}

.agent-form label small {
  color: var(--muted);
  font-size: 8px;
}

.full-field {
  grid-column: 1 / -1;
}

.form-section > .full-field {
  grid-column: auto;
}

.runtime-grid {
  grid-column: 2;
}

.input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.input-unit input {
  border-radius: 5px 0 0 5px;
}

.input-unit span {
  display: grid;
  min-width: 44px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 5px 5px 0;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 8px;
}

.integration-selection {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 13px;
}

.integration-selection button {
  display: grid;
  min-height: 59px;
  grid-template-columns: 29px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  text-align: left;
}

.integration-selection button:hover {
  border-color: var(--teal);
  background: #ffffff;
}

.tool-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: #ffffff;
  color: var(--teal);
}

.tool-icon svg {
  width: 13px;
  height: 13px;
}

.integration-selection button > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.integration-selection strong {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-selection small {
  color: var(--muted);
  font-size: 7px;
}

.integration-selection button > svg {
  width: 14px;
  height: 14px;
  color: var(--green);
}

.agent-inspector {
  overflow: hidden;
}

.inspector-section {
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.inspector-section:last-child {
  border-bottom: 0;
}

.inspector-section h3 {
  margin: 4px 0 12px;
  font-size: 11px;
}

.inspector-section dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.inspector-section dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.inspector-section dt {
  color: var(--muted);
  font-size: 8px;
}

.inspector-section dd {
  margin: 0;
  font-size: 8px;
  font-weight: 750;
  text-align: right;
}

.test-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.test-score strong {
  font-size: 20px;
}

.test-score span,
.inspector-section > small {
  color: var(--muted);
  font-size: 8px;
}

.score-bar {
  height: 5px;
  margin: 8px 0;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line);
}

.score-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.usage-meter {
  display: block;
  width: 90px;
  height: 4px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.usage-meter i {
  display: block;
  height: 100%;
  background: var(--teal);
}

.usage-meter.warning i {
  background: var(--amber);
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.integration-card {
  display: grid;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.integration-card-header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.integration-logo {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.integration-logo.pbx {
  background: var(--teal-soft);
  color: var(--teal);
}

.integration-logo.iristel {
  background: var(--blue-soft);
  color: var(--blue);
}

.integration-logo.quickbooks {
  background: var(--green-soft);
  color: var(--green);
}

.integration-logo.openai {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.integration-logo.sim {
  background: var(--amber-soft);
  color: var(--amber);
}

.integration-card h2 {
  margin: 0;
  font-size: 12px;
}

.integration-card-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 8px;
}

.integration-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 16px 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.integration-card dl div {
  display: grid;
  gap: 3px;
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.integration-card dl div:nth-child(2n) {
  border-right: 0;
}

.integration-card dl div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.integration-card dt {
  color: var(--muted);
  font-size: 8px;
}

.integration-card dd {
  margin: 0;
  font-size: 9px;
  font-weight: 750;
}

.blocked-text {
  color: var(--red);
}

.integration-warning,
.integration-note {
  display: grid;
  min-height: 66px;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 13px;
  padding: 9px;
  border: 1px solid #efcfd3;
  border-radius: 6px;
  background: var(--red-soft);
  color: #7b363c;
  font-size: 8px;
  line-height: 1.45;
}

.integration-note {
  border-color: #d7e2e5;
  background: var(--surface-subtle);
  color: var(--muted);
}

.integration-warning svg,
.integration-note svg {
  width: 15px;
  height: 15px;
}

.security-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1.5fr) minmax(300px, 0.7fr);
  gap: 18px;
}

.posture-score {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.posture-score > div:first-child {
  display: flex;
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  align-items: baseline;
  justify-content: center;
  padding-top: 23px;
  border: 8px solid #d9efea;
  border-top-color: var(--teal);
  border-right-color: var(--teal);
  border-radius: 50%;
}

.posture-score > div:first-child strong {
  font-size: 24px;
}

.posture-score > div:first-child span {
  color: var(--muted);
  font-size: 8px;
}

.posture-score > div:last-child p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.control-list {
  display: grid;
}

.control-list > div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 65px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.control-list > div:last-child {
  border-bottom: 0;
}

.control-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.control-icon.pass {
  background: var(--green-soft);
  color: var(--green);
}

.control-icon.pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.control-icon svg {
  width: 13px;
  height: 13px;
}

.control-list strong {
  font-size: 10px;
}

.control-list p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 8px;
}

.control-list > div > span:last-child {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
}

.role-list {
  display: grid;
}

.role-list > div {
  display: grid;
  min-height: 66px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
}

.role-list > div:last-child {
  border-bottom: 0;
}

.role-list > div > div {
  display: grid;
  gap: 3px;
}

.role-list strong {
  font-size: 9px;
}

.role-list small,
.role-list > div > span:last-child {
  color: var(--muted);
  font-size: 8px;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 101;
  width: min(440px, calc(100vw - 24px));
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -18px 0 45px rgba(18, 31, 38, 0.18);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(17, 27, 33, 0.38);
}

body.drawer-open .drawer-scrim {
  display: block;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  min-height: 73px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.drawer-header h2 {
  margin: 3px 0 0;
  font-size: 15px;
}

.drawer-content {
  display: grid;
}

.drawer-content > p {
  margin: 0;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  color: #3d4c53;
  font-size: 10px;
  line-height: 1.5;
}

.drawer-content > p:first-child {
  padding-top: 16px;
  color: var(--ink-strong);
  font-weight: 750;
}

.drawer-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.drawer-hero .entity-avatar {
  width: 44px;
  height: 44px;
  font-size: 12px;
}

.drawer-hero div {
  display: grid;
  gap: 3px;
}

.drawer-hero strong {
  font-size: 14px;
}

.drawer-hero span {
  color: var(--muted);
  font-size: 9px;
}

.drawer-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-section h3 {
  margin: 0 0 11px;
  font-size: 11px;
}

.drawer-section dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.drawer-section dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.drawer-section dt {
  color: var(--muted);
  font-size: 9px;
}

.drawer-section dd {
  margin: 0;
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
  text-align: right;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  padding: 16px 18px;
}

.drawer-actions button {
  flex: 1;
}

.sync-dialog {
  width: min(620px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.sync-dialog::backdrop {
  background: rgba(17, 27, 33, 0.45);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 17px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 3px 0 4px;
  font-size: 16px;
}

.dialog-header p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.sync-source-list {
  display: grid;
  padding: 10px;
}

.sync-source-list > button {
  display: grid;
  min-height: 65px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.sync-source-list > button:hover {
  border-color: var(--line);
  background: var(--surface-subtle);
}

.sync-source-list > button.blocked {
  cursor: not-allowed;
  background: #fcf8f8;
}

.sync-source-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
}

.sync-source-list button.blocked .sync-source-icon {
  background: var(--red-soft);
  color: var(--red);
}

.sync-source-list > button > span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.sync-source-list strong {
  font-size: 10px;
}

.sync-source-list small {
  color: var(--muted);
  font-size: 8px;
}

.sync-dialog-result {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 54px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.sync-dialog-result svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--teal);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  animation: toast-in 160ms ease-out;
}

.toast > span:first-child {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}

.toast > span:first-child svg {
  width: 13px;
  height: 13px;
}

.toast div {
  display: grid;
  gap: 2px;
}

.toast strong {
  font-size: 10px;
}

.toast small {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.toast button {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.toast button:hover {
  background: var(--surface-subtle);
}

.toast button svg {
  width: 13px;
  height: 13px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.carrier-lock-banner {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #b8d8cf;
  border-left: 4px solid #13795b;
  background: #f3fbf8;
}

.carrier-lock-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #13795b;
  background: #dff4ec;
}

.carrier-lock-icon svg {
  width: 19px;
}

.carrier-lock-banner div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.carrier-lock-banner div span {
  color: var(--muted);
  font-size: 12px;
}

.carrier-metrics .metric-card > strong {
  font-size: 22px;
}

.carrier-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 284px;
  gap: 18px;
  margin-bottom: 18px;
}

.carrier-console,
.carrier-controls,
.carrier-queue {
  overflow: hidden;
}

.carrier-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.carrier-tabs button {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.carrier-tabs button:last-child {
  border-right: 0;
}

.carrier-tabs button.active {
  box-shadow: inset 0 -3px 0 #1769aa;
  color: #0f4f82;
  background: #fff;
}

.carrier-tabs svg {
  width: 16px;
}

.carrier-panel {
  min-height: 436px;
}

.carrier-panel[hidden] {
  display: none;
}

.carrier-panel .surface-header {
  padding: 20px 22px 16px;
}

.carrier-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 0 22px 22px;
}

.carrier-form label,
.portability-check label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.carrier-form label > span,
.portability-check label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.carrier-form input,
.carrier-form select,
.portability-check input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.carrier-form-wide,
.carrier-form-actions {
  grid-column: 1 / -1;
}

.carrier-form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-top: 4px;
}

.carrier-form-actions > span {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.carrier-form-actions > span svg {
  width: 14px;
}

.portability-check {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(150px, 0.7fr);
  gap: 12px;
  align-items: end;
  margin: 0 22px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.portability-check output {
  display: flex;
  min-height: 38px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.carrier-controls {
  align-self: stretch;
}

.carrier-controls .inspector-section {
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.carrier-controls .inspector-section:last-child {
  border-bottom: 0;
}

.carrier-controls .inspector-section p:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.carrier-queue table {
  min-width: 760px;
}

@media (max-width: 1360px) {
  .topbar {
    grid-template-columns: minmax(160px, 0.7fr) minmax(240px, 1fr) auto;
    gap: 14px;
    padding: 0 20px;
  }

  .environment-picker {
    display: none;
  }

  .profile-copy {
    display: none;
  }

  .workspace-view {
    padding: 24px 20px;
  }

  .preview-notice {
    margin-right: 20px;
    margin-left: 20px;
  }

  .agent-workspace {
    grid-template-columns: 230px minmax(500px, 1fr);
  }

  .agent-inspector {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  .inspector-section {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .inspector-section:last-child {
    border-right: 0;
  }
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-layout,
  .security-layout {
    grid-template-columns: 1fr;
  }

  .integration-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trace-layout {
    grid-template-columns: 1fr;
  }

  .trace-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trace-row:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .route-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .route-status {
    grid-column: 1 / -1;
    justify-items: start;
    padding: 8px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .billing-summary-strip,
  .route-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .billing-summary-strip div:nth-child(2),
  .route-meta-grid div:nth-child(2) {
    border-right: 0;
  }

  .billing-summary-strip div:nth-child(-n + 2),
  .route-meta-grid div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 224px;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 45px rgba(18, 31, 38, 0.22);
  }

  body.sidebar-open::after {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(17, 27, 33, 0.4);
    content: "";
  }

  .main-column {
    margin-left: 0;
  }

  .topbar {
    grid-template-columns: auto minmax(200px, 1fr) auto;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .page-identity {
    display: none;
  }

  .topbar-actions .secondary-button span {
    display: none;
  }

  .topbar-actions .secondary-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .profile-button {
    display: none;
  }

  .agent-workspace {
    grid-template-columns: 210px minmax(480px, 1fr);
    overflow-x: auto;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 58px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 10px;
  }

  .topbar-actions {
    gap: 3px;
  }

  .global-search {
    min-height: 36px;
  }

  .global-search kbd,
  .topbar-actions > .icon-button {
    display: none;
  }

  .preview-notice {
    align-items: flex-start;
    margin: 12px 12px 0;
    padding: 10px;
  }

  .workspace-view {
    padding: 20px 12px;
  }

  .view-heading {
    display: grid;
    gap: 15px;
    margin-bottom: 18px;
  }

  .view-heading h1 {
    font-size: 22px;
  }

  .heading-actions {
    justify-content: flex-start;
  }

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

  .metric-card {
    min-height: 136px;
  }

  .service-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .service-measure {
    display: none;
  }

  .surface-header,
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .surface-header {
    min-height: 0;
  }

  .header-actions,
  .toolbar-group {
    justify-content: flex-start;
  }

  .billing-summary-strip,
  .route-meta-grid {
    grid-template-columns: 1fr;
  }

  .billing-summary-strip div,
  .billing-summary-strip div:nth-child(2),
  .route-meta-grid div,
  .route-meta-grid div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .billing-summary-strip div:last-child,
  .route-meta-grid div:last-child {
    border-bottom: 0;
  }

  .run-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .run-progress {
    justify-content: flex-start;
  }

  .run-line {
    width: 32px;
  }

  .trace-list {
    grid-template-columns: 1fr;
  }

  .trace-row:nth-child(odd) {
    border-right: 0;
  }

  .trace-row {
    grid-template-columns: 30px minmax(120px, 1fr) auto;
  }

  .trace-row > span:nth-child(3),
  .trace-row > time {
    display: none;
  }

  .trace-facts,
  .trace-costs {
    grid-template-columns: repeat(2, 1fr);
  }

  .trace-facts div:nth-child(2),
  .trace-costs div:nth-child(2) {
    border-right: 0;
  }

  .trace-facts div:nth-child(-n + 2),
  .trace-costs div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .route-toolbar {
    grid-template-columns: 1fr;
  }

  .route-status {
    grid-column: auto;
  }

  .independence-banner {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .independence-banner > .state-pill {
    grid-column: 1 / -1;
  }

  .agent-workspace {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .agent-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-list-header {
    grid-column: 1 / -1;
  }

  .agent-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .agent-row .state-pill {
    display: none;
  }

  .agent-editor-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .form-grid,
  .runtime-grid {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .integration-selection {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .agent-inspector {
    grid-template-columns: 1fr;
  }

  .inspector-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .security-layout {
    grid-template-columns: 1fr;
  }

  .carrier-workspace {
    grid-template-columns: 1fr;
  }

  .carrier-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .carrier-controls .inspector-section {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .carrier-controls .inspector-section:last-child {
    border-right: 0;
  }

  .posture-score {
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .topbar-actions .secondary-button {
    display: none;
  }

  .global-search input::placeholder {
    color: transparent;
  }

  .heading-actions,
  .heading-actions .primary-button,
  .heading-actions .secondary-button {
    width: 100%;
  }

  .agent-list {
    grid-template-columns: 1fr;
  }

  .trace-facts,
  .trace-costs {
    grid-template-columns: 1fr;
  }

  .trace-facts div,
  .trace-facts div:nth-child(2),
  .trace-costs div,
  .trace-costs div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .trace-facts div:last-child,
  .trace-costs div:last-child {
    border-bottom: 0;
  }

  .posture-score {
    display: grid;
  }

  .carrier-tabs {
    grid-template-columns: 1fr;
  }

  .carrier-tabs button {
    justify-content: flex-start;
    min-height: 42px;
    padding: 0 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .carrier-tabs button.active {
    box-shadow: inset 3px 0 0 #1769aa;
  }

  .carrier-form,
  .portability-check,
  .carrier-controls {
    grid-template-columns: 1fr;
  }

  .carrier-form-wide,
  .carrier-form-actions {
    grid-column: auto;
  }

  .carrier-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .carrier-form-actions button {
    width: 100%;
  }

  .carrier-lock-banner {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .carrier-lock-banner > .state-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .carrier-controls .inspector-section {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Production data workspace */
.production-shell {
  min-height: 100vh;
}

.production-shell .main-content {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.brand-block {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block img {
  width: 105px;
  max-height: 32px;
  object-fit: contain;
}

.brand-block > div {
  display: grid;
  gap: 1px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.brand-block strong {
  color: #fff;
  font-size: 11px;
}

.brand-block span {
  color: #8fa4ad;
  font-size: 9px;
  text-transform: uppercase;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px;
  padding: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-status > div {
  display: grid;
  gap: 2px;
}

.sidebar-status strong {
  color: #dce6ea;
  font-size: 11px;
}

.sidebar-status small {
  color: #82969f;
  font-size: 9px;
}

.source-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #39b978;
  box-shadow: 0 0 0 4px rgba(57, 185, 120, 0.12);
}

.source-dot.warning {
  background: #d59128;
  box-shadow: 0 0 0 4px rgba(213, 145, 40, 0.12);
}

.production-shell .topbar {
  grid-template-columns: auto minmax(150px, 0.7fr) minmax(240px, 1fr) auto auto;
}

.environment-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.workspace {
  min-width: 0;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.button.primary {
  border-color: var(--teal-dark);
  background: var(--teal);
  color: #fff;
}

.button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: #35444c;
}

.button.small {
  min-height: 32px;
  padding: 6px 9px;
}

.metric-card > span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.metric-card > small {
  color: var(--muted);
  font-size: 9px;
}

.content-grid {
  display: grid;
  gap: 16px;
}

.content-grid.two-column {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}

.data-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-heading,
.section-heading {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.section-heading h3 {
  margin: 2px 0 0;
  font-size: 14px;
}

.source-list {
  display: grid;
}

.source-row {
  display: grid;
  min-height: 62px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
}

.source-row:last-child {
  border-bottom: 0;
}

.source-row > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.source-row small {
  color: var(--muted);
  font-size: 9px;
}

.source-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--teal);
}

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.cms-workflow-block {
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 14px;
}

.cms-workflow-form {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.cms-workflow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cms-workflow-form .full-field {
  grid-column: 1 / -1;
}

.cms-workflow-form label {
  display: grid;
  gap: 5px;
}

.cms-workflow-form .toggle-row {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.cms-workflow-form .toggle-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--teal);
}

.cms-workflow-form .form-actions {
  padding: 0;
  border-top: 0;
}

.cms-workflow-form input,
.cms-workflow-form select,
.cms-workflow-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  min-height: 38px;
  padding: 8px 10px;
}

.cms-workflow-form textarea {
  min-height: 84px;
  resize: vertical;
}

.cms-workflow-form label > span,
.cms-workflow-form .security-readout span,
.cms-summary,
.security-readout {
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  color: var(--muted);
}

.cms-result {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
}

.cms-summary {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.security-readout {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px;
}

.security-readout strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
}

.alert-list,
.api-key-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.alert-item,
.api-key-row {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.alert-item.warning {
  border-left-color: var(--amber);
}

.alert-item.critical,
.alert-item.error {
  border-left-color: var(--red);
}

.alert-item span,
.api-key-row span,
.alert-item small {
  color: var(--muted);
}

.table-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font: inherit;
  cursor: pointer;
}

.table-link:hover {
  text-decoration: underline;
}

.row-result {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.assignment-select {
  width: 100%;
  min-width: 180px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.did-assignment-select {
  min-width: 250px;
}

.assignment-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 20px;
}

.icon-button.danger {
  color: var(--red);
}

.cms-list {
  padding: 0 12px 12px;
  display: grid;
  gap: 8px;
}

.modal-dialog-header,
.data-actions,
.cms-workflow-filter {
  padding: 12px;
}

.modal-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.data-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.admin-only {
  position: relative;
}

.role-hidden {
  display: none !important;
}

.table-search {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  width: min(320px, 100%);
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.table-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.empty-table-cell {
  padding: 30px 18px !important;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 32px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.empty-state svg {
  width: 30px;
  height: 30px;
  color: var(--muted-2);
}

.empty-state span {
  max-width: 580px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.route-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.route-toolbar label {
  display: grid;
  gap: 5px;
  width: min(480px, 100%);
}

.route-toolbar label span,
.form-grid label > span,
.transfer-builder label > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.route-toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.transfer-builder input,
.transfer-builder select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.route-toolbar select,
.form-grid input,
.form-grid select,
.transfer-builder input,
.transfer-builder select {
  min-height: 38px;
  padding: 7px 9px;
}

.form-grid textarea {
  resize: vertical;
  padding: 9px;
  line-height: 1.55;
}

.production-route {
  display: flex;
  min-height: 190px;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f4;
}

.production-route.empty-route {
  justify-content: center;
  color: var(--muted);
}

.production-route-node {
  display: grid;
  min-width: 190px;
  min-height: 92px;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-content: center;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.production-route-node.route-type-carrier {
  border-left-color: var(--teal);
}

.production-route-node.route-type-dialplan_application {
  border-left-color: var(--magenta);
}

.production-route-node span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.production-route-node small,
.production-route-node em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.production-route-node em {
  grid-column: 2;
}

.route-sequence {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.route-arrow {
  display: grid;
  flex: 0 0 78px;
  place-items: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}

.route-arrow span {
  font-size: 8px;
}

.production-agent-layout {
  display: grid;
  grid-template-columns: minmax(250px, 0.34fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.agent-list {
  display: grid;
}

.agent-list-row {
  display: grid;
  min-height: 66px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
}

.agent-list-row:hover,
.agent-list-row.active {
  background: var(--teal-soft);
}

.agent-list-row > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.agent-list-row small {
  color: var(--muted);
  font-size: 9px;
}

.agent-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 7px;
  background: #e8f0f6;
  color: var(--blue);
}

.agent-editor {
  overflow: visible;
}

.agent-policy-notice {
  grid-column: 1 / -1;
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(190, 131, 31, 0.42);
  border-radius: 6px;
  background: var(--amber-soft);
  color: #8a640c;
  font-size: 11px;
  line-height: 1.35;
}

.agent-lock-badge {
  grid-column: 1 / -1;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.agent-lock-badge label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.agent-lock-badge input[type="checkbox"] {
  accent-color: var(--teal);
}

.agent-ivr-section {
  margin-top: 4px;
  padding: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.agent-ivr-section > .section-heading {
  margin: 0;
  padding: 12px 14px;
  border-top: 0;
}

.agent-ivr-section > .section-heading p {
  max-width: 680px;
}

.agent-ivr-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 12px;
  padding: 8px 10px;
  border: 1px solid rgba(190, 131, 31, 0.42);
  border-radius: 6px;
  background: var(--amber-soft);
  color: #8a640c;
  font-size: 10px;
}

.agent-ivr-lock strong {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agent-ivr-settings {
  padding: 0 14px 12px;
}

.agent-ivr-option-heading {
  margin: 0 14px 12px !important;
  padding: 12px 0 0 !important;
}

.ivr-option-builder {
  grid-template-columns: 120px minmax(150px, 1fr) 90px minmax(170px, 1fr);
  margin: 0 14px 10px;
}

.ivr-option-row small {
  line-height: 1.35;
}


.agent-field-help {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.agent-support-template-bar {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-subtle);
}

.agent-support-template-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.agent-support-template-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 16px;
}

.form-grid label {
  display: grid;
  gap: 5px;
}

.form-grid .full-field {
  grid-column: 1 / -1;
}

.editor-section {
  padding: 0 16px 16px;
}

.editor-section .section-heading {
  margin: 0 -16px 12px;
  border-top: 1px solid var(--line);
}

.transfer-builder {
  display: grid;
  grid-template-columns: 150px minmax(150px, 1fr) minmax(120px, 0.7fr);
  gap: 10px;
  margin-bottom: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
}

.transfer-builder label {
  display: grid;
  gap: 5px;
}

.outbound-builder {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.outbound-builder label:last-child {
  grid-column: 1 / -1;
}

.compact-form-grid {
  padding: 0 0 10px;
}

.agent-ability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
}

.agent-ability-grid .agent-ability-option,
.agent-ability-grid .agent-ability-limit {
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.agent-ability-grid .agent-ability-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.agent-ability-grid .agent-ability-option > span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: none;
}

.agent-ability-grid .agent-ability-option input[type="checkbox"] {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--teal);
}

.agent-ability-grid .agent-ability-option.is-locked {
  cursor: default;
}

.agent-ability-grid .agent-ability-limit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agent-ability-grid .agent-ability-limit > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.agent-ability-grid input[type="number"] {
  flex: 0 0 72px;
  width: 72px;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-raised);
  color: var(--ink);
  font-weight: 750;
}

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

.transfer-target-row {
  display: grid;
  min-height: 50px;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.transfer-target-row > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.transfer-target-row small {
  color: var(--muted);
}

.target-type {
  color: var(--blue);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.compact-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.compact-empty span {
  font-size: 10px;
}

.compact-empty.horizontal {
  min-height: 52px;
  grid-template-columns: auto auto;
}

.fact-list,
.security-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
}

.fact-list > div,
.security-facts > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-right: 0;
}

.fact-list > div:last-child,
.security-facts > div:last-child {
  border-right: 1px solid var(--line);
}

.fact-list dt,
.security-facts dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.fact-list dd,
.security-facts dd {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
}

.security-facts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
}

.toast-region .toast {
  display: flex;
  min-width: min(340px, calc(100vw - 36px));
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid #b7d7d4;
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.toast-region .toast.warning {
  border-color: #e3c48d;
}

.is-loading svg {
  animation: production-spin 0.8s linear infinite;
}

@keyframes production-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
  .content-grid.two-column,
  .production-agent-layout {
    grid-template-columns: 1fr;
  }

  .production-shell .topbar {
    grid-template-columns: auto minmax(120px, 0.7fr) minmax(180px, 1fr) auto;
  }

  .production-shell .environment-state {
    display: none;
  }

  .transfer-builder {
    grid-template-columns: 1fr 1fr;
  }

}

@media (max-width: 900px) {
  .production-shell .main-content {
    margin-left: 0;
  }

  .production-shell .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0 14px;
  }

  .production-shell .global-search {
    display: none;
  }

  .outbound-builder {
    grid-template-columns: 1fr;
  }

  .outbound-builder label:last-child {
    grid-column: auto;
  }

  .topbar-controls {
    min-width: 0;
    justify-content: flex-end;
  }

  #identityName,
  #identityRole {
    display: none;
  }

  #customerPicker {
    order: 1;
  }

  .topbar-controls .button {
    min-height: 34px;
  }

  .topbar-actions,
  .topbar-controls {
    max-width: 100%;
  }

  .production-shell .mobile-menu {
    display: inline-grid;
  }

  .production-shell .sidebar {
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }

  body.sidebar-open .production-shell .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 45;
    inset: 0;
    display: none;
    background: rgba(11, 20, 25, 0.44);
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
  }
}

@media (max-width: 720px) {
  .workspace-view {
    padding: 18px 14px;
  }

  .view-heading {
    min-height: 0;
    flex-direction: column;
    gap: 12px;
  }

  .heading-actions {
    width: 100%;
    justify-content: stretch;
  }

  .heading-actions .button {
    flex: 1;
  }

  .metric-grid,
  .form-grid,
  .transfer-builder,
  .fact-list,
  .security-facts {
    grid-template-columns: 1fr;
  }

  .agent-ability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 112px;
  }

  .form-grid .full-field {
    grid-column: auto;
  }

  .agent-support-template-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .fact-list > div,
  .security-facts > div {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .fact-list > div:last-child,
  .security-facts > div:last-child {
    border-bottom: 1px solid var(--line);
  }

  .route-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .production-route {
    align-items: stretch;
    flex-direction: column;
  }

  .production-route-node {
    min-width: 100%;
  }

  .route-arrow {
    min-height: 54px;
    transform: rotate(90deg);
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .cms-workflow-grid {
    grid-template-columns: 1fr;
  }

  .cms-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .table-toolbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .agent-ability-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: auto auto auto;
    gap: 8px;
  }

  .topbar-controls {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
  }

  #customerSelect {
    min-width: 120px;
  }

  .topbar .global-search {
    display: none;
  }

  .view-heading .heading-actions .button {
    width: 100%;
  }

  .cms-workflow-filter .table-search {
    width: 100%;
  }

  .modal-dialog-header,
  .cms-workflow-form,
  .cms-workflow-block {
    min-width: 0;
  }

  dialog {
    width: min(92vw, 390px) !important;
    margin: 0;
  }
}

#softphoneDialog {
  width: min(460px, calc(100vw - 2rem));
  max-height: min(850px, calc(100vh - 2rem));
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

#numberDialog,
#sendDialog {
  border: 1px solid var(--line);
  width: min(540px, calc(100vw - 2rem));
  padding: 0;
  border-radius: 8px;
  background: #fff;
}

#numberDialog {
  max-height: min(820px, calc(100vh - 2rem));
  overflow: hidden;
}

#numberDialog .modal-dialog-header {
  min-height: 58px;
  padding: 11px 14px;
}

#numberDialog .modal-dialog-header h3 {
  margin: 0;
  font-size: 15px;
}

#numberRoutingForm {
  max-height: calc(100vh - 92px);
  gap: 0;
  padding: 0;
  overflow-y: auto;
}

.routing-config-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.routing-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.routing-section-heading h4 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 12px;
}

.routing-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.routing-toggle-grid .toggle-row {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.routing-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.routing-dialog-footer {
  position: sticky;
  z-index: 2;
  bottom: 0;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
}

.routing-dialog-footer .cms-result {
  min-height: 0;
}

.observed-customer-row td {
  background: var(--surface-subtle);
}

.observed-customer-row td:first-child {
  box-shadow: inset 3px 0 0 var(--amber);
}

#numberDialog::backdrop,
#sendDialog::backdrop {
  background: rgba(16, 29, 36, 0.62);
}

#softphoneDialog::backdrop {
  background: rgba(1, 6, 10, 0.78);
  backdrop-filter: blur(3px);
}

.softphone-assignment-panel {
  margin-bottom: 1rem;
}

.softphone-assignment-panel .field-help {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.softphone-assignment-panel .cms-result {
  margin-right: auto;
}

.softphone-dialog-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.softphone-header-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
}

.softphone-header-main > div {
  display: grid;
  gap: 1px;
}

.softphone-header-main h3 {
  margin: 0;
  font-size: 15px;
}

.softphone-header-main small {
  color: var(--muted);
  font-size: 9px;
}

.softphone-brand-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--teal-soft);
  color: var(--teal);
}

.softphone-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.softphone-icon-button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink);
}

.softphone-icon-button:hover,
.softphone-icon-button[aria-expanded="true"] {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.softphone-status-strip {
  display: grid;
  gap: 6px;
  margin: 12px 16px 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-subtle);
}

.softphone-identity {
  display: flex;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.softphone-identity > span:first-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.softphone-identity small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#softphoneCallerIdentity {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#softphoneStatusText {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

#softphoneRemoteAudio,
#softphoneSpeakerTestAudio {
  display: none;
}

.softphone-call-panel {
  display: grid;
  gap: 8px;
  padding: 4px 16px 10px;
}

.softphone-destination {
  display: grid;
  gap: 5px;
}

.softphone-destination > span,
.softphone-transfer > span,
.softphone-device-field > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.softphone-destination > small {
  color: var(--muted-2);
  font-size: 8px;
}

.softphone-destination-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  gap: 5px;
}

.softphone-destination-input input,
.softphone-transfer input,
.softphone-device-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
}

.softphone-destination-input input,
.softphone-transfer input {
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 650;
}

.softphone-inline-button {
  display: grid;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--muted);
}

.softphone-inline-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.softphone-quick-dials {
  display: flex;
  min-height: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.softphone-quick-dials:empty {
  display: none;
}

.softphone-quick-dials button {
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.softphone-primary-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.75fr);
  gap: 7px;
}

.softphone-call-button,
.softphone-hangup-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 750;
}

.softphone-call-button {
  border: 1px solid rgba(34, 199, 216, 0.42);
  background: var(--teal);
  color: #031014;
}

.softphone-hangup-button {
  border: 1px solid rgba(239, 61, 90, 0.38);
  background: rgba(239, 61, 90, 0.12);
  color: #ff7188;
}

.softphone-call-button:disabled,
.softphone-hangup-button:disabled,
.softphone-tool-button:disabled,
.softphone-inline-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.softphone-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 16px 10px;
}

.softphone-key {
  display: grid;
  min-height: 48px;
  place-content: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--ink);
}

.softphone-key strong {
  font-size: 17px;
  line-height: 1;
}

.softphone-key small {
  min-height: 8px;
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.softphone-key:hover,
.softphone-key:active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.softphone-call-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 16px 10px;
}

.softphone-tool-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.softphone-tool-button.active,
.softphone-tool-button:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.softphone-transfer {
  display: grid;
  gap: 5px;
  padding: 0 16px 16px;
}

.softphone-transfer > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.softphone-audio-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 16px 12px;
  padding: 12px;
  border: 1px solid var(--teal);
  border-radius: 10px;
  background: color-mix(in srgb, var(--teal-soft) 68%, var(--surface));
}

.softphone-settings-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.softphone-settings-heading > div {
  display: grid;
  gap: 1px;
}

.softphone-settings-heading strong {
  font-size: 11px;
}

.softphone-settings-heading small,
#softphoneAudioPermission {
  color: var(--muted);
  font-size: 8px;
}

.softphone-device-field,
.softphone-level-control {
  display: grid;
  align-content: start;
  gap: 5px;
}

.softphone-device-field select {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 9px;
}

.softphone-level-control > span:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 8px;
}

.softphone-level-control input[type="range"] {
  width: 100%;
  min-height: 18px;
  accent-color: var(--teal);
}

.softphone-level-meter {
  height: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
}

.softphone-level-meter > i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #87e26b 72%, var(--amber));
  transition: width 80ms linear;
}

#softphoneTestSpeakerButton {
  grid-column: 1 / -1;
  justify-self: start;
}

.softphone-a11y-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* UVoIP theme and service navigation */
.topbar-icon-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group-toggle .nav-chevron {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.nav-group-toggle[aria-expanded="false"] .nav-chevron {
  transform: rotate(-90deg);
}

.nav-group.active > .nav-group-toggle {
  color: #f4f8fa;
}

.nav-submenu {
  display: grid;
  gap: 2px;
  padding: 1px 0 5px 30px;
}

.nav-subbutton {
  display: grid;
  min-height: 34px;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #9fb0b8;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
}

.nav-subbutton svg {
  width: 14px;
  height: 14px;
}

.nav-subbutton:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f4f8fa;
}

.nav-subbutton.active {
  border-color: rgba(34, 199, 216, 0.24);
  background: rgba(34, 199, 216, 0.12);
  color: #ffffff;
}

.nav-button.nav-external {
  text-decoration: none;
}

.nav-button.nav-external svg:last-child {
  width: 12px;
  margin-left: auto;
  opacity: 0.72;
}

.pbx-admin-panel {
  margin-bottom: 14px;
}

.pbx-admin-readout {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.pbx-admin-readout strong {
  color: var(--ink);
}

.pbx-admin-readout .source-dot {
  flex: 0 0 auto;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #071018;
  --surface: #101b27;
  --surface-subtle: #0d1722;
  --surface-raised: #142331;
  --ink: #f4fbfd;
  --ink-strong: #ffffff;
  --muted: #9fb2c2;
  --muted-2: #7f94a4;
  --line: rgba(150, 190, 210, 0.18);
  --line-strong: rgba(79, 216, 239, 0.34);
  --sidebar: #040b11;
  --sidebar-2: #101b27;
  --sidebar-text: #dce8ed;
  --teal: #22c7d8;
  --teal-dark: #1299aa;
  --teal-soft: rgba(34, 199, 216, 0.14);
  --blue: #63aaf2;
  --blue-soft: rgba(99, 170, 242, 0.14);
  --coral: #ff806f;
  --coral-soft: rgba(255, 128, 111, 0.14);
  --magenta: #ef3d9a;
  --magenta-soft: rgba(239, 61, 154, 0.14);
  --green: #40d46f;
  --green-soft: rgba(64, 212, 111, 0.14);
  --amber: #f4bd50;
  --amber-soft: rgba(244, 189, 80, 0.14);
  --red: #ff6480;
  --red-soft: rgba(255, 100, 128, 0.14);
  --violet: #b18cff;
  --violet-soft: rgba(177, 140, 255, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 18px 46px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--canvas);
}

html[data-theme="dark"] .sidebar {
  border-right-color: rgba(93, 228, 242, 0.16);
}

html[data-theme="dark"] .brand-block {
  border-bottom-color: rgba(93, 228, 242, 0.14);
}

html[data-theme="dark"] .brand-block > div {
  border-left-color: rgba(239, 61, 154, 0.55);
}

html[data-theme="dark"] .brand-block span,
html[data-theme="dark"] .nav-label {
  color: #8fa6b2;
}

html[data-theme="dark"] .nav-button.active,
html[data-theme="dark"] .nav-group.active > .nav-group-toggle {
  border-color: rgba(34, 199, 216, 0.2);
  background: rgba(34, 199, 216, 0.11);
}

html[data-theme="dark"] .nav-button.active::before {
  background: var(--teal);
}

html[data-theme="dark"] .topbar {
  border-bottom-color: var(--line);
  background: rgba(7, 16, 24, 0.96);
}

html[data-theme="dark"] :is(input, select, textarea) {
  color-scheme: dark;
}

html[data-theme="dark"] ::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

html[data-theme="dark"] :is(
  #customerSelect,
  .global-search kbd,
  .icon-button.bordered,
  .secondary-button,
  .button.secondary,
  .cms-workflow-form input,
  .cms-workflow-form select,
  .cms-workflow-form textarea,
  .route-toolbar select,
  .form-grid input,
  .form-grid select,
  .form-grid textarea,
  .transfer-builder input,
  .transfer-builder select,
  .agent-form input,
  .agent-form select,
  .agent-form textarea,
  .softphone-icon-button,
  .softphone-control-button
) {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
  color: var(--ink);
}

html[data-theme="dark"] :is(.icon-button, .profile-button):hover {
  background: var(--surface-raised);
  color: var(--ink);
}

html[data-theme="dark"] :is(.secondary-button, .button.secondary) {
  color: var(--ink);
}

html[data-theme="dark"] :is(.primary-button, .button.primary) {
  color: #041014;
}

html[data-theme="dark"] .notification-dot {
  border-color: var(--canvas);
}

html[data-theme="dark"] :is(.metric-card, .data-panel, .empty-state) {
  border-color: var(--line);
  background: var(--surface);
}

html[data-theme="dark"] :is(
  .production-route,
  .route-canvas
) {
  background-color: #0a141e;
}

html[data-theme="dark"] :is(
  .production-route-node,
  .route-node,
  .agent-list-row,
  .agent-row
) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

html[data-theme="dark"] :is(.agent-list-row:hover, .agent-list-row.active, .agent-row:hover, .agent-row.active) {
  background: var(--teal-soft);
}

html[data-theme="dark"] .agent-avatar {
  background: var(--blue-soft);
}

html[data-theme="dark"] :is(table, th, td) {
  border-color: var(--line);
}

html[data-theme="dark"] td {
  color: var(--ink);
}

html[data-theme="dark"] thead {
  background: var(--surface-subtle);
}

html[data-theme="dark"] tbody tr td {
  background: var(--surface);
}

html[data-theme="dark"] tbody tr:hover td,
html[data-theme="dark"] tbody tr:focus-within td {
  background: rgba(34, 199, 216, 0.06);
}

html[data-theme="dark"] .observed-customer-row td {
  background: var(--surface-subtle);
}

html[data-theme="dark"] .observed-customer-row:hover td {
  background: rgba(244, 189, 80, 0.09);
}

html[data-theme="dark"] :is(.trace-row, .agent-row, .agent-list-row) {
  background: var(--surface);
  color: var(--ink);
}

html[data-theme="dark"] :is(.trace-row:hover, .agent-row:hover, .agent-list-row:hover) {
  background: var(--surface-raised);
}

html[data-theme="dark"] :is(.trace-row.active, .agent-row.active, .agent-list-row.active) {
  background: var(--teal-soft);
  box-shadow: inset 3px 0 0 var(--teal);
}

html[data-theme="dark"] .carrier-tabs {
  background: var(--surface-subtle);
}

html[data-theme="dark"] .carrier-tabs button {
  color: var(--muted);
}

html[data-theme="dark"] .carrier-tabs button.active {
  background: var(--surface-raised);
  color: var(--teal);
  box-shadow: inset 0 -3px 0 var(--teal);
}

html[data-theme="dark"] .routing-dialog-footer {
  border-top-color: var(--line);
  background: var(--surface);
}

html[data-theme="dark"] .routing-toggle-grid .toggle-row {
  border-color: var(--line);
  background: var(--surface-subtle);
}

html[data-theme="dark"] :is(
  #numberDialog,
  #sendDialog,
  #softphoneDialog,
  .toast-region .toast
) {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

html[data-theme="dark"] :is(#numberDialog, #sendDialog, #softphoneDialog)::backdrop {
  background: rgba(1, 6, 10, 0.78);
}

html[data-theme="dark"] .route-drift-banner {
  border-color: rgba(244, 189, 80, 0.34);
  background: var(--amber-soft);
  color: var(--amber);
}

html[data-theme="dark"] .preview-notice {
  border-color: var(--line-strong);
  color: var(--teal);
}

html[data-theme="dark"] .agent-policy-notice {
  border-color: rgba(244, 189, 80, 0.44);
  background: #2d2816;
  color: #e6c98a;
}

html[data-theme="dark"] .data-badge.live-data {
  border-color: var(--line-strong);
  color: var(--teal);
}

html[data-theme="dark"] .data-badge.sample-data {
  border-color: rgba(244, 189, 80, 0.34);
  background: var(--amber-soft);
  color: var(--amber);
}

html[data-theme="dark"] .state-pill.muted {
  background: rgba(159, 178, 194, 0.12);
  color: var(--muted);
}

html[data-theme="dark"] .table-search {
  border-color: var(--line);
  background: var(--surface-subtle);
}

html[data-theme="dark"] .table-search select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

html[data-theme="dark"] .toast-region .toast.warning {
  border-color: rgba(244, 189, 80, 0.44);
}

@media (max-width: 640px) {
  #numberDialog,
  #sendDialog,
  #softphoneDialog {
    width: min(92vw, 420px);
    padding: 14px;
  }

  .softphone-identity {
    align-items: flex-start;
    flex-direction: column;
  }

  .softphone-header-actions .state-pill {
    display: none;
  }

  .softphone-audio-settings {
    grid-template-columns: minmax(0, 1fr);
  }

  .softphone-settings-heading,
  #softphoneTestSpeakerButton {
    grid-column: auto;
  }

  .routing-toggle-grid,
  .routing-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
