:root {
  --canvas: #10151d;
  --panel: #171e29;
  --panel-raised: #1d2634;
  --border: #2c3747;
  --text: #ecf2fa;
  --muted: #9aa8bb;
  --accent: #77c8ff;
  --create: #4cce93;
  --update: #f2bd5c;
  --replace: #f58e68;
  --delete: #ed6675;
  --read: #9e8cff;
  --noop: #718096;
  --radius: 10px;
  color: var(--text);
  background: var(--canvas);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 900px;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
}

button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}

.topbar {
  min-height: 86px;
  padding: 17px 24px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #141b25;
}

.plan-loader {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.plan-loader input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font: inherit;
}

.upload-button:hover,
.upload-button:focus-visible {
  border-color: var(--accent);
}

#upload-status {
  color: var(--muted);
  font-size: 0.85rem;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 0;
  font-size: 1.25rem;
}
h2 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}
h3 {
  margin: 16px 0 7px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}
.summary-chip,
.badge,
.dependency,
.action-filter {
  border-radius: 999px;
}
.summary-chip {
  padding: 4px 9px;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--panel-raised);
  font-size: 0.76rem;
  white-space: nowrap;
}

.layout {
  height: calc(100vh - 86px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(420px, 1fr) minmax(
      310px,
      390px
    );
}

.left-panel,
.details {
  min-width: 0;
  overflow: auto;
  background: var(--panel);
}
.left-panel {
  padding: 19px 16px;
  border-right: 1px solid var(--border);
}
.details {
  padding: 20px;
  border-left: 1px solid var(--border);
}

.search-label,
.filter-heading {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.search-label {
  margin-bottom: 7px;
}
#search {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  color: var(--text);
  background: #101720;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #77c8ff24;
}

.filter-heading {
  margin: 20px 0 8px;
  display: flex;
  justify-content: space-between;
}
.text-button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 0.73rem;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.action-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.74rem;
  user-select: none;
}
.action-filter input {
  margin: 0;
  accent-color: var(--accent);
}
.result-count {
  margin: 17px 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.tree details {
  border-top: 1px solid #243041;
}
.tree summary {
  padding: 8px 3px;
  color: #c4d0df;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 650;
}
.tree summary small {
  color: var(--muted);
  font-weight: 500;
}
.tree-branch {
  padding-left: 11px;
}
.resource-button {
  width: 100%;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 5px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  border-radius: 5px;
}
.resource-button:hover,
.resource-button.is-selected {
  background: #27364a;
}
.resource-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}
.status-dot {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--noop);
}

.graph-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #111821;
}
.graph-toolbar {
  min-height: 53px;
  padding: 9px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.focus-controls {
  display: flex;
  gap: 5px;
  align-items: center;
}
.focus-controls > span {
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}
.focus-controls button {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.74rem;
}
.focus-controls button.is-active,
.focus-controls button:hover {
  color: var(--text);
  border-color: var(--accent);
  background: #223348;
}
.instructions {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.graph-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
}
#graph {
  width: 100%;
  height: 100%;
  display: block;
  background-image: radial-gradient(#31405270 1px, transparent 1px);
  background-size: 20px 20px;
  cursor: grab;
  touch-action: none;
}
#graph.is-panning {
  cursor: grabbing;
}
#graph.is-panning .graph-node {
  cursor: grabbing;
}
.graph-edge {
  stroke: #64748b;
  stroke-width: 1.5;
  opacity: 0.65;
  marker-end: url(#arrow);
}
.graph-node {
  cursor: pointer;
}
.graph-node rect {
  stroke: #59697e;
  stroke-width: 1.5;
  fill: #202b3a;
  transition:
    fill 0.12s,
    stroke 0.12s,
    stroke-width 0.12s;
}
.graph-node:hover rect,
.graph-node.is-selected rect,
.graph-node:focus-visible rect {
  stroke: var(--accent);
  stroke-width: 3;
  fill: #283a51;
}
.graph-node rect.action-create {
  stroke: var(--create);
}
.graph-node rect.action-update {
  stroke: var(--update);
}
.graph-node rect.action-replace {
  stroke: var(--replace);
}
.graph-node rect.action-delete {
  stroke: var(--delete);
}
.graph-node rect.action-read {
  stroke: var(--read);
}
.graph-node rect.action-forget {
  stroke: #cc81e9;
}
.graph-node text {
  pointer-events: none;
  fill: #edf4fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}
.graph-node .node-action {
  fill: #b5c4d8;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.graph-node .node-drift {
  fill: #dc9cff;
  font-size: 13px;
}
.empty-graph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}
.empty-graph[hidden] {
  display: none;
}
.legend {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.71rem;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--noop);
}

.action-create,
.status-dot.action-create,
.swatch.action-create {
  background: var(--create);
}
.action-update,
.status-dot.action-update,
.swatch.action-update {
  background: var(--update);
}
.action-replace,
.status-dot.action-replace,
.swatch.action-replace {
  background: var(--replace);
}
.action-delete,
.status-dot.action-delete,
.swatch.action-delete {
  background: var(--delete);
}
.action-read,
.status-dot.action-read {
  background: var(--read);
}
.action-forget,
.status-dot.action-forget {
  background: #cc81e9;
}
.action-no-op,
.status-dot.action-no-op,
.swatch.action-no-op {
  background: var(--noop);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  color: #071017;
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--noop);
}
.badge.action-no-op {
  color: white;
}
.drift-badge {
  margin-left: 5px;
  color: #edcbff;
  font-size: 0.71rem;
}
.address {
  margin: 7px 0 16px;
  color: #c9d7e8;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  line-height: 1.5;
}
.metadata {
  display: grid;
  grid-template-columns: minmax(95px, 0.65fr) minmax(0, 1fr);
  gap: 6px 9px;
  margin-bottom: 14px;
  font-size: 0.76rem;
}
.metadata dt {
  color: var(--muted);
}
.metadata dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}
.detail-actions {
  display: flex;
  gap: 6px;
  margin: 14px 0 16px;
}
.detail-actions button,
.dependency {
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #d6e4f3;
  background: var(--panel-raised);
  font-size: 0.73rem;
}
.detail-actions button:hover,
.dependency:hover {
  border-color: var(--accent);
}
.neighbors {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.neighbors-title {
  margin: 13px 0 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.changes {
  margin-top: 18px;
  border-top: 1px solid var(--border);
}
.change {
  border-bottom: 1px solid var(--border);
}
.change-path {
  margin: 0;
  padding: 9px 0 6px;
  color: #d6e0ee;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 650;
}
.value-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 0 10px;
}
.value-pair strong {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.64rem;
  text-transform: uppercase;
}
pre {
  max-height: 300px;
  margin: 0;
  padding: 9px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #d8e4f1;
  background: #101720;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.69rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.details > details {
  margin-top: 18px;
  border-top: 1px solid var(--border);
}
.details > details summary {
  padding: 10px 0;
  color: #d6e0ee;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 650;
}
.generated {
  white-space: pre-wrap;
}
.empty-details {
  color: var(--muted);
}
.empty-details h2 {
  color: var(--text);
}

@media (max-width: 1150px) {
  .layout {
    grid-template-columns: 250px minmax(390px, 1fr) 310px;
  }
  .instructions {
    display: none;
  }
}
