:root {
  color-scheme: dark;
  --bg: #14191f;
  --surface: #1b222a;
  --surface-2: #222b35;
  --surface-3: #2b3642;
  --line: #34404d;
  --line-strong: #526274;
  --text: #eef2f6;
  --muted: #b8c3cf;
  --faint: #9ba9b8;
  --accent: #68acff;
  --accent-soft: #68acff1f;
  --accent-ink: #102137;
  --edge-runs-on: color-mix(in srgb, var(--accent) 55%, transparent);
  --edge-runs-on-dash: 5 5;
  --healthy: #39d59b;
  --degraded: #f7bd45;
  --critical: #ff7078;
  --unknown: #7d8797;
  --shadow: 0 12px 32px rgb(0 0 0 / 0.24);
  --font-sans: "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #edf0f5;
  --line: #dce2e9;
  --line-strong: #aebbc9;
  --text: #171c25;
  --muted: #4f5968;
  --faint: #626e7e;
  --accent: #075ec9;
  --accent-soft: #075ec912;
  --accent-ink: #ffffff;
  --healthy: #087f5b;
  --degraded: #a95109;
  --critical: #cf2935;
  --unknown: #667085;
  --shadow: 0 12px 32px rgb(25 34 48 / 0.14);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

input,
select {
  caret-color: var(--accent);
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
a {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.app-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  height: 100dvh;
}

.pulse-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-decoration: none;
}

.brand img {
  display: block;
}

.brand-accent {
  color: var(--accent);
}

.connection {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-dot,
.status-dot,
.service-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--unknown);
}

.connection[data-state="connected"] .live-dot {
  background: var(--healthy);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--healthy) 13%, transparent);
}

.connection[data-state="connecting"] .live-dot,
.connection[data-state="reconnecting"] .live-dot {
  background: var(--degraded);
  animation: pulse 1.4s ease-in-out infinite;
}

.connection[data-state="disconnected"] .live-dot {
  background: var(--critical);
}

.pulse-metrics {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
}

.pulse-metrics > div {
  display: grid;
  align-content: center;
  min-width: 88px;
  padding: 0 18px;
  border-left: 1px solid var(--line);
}

