:root {
  color-scheme: dark;
  --bg: #09090b;
  --bg-elev: #0f0f12;
  --surface: #16161a;
  --surface-2: #1f1f24;
  --glass: rgba(15, 15, 18, 0.84);
  --glass-strong: rgba(18, 18, 22, 0.94);
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --dot-color: rgba(255, 255, 255, 0.075);
  --accent: #f2542d;
  --accent-strong: #ff6b42;
  --accent-soft: rgba(242, 84, 45, 0.13);
  --accent-glow: rgba(255, 107, 66, 0.34);
  --tint: rgba(242, 84, 45, 0.10);
  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.08);
  --green-line: rgba(74, 222, 128, 0.22);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.08);
  --red-line: rgba(248, 113, 113, 0.22);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.08);
  --amber-line: rgba(251, 191, 36, 0.22);
  --cyan: #38bdf8;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.48);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.65);

  /* Canvas frames & hardware symbols */
  --vpc-bg: rgba(255, 255, 255, 0.018);
  --vpc-line: rgba(255, 255, 255, 0.10);
  --subnet-bg: rgba(255, 255, 255, 0.028);
  --subnet-line: rgba(255, 255, 255, 0.09);
  --hw-ink: #e4e4e7;
  --hw-surface: #141418;
  --hw-solid: #242429;
  --hw-mid: #71717a;
  --hw-glyph: #fafafa;
  --hw-signal: #ff6b42;
  --wire: #62626b;
  --wire-attach: #4a4a52;
  --wire-label-bg: #121215;
  --wire-label-line: #27272c;

  /* Miniatures */
  --art-ink: #27272d;
  --art-light: #16161a;
  --art-stroke: #3f3f46;
  --art-accent: #ff6b42;
  --art-glyph: #f4f4f5;

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --glass: rgba(255, 255, 255, 0.88);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --ink: #18181b;
  --muted: #52525b;
  --faint: #71717a;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --dot-color: rgba(0, 0, 0, 0.11);
  --accent: #e0461e;
  --accent-strong: #c83a15;
  --accent-soft: rgba(224, 70, 30, 0.09);
  --accent-glow: rgba(224, 70, 30, 0.22);
  --tint: rgba(224, 70, 30, 0.08);
  --green: #15803d;
  --green-bg: rgba(21, 128, 61, 0.06);
  --green-line: rgba(21, 128, 61, 0.20);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.06);
  --red-line: rgba(220, 38, 38, 0.20);
  --amber: #b45309;
  --amber-bg: rgba(180, 83, 9, 0.06);
  --amber-line: rgba(180, 83, 9, 0.20);
  --cyan: #0284c7;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.14);

  --vpc-bg: rgba(0, 0, 0, 0.02);
  --vpc-line: #d4d4d8;
  --subnet-bg: #ffffff;
  --subnet-line: #e4e4e7;
  --hw-ink: #18181b;
  --hw-surface: #ffffff;
  --hw-solid: #18181b;
  --hw-mid: #71717a;
  --hw-glyph: #ffffff;
  --hw-signal: #e0461e;
  --wire: #9ca3af;
  --wire-attach: #b4b4bd;
  --wire-label-bg: #ffffff;
  --wire-label-line: #e4e4e7;

  --art-ink: #27272a;
  --art-light: #fafafa;
  --art-stroke: #d4d4d8;
  --art-accent: #e0461e;
  --art-glyph: #ffffff;
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button { color: inherit; }
button:disabled { opacity: 0.36; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 1.5px solid var(--accent-strong);
  outline-offset: 2px;
}
button, summary, input, textarea, select { -webkit-tap-highlight-color: transparent; }
p, h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
svg { width: 16px; height: 16px; display: block; flex: none; }
[data-icon] { display: inline-flex; flex: none; align-items: center; justify-content: center; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

/* ── Single-Row Topbar ──────────────────────────────────── */
.topbar {
  height: 46px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
  position: relative;
  z-index: 6;
}
.top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #141416;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fafafa;
}
.brand-icon svg { width: 22px; height: 22px; }
.breadcrumb {
  display: flex;
  align-items: center;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.stack-menu { position: relative; }
.stack-menu summary { list-style: none; }
.stack-menu summary::-webkit-details-marker { display: none; }
.stack-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  margin: -4px -4px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
  white-space: nowrap;
  max-width: 240px;
}
.stack-trigger:hover, .stack-menu[open] .stack-trigger { background: var(--surface-2); }
.stack-trigger > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.stack-trigger svg { width: 12px; height: 12px; color: var(--faint); }
.stack-dropdown { left: 0; right: auto; top: 32px; width: 214px; }

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  font: 530 12px/1 inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--muted);
  white-space: nowrap;
}
.health-pill:hover { background: var(--surface-2); color: var(--ink); }
.health-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); flex: none; }
.health-pill.ok { color: var(--muted); }
.health-pill.ok .health-dot { background: var(--green); }
.health-pill.bad { color: var(--ink); }
.health-pill.bad .health-dot { background: var(--red); }
.health-pill.warn { color: var(--ink); }
.health-pill.warn .health-dot { background: var(--amber); }

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
}
.view-switch button {
  min-height: 24px;
  border: 0;
  border-radius: 6px;
  padding: 2px 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 550;
  font-size: 11.5px;
}
.view-switch button[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 620;
}
.view-switch button:hover:not([aria-pressed="true"]) { color: var(--ink); }

.cmd-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.cmd-trigger:hover { border-color: var(--line-strong); color: var(--ink); }
.cmd-trigger kbd, .cmd-search kbd {
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--muted);
}
.cmd-search kbd { padding: 2px 5px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); }

.save-status { display: inline-flex; align-items: center; margin-inline: 5px; color: var(--muted); font-size: 11px; }
.save-status i { display: inline-block; width: 5px; height: 5px; background: var(--green); border-radius: 50%; opacity: 0.85; }

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  white-space: nowrap;
}
.tool.icon-only { width: 28px; padding: 0; }
.tool svg { width: 15px; height: 15px; }
.tool:hover:not(:disabled), .tool[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
.tool[aria-pressed="true"] { color: var(--accent-strong); background: var(--accent-soft); }

.file-menu { position: relative; }
.file-menu summary { list-style: none; }
.file-menu summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute;
  right: 0;
  top: 36px;
  width: 204px;
  padding: 5px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  border-radius: 10px;
  z-index: 20;
}
.menu-label { padding: 5px 8px 3px; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 3px; }
.menu button {
  display: block;
  text-align: left;
  padding: 6px 8px;
  width: 100%;
  border: 0;
  background: none;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink);
}
.menu button:hover { background: var(--accent-soft); color: var(--accent-strong); }

/* ── Workspace & Sidebars ───────────────────────────────── */
.workspace { height: calc(100dvh - 46px); display: flex; min-height: 0; position: relative; }
.library, .inspector { background: var(--bg-elev); display: flex; flex-direction: column; min-height: 0; z-index: 4; }
.library { width: 224px; flex: none; border-right: 1px solid var(--line); }
.inspector { width: 292px; flex: none; border-left: 1px solid var(--line); }
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px 14px; }
.pane-head h2 { margin: 0; font-size: 14px; font-weight: 640; letter-spacing: -0.02em; }

.cloud-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}
.library .cloud-switch { margin: 0 12px 8px; align-self: flex-start; }
.cloud-switch button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 540;
}
.cloud-switch button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); font-weight: 620; }

.search {
  margin: 0 12px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 14px; height: 14px; }
.search input { width: 100%; min-width: 0; border: 0; padding: 2px 0; background: none; color: var(--ink); font-size: 12.5px; }
.search input:focus-visible { outline: none; }

