/*
 * Complex admin workspaces.
 * Loaded after admin.css. This layer is self-contained and does not depend on
 * the retired redesign-special.css file.
 */

:root {
  --rdc-surface: #101925;
  --rdc-surface-subtle: #0d1621;
  --rdc-surface-quiet: #131f2d;
  --rdc-line: #29394c;
  --rdc-divider: #202e3e;
  --rdc-text: #edf2f8;
  --rdc-text-secondary: #b3becc;
  --rdc-text-muted: #8492a6;
  --rdc-accent: #6f98e8;
  --rdc-accent-soft: rgba(111, 152, 232, 0.12);
  --rdc-success: #43bd91;
  --rdc-warning: #d9aa51;
  --rdc-danger: #df777c;
  --rdc-radius: 8px;
}

.rd-complex-page {
  min-width: 0;
  color: var(--rdc-text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.rd-complex-page :is(button, input, select, textarea) {
  font-size: 14px;
}

.rd-complex-page :is(table, .table-wrap) {
  font-size: 13px;
}

.rd-complex-page :is(h3, .billing-panel-head h3, .mc-card-head h3) {
  color: var(--rdc-text);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.35;
}

.rd-complex-page :is(.card, .stat-card) {
  box-shadow: none;
}

.rd-complex-page .page-header {
  margin-bottom: 16px;
}

.rd-complex-page .page-header h2 {
  margin: 0 0 3px;
  color: var(--rdc-text);
  font-size: 22px;
  font-weight: 670;
  letter-spacing: -0.02em;
}

.rd-complex-page .page-header p {
  margin: 0;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

/* Dashboard -------------------------------------------------------------- */

.rd-dashboard-workspace {
  overflow: hidden;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
}

.rd-dashboard-metrics.stats-grid {
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
}

.rd-dashboard-primary,
.rd-dashboard-supporting {
  display: grid;
  min-width: 0;
}

.rd-dashboard-primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-dashboard-supporting {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rd-dashboard-metrics .stat-card {
  min-width: 0;
  min-height: 92px;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-dashboard-primary .stat-card {
  min-height: 112px;
  padding-block: 19px;
}

.rd-dashboard-primary .stat-card:last-child,
.rd-dashboard-supporting .stat-card:nth-child(3n) {
  border-right: 0;
}

.rd-dashboard-supporting .stat-card:nth-child(n + 4) {
  border-top: 1px solid var(--rdc-divider);
}

.rd-dashboard-metrics .stat-card .label {
  margin-bottom: 7px;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

.rd-dashboard-metrics .stat-card .value {
  color: var(--rdc-text);
  font-size: 21px;
  font-weight: 680;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.rd-dashboard-primary .stat-card .value {
  font-size: 26px;
}

.rd-dashboard-actions.card {
  margin: 0;
  padding: 16px 18px 18px;
  border: 0;
  border-top: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: var(--rdc-surface-subtle);
}

.rd-dashboard-actions.card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.rd-dashboard-actions.card > div {
  gap: 8px !important;
}

.rd-dashboard-actions .btn {
  min-height: 34px;
}

.rd-dashboard-analytics {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.rd-analytics-metrics {
  overflow: hidden;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
}

.rd-analytics-metrics > .ops-data-alert {
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: var(--rdc-surface-subtle);
  font-size: 13px;
}

.rd-analytics-metrics > .stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-analytics-metrics > .stats-grid:last-child {
  border-bottom: 0;
}

.rd-analytics-metrics > .stats-grid > .stat-card {
  min-width: 0;
  min-height: 94px;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-analytics-metrics > .stats-grid > .stat-card:nth-child(4n) {
  border-right: 0;
}

.rd-analytics-metrics > .stats-grid > .stat-card:nth-child(n + 5) {
  border-top: 1px solid var(--rdc-divider);
}

.rd-analytics-metrics .stat-card .label {
  margin-bottom: 5px;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

.rd-analytics-metrics .stat-card .value {
  color: var(--rdc-text);
  font-size: 20px;
  line-height: 1.3;
}

.rd-analytics-metrics .stat-card .sub {
  margin-top: 5px;
  color: var(--rdc-text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.rd-analytics-sections {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.rd-analytics-sections > .grid-2 {
  gap: 12px;
  margin: 0;
}

.rd-analytics-sections > .card,
.rd-analytics-sections > .grid-2 > .card {
  min-width: 0;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
}

.rd-analytics-sections .card > h3 {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-analytics-sections .chart-box {
  height: 240px;
  min-height: 210px;
}

.rd-analytics-sections .card .stats-grid {
  gap: 0;
  margin: 12px 0 0;
  border-block: 1px solid var(--rdc-divider);
  background: transparent;
}

.rd-analytics-sections .card .stats-grid .stat-card {
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-analytics-sections .table-wrap {
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.rd-analytics-sections table {
  border-top: 1px solid var(--rdc-divider);
}

/* Billing ---------------------------------------------------------------- */

.rd-billing-console {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.rd-billing-command {
  border-bottom: 1px solid var(--rdc-line);
}

.rd-billing-command .billing-page-head {
  display: flex;
  min-height: 74px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  padding: 0 0 14px;
  border: 0;
  background: transparent;
}

.rd-billing-command .billing-page-head h2 {
  margin: 2px 0 3px;
  color: var(--rdc-text);
  font-size: 22px;
  line-height: 1.3;
}

.rd-billing-command .billing-page-head p {
  margin: 0;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

.rd-billing-command :is(.billing-eyebrow, .billing-connected-chip) {
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.rd-billing-command .billing-primary-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.rd-billing-command .billing-primary-tabs button {
  min-height: 42px;
  justify-content: center;
  padding: 9px 14px;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--rdc-text-muted);
  font-size: 14px;
}

.rd-billing-command .billing-primary-tabs button:last-child {
  border-right: 0;
}

.rd-billing-command .billing-primary-tabs button > span {
  display: none;
}

.rd-billing-command .billing-primary-tabs button.active {
  border-bottom-color: var(--rdc-accent);
  background: var(--rdc-accent-soft);
  color: var(--rdc-text);
}

.rd-billing-command .billing-data-warning {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
  font-size: 13px;
}

.rd-billing-stage {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
}

.rd-billing-stage .billing-workspace {
  display: grid;
  min-width: 0;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 0;
}

.rd-billing-stage .billing-rail {
  min-width: 0;
  padding: 16px 0;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: var(--rdc-surface-subtle);
}

.rd-billing-stage .billing-rail-label {
  padding: 0 16px 10px;
  color: var(--rdc-text-muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

.rd-billing-stage .billing-rail-list {
  display: flex;
  flex-direction: column;
}

.rd-billing-stage .billing-rail-item {
  display: grid;
  min-height: 54px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 0;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--rdc-text-secondary);
  text-align: left;
}

.rd-billing-stage .billing-rail-item.active {
  border-color: var(--rdc-divider);
  background: var(--rdc-accent-soft);
  color: var(--rdc-text);
  box-shadow: inset 2px 0 0 var(--rdc-accent);
}

.rd-billing-stage .billing-rail-mark {
  display: none;
}

.rd-billing-stage .billing-rail-item strong,
.rd-billing-stage .billing-rail-item small {
  display: block;
}

.rd-billing-stage .billing-rail-item strong {
  font-size: 14px;
}

.rd-billing-stage .billing-rail-item small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--rdc-text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rd-billing-stage .billing-rail-note {
  margin: 14px 16px 0;
  padding-top: 12px;
  border: 0;
  border-top: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-billing-stage .billing-rail-note p {
  margin: 4px 0 0;
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.rd-billing-stage :is(.billing-panel, .billing-price-panel, .billing-platform-panel) {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.rd-billing-stage .billing-panel-head {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-billing-stage .billing-panel-head h3 {
  margin: 0;
}

.rd-billing-stage .billing-panel-head p {
  margin: 0;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

.rd-billing-stage .billing-panel-head span,
.rd-billing-stage .billing-panel-head small {
  font-size: 12px;
}

.rd-billing-stage :is(.billing-audit-table-wrap, .billing-price-table-wrap, .billing-drama-table-wrap) {
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.rd-billing-stage table {
  width: 100%;
  font-size: 13px;
}

.rd-billing-stage :is(th, td) {
  padding: 11px 12px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-billing-stage thead th {
  color: var(--rdc-text-muted);
  background: var(--rdc-surface-subtle);
  font-weight: 650;
}

.rd-billing-stage .billing-policy-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 15px 18px;
  border: 0;
  border-bottom: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: var(--rdc-surface-subtle);
}

.rd-billing-stage .billing-policy-bar p {
  margin: 3px 0 0;
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.rd-billing-stage .billing-policy-editor {
  display: flex;
  align-items: end;
  gap: 8px;
}

.rd-billing-stage .billing-drama-stack,
.rd-billing-stage .billing-drama-block {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.rd-billing-stage .billing-drama-block + .billing-drama-block,
.rd-billing-stage .billing-drama-engine {
  border-top: 1px solid var(--rdc-divider);
}

.rd-billing-stage .billing-drama-block-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-billing-stage .billing-drama-selection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.rd-billing-stage .billing-drama-selection {
  min-width: 0;
  padding: 15px 16px;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-billing-stage .billing-drama-selection:last-child {
  border-right: 0;
}

.rd-billing-platform-view .billing-platform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  background: var(--rdc-divider);
}

.rd-billing-platform-view .billing-platform-card {
  min-width: 0;
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: var(--rdc-surface);
  box-shadow: none;
}

.rd-billing-platform-view .billing-platform-card > header,
.rd-billing-platform-view .billing-platform-card > footer {
  padding: 0;
  background: transparent;
}

.rd-billing-platform-view .billing-platform-metrics {
  margin: 14px 0;
  padding-block: 12px;
  border-block: 1px solid var(--rdc-divider);
}

.rd-billing-platform-view .billing-pool-list > div {
  padding-block: 8px;
  border-bottom: 1px solid var(--rdc-divider);
}

/* Model control ---------------------------------------------------------- */

.rd-model-command {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--rdc-line);
}

.rd-model-command .mc-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 0 0 14px;
  border: 0;
  background: transparent;
}

.rd-model-command .mc-page-copy h2 {
  margin: 2px 0 3px;
  color: var(--rdc-text);
  font-size: 22px;
}

.rd-model-command .mc-page-copy p {
  margin: 0;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

.rd-model-command .mc-eyebrow {
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.rd-model-command .mc-tabs {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 1px solid var(--rdc-line);
  border-bottom: 0;
  border-radius: var(--rdc-radius) var(--rdc-radius) 0 0;
  background: var(--rdc-surface-subtle);
}

.rd-model-command .mc-tabs .sys-tab {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 8px 9px;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-bottom: 2px solid transparent;
  color: var(--rdc-text-muted);
  font-size: 13px;
  text-align: center;
}

.rd-model-command .mc-tabs .sys-tab:last-child {
  border-right: 0;
}

.rd-model-command .mc-tabs .sys-tab.active {
  border-bottom-color: var(--rdc-accent);
  background: var(--rdc-accent-soft);
  color: var(--rdc-text);
}

.rd-model-workspace {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.rd-model-workspace > :is(.mc-partial-alert, .mc-compat-note, .mc-semantics-note, .mc-economic-warning) {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface-subtle);
  font-size: 13px;
}

.rd-model-workspace .mc-lens-grid {
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-divider);
}

.rd-model-workspace .mc-lens {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 0;
  border-radius: 0;
  background: var(--rdc-surface);
  box-shadow: none;
}

.rd-model-workspace .mc-lens::after {
  display: none;
}

.rd-model-workspace .mc-lens-value {
  margin-block: 12px;
  color: var(--rdc-text);
  font-size: 22px;
  line-height: 1.3;
}

.rd-model-workspace .mc-lens :is(p, small, .mc-lens-kpis) {
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.rd-model-workspace .mc-health-strip {
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
}

.rd-model-workspace .mc-health-strip > div {
  padding: 13px 15px;
  border-right: 1px solid var(--rdc-divider);
}

.rd-model-workspace .mc-health-strip > div:last-child {
  border-right: 0;
}

.rd-model-workspace .mc-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rd-model-workspace :is(.mc-data-card, .mc-ledger-shell, .mc-ledger-table, .card) {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
  box-shadow: none;
}

.rd-model-workspace .mc-card-head,
.rd-model-workspace .mc-ledger-title {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-model-workspace .mc-ledger-filters {
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-model-workspace .table-wrap {
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.rd-model-workspace :is(th, td) {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rdc-divider);
}

/* Harness ---------------------------------------------------------------- */

.rd-harness-navigation {
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
}

.rd-harness-navigation .hn-tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0 12px;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-harness-navigation .hn-tab {
  flex: 0 0 auto;
  min-height: 43px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--rdc-text-muted);
  font-size: 14px;
}

.rd-harness-navigation .hn-tab.active {
  border-bottom-color: var(--rdc-accent);
  background: var(--rdc-accent-soft);
  color: var(--rdc-text);
}

.rd-harness-navigation .hn-dot {
  width: 6px;
  height: 6px;
}

.rd-harness-navigation .hn-sub {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0 12px;
  overflow-x: auto;
  background: var(--rdc-surface-subtle);
}

.rd-harness-navigation .hn-pill {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

.rd-harness-navigation .hn-pill.active {
  color: var(--rdc-text);
  background: var(--rdc-accent-soft);
}

.rd-harness-workspace {
  overflow: hidden;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
}

.rd-harness-workspace .hn-list {
  display: block;
  margin: 0;
  padding: 0;
}

.rd-harness-workspace .hn-card {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.rd-harness-workspace .hn-card:last-child {
  border-bottom: 0;
}

.rd-harness-workspace .hn-card.editing {
  background: var(--rdc-surface-subtle);
  box-shadow: inset 2px 0 0 var(--rdc-accent);
}

.rd-harness-workspace .hn-card-head {
  display: grid;
  min-height: 54px;
  grid-template-columns: minmax(150px, 0.7fr) minmax(130px, 0.55fr) minmax(220px, 1.6fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
}

.rd-harness-workspace .hn-key {
  overflow: hidden;
  color: var(--rdc-text-muted);
  font-family: inherit;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rd-harness-workspace .hn-preview {
  overflow: hidden;
  color: var(--rdc-text-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rd-harness-workspace .hn-editor {
  padding: 0 16px;
  border-top: 1px solid var(--rdc-divider);
}

.rd-harness-workspace .hn-card.editing .hn-editor {
  padding-block: 16px;
}

.rd-harness-workspace .hn-prompt-textarea {
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--rdc-line);
  border-radius: 6px;
  background: #0a131e;
  color: var(--rdc-text);
  font-size: 13px;
  line-height: 1.6;
}

/* System settings -------------------------------------------------------- */

.rd-settings-console.card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  grid-template-columns: 216px minmax(0, 1fr);
  grid-template-rows: auto auto;
  margin: 0;
  padding: 0;
  border: 1px solid var(--rdc-line);
  border-radius: var(--rdc-radius);
  background: var(--rdc-surface);
  box-shadow: none;
}

.rd-settings-console > .sys-tabs {
  display: flex !important;
  min-width: 0;
  min-height: 620px;
  grid-column: 1;
  grid-row: 1 / span 2;
  flex-direction: column;
  flex-wrap: nowrap !important;
  gap: 0;
  margin: 0;
  padding: 10px 0;
  overflow: visible;
  border: 0;
  border-right: 1px solid var(--rdc-divider);
  background: var(--rdc-surface-subtle);
}

.rd-settings-console > .sys-tabs > .sys-tab {
  display: flex;
  width: 100%;
  min-height: 40px;
  flex: 0 0 auto;
  align-items: center;
  padding: 8px 16px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--rdc-text-muted);
  font-size: 13px;
  text-align: left;
}

.rd-settings-console > .sys-tabs > .sys-tab.active {
  border-left-color: var(--rdc-accent);
  background: var(--rdc-accent-soft);
  color: var(--rdc-text);
}

.rd-settings-console > .rd-settings-panel {
  min-width: 0;
  max-width: none;
  grid-column: 2;
  grid-row: 1;
  padding: 20px 22px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.rd-settings-panel > h4,
.rd-settings-panel > div:first-child h4,
.rd-settings-panel .sys-credential-head h4 {
  margin: 0;
  color: var(--rdc-text) !important;
  font-size: 18px;
  font-weight: 650;
}

.rd-settings-panel > h4,
.rd-settings-panel > div:first-child:has(h4),
.rd-settings-panel > .sys-credential-head {
  margin-bottom: 4px !important;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--rdc-divider);
}

.rd-settings-panel > :is(h4, div:first-child:has(h4), .sys-credential-head) + .rd-settings-field-group {
  border-top: 0;
}

.rd-settings-field-group .form-row {
  gap: 14px 16px;
  margin: 0;
}

.rd-settings-field-group .form-group {
  margin: 0;
}

.rd-settings-panel :is(label, .sys-credential-field, .sys-credential-input-label) {
  color: var(--rdc-text-secondary);
  font-size: 13px;
}

.rd-settings-panel > div[style*="background:rgba"] {
  margin-top: 16px !important;
  padding: 12px 0 !important;
  border: 0 !important;
  border-block: 1px solid var(--rdc-divider) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--rdc-text-muted) !important;
  font-size: 12px !important;
}

.rd-settings-console > .rd-settings-savebar {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  padding: 14px 22px;
  border: 0;
  border-top: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: var(--rdc-surface-subtle);
}

.rd-settings-savebar span {
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.rd-credential-workspace {
  min-width: 0;
}

.rd-credential-workspace .sys-credential-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 16px;
  padding: 0;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid var(--rdc-divider);
  border-radius: 0;
  background: transparent;
}

.rd-credential-workspace .sys-credential-tab {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--rdc-text-muted);
  font-size: 13px;
}

.rd-credential-workspace .sys-credential-tab.active {
  border-bottom-color: var(--rdc-accent);
  background: var(--rdc-accent-soft);
  color: var(--rdc-text);
}

.rd-credential-workspace .sys-credential-panels {
  max-width: none;
}

.rd-credential-item.sys-credential-item {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.rd-credential-item .sys-credential-item-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rdc-divider);
}

.rd-credential-item .sys-credential-meta {
  margin: 12px 0;
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.rd-credential-item .sys-credential-fields {
  gap: 12px;
}

.rd-credential-item .sys-credential-item-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rdc-divider);
}

.rd-credential-item :is(.sys-credential-hint, .sys-credential-item-actions span) {
  color: var(--rdc-text-muted);
  font-size: 12px;
}

/* Modal ------------------------------------------------------------------ */

#_globalModal.rd-complex-modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#_globalModal .rd-complex-modal {
  width: min(720px, calc(100vw - 48px));
  max-height: min(84vh, 820px);
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--rdc-line);
  border-radius: 10px;
  background: var(--rdc-surface);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

#_globalModal .modal-box-wide.rd-complex-modal {
  width: min(940px, calc(100vw - 48px));
}

#_globalModal .rd-modal-header {
  min-height: 62px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--rdc-divider);
  background: var(--rdc-surface);
}

#_globalModal .rd-modal-header h3 {
  margin: 0;
  color: var(--rdc-text);
  font-size: 18px;
}

#_globalModal .rd-complex-modal-body {
  max-height: calc(min(84vh, 820px) - 126px);
  padding: 18px;
  overflow: auto;
  color: var(--rdc-text-secondary);
  font-size: 14px;
}

#_globalModal .rd-modal-section {
  padding: 14px 0 0;
  border: 0;
}

#_globalModal .rd-modal-section:first-child {
  padding-top: 0;
}

#_globalModal .rd-modal-section + .rd-modal-section,
#_globalModal .rd-complex-modal-body > div[style*="display:grid"] + .rd-modal-section {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--rdc-divider);
}

#_globalModal .rd-modal-section-title {
  margin: 0 0 12px !important;
  color: var(--rdc-text) !important;
  font-size: 15px !important;
  font-weight: 650;
}

body #_globalModal #_modalBody.rd-complex-modal-body .rd-modal-section .form-row {
  gap: 12px 14px;
  margin-bottom: 12px;
  padding: 0;
  border: 0 !important;
}

body #_globalModal #_modalBody.rd-complex-modal-body .rd-modal-section .form-row:last-child {
  margin-bottom: 0;
}

#_globalModal .rd-modal-business-block {
  margin: 0;
  padding: 14px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body #_globalModal #_modalBody.rd-complex-modal-body > div[style*="display:grid"] {
  gap: 0 !important;
  overflow: visible;
  border: 0 !important;
  border-radius: 0 !important;
}

body #_globalModal #_modalBody.rd-complex-modal-body .stat-card {
  margin: 0;
  padding: 12px 14px;
  border: 0 !important;
  border-radius: 0;
  background: transparent;
}

body #_globalModal #_modalBody.rd-complex-modal-body > div[style*="display:grid"] > .stat-card:nth-child(even) {
  border-left: 1px solid var(--rdc-divider) !important;
}

body #_globalModal #_modalBody.rd-complex-modal-body > div[style*="display:grid"] > .stat-card:nth-child(n + 3) {
  border-top: 1px solid var(--rdc-divider) !important;
}

#_globalModal .rd-complex-modal-body .stat-card .label {
  color: var(--rdc-text-muted);
  font-size: 12px;
}

#_globalModal .rd-complex-modal-body .stat-card .value {
  color: var(--rdc-text);
  font-size: 16px !important;
}

#_globalModal .rd-modal-footer {
  min-height: 64px;
  padding: 12px 18px;
  border-top: 1px solid var(--rdc-divider);
  background: var(--rdc-surface-subtle);
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 1280px) {
  .rd-model-command .mc-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .rd-model-command .mc-tabs .sys-tab:nth-child(4n) {
    border-right: 0;
  }

  .rd-model-command .mc-tabs .sys-tab:nth-child(n + 5) {
    border-top: 1px solid var(--rdc-divider);
  }

  .rd-model-workspace .mc-lens-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rd-billing-platform-view .billing-platform-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .rd-complex-page .page-header,
  .rd-billing-command .billing-page-head,
  .rd-model-command .mc-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .rd-dashboard-primary,
  .rd-dashboard-supporting,
  .rd-analytics-metrics > .stats-grid,
  .rd-model-workspace .mc-lens-grid,
  .rd-model-workspace .mc-health-strip,
  .rd-model-workspace .mc-data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .rd-dashboard-supporting .stat-card:nth-child(3n),
  .rd-analytics-metrics > .stats-grid > .stat-card:nth-child(4n) {
    border-right: 1px solid var(--rdc-divider);
  }

  .rd-dashboard-supporting .stat-card:nth-child(2n),
  .rd-analytics-metrics > .stats-grid > .stat-card:nth-child(2n) {
    border-right: 0;
  }

  .rd-dashboard-supporting .stat-card:nth-child(n + 3),
  .rd-analytics-metrics > .stats-grid > .stat-card:nth-child(n + 3) {
    border-top: 1px solid var(--rdc-divider);
  }

  .rd-analytics-sections > .grid-2 {
    grid-template-columns: 1fr;
  }

  .rd-billing-command .billing-primary-tabs {
    grid-template-columns: 1fr;
  }

  .rd-billing-command .billing-primary-tabs button {
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 1px solid var(--rdc-divider);
    border-left: 2px solid transparent;
  }

  .rd-billing-command .billing-primary-tabs button.active {
    border-bottom-color: var(--rdc-divider);
    border-left-color: var(--rdc-accent);
  }

  .rd-billing-stage .billing-workspace {
    grid-template-columns: 1fr;
  }

  .rd-billing-stage .billing-rail {
    padding: 0;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rdc-divider);
  }

  .rd-billing-stage .billing-rail-label,
  .rd-billing-stage .billing-rail-note {
    display: none;
  }

  .rd-billing-stage .billing-rail-list {
    flex-direction: row;
  }

  .rd-billing-stage .billing-rail-item {
    min-width: 160px;
    flex: 0 0 auto;
    border-right: 1px solid var(--rdc-divider);
  }

  .rd-billing-stage .billing-rail-item.active {
    box-shadow: inset 0 -2px 0 var(--rdc-accent);
  }

  .rd-billing-stage .billing-policy-bar,
  .rd-billing-stage .billing-drama-selection-grid {
    grid-template-columns: 1fr;
  }

  .rd-billing-stage .billing-policy-editor {
    align-items: stretch;
    flex-direction: column;
  }

  .rd-billing-stage .billing-drama-selection {
    border-right: 0;
    border-bottom: 1px solid var(--rdc-divider);
  }

  .rd-model-command .mc-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rd-model-command .mc-tabs .sys-tab:nth-child(2n) {
    border-right: 0;
  }

  .rd-model-command .mc-tabs .sys-tab:nth-child(n + 3) {
    border-top: 1px solid var(--rdc-divider);
  }

  .rd-harness-workspace .hn-card-head {
    grid-template-columns: minmax(130px, 1fr) minmax(110px, 0.7fr) auto auto;
  }

  .rd-harness-workspace .hn-preview {
    display: none;
  }

  .rd-settings-console.card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .rd-settings-console > .sys-tabs {
    min-height: 0;
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    padding: 0;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rdc-divider);
  }

  .rd-settings-console > .sys-tabs > .sys-tab {
    width: auto;
    min-width: 128px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    text-align: center;
  }

  .rd-settings-console > .sys-tabs > .sys-tab.active {
    border-bottom-color: var(--rdc-accent);
  }

  .rd-settings-console > .rd-settings-panel {
    grid-column: 1;
    grid-row: 2;
    padding: 18px 16px 6px;
  }

  .rd-settings-console > .rd-settings-savebar {
    grid-column: 1;
    grid-row: 3;
    padding-inline: 16px;
  }

  .rd-settings-field-group .form-row,
  .rd-credential-item .sys-credential-fields {
    grid-template-columns: 1fr;
  }

  #_globalModal.rd-complex-modal-overlay {
    padding: 12px;
  }

  #_globalModal :is(.rd-complex-modal, .modal-box-wide.rd-complex-modal) {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  #_globalModal .rd-complex-modal-body {
    max-height: calc(100vh - 150px);
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rd-complex-page *,
  #_globalModal * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Read-only billing rules: keep each condition next to its price. */
#_globalModal .modal-box-wide.rd-complex-modal.billing-rule-modal {
  width: min(880px, calc(100vw - 48px));
}

#_globalModal .billing-rule-modal .rd-complex-modal-body {
  padding: 20px 22px;
}

.billing-rule-dialog {
  display: grid;
  gap: 18px;
}

.billing-rule-overview {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rdc-divider);
}

.billing-rule-overview > strong {
  color: var(--rdc-text);
  font-size: 20px;
  line-height: 1.35;
}

.billing-rule-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.billing-rule-meta > span {
  padding: 4px 9px;
  color: var(--rdc-text-secondary);
  background: var(--rdc-surface-subtle);
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
}

.billing-rule-meta > span:first-child {
  color: #9db8ff;
  background: #172747;
}

.billing-rule-meta > span:nth-child(2) {
  color: #57d7b0;
  background: #163a36;
}

.billing-rule-groups {
  display: grid;
  gap: 20px;
}

.billing-rule-group > header {
  margin-bottom: 10px;
}

.billing-rule-group h4 {
  margin: 0;
  color: var(--rdc-text);
  font-size: 15px;
  line-height: 1.4;
}

.billing-rule-group header p {
  margin: 2px 0 0;
  color: var(--rdc-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.billing-rule-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.billing-rule-values > div {
  min-width: 0;
  min-height: 92px;
  padding: 14px 16px;
  background: #0d1525;
  border-radius: 9px;
}

.billing-rule-values dt {
  color: var(--rdc-text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.billing-rule-values dd {
  margin: 5px 0 0;
  color: var(--rdc-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.billing-rule-values dd small {
  display: block;
  margin-top: 5px;
  color: #6f7e97;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.billing-rule-empty {
  margin: 0;
  color: var(--rdc-text-muted);
  font-size: 14px;
}

.billing-rule-technical {
  padding-top: 10px;
  border-top: 1px solid var(--rdc-divider);
  color: var(--rdc-text-muted);
  font-size: 12px;
}

.billing-rule-technical summary {
  width: max-content;
  cursor: pointer;
}

.billing-rule-technical code {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (max-width: 700px) {
  #_globalModal .modal-box-wide.rd-complex-modal.billing-rule-modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  #_globalModal .billing-rule-modal .rd-complex-modal-body {
    padding: 16px;
  }

  .billing-rule-values {
    grid-template-columns: 1fr;
  }

  .billing-rule-values > div {
    min-height: 0;
    padding: 14px;
  }
}

.billing-inherited-state {
  display: grid;
  gap: 10px;
  margin: 14px 18px 0;
  padding: 18px;
  background: #0d1525;
  border-radius: 10px;
}

.billing-inherited-state__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.billing-inherited-state__head > span {
  color: #8fa0b8;
  font-size: 12px;
}

.billing-inherited-state__head > b {
  padding: 4px 10px;
  color: #57d7b0;
  background: #163a36;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.billing-inherited-state > strong {
  color: #f1f5fb;
  font-size: 18px;
  line-height: 1.4;
}

.billing-inherited-state > p {
  margin: 0;
  color: #a7b3c7;
  font-size: 13px;
  line-height: 1.55;
}

.billing-inherited-model {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 38px;
  padding: 8px 12px;
  background: #182235;
  border-radius: 7px;
}

.billing-inherited-model > strong {
  min-width: 0;
  overflow: hidden;
  color: #f1f5fb;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-inherited-model > span {
  flex: none;
  color: #8ab4ff;
  font-size: 12px;
}

.billing-inherited-note {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin: 12px 18px 14px;
  padding: 10px 14px;
  color: #a7b3c7;
  background: #101d2c;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.billing-inherited-note > i {
  width: 7px;
  height: 7px;
  flex: none;
  background: #57d7b0;
  border-radius: 50%;
}

@media (max-width: 700px) {
  .billing-inherited-state,
  .billing-inherited-note {
    margin-inline: 0;
  }

  .billing-inherited-model {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .billing-inherited-model > strong {
    white-space: normal;
  }
}
