html.grm-route-active .main-content > :not(#grok-registration-monitor) {
  display: none !important;
}

.grm-nav-item .nav-icon {
  color: var(--info-color, #48c6d9);
}

.grm-nav-item.active {
  background: var(--bg-hover, #292a27);
}

#grok-registration-monitor.grm-page {
  --grm-green: var(--success-color, #47c889);
  --grm-red: var(--danger-color, #ef776d);
  --grm-cyan: var(--info-color, #48c6d9);
  --grm-blue: #75a7ff;
  --grm-amber: var(--warning-color, #e9b949);
  width: 100%;
  min-width: 0;
  padding: 4px 0 28px;
  color: var(--text-primary, #f2f2ee);
  letter-spacing: 0;
}

#grok-registration-monitor.grm-page *,
#grok-registration-monitor.grm-page *::before,
#grok-registration-monitor.grm-page *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

.grm-page-header,
.grm-title-row,
.grm-section-header,
.grm-capacity,
.grm-resource-row > div:first-child,
.grm-status-band,
.grm-chart-legend {
  display: flex;
  align-items: center;
}

.grm-page-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.grm-eyebrow,
.grm-section-label,
.grm-metric-label {
  color: var(--text-tertiary, #999992);
  font-size: 12px;
  font-weight: 650;
}

.grm-eyebrow {
  margin-bottom: 6px;
  color: var(--grm-cyan);
}

.grm-title-row {
  gap: 12px;
  flex-wrap: wrap;
}

.grm-title-row h1,
.grm-section-header h2 {
  margin: 0;
  color: var(--text-primary, #f2f2ee);
  font-weight: 720;
}

.grm-heading-note {
  color: var(--text-tertiary, #92928b);
  font-size: 11px;
  font-weight: 500;
}

.grm-title-row h1 { font-size: 28px; line-height: 1.2; }
.grm-section-header h2 { margin-top: 4px; font-size: 18px; line-height: 1.25; }

.grm-service-badge,
.grm-running-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--border-color, #353630);
  border-radius: 999px;
  color: var(--text-secondary, #c5c5be);
  background: var(--bg-tertiary, #20211e);
  font-size: 12px;
  white-space: nowrap;
}

.grm-control-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.grm-service-toggle {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--border-color, #383a35);
  border-radius: 7px;
  color: var(--text-secondary, #d8d8d1);
  background: var(--bg-secondary, #20211e);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}
.grm-service-toggle:hover:not(:disabled) { border-color: var(--border-hover, #65665e); background: var(--bg-hover, #2a2b27); }
.grm-service-toggle:focus-visible { outline: 2px solid var(--focus-ring-color, #75a7ff); outline-offset: 2px; }
.grm-service-toggle.is-stop { color: #ffd0cc; border-color: color-mix(in srgb, var(--grm-red) 45%, transparent); }
.grm-service-toggle.is-start { color: #b8f1d5; border-color: color-mix(in srgb, var(--grm-green) 45%, transparent); }
.grm-service-toggle:disabled { opacity: .5; cursor: wait; }

.grm-service-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #77776f;
}

.grm-service-badge.is-refilling { color: #b8f1d5; border-color: color-mix(in srgb, var(--grm-green) 45%, transparent); }
.grm-service-badge.is-refilling i { background: var(--grm-green); animation: grm-pulse 1.6s ease-in-out infinite; }
.grm-service-badge.is-waiting { color: #bdeaf0; border-color: color-mix(in srgb, var(--grm-cyan) 45%, transparent); }
.grm-service-badge.is-waiting i { background: var(--grm-cyan); }
.grm-service-badge.is-stopped { color: #ffd0cc; border-color: color-mix(in srgb, var(--grm-red) 45%, transparent); }
.grm-service-badge.is-stopped i { background: var(--grm-red); }
.grm-service-badge.is-loading i { animation: grm-pulse 1.2s ease-in-out infinite; }

.grm-icon-button,
.grm-step,
.grm-range button,
.grm-dialog-actions button {
  border: 1px solid var(--border-color, #383a35);
  color: var(--text-secondary, #d8d8d1);
  background: var(--bg-secondary, #20211e);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}

.grm-icon-button:hover,
.grm-step:hover:not(:disabled),
.grm-range button:hover,
.grm-dialog-actions button:hover { border-color: var(--border-hover, #65665e); background: var(--bg-hover, #2a2b27); }
.grm-icon-button:focus-visible,
.grm-step:focus-visible,
.grm-range button:focus-visible,
.grm-dialog-actions button:focus-visible { outline: 2px solid var(--focus-ring-color, #75a7ff); outline-offset: 2px; }
.grm-icon-button:disabled,
.grm-step:disabled { opacity: .38; cursor: not-allowed; }

.grm-icon-button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
}
.grm-icon-button.is-loading { animation: grm-spin .9s linear infinite; }

.grm-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--border-color, #30312d);
  border-bottom: 1px solid var(--border-color, #30312d);
}

.grm-metric {
  position: relative;
  min-width: 0;
  padding: 18px 18px 17px;
  border-right: 1px solid var(--border-color, #30312d);
}
.grm-metric:first-child { padding-left: 0; }
.grm-metric:last-child { border-right: 0; }
.grm-metric::before {
  position: absolute;
  top: 20px;
  left: 8px;
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: #77776f;
  content: "";
}
.grm-metric:first-child::before { left: 0; }
.grm-tone-green::before { background: var(--grm-green); }
.grm-tone-cyan::before { background: var(--grm-cyan); }
.grm-tone-blue::before { background: var(--grm-blue); }
.grm-tone-amber::before { background: var(--grm-amber); }
.grm-tone-red::before { background: var(--grm-red); }
.grm-tone-neutral::before { background: #8f9088; }
.grm-metric-label { display: block; padding-left: 8px; white-space: nowrap; }
.grm-metric-value { display: block; margin-top: 10px; overflow: hidden; color: var(--text-primary, #f2f2ee); font-size: 25px; line-height: 1.1; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.grm-metric-detail { display: block; margin-top: 7px; overflow: hidden; color: var(--text-tertiary, #87877f); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.grm-flow {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border-color, #30312d);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-secondary, #1c1d1a);
}
.grm-flow-step { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.grm-flow-step span { color: var(--text-tertiary, #92928b); font-size: 12px; white-space: nowrap; }
.grm-flow-step strong { color: var(--text-primary, #f2f2ee); font-size: 22px; line-height: 1; }
.grm-flow-step.is-primary strong { color: var(--grm-blue); }
.grm-flow-step.is-success strong { color: var(--grm-green); }
.grm-flow-arrow { color: var(--text-quaternary, #73736c); font-size: 18px; }
.grm-flow-side { display: flex; align-items: center; gap: 14px; min-width: 0; margin-left: auto; color: var(--text-tertiary, #92928b); font-size: 11px; flex-wrap: wrap; justify-content: flex-end; }
.grm-flow-side span { white-space: nowrap; }
.grm-flow-side b { margin-left: 4px; color: var(--text-primary, #f2f2ee); font-size: 13px; }
.grm-flow-side .is-danger b { color: var(--grm-red); }

.grm-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .9fr);
  gap: 18px;
  margin-top: 18px;
}

.grm-chart-panel,
.grm-control-panel,
.grm-status-band {
  border: 1px solid var(--border-color, #30312d);
  background: var(--bg-secondary, #1c1d1a);
}
.grm-chart-panel,
.grm-control-panel { min-width: 0; padding: 20px; border-radius: var(--radius-md, 8px); }
.grm-status-band { border-radius: var(--radius-md, 8px); }
.grm-section-header { justify-content: space-between; gap: 16px; }

.grm-range { display: flex; gap: 4px; flex-wrap: wrap; }
.grm-range button { min-height: 28px; padding: 4px 9px; border-radius: 5px; font-size: 12px; }
.grm-range button.is-active { color: var(--primary-contrast, #fff); border-color: var(--primary-color, #688cff); background: var(--primary-color, #536fc4); }

.grm-chart-shell { position: relative; width: 100%; height: 322px; margin-top: 18px; overflow: hidden; border-top: 1px solid var(--border-color, #30312d); border-bottom: 1px solid var(--border-color, #30312d); }
.grm-chart { display: block; width: 100%; height: 100%; }
.grm-chart-tooltip { position: absolute; z-index: 1; display: flex; flex-direction: column; gap: 3px; min-width: 126px; padding: 9px 10px; border: 1px solid var(--border-hover, #5d5e57); border-radius: 6px; color: var(--text-secondary, #e4e4dc); background: color-mix(in srgb, var(--bg-primary, #121311) 94%, transparent); box-shadow: var(--shadow, 0 7px 18px #0005); pointer-events: none; font-size: 11px; }
.grm-chart-tooltip b { margin-bottom: 2px; color: var(--text-primary, #fff); }
.grm-chart-legend { gap: 16px; flex-wrap: wrap; padding-top: 12px; color: var(--text-tertiary, #888881); font-size: 11px; }
.grm-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.grm-chart-legend i { width: 8px; height: 8px; border-radius: 2px; background: #77776f; }
.grm-chart-legend i.is-registered { background: var(--grm-blue); }
.grm-chart-legend i.is-admitted { background: var(--grm-green); }
.grm-chart-legend i.is-deleted { background: var(--grm-red); }
.grm-chart-point { margin-left: auto; }

.grm-control-panel { display: flex; flex-direction: column; }
.grm-running-pill { color: var(--grm-green); border-color: color-mix(in srgb, var(--grm-green) 40%, transparent); }
.grm-worker-control { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 27px 0 18px; }
.grm-step { width: 40px; height: 40px; border-radius: 7px; font-size: 25px; line-height: 1; }
.grm-worker-count { display: flex; align-items: baseline; gap: 7px; min-width: 112px; justify-content: center; }
.grm-worker-count strong { color: var(--text-primary, #fff); font-size: 38px; line-height: 1; }
.grm-worker-count span { color: var(--text-tertiary, #999992); font-size: 13px; }
.grm-capacity { justify-content: center; gap: 12px; flex-wrap: wrap; padding-bottom: 20px; color: var(--text-tertiary, #999992); font-size: 11px; }
.grm-recommended { color: var(--grm-cyan); }
.grm-speed { color: var(--text-secondary, #d0d0c8); }
.grm-resource-list { display: flex; flex-direction: column; gap: 15px; padding: 17px 0; border-top: 1px solid var(--border-color, #30312d); border-bottom: 1px solid var(--border-color, #30312d); }
.grm-resource-row > div:first-child { justify-content: space-between; gap: 12px; color: var(--text-secondary, #c5c5be); font-size: 12px; }
.grm-resource-row b { color: var(--text-primary, #f2f2ee); font-size: 12px; font-weight: 650; }
.grm-resource-track,
.grm-policy-track { height: 6px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: var(--bg-tertiary, #2b2c27); }
.grm-resource-track span,
.grm-policy-track span { display: block; width: 0; height: 100%; border-radius: inherit; transition: width .35s ease; }
.grm-cpu-bar { background: var(--grm-cyan); }
.grm-memory-bar { background: var(--grm-amber); }
.grm-policy { padding-top: 17px; color: var(--text-secondary, #d0d0c8); font-size: 12px; }
.grm-policy > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.grm-policy-copy { color: var(--text-primary, #f2f2ee); font-weight: 650; text-align: right; }
.grm-policy-track span { background: var(--grm-green); }
.grm-policy-value { display: block; margin-top: 7px; color: var(--text-tertiary, #898981); font-size: 11px; text-align: right; }
.grm-warning { margin-top: 14px; padding: 9px 10px; border: 1px solid color-mix(in srgb, var(--grm-amber) 45%, transparent); border-radius: 6px; color: var(--amber-text, #f3ca67); background: color-mix(in srgb, var(--grm-amber) 10%, transparent); font-size: 11px; line-height: 1.5; }

.grm-status-band { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-top: 18px; }
.grm-status-band > div { min-width: 0; padding: 14px 16px; border-right: 1px solid var(--border-color, #30312d); }
.grm-status-band > div:last-child { border-right: 0; }
.grm-status-band span,
.grm-status-band b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grm-status-band span { color: var(--text-tertiary, #92928b); font-size: 11px; }
.grm-status-band b { margin-top: 6px; color: var(--text-secondary, #e1e1da); font-size: 13px; font-weight: 650; }
.grm-deletion-panel { margin-top: 18px; padding: 20px; border: 1px solid var(--border-color, #30312d); border-radius: var(--radius-md, 8px); background: var(--bg-secondary, #1c1d1a); }
.grm-deletion-note { color: var(--text-tertiary, #92928b); font-size: 11px; }
.grm-deletion-reasons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.grm-deletion-reason { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 13px 14px; border: 1px solid var(--border-color, #30312d); border-radius: 6px; background: var(--bg-tertiary, #20211e); }
.grm-deletion-reason span { overflow: hidden; color: var(--text-secondary, #d0d0c8); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.grm-deletion-reason strong { flex: 0 0 auto; color: var(--grm-red); font-size: 20px; line-height: 1; }
.grm-deletion-empty { color: var(--text-tertiary, #92928b); font-size: 12px; }
.grm-toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(420px, calc(100vw - 44px)); padding: 11px 14px; border: 1px solid var(--border-hover, #5d5e57); border-radius: 7px; color: var(--text-primary, #fff); background: var(--bg-secondary, #242520); box-shadow: var(--shadow-lg, 0 16px 36px #0006); font-size: 13px; }
.grm-toast.is-success { border-color: color-mix(in srgb, var(--grm-green) 50%, transparent); }
.grm-toast.is-error { border-color: color-mix(in srgb, var(--grm-red) 55%, transparent); color: #ffd4cf; }

.grm-dialog-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgb(0 0 0 / 62%); }
.grm-dialog { width: min(430px, 100%); padding: 22px; border: 1px solid var(--border-hover, #5d5e57); border-radius: 9px; background: var(--bg-secondary, #20211e); box-shadow: var(--shadow-lg, 0 20px 50px #0008); }
.grm-dialog-icon { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid color-mix(in srgb, var(--grm-amber) 50%, transparent); border-radius: 50%; color: var(--grm-amber); font-weight: 750; }
.grm-dialog h2 { margin: 14px 0 8px; color: var(--text-primary, #f4f4ee); font-size: 18px; }
.grm-dialog p { margin: 0; color: var(--text-secondary, #c4c4bd); font-size: 13px; line-height: 1.6; }
.grm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.grm-dialog-actions button { min-height: 34px; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.grm-dialog-actions [data-confirm] { border-color: var(--primary-color, #6d8cff); color: var(--primary-contrast, #fff); background: var(--primary-color, #536fc4); }

@keyframes grm-pulse { 0%, 100% { opacity: .65; box-shadow: 0 0 0 0 rgb(71 200 137 / 0); } 50% { opacity: 1; box-shadow: 0 0 0 5px rgb(71 200 137 / 13%); } }
@keyframes grm-spin { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .grm-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grm-metric { border-bottom: 1px solid var(--border-color, #30312d); }
  .grm-metric:nth-child(3n) { border-right: 0; }
  .grm-metric:nth-child(n + 4) { border-bottom: 0; }
  .grm-metric:first-child { padding-left: 18px; }
  .grm-metric:first-child::before { left: 8px; }
  .grm-main-grid { grid-template-columns: 1fr; }
  .grm-flow { align-items: flex-start; flex-wrap: wrap; }
  .grm-flow-side { width: 100%; margin-left: 0; justify-content: flex-start; padding-top: 10px; border-top: 1px solid var(--border-color, #30312d); }
}

@media (max-width: 720px) {
  #grok-registration-monitor.grm-page { padding: 0 0 20px; }
  .grm-title-row h1 { font-size: 22px; }
  .grm-page-header { margin-bottom: 16px; }
  .grm-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grm-metric { min-height: 98px; padding: 15px 12px 13px; }
  .grm-metric:nth-child(3n) { border-right: 1px solid var(--border-color, #30312d); }
  .grm-metric:nth-child(2n) { border-right: 0; }
  .grm-metric:nth-child(4) { border-bottom: 1px solid var(--border-color, #30312d); }
  .grm-metric-value { font-size: 21px; }
  .grm-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 13px; }
  .grm-flow-arrow { display: none; }
  .grm-flow-step { align-items: flex-start; flex-direction: column; gap: 5px; }
  .grm-flow-step.is-success { grid-column: auto; align-items: flex-start; flex-direction: column; justify-content: flex-start; padding: 0; border: 0; }
  .grm-flow-side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; padding-top: 0; border-top: 0; }
  .grm-chart-panel, .grm-control-panel { padding: 15px; }
  .grm-section-header { align-items: flex-start; flex-direction: column; }
  .grm-section-header .grm-range { width: 100%; }
  .grm-range button { flex: 1 1 auto; }
  .grm-chart-shell { height: 260px; margin-top: 14px; }
  .grm-chart-point { width: 100%; margin-left: 0; }
  .grm-status-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grm-status-band > div:nth-child(2n) { border-right: 0; }
  .grm-status-band > div:nth-child(-n + 4) { border-bottom: 1px solid var(--border-color, #30312d); }
  .grm-policy > div:first-child { align-items: flex-start; flex-direction: column; gap: 5px; }
  .grm-policy-copy { text-align: left; }
  .grm-deletion-panel { padding: 15px; }
  .grm-deletion-reasons { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .grm-service-badge.is-refilling i,
  .grm-service-badge.is-loading i,
  .grm-icon-button.is-loading { animation: none; }
  .grm-resource-track span, .grm-policy-track span { transition: none; }
}