.pulse-metrics dt,
.eyebrow,
.stat-label {
  color: var(--faint);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.pulse-metrics dd {
  margin: 2px 0 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.pulse-metrics dt {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.connect-menu {
  position: relative;
}

.connect-menu summary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  list-style: none;
}

.connect-menu summary::-webkit-details-marker {
  display: none;
}

.connect-menu summary:hover,
.connect-menu[open] summary {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}

.connect-menu summary svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.connect-popover {
  position: absolute;
  z-index: 2;
  top: calc(100% + 8px);
  right: 0;
  width: min(370px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.endpoint-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
}

.endpoint-row + .endpoint-row {
  border-top: 1px solid var(--line);
}

.endpoint-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.endpoint-value {
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-copy {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.endpoint-copy:hover {
  border-color: var(--line-strong);
}

.coverage-badge,
.coverage-tag {
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.icon-button svg,
.search-field svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.moon-icon {
  display: none;
}

[data-theme="light"] .sun-icon {
  display: none;
}

[data-theme="light"] .moon-icon {
  display: block;
}

.command-dialog,
.shortcut-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.shortcut-dialog {
  width: min(520px, calc(100vw - 28px));
}

.command-dialog::backdrop,
.shortcut-dialog::backdrop {
  background: rgb(0 0 0 / 0.58);
  backdrop-filter: blur(4px);
}

.dialog-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100dvh - 28px));
}

.shortcut-dialog .dialog-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

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

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

.dialog-header .eyebrow {
  margin: 0;
}

.command-search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--faint);
}

.command-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.command-search svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.command-search input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.command-results {
  min-height: 0;
  padding: 0 8px 8px;
  overflow: auto;
}

.command-group + .command-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.command-group h3 {
  margin: 0;
  padding: 6px 8px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.command-item {
  display: grid;
  width: 100%;
  min-height: 46px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.command-item:hover,
.command-item:focus-visible {
  background: var(--surface-2);
}

.command-item strong {
  font-size: 12px;
}

.command-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-empty {
  margin: 0;
  padding: 22px 12px;
  color: var(--muted);
  text-align: center;
}

.dialog-hint {
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

kbd {
  display: inline-block;
  min-width: 20px;
  margin: 0 2px;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
}

.shortcut-list {
  margin: 0;
  padding: 8px 18px 18px;
  overflow: auto;
}

.shortcut-list > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 18px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

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

.shortcut-list dt,
.shortcut-list dd {
  margin: 0;
}

.shortcut-list dd {
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 0;
}

.is-system-overview .workspace,
.has-inspector.is-system-overview .workspace {
  grid-template-columns: minmax(0, 1fr);
}

.is-system-overview .service-rail {
  display: none;
}

.map-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.map-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(180px, 260px);
  align-items: center;
  gap: 16px;
  padding: 20px 22px 12px;
}

.map-toolbar h1 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.map-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.map-navigation .scope-action {
  border-color: var(--line);
  font-size: 12px;
}

.map-navigation button:disabled {
  cursor: default;
  opacity: 0.5;
}

.map-scope {
  display: flex;
  grid-row: 2;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 0 22px 16px;
  border-bottom: 1px solid var(--line);
}

.map-summary {
  flex: 1 0 100%;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.scope-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.scope-field:has(select[hidden]) {
  display: none;
}

.scope-field select {
  min-width: 0;
  max-width: 230px;
  height: 32px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
}

.scope-field select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.scope-action {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.scope-action:hover,
.scope-action[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--accent-soft);
}

.inventory-action {
  margin-left: auto;
}

.eyebrow {
  margin: 0 0 4px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.view-switch {
  display: none;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.view-switch button {
  padding: 5px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.view-switch button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.group-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.group-toggle[aria-disabled="true"] {
  color: var(--faint);
  cursor: not-allowed;
}

/* Host marker: a diamond, so a host never reads as a service dot. */
.host-mark {
  display: inline-block;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--accent);
  border-radius: 1px;
  transform: rotate(45deg);
}

.group-toggle[aria-pressed="true"] .host-mark {
  background: var(--accent);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--faint);
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.search-field input::placeholder {
  color: var(--faint);
}

#search-count {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.impact-banner {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 22px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--critical) 32%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--critical) 8%, var(--surface));
  color: var(--muted);
  font-size: 11px;
}

.impact-banner strong {
  color: var(--text);
  font-family: var(--font-mono);
}

.impact-banner button {
  border: 0;
  background: transparent;
  color: var(--critical);
  font-size: 11px;
  font-weight: 700;
}

.map-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  grid-row: 4;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

.system-overview {
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.overview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.overview-header h2 {
  font-size: 18px;
}

.overview-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.overview-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  min-height: 102px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.overview-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.overview-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.overview-health,
.overview-counts {
  color: var(--muted);
  font-size: 12px;
}

.overview-members {
  display: flex;
  grid-column: 1 / -1;
  gap: 4px;
  min-width: 0;
}

.overview-members button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 16px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--unknown);
}

.overview-members button.healthy {
  background: var(--healthy);
}

.overview-members button.degraded {
  background: var(--degraded);
}

.overview-members button.critical {
  background: var(--critical);
}

.overview-open {
  align-self: end;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
}

.map-evidence {
  flex: 0 0 auto;
  max-height: 40%;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.map-evidence summary {
  min-height: 32px;
  padding: 6px 14px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.map-evidence-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 0 12px 12px;
}

.map-connection-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  min-height: 40px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.loading-state,
.error-state,
.empty-state {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.loading-state p,
.error-state p,
.empty-state p {
  max-width: 460px;
  margin-bottom: 8px;
}

.state-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.spinner {
  width: 22px;
  height: 22px;
  margin-bottom: 10px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.error-state button,
.inspector-body .action-button {
  margin-top: 10px;
}

.error-state button,
.action-button,
.secondary-button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.action-button {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.action-button:hover {
  filter: brightness(1.08);
}

.empty-endpoints {
  width: min(500px, 100%);
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
}

.empty-mark {
  position: relative;
  width: 72px;
  height: 45px;
  margin-bottom: 16px;
}

.empty-mark::before,
.empty-mark::after {
  position: absolute;
  top: 22px;
  width: 34px;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.empty-mark::before {
  left: 6px;
  transform: rotate(-28deg);
}

.empty-mark::after {
  right: 6px;
  transform: rotate(28deg);
}

.empty-mark span {
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 10px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}

.empty-mark span:nth-child(1) {
  left: 0;
  bottom: 0;
}

.empty-mark span:nth-child(2) {
  top: 0;
  left: 31px;
}

.empty-mark span:nth-child(3) {
  right: 0;
  bottom: 0;
}

.canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}

#service-map {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

.runs-on-edge {
  fill: none;
  stroke: var(--edge-runs-on);
  stroke-dasharray: var(--edge-runs-on-dash);
  stroke-linecap: round;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.graph-edge {
  fill: none;
  outline: none;
  stroke: var(--line-strong);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  pointer-events: stroke;
}

.graph-edge:hover,
.graph-edge:focus-visible,
.graph-edge.is-selected,
.graph-edge.is-highlighted,
.graph-edge.is-related,
.graph-edge.is-impact,
.graph-edge.is-critical {
  stroke: var(--accent);
  stroke-width: 2;
}

.graph-edge:focus-visible {
  outline: none;
  stroke-width: 4;
}

.graph-edge.is-impact,
.graph-edge.is-critical {
  stroke: var(--critical);
}

.edge-arrow {
  fill: var(--line-strong);
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
  cursor: pointer;
}

.edge-label {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  text-anchor: middle;
  pointer-events: none;
}

.edge-label-bg {
  fill: var(--bg);
  stroke: var(--line);
  stroke-width: 0.5;
  pointer-events: none;
}

.graph-edge.is-dim,
.graph-edge.is-dimmed,
.edge-label.is-dimmed,
.edge-label-bg.is-dimmed {
  opacity: 0.2;
}

.service-node {
  --node-color: var(--unknown);
  cursor: pointer;
}

.service-node[data-status="healthy"] {
  --node-color: var(--healthy);
}

.service-node[data-status="degraded"] {
  --node-color: var(--degraded);
}

.service-node[data-status="critical"] {
  --node-color: var(--critical);
}

.node-card {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.node-status-bar {
  fill: var(--node-color);
}

.node-label,
.node-kind,
.node-metrics,
.node-status-label {
  fill: var(--text);
  font-family: var(--font-sans);
  text-anchor: start;
  pointer-events: none;
}

.node-label {
  font-size: 14px;
  font-weight: 650;
}

.node-kind {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.node-metrics {
  fill: var(--muted);
  font-size: 12px;
}

.node-status-label {
  fill: var(--node-color);
  font-size: 11px;
  font-weight: 650;
  text-anchor: end;
}

.service-node[data-kind="host"] {
  --node-color: var(--accent);
}

.host-symbol {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 1;
}

.service-node:hover .node-card,
.service-node:focus-visible .node-card,
.service-node.is-highlighted .node-card,
.service-node.is-search-match .node-card {
  stroke: var(--accent);
  stroke-width: 2;
}

.service-node.is-selected .node-card {
  fill: color-mix(in srgb, var(--surface) 94%, var(--accent));
  stroke: var(--accent);
  stroke-width: 2;
}

.service-node:focus-visible {
  outline: none;
}

.service-node:focus-visible .node-card {
  stroke-width: 3;
}

.service-node.is-dim,
.service-node.is-dimmed {
  opacity: 0.25;
}

.service-node.is-impact {
  --node-color: var(--critical);
}

.service-node.is-impact .node-card {
  stroke: var(--critical);
  stroke-width: 2;
}

.minimap-button {
  position: absolute;
  right: 12px;
  bottom: 56px;
  width: 112px;
  height: 88px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

#service-minimap {
  display: block;
  width: 100%;
  height: 100%;
}

.minimap-edge {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 3;
}

.minimap-node {
  fill: var(--unknown);
}

.minimap-node[data-status="healthy"] {
  fill: var(--healthy);
}

.minimap-node[data-status="degraded"] {
  fill: var(--degraded);
}

.minimap-node[data-status="critical"] {
  fill: var(--critical);
}

#minimap-viewport {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.map-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.map-controls button {
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.map-controls button:last-child {
  border-right: 0;
  font-size: 10px;
}

.map-controls button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.map-legend {
  position: absolute;
  bottom: 13px;
  left: 13px;
  display: flex;
  gap: 12px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 6px;
  height: 6px;
}

.healthy {
  background: var(--healthy);
}

.degraded {
  background: var(--degraded);
}

.critical {
  background: var(--critical);
}

.service-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.index-switch {
  display: flex;
  gap: 4px;
  padding: 0 8px 10px;
}

.index-switch button {
  flex: 1;
  min-width: 0;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.index-switch button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.neighborhood-row {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 62px;
  padding: 9px 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 14px;
}

.neighborhood-row:hover {
  background: var(--surface-2);
}

.neighborhood-row[aria-current="true"] {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

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

.rail-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 20px 16px 13px;
}

.rail-heading #service-count {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.severity-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0 12px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.severity-summary div {
  padding: 8px 6px;
  background: var(--surface-2);
  text-align: center;
}

.severity-summary strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
}

.severity-summary span {
  color: var(--faint);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.severity-summary .summary-healthy strong {
  color: var(--healthy);
}

.severity-summary .summary-degraded strong {
  color: var(--degraded);
}

.severity-summary .summary-critical strong {
  color: var(--critical);
}

.service-list,
.neighborhood-list,
.mobile-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 8px 14px;
  overflow: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.service-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.service-row:hover,
.service-row[aria-current="true"] {
  border-color: var(--line);
  background: var(--surface-2);
}

.service-row[hidden] {
  display: none;
}

.host-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  margin: 10px 0 2px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.host-heading:first-child {
  margin-top: 4px;
}

button.host-heading:hover,
.host-heading[aria-current="true"] {
  border-color: var(--line);
  background: var(--surface-2);
}

.host-name {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.host-count {
  color: var(--faint);
  font-size: 9px;
  white-space: nowrap;
}

.service-row-main {
  min-width: 0;
  margin-left: 8px;
}

.service-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-meta {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.service-health {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.mobile-list {
  position: absolute;
  inset: 0;
  height: auto;
  padding: 8px;
  background: var(--surface);
}

.disconnected-inventory {
  position: absolute;
  inset: 0;
  padding: 24px;
  overflow: auto;
  background: var(--bg);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.inventory-header {
  max-width: 660px;
  margin-bottom: 24px;
}

.inventory-header h2 {
  margin-bottom: 6px;
  font-size: 18px;
  font-weight: 600;
}

.inventory-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.disconnected-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  align-content: start;
  gap: 10px;
}

.disconnected-list .service-row {
  min-height: 76px;
  padding: 12px;
  border-color: var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.disconnected-list .service-row:hover,
.disconnected-list .service-row[aria-current="true"] {
  border-color: var(--accent);
  background: var(--surface-2);
}

.disconnected-list .service-name {
  overflow: visible;
  font-size: 13px;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.disconnected-list .service-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: normal;
}

.disconnected-list > .quiet {
  grid-column: 1 / -1;
}

.inspector-scrim {
  position: fixed;
  z-index: 39;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
}

.inspector {
  position: fixed;
  z-index: 40;
  top: 74px;
  right: 18px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(470px, calc(100vw - 36px));
  max-height: calc(100dvh - 94px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.985);
  transition: opacity 140ms ease, transform 140ms ease;
}

.inspector[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.inspector-header {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 15px 15px 12px;
}

.inspector-header h2 {
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-status {
  width: 9px;
  height: 9px;
}

.health-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.inspector-tabs button {
  padding: 10px 4px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--faint);
  font-size: 10px;
  font-weight: 750;
}

.inspector-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.inspector-body {
  min-height: 280px;
  padding: 16px;
  overflow: auto;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.stat-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
}

.stat-card.is-empty strong {
  color: var(--faint);
  font-weight: 500;
}

.resource-grid {
  grid-template-columns: repeat(3, 1fr);
}

.spark {
  display: block;
  width: 100%;
  height: 24px;
  margin-top: 6px;
}

.spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.spark circle {
  fill: var(--accent);
}

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

.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.host-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 650;
}

.host-chip::before {
  width: 6px;
  height: 6px;
  border: 1.5px solid var(--accent);
  border-radius: 1px;
  transform: rotate(45deg);
  content: "";
}

.host-chip:hover {
  border-color: var(--accent);
}

.service-status.host {
  border: 2px solid var(--accent);
  border-radius: 1px;
  background: transparent;
  transform: rotate(45deg);
}

.stat-card.is-critical strong {
  color: var(--critical);
}

.health-meter {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
}

.meter-track,
.score-track {
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.meter-fill,
.score-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.section {
  margin-top: 18px;
}

.section:first-child {
  margin-top: 0;
}

.section-title {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.quiet {
  color: var(--muted);
  font-size: 11px;
}

.alert-list,
.dependency-list,
.cause-list,
.affected-list,
.evidence-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.alert-list li {
  margin-top: 6px;
  padding: 8px 9px;
  border-left: 2px solid var(--critical);
  background: color-mix(in srgb, var(--critical) 8%, transparent);
  color: var(--muted);
  font-size: 11px;
}

.dependency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  padding: 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.dependency-row:hover {
  background: var(--surface-2);
}

.dependency-row strong {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.verb-frame {
  display: grid;
  align-content: start;
  min-height: 240px;
}

.verb-hint {
  max-width: 390px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
}

.tool-state {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.cause-list,
.affected-list {
  display: grid;
  gap: 8px;
}

.cause-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.cause-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 7px;
}

.cause-rank,
.cause-score {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 750;
}

.cause-service {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-list {
  margin-top: 9px;
  padding-left: 15px;
  color: var(--muted);
  font-size: 10px;
  list-style: disc;
}

.impact-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.impact-result-header p {
  margin: 0;
}

.inspector code {
  color: var(--accent);
  font-family: var(--font-mono);
}

.toast {
  position: fixed;
  z-index: 60;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 11px;
}

.noscript {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

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

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

@media (min-width: 1100px) {
  .has-inspector .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
    margin-right: 380px;
  }

  .has-inspector .inspector {
    top: 58px;
    right: 0;
    bottom: 0;
    width: 380px;
    max-height: none;
    border-width: 0 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .has-inspector .inspector-scrim {
    display: none;
  }
}

@media (max-width: 1200px) {
  .overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .has-inspector .map-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .has-inspector .map-toolbar .search-field {
    grid-column: 1 / -1;
    max-width: none;
  }
}

@media (max-width: 1050px) {
  .pulse-metrics > div {
    min-width: 76px;
    padding: 0 12px;
  }

  .pulse-db {
    display: none !important;
  }

  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .map-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .map-toolbar .search-field {
    grid-column: 1 / -1;
    max-width: none;
  }

  .map-toolbar .view-switch {
    display: none;
  }
}

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

  .system-overview {
    padding: 12px;
  }

  .overview-heading {
    flex-wrap: wrap;
  }

  .map-evidence-body {
    grid-template-columns: minmax(0, 1fr);
  }

  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
  }

  .pulse-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    min-height: 58px;
    padding: 9px 12px;
  }

  .brand {
    font-size: 11px;
  }

  .brand img {
    width: 25px;
    height: 25px;
  }

  .connection {
    justify-self: end;
  }

  .connection #connection-label {
    display: none;
  }

  .pulse-metrics {
    grid-column: 1 / -1;
    order: 4;
    width: 100%;
    height: 35px;
    border-top: 1px solid var(--line);
  }

  .pulse-metrics > div {
    min-width: 0;
    flex: 1 1 0;
    padding: 6px 9px 0;
  }

  .pulse-metrics > div:first-child {
    border-left: 0;
  }

  .pulse-metrics dt {
    font-size: 11px;
  }

  .pulse-metrics dd {
    margin-top: 0;
    font-size: 12px;
  }

  .pulse-db,
  .pulse-up,
  .coverage-badge,
  #refresh-button {
    display: none !important;
  }

  .header-actions {
    gap: 0;
  }

  .connect-menu summary {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .connect-menu summary span {
    display: none;
  }

  .workspace {
    display: block;
    min-height: 0;
  }

  .map-panel {
    height: calc(100dvh - 103px);
    min-height: 0;
  }

  .map-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 12px 10px;
  }

  .map-toolbar h1 {
    font-size: 20px;
  }

  .map-toolbar .view-switch {
    display: flex;
  }

  .search-field {
    grid-column: 1 / -1;
    max-width: none;
  }

  .impact-banner {
    margin: 8px 12px;
  }

  .map-stage {
    margin: 0;
  }

  .map-scope {
    gap: 8px;
    padding: 0 12px 12px;
  }

  .map-summary {
    font-size: 11px;
  }

  .scope-field {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .scope-field select {
    flex: 1 1 auto;
    max-width: calc(100% - 88px);
    height: 36px;
  }

  .scope-action {
    min-height: 36px;
  }

  .inventory-action {
    margin-left: 0;
    text-align: left;
  }

  .disconnected-inventory {
    padding: 18px 12px;
  }

  .inventory-header {
    margin-bottom: 18px;
  }

  .inventory-header h2 {
    font-size: 17px;
  }

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

  .service-rail {
    display: none;
  }

  .map-legend {
    display: none;
  }

  .minimap-button {
    display: none;
  }

  .service-row {
    min-height: 56px;
  }

  .inspector-scrim:not([hidden]) {
    display: block;
  }

  .inspector {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(84dvh, 720px);
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
    transform: translateY(24px);
  }

  .inspector-header {
    padding-top: 18px;
  }

  .inspector-header::before {
    position: absolute;
    top: 7px;
    left: calc(50% - 22px);
    width: 44px;
    height: 3px;
    border-radius: 99px;
    background: var(--line-strong);
    content: "";
  }

  .inspector-body {
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .pulse-metrics > div:nth-child(2) {
    display: none;
  }

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

  .resource-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .inspector-tabs {
    overflow-x: auto;
  }

  .inspector-tabs button {
    min-width: 76px;
  }
}

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

@media (prefers-contrast: more) {
  :root {
    --line: #3b4556;
    --line-strong: #58667a;
    --faint: #a8b0bd;
  }

  [data-theme="light"] {
    --line: #aeb7c5;
    --line-strong: #808c9e;
    --faint: #465164;
  }
}