.palette { flex: 1; overflow: auto; padding: 0 8px 10px; }
.palette h3 { color: var(--faint); margin: 12px 6px 4px; font-size: 10.5px; font-weight: 620; text-transform: uppercase; letter-spacing: 0.06em; }
.palette button {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  width: 100%;
  border: 1px solid transparent;
  padding: 5px 6px;
  background: none;
  min-height: 33px;
  border-radius: 7px;
  font-size: 12.5px;
  white-space: nowrap;
  touch-action: none;
}
.palette button:hover { border-color: var(--line); background: var(--surface); }
.catalog-name { display: grid; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.22; gap: 1px; }
.catalog-name strong { font-size: 12px; font-weight: 560; }
.catalog-name small, .native-type small { font-size: 10px; color: var(--faint); }
.catalog-pages { display: flex; align-items: center; justify-content: space-between; color: var(--muted); padding: 4px; }
.catalog-pages button { width: auto; }
.library-foot { display: flex; border-top: 1px solid var(--line); }
.catalog-coverage {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 8px 10px;
  font-size: 11.5px;
  text-align: center;
  color: var(--muted);
}
.catalog-coverage:last-child { border-right: 0; }
.catalog-coverage:hover { background: var(--surface); color: var(--ink); }

.icon-tile { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--kind-color, var(--accent-strong)); background: var(--kind-bg, var(--accent-soft)); flex: none; }
.icon-tile svg { width: 13px; height: 13px; }
.kind-vpc, .kind-subnet { --kind-color: #ff6b42; --kind-bg: rgba(242, 84, 45, 0.13); }
.kind-alb { --kind-color: #fb923c; --kind-bg: rgba(251, 146, 60, 0.13); }
.kind-app { --kind-color: #e4e4e7; --kind-bg: rgba(228, 228, 231, 0.11); }
.kind-db { --kind-color: #38bdf8; --kind-bg: rgba(56, 189, 248, 0.13); }
.kind-bucket { --kind-color: #34d399; --kind-bg: rgba(52, 211, 153, 0.14); }
.kind-sg { --kind-color: #fbbf24; --kind-bg: rgba(251, 191, 36, 0.14); }
.kind-role { --kind-color: #f472b6; --kind-bg: rgba(244, 114, 182, 0.14); }
[data-theme="light"] .kind-vpc, [data-theme="light"] .kind-subnet { --kind-color: #e0461e; --kind-bg: #fff2ee; }
[data-theme="light"] .kind-alb { --kind-color: #c2410c; --kind-bg: #fff7ed; }
[data-theme="light"] .kind-app { --kind-color: #27272a; --kind-bg: #f4f4f5; }
[data-theme="light"] .kind-db { --kind-color: #0284c7; --kind-bg: #f0f9ff; }
[data-theme="light"] .kind-bucket { --kind-color: #047857; --kind-bg: #ecfdf5; }
[data-theme="light"] .kind-sg { --kind-color: #b45309; --kind-bg: #fffbeb; }
[data-theme="light"] .kind-role { --kind-color: #be185d; --kind-bg: #fdf2f8; }

/* ── Workbench & Canvas ─────────────────────────────────── */
.workbench {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  min-width: 0;
  min-height: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
}

.canvas-bar {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.canvas-bar > * { pointer-events: auto; }
.canvas-mid { display: flex; align-items: center; gap: 6px; }
.canvas-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.zone-trigger, .zone-pill {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  color: var(--amber);
  box-shadow: var(--shadow-sm);
}
.zone-pill { background: var(--amber-bg); border-color: var(--amber-line); font-size: 11.5px; font-weight: 600; padding: 0 9px; }
.zone-trigger:hover { background: var(--amber-bg); border-color: var(--amber-line); }

.traffic-toggle { position: relative; }
.traffic-dot {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: var(--faint);
}
.traffic-toggle[aria-pressed="true"] .traffic-dot { background: var(--accent-strong); }
.policy-toggle { position: relative; }
.policy-dot {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: var(--faint);
}
.policy-toggle[aria-pressed="true"] { color: var(--accent-strong); }
.policy-toggle[aria-pressed="true"] .policy-dot { background: var(--accent-strong); }
.policy-callout {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 4;
  animation: callout-in 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.14s;
}
.policy-callout[hidden] { display: none; }
.policy-callout:hover { border-color: var(--accent-strong); }
.policy-callout::before {
  content: "";
  position: absolute;
  top: -5px;
  right: calc(var(--caret-right, 45px) - 4px);
  width: 8px;
  height: 8px;
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
  transition: border-color 0.14s;
}
.policy-callout:hover::before { border-color: var(--accent-strong); }
.policy-callout kbd {
  font: 600 10.5px ui-monospace, monospace;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.policy-callout[data-leaving] { opacity: 0; transform: translateY(-3px); pointer-events: none; }
@keyframes callout-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.labels-toggle { font: 600 11px ui-monospace, monospace; }

/* ── Playground Strip & Fault Banner ────────────────────── */
.play-dock {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 6px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 140px);
}
.play-dock > * { pointer-events: auto; }
.workbench[data-chat-offline] .play-dock {
  top: auto;
  bottom: 14px;
}
.workbench[data-chat-offline] .chat-dock { display: none; }
.workbench[data-empty] .play-dock { display: none; }

.play-bar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
  flex-wrap: nowrap;
  justify-content: center;
}
.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.1s;
}
.play-btn:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.play-btn:active { transform: scale(0.97); }
.play-btn svg { width: 13px; height: 13px; color: var(--muted); }
.play-btn[data-active="true"] {
  background: var(--red-bg);
  border-color: transparent;
  color: var(--red);
}
.play-btn[data-active="true"] svg { color: var(--red); }
.play-btn[data-kind="zone"][data-active="true"] {
  background: var(--amber-bg);
  border-color: transparent;
  color: var(--amber);
}
.play-btn[data-kind="zone"][data-active="true"] svg { color: var(--amber); }
.play-btn[data-kind="node-down"][data-active="true"] {
  background: var(--amber-bg);
  border-color: transparent;
  color: var(--amber);
}
.play-btn[data-kind="node-down"][data-active="true"] svg { color: var(--amber); }
.fault-more { position: relative; }
.fault-more summary { list-style: none; cursor: pointer; }
.fault-more summary::-webkit-details-marker { display: none; }
.play-more-btn { padding: 0 7px; gap: 3px; font-variant-numeric: tabular-nums; }
.play-more-btn svg { width: 11px; height: 11px; transition: transform 0.14s ease; }
.fault-more[open] .play-more-btn { background: var(--surface-2); color: var(--ink); }
.fault-more[open] .play-more-btn svg { transform: rotate(180deg); }
.fault-menu {
  position: absolute;
  right: 0;
  top: 32px;
  width: 210px;
  max-height: min(56dvh, 360px);
  overflow-y: auto;
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  z-index: 20;
}
.fault-menu-group + .fault-menu-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.fault-menu-item, .fault-menu-reset {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.fault-menu-item svg { width: 13px; height: 13px; color: var(--muted); flex: none; }
.fault-menu-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fault-menu-item:hover { background: var(--surface-2); }
.fault-menu-item[data-active="true"] { background: var(--red-bg); color: var(--red); }
.fault-menu-item[data-active="true"] svg { color: var(--red); }
.fault-menu-item[data-kind="zone"][data-active="true"],
.fault-menu-item[data-kind="node-down"][data-active="true"] { background: var(--amber-bg); color: var(--amber); }
.fault-menu-item[data-kind="zone"][data-active="true"] svg,
.fault-menu-item[data-kind="node-down"][data-active="true"] svg { color: var(--amber); }
.fault-menu-reset { color: var(--muted); font-size: 11.5px; justify-content: center; }
.fault-menu-reset:hover { background: var(--surface-2); color: var(--ink); }
.play-sep { width: 1px; height: 16px; background: var(--line); margin: 0 2px; }
.play-card-btn { background: transparent; color: var(--muted); }
.play-card-btn:hover { color: var(--ink); background: var(--surface-2); }

.fault-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 6px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  max-width: min(640px, 92vw);
}
.fault-banner[hidden] { display: none; }
.fault-banner-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 520;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.fault-banner-main::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}
.fault-banner.warn .fault-banner-main::before { background: var(--amber); }
.fault-banner-main:hover { background: var(--surface-2); }
.fault-banner-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-fix-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: none;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid rgba(242, 84, 45, 0.34);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ai-fix-btn svg { width: 11px; height: 11px; flex: none; }
.ai-fix-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ai-fix-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ai-fix-btn[hidden] { display: none; }
.ai-fix-btn.compact { min-height: 22px; padding: 2px 6px; font-size: 10.5px; }
.finding-actions .ai-fix-btn.compact { min-height: 24px; padding: 2px 7px; font-size: 11px; }
.ai-fix-btn.panel-fix { min-height: 30px; padding: 5px 10px; border-radius: 7px; font-size: 12px; }
.ai-fix-btn.panel-fix svg { width: 13px; height: 13px; }

.viewport {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: auto;
  padding: 48px 24px 104px;
  cursor: default;
}
.viewport.panning, .viewport.pan-ready { cursor: grab; }
.viewport.panning { cursor: grabbing; user-select: none; }
.viewport[data-dropping] { box-shadow: inset 0 0 0 2px var(--accent); }

.stage { position: relative; flex: none; margin: auto; transform-origin: 0 0; isolation: isolate; }
.stage > div { position: absolute; inset: 0; pointer-events: none; }
#frames { z-index: 0; }
#nodes { z-index: 2; }
.edges, .connect-preview { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 1; pointer-events: none; }
.connect-preview { z-index: 4; }
.connect-preview path { fill: none; stroke: var(--accent-strong); stroke-width: 2; stroke-dasharray: 5 4; }

.stage-caption {
  position: absolute;
  top: 24px;
  left: 17px;
  color: var(--faint);
  font: 600 10px ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Frames ─────────────────────────────────────────────── */
.frame {
  position: absolute;
  border: 1px solid var(--vpc-line);
  background: var(--vpc-bg);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.frame.subnet {
  background: var(--subnet-bg);
  border: 1px solid var(--subnet-line);
  border-radius: 9px;
}
.frame-title {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12.5px;
  text-align: left;
  max-width: 100%;
  cursor: grab;
  color: var(--ink);
}
.frame-title .icon-tile { height: 20px; width: 20px; border-radius: 5px; }
.frame-title .icon-tile svg { width: 11px; height: 11px; }
.frame-title strong, .node-text strong { overflow: hidden; text-overflow: ellipsis; }
.frame-title small { font: 500 10px ui-monospace, monospace; color: var(--faint); flex-shrink: 0; }
.subnet .frame-title {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 2px 7px;
  width: 100%;
  padding: 9px 10px;
  font-size: 11.5px;
}
.subnet .frame-title .icon-tile { grid-row: 1 / span 2; }
.subnet .frame-title strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.subnet .frame-title small { grid-column: 2; }
.zone-mark {
  position: absolute;
  bottom: 7px;
  right: 10px;
  left: auto;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--faint);
  font: 550 9.5px/12px ui-monospace, monospace;
  pointer-events: none;
}
.frame.selected { border-color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-soft); }
.frame.drop-target { outline: 1.5px solid var(--accent-strong); outline-offset: -2px; background: var(--accent-soft); }
.zone-affected { outline: 1.5px dashed var(--amber); outline-offset: 2px; }
.resource-node.offline-node { outline: 1.5px dashed var(--red); outline-offset: 3px; border-radius: 10px; }
.resource-node.offline-node .machine-art { opacity: 0.45; filter: grayscale(0.4); }
body.tab-hidden *, body.tab-hidden *::before, body.tab-hidden *::after { animation-play-state: paused !important; }

/* ── Wires & Packets ────────────────────────────────────── */
.edges path.edge { fill: none; stroke: var(--wire); stroke-width: 1.35; stroke-linejoin: round; transition: stroke 0.14s, stroke-width 0.14s; }
.edges path.attachment { fill: none; stroke: var(--wire-attach); stroke-width: 1.1; stroke-dasharray: 4 4; opacity: 0.7; }
.edges path.trace { stroke: var(--accent-strong); stroke-width: 2; }
.edges path.trace-blocked { stroke: var(--red); stroke-width: 2.1; }
.edges path.trace-unknown { stroke: var(--amber); stroke-width: 1.9; }
.edges path.replication { stroke: var(--cyan); stroke-dasharray: 4 4; stroke-width: 1.35; }
.edges path.replication-live { animation: replica-march 1.6s linear infinite; }
.edges .replica-pulse { fill: var(--cyan); opacity: 0.72; pointer-events: none; }
@keyframes replica-march { from { stroke-dashoffset: 16; } to { stroke-dashoffset: 0; } }
.edges .packet { fill: var(--accent-strong); }
.edges .packet.stopped { fill: var(--red); }
.traffic-leg.intent .packet { fill: var(--cyan); }

.edge-label rect { fill: var(--wire-label-bg); stroke: var(--wire-label-line); rx: 4; stroke-width: 1; }
.edge-label text { fill: var(--muted); font: 550 9.5px ui-monospace, monospace; text-anchor: middle; dominant-baseline: middle; }
.edge-label.active rect { fill: var(--wire-label-bg); stroke: var(--accent-strong); }
.edge-label.active text { fill: var(--accent-strong); }
.edge-label.blocked rect { fill: var(--wire-label-bg); stroke: var(--red); }
.edge-label.blocked text { fill: var(--red); }

.boundary-marker circle { fill: var(--bg-elev); stroke: var(--red); stroke-width: 1.5; }
.boundary-marker path { fill: none; stroke: var(--red); stroke-width: 1.5; stroke-linecap: round; }

.wire-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.wire-hit:focus { outline: none; }
.wire:has(.wire-hit:is(:hover, :focus-visible)) .edge { stroke: var(--accent-strong); stroke-width: 2.2; }

.wire-detail {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  max-width: min(280px, 80vw);
  padding: 6px 9px;
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 7px;
  font-size: 11.5px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 2px;
}
.wire-detail-route { font-weight: 600; }
.wire-detail-meta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.wire-badge { padding: 1px 5px; border-radius: 4px; font-weight: 600; font-size: 9.5px; text-transform: uppercase; }
.wire-badge.allowed { background: var(--green-bg); color: var(--green); }
.wire-badge.blocked { background: var(--red-bg); color: var(--red); }
.wire-badge.unknown { background: var(--amber-bg); color: var(--amber); }
.wire-badge.intent { background: var(--accent-soft); color: var(--accent-strong); }

/* ── Surgical Node Styling & Hardware Symbols ───────────── */
.stage .node.resource-node {
  pointer-events: auto;
  position: absolute;
  display: grid;
  grid-template: 48px max-content / 1fr;
  align-content: center;
  justify-items: center;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  cursor: grab;
  touch-action: none;
}
.stage .node.resource-node::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.14s, background 0.14s;
}
.stage .node.resource-node:hover::before {
  border-color: var(--line);
  background: rgba(128, 128, 140, 0.04);
}
.stage .node.resource-node.selected::before {
  border-color: var(--accent-strong);
  background: rgba(242, 84, 45, 0.06);
}
.stage .node.resource-node.trace-node .machine {
  filter: drop-shadow(0 0 7px var(--accent-glow));
}
.stage .node.resource-node.blocked-node .machine {
  filter: drop-shadow(0 0 7px rgba(251, 113, 133, 0.4));
}
.stage .node.resource-node.connect-target::before {
  border-color: var(--green);
  background: var(--green-bg);
}

.connect-handle {
  position: absolute;
  right: -5px;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent-strong);
  border: 2px solid var(--bg);
  opacity: 0;
  transform: translateY(-50%) scale(0.75);
  cursor: crosshair;
  pointer-events: auto;
  transition: opacity 0.14s, transform 0.14s;
  z-index: 3;
}
.stage .node.resource-node:hover .connect-handle,
.stage .node.resource-node.selected .connect-handle,
.connect-handle:hover { opacity: 1; transform: translateY(-50%) scale(1); }
.connect-handle:hover { transform: translateY(-50%) scale(1.22); }

.stage .resource-node .node-text {
  position: relative;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 1px;
  max-width: calc(100% - 4px);
  padding: 2px 3px;
}
.stage .resource-node .node-text strong {
  font-size: 12.5px;
  font-weight: 590;
  letter-spacing: -0.015em;
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.stage .resource-node .node-text small {
  color: var(--faint);
  font: 500 10px/1.25 ui-monospace, monospace;
  white-space: normal;
  overflow-wrap: anywhere;
}
.stage .resource-node:is(.trace-node, .selected) .node-text strong { color: var(--accent-strong); }
.stage .resource-node.blocked-node .node-text strong { color: var(--red); }

.machine-bay { position: relative; width: 100%; height: 100%; pointer-events: none; display: block; }
.machine {
  --ink: var(--hw-ink);
  --mid: var(--hw-mid);
  --line: var(--hw-mid);
  --pale: var(--hw-surface);
  --signal: var(--hw-signal);
  position: absolute;
  inset: 50% auto auto 50%;
  width: 100px;
  height: 62px;
  transform: translate(-50%, -50%) scale(var(--scale));
  color: var(--ink);
}
.machine-symbol { display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); box-sizing: border-box; }
.machine i { position: absolute; display: block; box-sizing: border-box; font-style: normal; }
.machine [data-motion] { color: var(--idle-mark, var(--mid)); }
.machine .fault-lamp { right: 8px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--red-bg); opacity: 0; }

.symbol-players { width: 72px; height: 38px; border: 2px solid var(--ink); border-radius: 12px; background: var(--hw-surface); }
.console-display { inset: 4px 13px; border-radius: 4px; background: var(--hw-solid); overflow: hidden; }
.playhead { --idle-mark: var(--hw-glyph); left: calc(50% - 5px); top: calc(50% - 5px); width: 9px; height: 10px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.console-pad { left: 3px; top: 13px; width: 8px; height: 8px; background: var(--ink); clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%); }
.console-keys { width: 3px; height: 3px; right: 4px; top: 13px; border-radius: 50%; background: var(--ink); box-shadow: -4px 5px var(--ink); }

.symbol-endpoint { width: 50px; height: 34px; }
.gate-entry, .gate-exit { top: 0; bottom: 0; width: 12px; border: 2px solid var(--ink); }
.gate-entry { left: 0; border-right: 0; border-radius: 6px 0 0 6px; }
.gate-exit { right: 0; border-left: 0; border-radius: 0 6px 6px 0; }
.gate-entry::after { content: ""; position: absolute; top: calc(50% - 1px); left: 0; width: 8px; height: 2px; background: var(--ink); }
.gate-packet { --idle-mark: var(--ink); width: 8px; height: 8px; left: 17px; top: 13px; border-radius: 2px; background: currentColor; }

.symbol-app { width: 64px; height: 36px; background: var(--hw-solid); border: 1.5px solid var(--ink); border-radius: 6px; }
.terminal-chevron { --idle-mark: var(--hw-glyph); width: 10px; height: 10px; left: 20px; top: 11px; rotate: -45deg; border: solid currentColor; border-width: 0 2px 2px 0; }
.terminal-cursor { --idle-mark: #ff8c6b; width: 10px; height: 2px; left: 33px; top: 21px; background: currentColor; }
.symbol-function { width: 52px; height: 38px; }
.symbol-function::before { content: ""; position: absolute; inset: 0 5px; background: var(--hw-solid); border: 1.5px solid var(--ink); border-radius: 6px; }
.symbol-function::after { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 9px; height: 2px; background: var(--ink); box-shadow: 0 9px var(--ink), 0 18px var(--ink); }
.function-mark { --idle-mark: var(--hw-glyph); left: 17px; top: 10px; width: 18px; height: 18px; background: currentColor; clip-path: polygon(16% 0, 41% 0, 77% 80%, 96% 80%, 96% 98%, 64% 98%, 41% 48%, 20% 98%, 0 98%, 32% 28%, 27% 17%, 16% 17%); }

.symbol-alb, .symbol-matchmaker { width: 64px; height: 36px; }
.fork-stem { left: 0; right: 3px; top: 17px; height: 2px; background: var(--ink); }
.fork-arm { left: 25px; right: 3px; height: 16px; border-left: 2px solid var(--ink); }
.upper-arm { top: 2px; border-top: 2px solid var(--ink); border-top-left-radius: 9px; }
.lower-arm { bottom: 2px; border-bottom: 2px solid var(--ink); border-bottom-left-radius: 9px; }
.fork-contact { --idle-mark: var(--ink); right: 0; width: 6px; height: 6px; border-radius: 1.5px; background: currentColor; }
.upper-contact { top: 0; } .middle-contact { top: 15px; } .lower-contact { bottom: 0; }
.symbol-matchmaker .fork-arm { left: 3px; right: 25px; border-left: 0; border-right: 2px solid var(--ink); }
.symbol-matchmaker .upper-arm { border-radius: 0 9px 0 0; }
.symbol-matchmaker .lower-arm { border-radius: 0 0 9px 0; }
.symbol-matchmaker .fork-contact { left: 0; right: auto; }
.symbol-matchmaker .fork-stem { left: 37px; right: 0; }
.match-dot { --idle-mark: var(--ink); left: 35px; top: 15px; width: 6px; height: 6px; border-radius: 1px; rotate: 45deg; background: currentColor; }

.symbol-queue { width: 82px; height: 28px; border: 2px solid var(--ink); background: var(--hw-surface); border-radius: 5px; }
.queue-window { width: 67px; height: 8px; left: 5px; top: 8px; overflow: hidden; }
.machine .parcel { display: flex; gap: 3px; left: -10px; top: 0; }
.machine .queue-cell { position: static; width: 7px; height: 8px; flex: none; border-radius: 1.5px; background: var(--mid); }
.read-cursor { --idle-mark: var(--ink); top: 5px; bottom: 5px; left: 53px; width: 2px; background: currentColor; }

.symbol-fleet { width: 60px; height: 40px; display: grid; grid-template-rows: repeat(3, 12px); gap: 2px; }
.machine .rack-row { position: relative; background: var(--hw-solid); border: 1px solid var(--ink); border-radius: 3px; }
.rack-slot { width: 15px; left: 6px; top: 4px; height: 2px; background: var(--hw-mid); }
.rack-led { --idle-mark: var(--green); right: 6px; top: 3px; width: 4px; height: 4px; border-radius: 1px; background: currentColor; }

.symbol-db { width: 48px; height: 42px; }
.symbol-db::before { content: ""; position: absolute; inset: 6px 0 0; background: var(--hw-surface); border: 2px solid var(--ink); border-top: 0; border-radius: 0 0 50% 50% / 0 0 6px 6px; }
.db-cap { inset: 0 0 auto; height: 12px; border: 2px solid var(--ink); border-radius: 50%; background: var(--hw-surface); }
.db-ring, .write-band { --idle-mark: var(--mid); left: 2px; right: 2px; height: 9px; border-bottom: 2px solid currentColor; border-radius: 0 0 50% 50% / 0 0 5px 5px; }
.db-ring { top: 13px; }
.write-band { top: 23px; }

.symbol-bucket { width: 44px; height: 38px; }
.bucket-well { inset: 5px 1px 0; background: var(--hw-solid); overflow: hidden; clip-path: polygon(0 0, 100% 0, 86% 90%, 82% 96%, 68% 100%, 32% 100%, 18% 96%, 14% 90%); }
.bucket-rim { inset: 0 0 auto; height: 10px; border: 2px solid var(--ink); background: var(--hw-surface); border-radius: 50%; }
.stored-object { --idle-mark: var(--hw-glyph); left: calc(50% - 4px); top: 15px; width: 8px; height: 7px; border-radius: 1px; background: currentColor; }

.symbol-internet { width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 50%; background: var(--hw-surface); overflow: hidden; }
.meridian { inset: -2px 8px; border: 2px solid var(--mid); border-radius: 50%; }
.latitude { left: 0; right: 0; top: 17px; height: 2px; background: var(--mid); }
.world-dot { --idle-mark: var(--ink); width: 6px; height: 6px; left: 6px; top: 15px; border-radius: 50%; background: currentColor; }

.symbol-shield, .symbol-sg { width: 34px; height: 38px; }
.shield-field { inset: 0; background: var(--hw-solid); clip-path: polygon(50% 0, 100% 14%, 100% 50%, 94% 65%, 80% 81%, 50% 100%, 20% 81%, 6% 65%, 0 50%, 0 14%); }
.shield-tick { --idle-mark: var(--hw-glyph); width: 14px; height: 8px; left: 10px; top: 12px; border: solid currentColor; border-width: 0 0 2px 2px; rotate: -45deg; }
.symbol-role { width: 51px; height: 24px; }
.key-head { left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--hw-solid); border: 1.5px solid var(--ink); }
.key-dot { --idle-mark: var(--hw-glyph); width: 10px; height: 10px; left: 5px; top: 5px; background: currentColor; border-radius: 50%; }
.key-stem { left: 22px; top: 10px; right: 0; height: 4px; background: var(--ink); }
.key-teeth { right: 2px; top: 13px; width: 11px; height: 6px; border-inline: 3px solid var(--ink); }

.symbol-subnet { width: 60px; height: 30px; border: 2px solid var(--ink); border-radius: 4px; background: var(--hw-surface); }
.router-line { left: 5px; top: 5px; width: 13px; height: 2px; background: var(--mid); }
.machine .router-ports { inset: auto 5px 5px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.machine .router-port { position: static; height: 7px; background: currentColor; border-radius: 1px; }
.symbol-layers { width: 46px; height: 36px; }
.layer-back, .layer-front { width: 40px; height: 30px; border: 2px solid var(--ink); border-radius: 4px; background: var(--hw-surface); }
.layer-back { top: 0; left: 0; } .layer-front { right: 0; bottom: 0; }
.module-dot { width: 6px; height: 6px; top: 10px; left: 15px; background: currentColor; border-radius: 1px; }

.symbol-cache { width: 72px; height: 32px; }
.dimm-body { inset: 0 0 6px; background: var(--hw-solid); border: 1.5px solid var(--ink); border-radius: 4px; overflow: hidden; }
.dimm-bank { --idle-mark: var(--hw-mid); width: 12px; height: 11px; top: 6px; border-radius: 2px; background: currentColor; }
.dimm-bank:nth-child(1) { left: 7px; } .dimm-bank:nth-child(2) { left: 23px; } .dimm-bank:nth-child(3) { left: 39px; }
.dimm-bolt { --idle-mark: #ff8c6b; right: 6px; top: 4px; width: 11px; height: 15px; background: currentColor; clip-path: polygon(58% 0, 14% 56%, 48% 56%, 34% 100%, 86% 42%, 52% 42%); }
.dimm-pins { left: 6px; right: 6px; bottom: 0; height: 5px; background: repeating-linear-gradient(90deg, var(--ink) 0 4px, transparent 4px 8px); }

.symbol-cdn { width: 44px; height: 44px; }
.cdn-ring { inset: 4px; border: 1.8px dashed var(--mid); border-radius: 50%; }
.cdn-wave { --idle-mark: var(--mid); inset: 8px; border: 1.5px solid currentColor; border-radius: 50%; }
.cdn-hub { --idle-mark: var(--ink); left: 16px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.cdn-pop { --idle-mark: var(--ink); width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cdn-pop.p1 { left: 18.5px; top: 0; } .cdn-pop.p2 { left: 2px; bottom: 5px; } .cdn-pop.p3 { right: 2px; bottom: 5px; }

.symbol-dns { width: 42px; height: 42px; }
.dns-dial { inset: 0; border: 2px solid var(--ink); border-radius: 50%; background: var(--hw-surface); }
.dns-ticks { inset: 3px; border-radius: 50%; border: 1.5px dotted var(--mid); }
.dns-needle { --idle-mark: var(--ink); left: 14px; top: 6px; width: 10px; height: 26px; background: linear-gradient(180deg, var(--accent-strong) 0 50%, currentColor 50% 100%); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

.symbol-ai { width: 46px; height: 42px; }
.ai-die { inset: 4px 6px; background: var(--hw-solid); border: 1.5px solid var(--ink); border-radius: 7px; }
.ai-pin { --idle-mark: var(--hw-mid); width: 4px; height: 4px; border-radius: 1px; background: currentColor; }
.ai-pin.p1 { left: 5px; top: 5px; } .ai-pin.p2 { right: 5px; top: 5px; }
.ai-pin.p3 { left: 5px; bottom: 5px; } .ai-pin.p4 { right: 5px; bottom: 5px; }
.ai-core { --idle-mark: var(--hw-glyph); left: 7px; top: 7px; width: 18px; height: 18px; background: currentColor; clip-path: polygon(50% 0, 64% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0 50%, 36% 36%); }

.symbol-search { width: 46px; height: 42px; }
.lens-rim { left: 2px; top: 2px; width: 30px; height: 30px; border: 2.2px solid var(--ink); border-radius: 50%; background: var(--hw-surface); overflow: hidden; }
.lens-bar { left: 6px; height: 2px; border-radius: 1px; background: var(--mid); }
.lens-bar.b1 { top: 8px; width: 13px; } .lens-bar.b2 { top: 14px; width: 9px; }
.lens-beam { --idle-mark: var(--accent-strong); left: 3px; right: 3px; top: 12px; height: 2.5px; border-radius: 2px; background: currentColor; }
.lens-handle { right: 4px; bottom: 3px; width: 14px; height: 4px; border-radius: 2px; background: var(--ink); rotate: 45deg; }

.symbol-warehouse { width: 56px; height: 38px; }
.wh-axis { left: 2px; right: 2px; bottom: 2px; height: 2px; border-radius: 1px; background: var(--ink); }
.machine .wh-bars { left: 7px; right: 7px; bottom: 6px; top: 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; align-items: end; }
.machine .wh-bar { position: static; background: currentColor; border-radius: 2px 2px 0 0; transform-origin: bottom center; }
.wh-bar.b1 { --idle-mark: var(--mid); height: 10px; } .wh-bar.b2 { --idle-mark: var(--ink); height: 17px; }
.wh-bar.b3 { --idle-mark: var(--mid); height: 13px; } .wh-bar.b4 { --idle-mark: var(--ink); height: 22px; }

.symbol-monitor { width: 62px; height: 38px; }
.mon-bezel { inset: 0; background: var(--hw-solid); border: 1.5px solid var(--ink); border-radius: 6px; }
.machine .mon-wave { left: 8px; right: 14px; top: 7px; bottom: 7px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; align-items: center; }
.machine .mon-bar { position: static; background: currentColor; border-radius: 2px; transform-origin: center; }
.mon-bar.b1 { --idle-mark: var(--hw-mid); height: 6px; } .mon-bar.b2 { --idle-mark: var(--hw-glyph); height: 13px; }
.mon-bar.b3 { --idle-mark: #ff8c6b; height: 18px; } .mon-bar.b4 { --idle-mark: var(--hw-glyph); height: 10px; }
.mon-bar.b5 { --idle-mark: var(--hw-mid); height: 7px; }
.mon-led { --idle-mark: var(--green); right: 5px; top: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.symbol-vault { width: 44px; height: 42px; }
.vault-shackle { left: 12px; top: 0; width: 20px; height: 14px; border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 10px 10px 0 0; }
.vault-door { left: 4px; right: 4px; top: 10px; bottom: 0; background: var(--hw-solid); border: 1.5px solid var(--ink); border-radius: 6px; }
.vault-dial { --idle-mark: var(--hw-glyph); left: 8px; top: 6px; width: 17px; height: 17px; border: 2.5px dashed currentColor; border-radius: 50%; }
.vault-pin { left: 14.5px; top: 12.5px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-strong); }

.symbol-workflow { width: 72px; height: 28px; }
.wf-rail { left: 8px; right: 8px; top: 13px; height: 2px; background: var(--mid); }
.wf-node { --idle-mark: var(--ink); top: 8px; width: 12px; height: 12px; background: currentColor; }
.wf-node.start { left: 2px; border-radius: 50%; }
.wf-node.gate { left: 30px; border-radius: 2px; rotate: 45deg; }
.wf-node.finish { right: 2px; border-radius: 3px; border: 2px solid var(--ink); background: var(--hw-surface); }

.symbol-registry { width: 52px; height: 38px; }
.reg-frame { inset: 0; border: 2px solid var(--ink); border-radius: 5px; background: var(--hw-surface); }
.reg-crate { position: absolute; width: 12px; height: 11px; border-radius: 2px; background: var(--ink); }
.reg-crate.c1 { left: 5px; top: 5px; } .reg-crate.c2 { left: 20px; top: 5px; } .reg-crate.c3 { left: 35px; top: 5px; background: var(--mid); }
.reg-crate.c4 { left: 5px; bottom: 5px; } .reg-crate.c5 { left: 20px; bottom: 5px; }
.reg-crate.c6 { --idle-mark: var(--accent-strong); left: 35px; bottom: 5px; background: currentColor; }

.symbol-notify { width: 54px; height: 36px; }
.env-body { left: 0; right: 4px; top: 5px; bottom: 0; border: 2px solid var(--ink); border-radius: 5px; background: var(--hw-surface); overflow: hidden; }
.env-flap { left: -2px; right: -2px; top: -12px; height: 24px; border: 2px solid var(--ink); border-radius: 0 0 12px 12px; }
.env-badge { --idle-mark: var(--accent-strong); right: 0; top: 0; width: 11px; height: 11px; border-radius: 50%; background: currentColor; border: 2px solid var(--hw-surface); }

.symbol-iot { width: 48px; height: 40px; }
.iot-base { left: 10px; right: 10px; bottom: 1px; height: 15px; border-radius: 4px; background: var(--hw-solid); border: 1.5px solid var(--ink); }
.iot-dot { --idle-mark: var(--hw-glyph); left: 10px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.iot-arc { --idle-mark: var(--ink); border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; transform-origin: bottom center; }
.iot-arc.inner { left: 13px; top: 10px; width: 22px; height: 22px; }
.iot-arc.outer { left: 5px; top: 2px; width: 38px; height: 38px; }

.symbol-backup { width: 42px; height: 42px; }
.bak-ring { --idle-mark: var(--ink); inset: 1px; border: 2.5px solid currentColor; border-left-color: transparent; border-radius: 50%; }
.bak-ring::before { content: ""; position: absolute; left: 1px; top: 2px; border: 4px solid transparent; border-bottom-color: currentColor; border-right-color: currentColor; }
.bak-core { --idle-mark: var(--accent-strong); left: 15px; top: 15px; width: 12px; height: 12px; border-radius: 3px; background: currentColor; }

.symbol-billing { width: 58px; height: 36px; }
.bill-frame { inset: 0; border: 2px solid var(--ink); border-radius: 5px; background: var(--hw-surface); }
.bill-lines { left: 8px; right: 8px; top: 8px; height: 10px; background: repeating-linear-gradient(90deg, var(--mid) 0 2px, transparent 2px 9px); }
.bill-bar { --idle-mark: var(--accent-strong); left: 8px; bottom: 7px; width: 22px; height: 5px; border-radius: 2px; background: currentColor; }

.symbol-files { width: 56px; height: 38px; }
.fs-tab { left: 4px; top: 0; width: 22px; height: 9px; border-radius: 4px 4px 0 0; background: var(--mid); }
.fs-drive { inset: 6px 0 0; border-radius: 5px; background: var(--hw-solid); border: 1.5px solid var(--ink); }
.fs-slot { left: 9px; right: 9px; top: 13px; height: 3px; border-radius: 2px; background: var(--hw-mid); }
.fs-head { --idle-mark: var(--hw-glyph); left: 11px; top: 10px; width: 11px; height: 9px; border-radius: 2px; background: currentColor; }

/* ── Minimal Visual-First Empty State ───────────────────── */
.workbench[data-empty] .canvas-bar,
.workbench[data-empty] .zoom,
.workbench[data-empty] .minimap,
.workbench[data-empty] .minimap-open { visibility: hidden; pointer-events: none; }
.workbench[data-empty] #undo:not(:disabled) { visibility: visible; pointer-events: auto; }

.empty {
  width: min(680px, calc(100% - 28px));
  margin: auto;
  padding-block: 8px 20px;
  text-align: center;
}
.empty h1 {
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 660;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.empty-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.shuffle-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 7px;
}
.shuffle-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.shuffle-btn svg { width: 13px; height: 13px; }

.starter-prompts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.starter-prompts button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px 6px;
  padding: 9px 11px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: border-color 0.14s, transform 0.14s;
}
.starter-prompts button:hover:not(:disabled), .starter-prompts button[data-chosen] {
  border-color: var(--accent-strong);
  transform: translateY(-2px);
}
.starter-prompts [data-art] {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  border-radius: 6px;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot-color) 0.9px, transparent 0.9px);
  background-size: 8px 8px;
  border: 1px solid var(--line);
}
.starter-prompts [data-art] svg { width: 100%; height: auto; }
.starter-prompts strong { font-size: 13px; font-weight: 590; letter-spacing: -0.015em; }
.starter-prompts [data-icon] { color: var(--faint); }
.starter-prompts [data-icon] svg { width: 13px; height: 13px; }
.starter-prompts [data-chosen]:disabled { opacity: 1; }

.template-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.template-card {
  display: grid;
  gap: 7px;
  padding: 9px 11px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  text-align: left;
  transition: border-color 0.14s, background 0.14s, transform 0.14s;
}
.template-card:hover:not(:disabled) { border-color: var(--accent-strong); background: var(--surface); transform: translateY(-1px); }
.template-card:disabled { opacity: 0.42; cursor: default; pointer-events: none; }
.tpl-art {
  display: block;
  width: 100%;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 5px 6px;
}
.tpl-art svg { width: 100%; height: auto; }
.template-card strong { font-size: 12.5px; font-weight: 560; color: var(--muted); letter-spacing: -0.01em; }
.template-card:hover:not(:disabled) strong { color: var(--ink); }
#empty[data-building] .empty-controls button:disabled { opacity: 0.45; cursor: default; pointer-events: none; }

/* ── Minimap, Zoom & Floating Composer ──────────────────── */
.minimap {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  width: 164px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.minimap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px 3px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
}
.minimap-head button { border: 0; background: none; padding: 2px; color: var(--muted); border-radius: 4px; display: grid; place-items: center; }
.minimap-head button svg { width: 11px; height: 11px; }
.minimap-body { padding: 5px; cursor: crosshair; }
.minimap-body svg { width: 100%; height: 84px; display: block; }
.minimap-open {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.minimap-open:hover { color: var(--ink); border-color: var(--line-strong); }
.minimap-open svg { width: 14px; height: 14px; }

.canvas-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px 12px;
  z-index: 3;
}
.canvas-foot > * { pointer-events: auto; }
.zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 2px;
  box-shadow: var(--shadow-sm);
}
.zoom span { font: 550 11px ui-monospace, monospace; color: var(--muted); min-width: 34px; text-align: center; }
.zoom button { border: 0; background: none; border-radius: 5px; display: grid; place-items: center; width: 25px; height: 25px; color: var(--muted); }
.zoom button:hover { background: var(--surface-2); color: var(--ink); }
.zoom svg { width: 13px; height: 13px; }

.chat-dock {
  z-index: 3;
  width: min(460px, calc(100% - 320px));
  min-width: 220px;
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 5px;
  box-shadow: var(--shadow-md);
}
.chat-dock:focus-within { border-color: var(--accent-strong); }
.chat-top { display: flex; align-items: center; gap: 6px; padding: 1px 4px 3px 8px; }
.chat-provider { font-size: 10.5px; margin-right: auto; color: var(--faint); }
.chat-control { display: inline-flex; align-items: center; background: none; border: 0; padding: 2px 5px; color: var(--muted); border-radius: 4px; font-size: 10.5px; }
.chat-control:hover { background: var(--surface-2); color: var(--ink); }
.chat-control svg { width: 13px; height: 13px; }
.chat-form { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 1px 0 7px; }
.chat-progress { display: grid; gap: 5px; padding: 4px 4px 5px 7px; }
.chat-progress[hidden] { display: none; }
.composer-mark { color: var(--accent-strong); }
.composer-mark svg { width: 14px; height: 14px; }
.chat-form textarea {
  flex: 1;
  min-width: 0;
  field-sizing: content;
  padding: 6px 0;
  min-height: 32px;
  max-height: 96px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.38;
  font-size: 13px;
}
.chat-form textarea:focus-visible { outline: none; }
.send { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; }
.send:hover:not(:disabled) { background: var(--accent-strong); }
.send svg { width: 15px; height: 15px; }
.chat-progress-head { display: flex; align-items: center; gap: 8px; min-height: 26px; color: var(--accent-strong); font-size: 12px; font-weight: 560; }
#chat-progress-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-progress-head small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; flex: none; }
.chat-spinner { display: block; flex: none; width: 12px; height: 12px; border: 2px solid var(--accent-soft); border-top-color: var(--accent-strong); border-radius: 50%; animation: chat-spin 0.9s linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
.chat-progress-bar { position: relative; height: 2px; border-radius: 99px; background: var(--line); overflow: hidden; }
.chat-progress-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-strong), transparent);
  animation: chat-bar-slide 1.5s ease-in-out infinite;
}
@keyframes chat-bar-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(300%); }
}
.chat-progress-log { list-style: none; margin: 0; padding: 0 2px 0 20px; display: grid; gap: 2px; font-size: 11px; line-height: 1.35; }
.chat-progress-log[hidden] { display: none; }
.chat-progress-log li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-progress-log li > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-progress-log li.done { color: var(--faint); }
.chat-progress-log li.done::before { content: "✓"; flex: none; color: var(--green); font-size: 10px; font-weight: 700; }
.chat-progress-log li.active { color: var(--ink); font-weight: 500; }
.chat-progress-log li.active::before { content: ""; flex: none; width: 5px; height: 5px; margin: 0 2px 0 1px; border-radius: 50%; background: var(--accent-strong); animation: chat-pulse 1.4s ease-in-out infinite; }
@keyframes chat-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .chat-progress-bar > span, .chat-progress-log li.active::before, .chat-spinner { animation: none; }
}

.chat-latest { margin: 0 2px 4px; padding: 4px 6px 6px; border-bottom: 1px solid var(--line); }
.chat-latest > div { display: grid; grid-template-columns: max-content minmax(0, 1fr) auto; gap: 6px 8px; align-items: baseline; }
.chat-latest > div + div { margin-top: 3px; }
.chat-latest > div > span { color: var(--faint); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.latest-prompt {
  font-size: 11.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  width: 100%;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.latest-prompt[data-expanded] {
  display: block;
  -webkit-line-clamp: unset;
  max-height: min(24dvh, 160px);
  overflow-y: auto;
  overscroll-behavior: contain;
  white-space: pre-wrap;
  padding-right: 2px;
}
.latest-answer { font-size: 11.5px; line-height: 1.42; overflow-wrap: anywhere; width: 100%; max-height: 3.1em; overflow: hidden; color: var(--ink); }
.latest-answer[data-expanded] { max-height: min(32dvh, 220px); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.latest-answer p, .message-body p { margin: 0 0 4px; }
.latest-answer p:last-child, .message-body p:last-child, .md-list:last-child { margin-bottom: 0; }
.latest-expand {
  align-self: start;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: -1px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.latest-expand:hover { background: var(--surface-2); color: var(--ink); }
.latest-expand svg { width: 11px; height: 11px; display: block; transition: transform 0.16s ease; }
.latest-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.latest-expand[hidden] { display: none; }
.latest-answer strong, .message-body strong { font-weight: 620; color: var(--ink); }
.latest-answer code, .message-body code { font-family: ui-monospace, monospace; font-size: 0.92em; padding: 0 3px; border-radius: 3px; background: var(--surface); }
.md-list { margin: 3px 0 4px 16px; padding: 0; display: grid; gap: 2px; }
.message-body { margin-top: 4px; white-space: normal; }
#latest-answer-row > span { color: var(--accent-strong); }

.chat-dock .history { max-height: min(34dvh, 240px); padding: 4px; overscroll-behavior: contain; font-size: 12px; display: grid; gap: 6px; overflow: auto; }
.message { background: var(--surface-2); padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); }
.message.assistant { background: var(--bg); }
.chat-dock .message.error { background: var(--red-bg); border-color: var(--red-line); }
.followups { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 3px 5px; }
.followups button { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); padding: 3px 7px; font-size: 10.5px; }
.followups button:hover { background: var(--accent-soft); color: var(--ink); }
.followups .more-ideas { display: inline-grid; place-items: center; padding: 3px 5px; }
.more-ideas svg { width: 12px; height: 12px; }
.snapshot-label { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

/* ── Minimal Inspector & Audit ──────────────────────────── */
.tabs { display: flex; padding: 0 10px; gap: 2px; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1;
  padding: 8px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 580;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed="true"] { border-bottom-color: var(--accent-strong); color: var(--accent-strong); }
.panel { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 13px 20px; }
.panel h3 { font-size: 12.5px; font-weight: 620; letter-spacing: -0.01em; margin: 0 0 7px; color: var(--ink); }
.panel p, .dialog p { color: var(--muted); line-height: 1.45; font-size: 12.5px; }

.audit-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: 580 11.5px ui-monospace, monospace;
  margin-bottom: 12px;
}
.audit-metric { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.audit-ai-bar { margin: -4px 0 12px; }
.audit-fix-all {
  width: 100%;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
}
.audit-fix-all svg { width: 13px; height: 13px; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.allowed, .dot.ok { background: var(--green); }
.dot.blocked, .dot.denied, .dot.bad { background: var(--red); }
.dot.unknown, .dot.warn { background: var(--amber); }
.dot.info { background: var(--accent-strong); }

.audit-group { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.audit-group:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }
.audit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  text-align: left;
  font-size: 12px;
}
.audit-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.audit-row.has-fix { padding: 3px 4px; gap: 4px; }
.audit-row.has-fix:hover { background: var(--surface); border-color: var(--line-strong); }
.audit-row-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 3px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.audit-row-trigger:hover { background: var(--surface-2); }
.audit-row-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 540; }
.audit-row code { font: 550 10.5px ui-monospace, monospace; color: var(--faint); flex: none; }
.audit-create-fold summary { list-style: none; cursor: pointer; }
.audit-create-fold summary::-webkit-details-marker { display: none; }
.audit-create-list { display: grid; gap: 5px; margin-top: 5px; }

.finding-card { display: grid; gap: 6px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.finding-head { display: flex; align-items: center; gap: 7px; }
.finding-head strong { font-size: 12px; font-weight: 580; }
.finding-card small { font-size: 11px; color: var(--muted); line-height: 1.35; }
.finding-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.audit-clear { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--green); padding: 6px 2px; }

.fields { display: grid; gap: 9px; }
.fields label { font-weight: 560; font-size: 11.5px; color: var(--muted); display: grid; gap: 3px; min-width: 0; }
.fields input, .fields select, textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 32px;
  background: var(--bg);
  padding: 5px 8px;
  color: var(--ink);
  font-size: 12.5px;
  min-width: 0;
  width: 100%;
}
.fields input:focus, .fields select:focus, textarea:focus { border-color: var(--accent-strong); outline: none; }
.fields select {
  appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 5 3 3 3-3' fill='none' stroke='%238890a6' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.inline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scenarios { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 10px; }
.chip { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; color: var(--muted); font-size: 11px; font-weight: 560; }
.chip:hover, .chip.active { background: var(--accent-soft); border-color: rgba(242, 84, 45, 0.34); color: var(--accent-strong); }

.result { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 9px 10px; margin: 10px 0; }
.verdict { display: flex; align-items: center; gap: 5px; text-transform: capitalize; font-size: 12.5px; color: var(--green); margin-bottom: 3px; }
.result.blocked .verdict, .result.denied .verdict { color: var(--red); }
.result.unknown .verdict { color: var(--amber); }
.result p { font-size: 12px; color: var(--ink); opacity: 0.85; overflow-wrap: anywhere; }

.evidence { display: grid; gap: 6px; }
.evidence-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  width: 100%;
}
button.evidence-row:hover { background: var(--surface-2); border-color: var(--line-strong); }
.evidence-row > .icon-tile { width: 22px; height: 22px; }
.evidence-row > span:nth-child(2) { min-width: 0; flex: 1; }
.evidence-row strong, .evidence-row small { display: block; overflow-wrap: anywhere; }
.evidence-row strong { font-size: 12px; font-weight: 560; }
.evidence-row small { color: var(--muted); margin-top: 1px; font-size: 11px; line-height: 1.3; }

.section { display: grid; gap: 7px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.section h3 { margin: 0; }
.section-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 560;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}
.button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); }
.button.compact { min-height: 24px; padding: 2px 7px; font-size: 11px; }
.button svg { width: 13px; height: 13px; }
.primary, .primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.icon-button { width: 30px; padding: 0; }
.danger { color: var(--red); border-color: var(--red-line); }
.danger:hover:not(:disabled) { background: var(--red-bg); border-color: var(--red); }

.eyebrow { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-strong); }
.cloud-settings summary { cursor: pointer; font-size: 12px; font-weight: 580; color: var(--ink); }
.cloud-settings[open] summary { margin-bottom: 8px; }
.cloud-settings .native-type { display: grid; gap: 4px; margin-bottom: 8px; }
.native-type code { font-size: 10.5px; overflow-wrap: anywhere; color: var(--accent-strong); }
.native-type a { width: fit-content; color: var(--accent-strong); font-size: 11.5px; }

/* ── Dialogs, Command Palette & Toast ───────────────────── */
dialog {
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0;
  width: min(480px, calc(100% - 24px));
  max-height: 85dvh;
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(7, 8, 10, 0.58); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { letter-spacing: -0.02em; font-size: 15px; }
.dialog-body { display: grid; gap: 11px; padding: 14px; overflow: auto; }
.dialog-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 4px; }
.form-error { color: var(--red); font-size: 12px; min-height: 0; }
.form-error:empty { display: none; }
.coverage-row { display: flex; gap: 12px; justify-content: space-between; font-size: 12px; padding: 3px 0; }
.coverage-row a { color: var(--accent-strong); }

.cmd-dialog { width: min(520px, calc(100% - 24px)); margin-top: 10dvh; overflow: hidden; }
.cmd-shell { display: grid; max-height: 68dvh; grid-template-rows: auto minmax(0, 1fr); }
.cmd-search { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmd-search input { flex: 1; border: 0; background: none; color: var(--ink); font-size: 13.5px; min-width: 0; }
.cmd-search input:focus-visible { outline: none; }
.cmd-list { overflow: auto; padding: 5px; display: grid; gap: 1px; }
.cmd-group { padding: 6px 8px 3px; font-size: 10px; font-weight: 620; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.cmd-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; padding: 7px 9px; border-radius: 7px; text-align: left; color: var(--ink); }
.cmd-item:hover, .cmd-item[aria-selected="true"] { background: var(--accent-soft); }
.cmd-item-text { flex: 1; min-width: 0; display: grid; }
.cmd-item-text strong { font-size: 12.5px; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item-text small { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-item kbd { font-family: ui-monospace, monospace; font-size: 10px; padding: 2px 5px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }

.shortcut-grid { display: grid; gap: 6px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.shortcut-row:last-child { border-bottom: 0; }
.shortcut-row kbd { font-family: ui-monospace, monospace; font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); }

#notice {
  position: fixed;
  top: auto;
  bottom: 54px;
  left: 16px;
  transform: none;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  padding: 6px 12px;
  color: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 15;
  max-width: 88%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
#notice:empty { display: none; }
.notice-undo { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-strong); border-radius: 5px; padding: 1px 7px; font-size: 11px; font-weight: 600; }
.notice-undo:hover { background: var(--accent); color: #fff; }

#resource-hint {
  position: fixed;
  z-index: 14;
  width: max-content;
  max-width: min(240px, calc(100vw - 12px));
  max-height: calc(100dvh - 12px);
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
#resource-hint strong, #resource-hint span, #resource-hint small { display: block; }
#resource-hint strong { font-size: 11.5px; margin-bottom: 3px; }
#resource-hint span { color: var(--muted); }
#resource-hint small { color: var(--accent-strong); margin-top: 6px; font-size: 10.5px; }

.resource-ghost { position: fixed; z-index: 16; left: 0; top: 0; pointer-events: none; padding: 6px 10px; background: var(--accent); color: #fff; border-radius: 7px; box-shadow: var(--shadow-md); font-size: 12px; font-weight: 560; }

/* ── Terraform Plan Diffs, HCL Modal & File Drop ────────── */
.diff-badge {
  position: absolute;
  top: -8px;
  right: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font: 600 9.5px/14px ui-monospace, monospace;
  letter-spacing: 0.01em;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  z-index: 3;
}
.diff-create { color: var(--green); }
.diff-update { color: var(--accent-strong); }
.diff-replace { color: var(--amber); }
.diff-delete { color: var(--red); }
.stage .node.resource-node.has-diff-replace::before { border-color: var(--amber-line); border-style: dashed; }
.stage .node.resource-node.has-diff-delete::before { border-color: var(--red-line); border-style: dashed; }

.drop-overlay {
  position: fixed;
  inset: 58px 18px 18px;
  z-index: 18;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent-strong);
  border-radius: 14px;
  background: var(--glass-strong);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.drop-overlay code { font-family: ui-monospace, monospace; color: var(--accent-strong); }

.tf-samples { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Animations & Reduced Motion ────────────────────────── */
.building-node { animation: place-card 0.2s cubic-bezier(0.22, 1, 0.36, 1) both; }
.frame.building-node { animation: place-frame 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }
.edges path.building-link { stroke: var(--accent-strong); stroke-width: 2.2; stroke-dasharray: 1; animation: ink-wire 0.24s cubic-bezier(0.22, 1, 0.36, 1) both; }
.edges .wire-pen { fill: var(--accent-strong); }
@keyframes ink-wire { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes place-card { from { opacity: 0; transform: translateY(5px) scale(0.975); } to { opacity: 1; transform: none; } }
@keyframes place-frame { from { opacity: 0; transform: scale(0.988); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .chat-spinner, .building-node, .frame.building-node, .edges path.building-link, .policy-callout, .edges path.replication-live { animation: none; }
  .wire-pen, .edges .packet, .edges .replica-pulse { display: none; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 920px) {
  .chat-dock { width: min(440px, calc(100% - 170px)); }
  .minimap, .minimap-open { display: none; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 10px; }
  .library, .inspector { position: absolute; z-index: 5; top: 0; bottom: 0; width: min(290px, 88vw); box-shadow: var(--shadow-lg); }
  .library { left: 0; } .inspector { right: 0; }
  .health-pill, .save-status { display: none; }
  .play-dock { max-width: calc(100% - 20px); }
  .play-bar { flex-wrap: wrap; }
  .canvas-foot { flex-direction: column-reverse; align-items: center; gap: 6px; padding: 0 10px 10px; }
  .zoom { position: static; align-self: flex-end; }
  .chat-dock { width: 100%; min-width: 0; }
  .starter-prompts, .template-bar { grid-template-columns: 1fr; }
}
