:root {
  --bg: #0b0f14;
  --panel: #111821;
  --panel-2: #16212d;
  --line: #253344;
  --text: #e8edf2;
  --muted: #93a4b7;
  --soft: #c1ccd8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --gray: #94a3b8;
  --blue: #60a5fa;
  --focus: #a7f3d0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  font-weight: 700;
}

h2 {
  margin-bottom: 10px;
  font-size: 16px;
}

h3 {
  margin-bottom: 8px;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.segment {
  min-height: 34px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
}

.icon-button:hover,
.segment:hover,
.node-button:hover {
  border-color: var(--blue);
}

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

.metric {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 14px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.metric-warn strong {
  color: var(--amber);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(560px, 1fr) 340px;
  gap: 14px;
  height: calc(100vh - 148px);
  min-height: 680px;
}

.sidebar,
.map-panel,
.detail-drawer {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}

.sidebar,
.detail-drawer {
  padding: 16px;
}

.panel-section {
  margin-bottom: 22px;
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  padding: 0 8px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segment.active {
  border-color: var(--blue);
  background: #10243c;
}

.registry-panel {
  margin-bottom: 0;
}

.registry-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.node-button {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.node-button strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.node-button span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.map-panel {
  display: flex;
  flex-direction: column;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

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

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 999px;
}

.governed {
  background: var(--green);
}

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

.blocker {
  background: var(--red);
}

.retired {
  background: var(--gray);
}

.map-canvas {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #0c1219;
}

#environmentMap {
  width: 100%;
  height: 100%;
  display: block;
}

.edge {
  stroke: #405268;
  stroke-width: 1.4;
}

.edge-label {
  fill: var(--muted);
  font-size: 11px;
}

.map-node {
  cursor: pointer;
}

.node-ring {
  stroke-width: 2.5;
}

.node-card {
  fill: #121c27;
  stroke: var(--line);
  stroke-width: 1.5;
  rx: 8;
}

.node-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
}

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

.drawer-empty {
  color: var(--muted);
}

.drawer-content.hidden,
.drawer-empty.hidden {
  display: none;
}

.drawer-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.drawer-header h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--text);
  font-size: 12px;
  text-transform: capitalize;
}

.status-pill.governed {
  border-color: rgba(52, 211, 153, 0.55);
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
}

.status-pill.warning {
  border-color: rgba(251, 191, 36, 0.55);
  color: var(--amber);
  background: rgba(251, 191, 36, 0.1);
}

.status-pill.blocker {
  border-color: rgba(251, 113, 133, 0.55);
  color: var(--red);
  background: rgba(251, 113, 133, 0.1);
}

.status-pill.retired {
  border-color: rgba(148, 163, 184, 0.55);
  color: var(--gray);
  background: rgba(148, 163, 184, 0.1);
}

.detail-list {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 10px;
  margin: 0 0 16px;
  font-size: 13px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  color: var(--soft);
  overflow-wrap: anywhere;
}

.drawer-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.drawer-section p,
.drawer-section li {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.45;
}

.drawer-section ul {
  padding-left: 18px;
  margin-bottom: 0;
}

@media (max-width: 1180px) {
  body {
    min-width: 960px;
  }

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