body.workspace-page {
  color-scheme: light;
  --workspace-bg: #f8f8f9;
  --workspace-surface: #ffffff;
  --workspace-line: #e7e7e9;
  --workspace-text: #242328;
  --workspace-muted: #77727e;
  --accent: #d50000;
  min-height: 100vh;
  color: var(--workspace-text);
  background: var(--workspace-bg);
  font-family: Arial, "Liberation Sans", sans-serif;
}

.workspace-page .ambient,
.workspace-page > .topbar,
.workspace-page > .site-footer { display: none; }

.workspace-page .shell {
  display: block;
  width: 100%;
  max-width: none;
  min-height: 100svh;
  margin: 0;
  padding: 0;
}

.workspace-layout { min-height: 100svh; background: var(--workspace-bg); }

.workspace-preview-mode {
  display: block;
  width: var(--workspace-column-width);
  margin: 10px auto 0;
  padding: 0 clamp(16px, 2vw, 30px);
  color: #9b101c;
  text-align: right;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.workspace-preview-mode:hover { text-decoration: underline; }

.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--workspace-line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}

.workspace-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--workspace-text);
  text-decoration: none;
}

.workspace-logo { display: grid; width: 27px; height: 27px; place-items: center; }
.workspace-logo svg { width: 100%; height: 100%; fill: var(--accent); }
.workspace-wordmark { display: inline-flex; align-items: baseline; gap: 7px; }

.workspace-wordmark strong {
  font-family: "Orbitron", "Arial Black", Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.055em;
}

.workspace-wordmark span { color: var(--workspace-muted); font-size: 14px; }
.workspace-actions { display: flex; align-items: center; gap: 10px; }
.workspace-action { position: relative; }

.workspace-icon-button,
.workspace-profile-button {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #45424a;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.workspace-icon-button:hover,
.workspace-profile-button:hover,
.workspace-icon-button[aria-expanded="true"],
.workspace-profile-button[aria-expanded="true"] {
  border-color: var(--workspace-line);
  background: #f8f8f9;
}

.workspace-icon-button:focus-visible,
.workspace-profile-button:focus-visible,
.workspace-menu-button:focus-visible,
.workspace-brand:focus-visible {
  outline: 2px solid #c50000;
  outline-offset: 3px;
}

.workspace-icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-profile-button { justify-content: flex-start; gap: 9px; padding: 0 9px 0 4px; }

.workspace-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #f0caca;
  border-radius: 50%;
  color: #a60000;
  background: #fff4f3;
  font-size: 12px;
  font-weight: 700;
}

.workspace-profile-name {
  max-width: 190px;
  overflow: hidden;
  color: var(--workspace-text);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-caret { display: grid; width: 16px; height: 16px; place-items: center; color: var(--workspace-muted); }
.workspace-caret svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.workspace-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(290px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--workspace-line);
  border-radius: 12px;
  color: var(--workspace-text);
  background: var(--workspace-surface);
  box-shadow: 0 12px 38px rgba(23, 22, 25, .12);
}

.workspace-popover[hidden] { display: none; }
.workspace-popover-title { margin: 0 0 8px; font-size: 15px; font-weight: 700; letter-spacing: -.015em; }
.workspace-popover-note { margin: 0; color: var(--workspace-muted); font-size: 14px; line-height: 1.5; }
.workspace-profile-popover { width: min(300px, calc(100vw - 32px)); }

.workspace-role {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px solid #f0d1d1;
  border-radius: 999px;
  color: #8f1010;
  background: #fff8f7;
  font-size: 12px;
  font-weight: 700;
}

.workspace-divider { height: 1px; margin: 15px 0 10px; background: var(--workspace-line); }

.workspace-menu-button {
  width: 100%;
  min-height: 38px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  color: #514d55;
  background: transparent;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.workspace-menu-button:hover { color: #8f1010; background: #fff5f4; }
.workspace-menu-button:disabled { opacity: .55; cursor: wait; }
.workspace-canvas {
  min-height: calc(100svh - 76px);
  padding: 30px clamp(20px, 4vw, 56px) 36px;
}

.graph-shell { width: min(1360px, 100%); margin: 0 auto; }

.graph-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 0 auto 14px;
}

.graph-control {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #dedee2;
  border-radius: 50%;
  color: #242328;
  background: #fff;
  box-shadow: 0 4px 16px rgba(32, 30, 36, .06);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.graph-control:hover {
  color: #b50000;
  border-color: #e7bcbc;
  background: #fffafa;
  transform: translateY(-1px);
}

.graph-control:focus-visible {
  outline: 2px solid #c50000;
  outline-offset: 3px;
}

.graph-zoom { font-size: 27px; font-weight: 400; line-height: 1; }
.graph-home { width: 56px; height: 56px; }
.graph-home svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }

.graph-stage {
  position: relative;
  height: min(76svh, 840px);
  min-height: 580px;
  overflow: hidden;
  border: 1px solid #2c2c32;
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(129, 41, 47, .16), transparent 43%),
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    #141417;
  background-size: auto, 38px 38px, 38px 38px, auto;
  box-shadow: 0 22px 72px rgba(20, 18, 25, .12);
}

.collaboration-graph { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.collaboration-graph.is-dragging { cursor: grabbing; }

.graph-badge {
  position: absolute;
  top: 17px;
  right: 20px;
  color: rgba(235, 232, 238, .58);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: .08em;
  pointer-events: none;
}

.graph-legend {
  position: absolute;
  right: 20px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  color: rgba(235, 232, 238, .62);
  font-size: 12px;
  pointer-events: none;
}

.graph-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.graph-legend-item::before { content: ""; width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.graph-legend-you::before { background: #ef303f; box-shadow: 0 0 10px rgba(239, 48, 63, .7); }
.graph-legend-members::before { background: #aaa9b2; }
.graph-legend-boundaries::before { width: 11px; height: 8px; border: 1px solid #777481; border-radius: 2px; }

.graph-containers { pointer-events: none; }
.platform-boundary { fill: rgba(255,255,255,.012); stroke: rgba(238,236,242,.30); stroke-width: 1.2; }
.platform-boundary-label { fill: rgba(244,241,248,.76); font-size: 14px; font-weight: 700; letter-spacing: .16em; }
.platform-boundary-mark { fill: #e22534; }
.graph-area-frame { stroke-width: 1.2; stroke-dasharray: 5 8; }
.area-agents { fill: rgba(115,95,155,.045); stroke: rgba(164,145,208,.48); }
.area-interfaces { fill: rgba(80,127,145,.045); stroke: rgba(125,177,193,.48); }
.area-science { fill: rgba(152,108,91,.045); stroke: rgba(193,145,124,.48); }
.graph-area-label { fill: rgba(231,226,238,.72); font-size: 13px; font-weight: 650; letter-spacing: .12em; }

.graph-edge-layer { pointer-events: none; }
.graph-link { fill: none; stroke-linecap: round; }
.graph-link-shared { stroke: rgba(210,208,218,.35); stroke-width: 1.35; stroke-dasharray: 4 6; }
.graph-link-current { stroke: rgba(231,45,58,.72); stroke-width: 1.8; }

.graph-project-card { fill: #202025; stroke: #55545d; stroke-width: 1.2; }
.graph-project:hover .graph-project-card { stroke: #aaa7b1; }
.graph-project-code { fill: #a7a4ae; font-family: "IBM Plex Mono", Consolas, monospace; font-size: 10px; letter-spacing: .11em; }
.graph-project-title { fill: #f6f3f7; font-size: 14px; font-weight: 650; }
.graph-project-rule { stroke: rgba(228,224,239,.12); stroke-width: 1; }
.graph-member-node { fill: #aaa9b2; stroke: #202025; stroke-width: 2; }
.graph-member-label { fill: #c0bdc6; font-size: 11px; }

.graph-focus-glow { fill: rgba(236,35,51,.12); }
.graph-focus-ring { fill: none; stroke: rgba(245,74,85,.82); stroke-width: 1.2; }
.graph-focus-node { fill: #e32939; stroke: #ffabb2; stroke-width: 1.5; }
.graph-focus-initial { fill: #fff; font-size: 17px; font-weight: 750; }
.graph-focus-name { fill: #fff; font-size: 15px; font-weight: 700; }
.graph-focus-caption { fill: rgba(244,241,248,.60); font-family: "IBM Plex Mono", Consolas, monospace; font-size: 10px; letter-spacing: .14em; }

@media (max-width: 560px) {
  .workspace-topbar { min-height: 68px; padding: 0 16px; gap: 12px; }
  .workspace-wordmark strong { font-size: 14px; }
  .workspace-wordmark span { font-size: 14px; }
  .workspace-logo { width: 23px; height: 23px; }
  .workspace-actions { gap: 2px; }
  .workspace-profile-button { padding-right: 5px; }
  .workspace-profile-name,
  .workspace-caret { display: none; }
  .workspace-icon-button { min-width: 36px; height: 36px; }
  .workspace-canvas { min-height: calc(100svh - 68px); padding: 20px 12px 26px; }
  .graph-shell { width: 100%; }
  .graph-controls { margin-bottom: 10px; gap: 9px; }
  .graph-control { width: 42px; height: 42px; }
  .graph-home { width: 48px; height: 48px; }
  .graph-stage { height: 68svh; min-height: 520px; overflow-x: auto; }
  .collaboration-graph { width: 920px; max-width: none; }
  .graph-badge { top: 12px; right: 12px; font-size: 10px; }
  .graph-legend { right: 12px; bottom: 12px; left: 12px; justify-content: flex-start; gap: 10px; font-size: 11px; }
}

/* Graph exploration stays inside the original centered navigation width. */
body.workspace-page { --workspace-column-width: min(40vw, 1080px); }

.workspace-topbar {
  width: var(--workspace-column-width);
  margin: 0 auto;
  padding-right: clamp(16px, 2vw, 30px);
  padding-left: clamp(16px, 2vw, 30px);
}

.workspace-canvas {
  width: var(--workspace-column-width);
  min-height: calc(100svh - 76px);
  margin: 0 auto;
  padding: 24px 0 30px;
}

.network-shell { width: 100%; margin: 0 auto; }
.network-controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 0 auto 8px; }

.network-example-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 8px 12px; }
.network-example-status { margin: 0; color: #77737d; font-size: 13px; }
.network-example-toggle { min-height: 36px; padding: 0 14px; border: 1px solid #e1bfc2; border-radius: 999px; color: #9b101c; background: #fff; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.network-example-toggle:hover { background: #fff6f6; border-color: #c74d56; }
.network-example-toggle:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.network-gesture-hint { margin: -4px 0 8px; color: #85818a; text-align: center; font-size: 11px; }

.network-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 5px;
}

.network-filter-button {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: opacity 140ms ease, border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.network-filter-button:hover { border-color: #ead0d2; background: #fff8f8; transform: translateY(-1px); }
.network-filter-button:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.network-filter-button[aria-pressed="false"] { opacity: .24; }
.network-filter-button svg { width: 22px; height: 22px; overflow: visible; }

.network-filter-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; margin-left: 8px; }
.network-filter-action { min-height: 28px; padding: 0 10px; border: 1px solid #e8d8d9; border-radius: 999px; color: #5d5961; background: #fff; font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; transition: border-color 140ms ease, color 140ms ease, background 140ms ease; }
.network-filter-action:hover { border-color: #c50000; color: #a30d18; background: #fff8f8; }
.network-filter-action:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }

.network-control {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #252329;
  background: transparent;
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: color 140ms ease, opacity 140ms ease;
}

.network-control:hover:not(:disabled) { color: #b50000; }
.network-control:disabled { opacity: .32; cursor: default; }
.network-control:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.network-home { width: 52px; height: 52px; border: 1px solid #aaa8ae; }
.network-home svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.network-stage {
  width: 100%;
  height: min(72svh, 740px);
  min-height: 500px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
}
.network-stage * { -webkit-user-select: none; user-select: none; }
.network-stage.is-space-pan-mode { cursor: grab; }
.network-stage.is-panning { cursor: grabbing; }
.network-entity-movable { cursor: grab; }
.network-stage.is-moving-node,
.network-stage.is-moving-node .network-entity-movable { cursor: grabbing; }
.network-stage.is-moving-node .network-edge { animation-play-state: paused; }
.network-node-dragged .network-entity { animation: none; opacity: 1; }

.network-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.network-links { fill: none; }
.network-edge { fill: none; stroke: #aaa6af; stroke-width: 1.45; opacity: .76; animation: connectionAppear 260ms ease both; }
.network-edge-current { stroke: #c82633; stroke-width: 1.8; opacity: .82; }
.network-edge-highlighted-base { opacity: .24; }
.network-edge-highlight { stroke-width: 3.2; stroke-linecap: round; opacity: 1; animation: none; pointer-events: none; }
.network-edge-highlight-red { stroke: #d72d3a; }
.network-edge-highlight-blue { stroke: #3478d4; }
.network-entity { animation: sphereAppear 280ms cubic-bezier(.2,.8,.2,1) both; }
.network-entity-expandable { cursor: pointer; }
.network-entity-expandable:not(.network-node-selected):hover { filter: drop-shadow(0 2px 4px rgba(70, 26, 33, .22)); }
.network-entity-hit-area { fill: transparent; pointer-events: all; cursor: pointer; }
.network-user-disc { fill: #d91e2d; stroke: #a8111c; stroke-width: 1.2; }
.network-glyph {
  overflow: visible;
  pointer-events: all;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 140ms ease;
}
.network-entity-expandable .network-glyph { cursor: pointer; }
.network-entity-label { fill: #28262d; font-size: 18px; font-weight: 650; }
.network-entity-label,
.network-entity-type { pointer-events: none; }
.network-entity-project .network-entity-label { font-size: 20px; }
.network-entity-label-global { font-size: 21px; }
.network-entity-type { fill: #85818a; font-size: 15px; font-weight: 550; letter-spacing: .07em; }
.network-empty-state { margin: 0; color: #77737d; text-align: center; font-size: 14px; }

@keyframes sphereAppear {
  from { opacity: 0; transform: scale(.72); transform-box: fill-box; transform-origin: center; }
  to { opacity: 1; transform: scale(1); transform-box: fill-box; transform-origin: center; }
}

@keyframes connectionAppear {
  from { opacity: 0; }
  to { opacity: .74; }
}

@media (max-width: 760px) {
  body.workspace-page { --workspace-column-width: calc(100vw - 24px); }
  .workspace-preview-mode { margin-top: 8px; padding: 0 12px; }
  .workspace-topbar { width: var(--workspace-column-width); min-height: 68px; padding: 0 12px; }
  .workspace-canvas { width: var(--workspace-column-width); min-height: calc(100svh - 68px); padding: 16px 0 24px; }
  .network-controls { gap: 16px; margin-bottom: 8px; }
  .network-control { width: 42px; height: 42px; }
  .network-home { width: 46px; height: 46px; }
  .network-stage { height: 68svh; min-height: 460px; }
  .network-example-row { margin-right: 2px; margin-left: 2px; gap: 8px; }
  .network-example-status { font-size: 12px; }
  .network-example-toggle { flex-shrink: 0; padding: 0 10px; font-size: 12px; }
  .network-entity-label { font-size: 17px; }
}

/* Keep the graph in its centered 40% column and use the right 30% for node gadgets. */
.workspace-canvas {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 30fr) minmax(0, 40fr) minmax(0, 30fr);
  align-items: start;
  padding: 24px 0 30px;
}

.network-shell {
  grid-column: 2;
  min-width: 0;
  width: 100%;
  margin: 0 auto;
}

.network-filter-actions { flex-wrap: nowrap; }

.network-help-wrap { position: relative; display: grid; flex: 0 0 auto; place-items: center; }

.network-help-trigger {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #c8c5cc;
  border-radius: 50%;
  color: #514d55;
  background: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.network-help-trigger:hover,
.network-help-trigger[aria-expanded="true"] { color: #a30d18; border-color: #c50000; background: #fff8f8; }
.network-help-trigger:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }

.network-help-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 25;
  width: min(340px, calc(100vw - 32px));
  padding: 16px 18px;
  border: 1px solid var(--workspace-line);
  border-radius: 12px;
  color: var(--workspace-text);
  background: #fff;
  box-shadow: 0 12px 38px rgba(23, 22, 25, .14);
}

.network-help-popover[hidden] { display: none; }
.network-help-copy { margin: 0; font-size: 14px; line-height: 1.55; }

.network-detail-panel {
  grid-column: 3;
  position: sticky;
  top: 94px;
  width: calc(100% - clamp(14px, 1.4vw, 26px));
  max-height: calc(100svh - 116px);
  overflow: auto;
  margin-left: clamp(14px, 1.4vw, 26px);
  padding: 20px;
  border: 1px solid var(--workspace-line);
  border-radius: 14px;
  color: var(--workspace-text);
  background: var(--workspace-surface);
  box-shadow: 0 10px 34px rgba(23, 22, 25, .09);
}

.network-detail-panel[hidden] { display: none; }
.network-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--workspace-line); }
.network-detail-heading { min-width: 0; }
.network-detail-route-badge { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; margin-left: auto; padding: 6px 9px; border: 1px solid currentColor; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.network-detail-route-badge::before { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: currentColor; content: ""; }
.network-detail-route-badge-red { color: #c82633; background: #fff3f4; }
.network-detail-route-badge-blue { color: #276cb8; background: #f1f7ff; }
.network-detail-kind { margin: 0 0 7px; color: #9b101c; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.network-detail-title { margin: 0; font-size: clamp(20px, 1.4vw, 25px); line-height: 1.2; overflow-wrap: anywhere; }

.network-detail-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--workspace-line);
  border-radius: 50%;
  color: #5f5b63;
  background: #fff;
  font: inherit;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.network-detail-close:hover { color: #a30d18; border-color: #e5bfc2; background: #fff8f8; }
.network-detail-close:focus-visible,
.network-detail-action:focus-visible,
.network-note-editor:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.network-detail-body { display: grid; gap: 14px; padding-top: 16px; }
.network-detail-copy { margin: 0; color: #58545d; font-size: 16px; line-height: 1.55; }
.network-detail-meta { display: grid; gap: 4px; padding: 11px 0; border-bottom: 1px solid #efeff1; }
.network-detail-meta-label { color: #77727e; font-size: 13px; font-weight: 650; }
.network-detail-meta-value { color: #302d34; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }

.network-detail-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #c50000;
  border-radius: 8px;
  color: #a30d18;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.network-detail-action:hover:not(:disabled) { color: #fff; background: #b31320; }
.network-detail-action:disabled { border-color: #e5e2e7; color: #99949e; background: #f8f8f9; cursor: not-allowed; }
.network-detail-footnote { margin: -6px 0 0; color: #77727e; font-size: 13px; line-height: 1.45; }
.network-detail-footnote.is-saved { color: #35734c; }

.network-recent-papers { display: grid; gap: 9px; margin-top: 3px; padding-top: 14px; border-top: 1px solid var(--workspace-line); }
.network-recent-papers-heading { margin: 0; color: var(--workspace-muted); font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.network-recent-papers-list { display: grid; gap: 7px; }
.network-recent-paper { display: grid; gap: 3px; min-width: 0; padding: 10px 11px; border: 1px solid var(--workspace-line); border-radius: 9px; color: var(--workspace-text); background: var(--workspace-bg); text-decoration: none; transition: border-color 150ms ease, background 150ms ease; }
.network-recent-paper:hover { border-color: #bd3540; background: #fff7f7; }
.network-recent-paper:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.network-recent-paper-title { overflow-wrap: anywhere; font-size: 14px; font-weight: 700; line-height: 1.35; }
.network-recent-paper-meta { color: var(--workspace-muted); font-size: 12px; line-height: 1.35; }
body.workspace-page.theme-dark .network-recent-paper:hover { background: #30252b; }

.network-note-editor {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #d9d6dd;
  border-radius: 8px;
  color: #302d34;
  background: #fff;
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
}

.network-chat-url-editor {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #d9d6dd;
  border-radius: 8px;
  color: #302d34;
  background: #fff;
  font: inherit;
  font-size: 14px;
}
.network-chat-url-editor:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }

.network-node { cursor: pointer; }
.network-node-selected .network-glyph,
.network-node:focus-visible .network-glyph { transform: scale(1.24); }

@media (max-width: 1100px) and (min-width: 761px) {
  .workspace-canvas { display: block; padding: 20px 16px 28px; }
  .network-shell { width: min(40vw, 700px); margin: 0 auto; }
  .workspace-canvas.has-node-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 38%);
    gap: 16px;
  }
  .workspace-canvas.has-node-details .network-shell { grid-column: 1; width: 100%; margin: 0; }
  .workspace-canvas.has-node-details .network-detail-panel { grid-column: 2; width: 100%; margin: 0; }
}

@media (max-width: 760px) {
  .workspace-canvas { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 0 24px; }
  .network-shell { width: 100%; margin: 0; }
  .network-detail-panel { position: relative; top: auto; width: 100%; max-height: none; margin: 0; }
  .network-filter-bar { gap: 2px; }
  .network-filter-actions { gap: 4px; margin-left: 4px; }
  .network-filter-action { padding: 0 7px; font-size: 10px; }
  .network-help-trigger { width: 28px; height: 28px; }
}

/* Personal gadget board in the left workspace column. */
.workspace-gadget-panel {
  grid-column: 1;
  position: relative;
  min-width: 0;
  min-height: calc(100svh - 106px);
  padding: 0 10px;
}

.workspace-layout-toggle {
  position: absolute;
  z-index: 32;
  top: 0;
  left: 0;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: start;
  padding: 6px 0 0 6px;
  border: 0;
  color: #fff;
  background: #c50000;
  clip-path: polygon(0 0, 100% 0, 0 100%);
  cursor: pointer;
  transition: background 150ms ease, filter 150ms ease;
}

.workspace-layout-toggle:hover,
.workspace-layout-toggle[aria-expanded="true"] { background: #a90000; }
.workspace-layout-toggle:focus-visible { outline: 3px solid #c50000; outline-offset: 3px; }
.workspace-layout-toggle svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.workspace-gadget-grid {
  display: grid;
  grid-template-columns: repeat(var(--gadget-columns, 1), minmax(0, 1fr));
  grid-auto-rows: clamp(70px, 7.5vw, 108px);
  gap: clamp(7px, .8vw, 12px);
  align-content: start;
  padding: 9px 2px;
}

.workspace-gadget-grid.is-single {
  min-height: calc(100svh - 140px);
  grid-template-columns: minmax(96px, 124px);
  grid-auto-rows: 108px;
  align-content: center;
  justify-content: center;
}

.workspace-gadget-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px dashed #d9d7dc;
  border-radius: 15px;
  background: rgba(255,255,255,.42);
  transition: border-color 150ms ease, background 150ms ease;
}

.workspace-gadget-slot:hover { border-color: #cdbfc0; background: #fff; }
.workspace-gadget-slot.has-gadget { border-color: transparent; background: transparent; }
.workspace-gadget-slot.is-dragging { opacity: .42; }
.workspace-gadget-slot.is-drop-target { z-index: 1; border-color: #b31320; background: #fff4f3; box-shadow: inset 0 0 0 1px rgba(179,19,32,.16); }
.workspace-gadget-slot.is-intentional-empty { border-color: transparent; background: transparent; }
.workspace-gadget-grid.is-single .workspace-gadget-slot { min-height: 108px; }

.workspace-gadget-add {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid #ddd9df;
  border-radius: 50%;
  color: #b31320;
  background: #fff;
  box-shadow: 0 5px 20px rgba(28,24,30,.07);
  font: inherit;
  font-size: 30px;
  font-weight: 350;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.workspace-gadget-add:hover { transform: scale(1.06); border-color: #c50000; box-shadow: 0 7px 24px rgba(197,0,0,.12); }
.workspace-gadget-add:focus-visible,
.workspace-gadget-link:focus-visible,
.workspace-gadget-remove:focus-visible { outline: 2px solid #c50000; outline-offset: 3px; }

.workspace-gadget-link {
  width: 100%;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 5px;
  border: 1px solid #e5e3e7;
  border-radius: 14px;
  color: #302d34;
  background: #fff;
  box-shadow: 0 7px 22px rgba(28,24,30,.06);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.workspace-gadget-link:hover { transform: translateY(-2px); border-color: #d8bfc1; box-shadow: 0 10px 28px rgba(28,24,30,.1); }
.workspace-gadget-link svg { width: clamp(25px, 2.8vw, 38px); height: clamp(25px, 2.8vw, 38px); flex: 0 0 auto; }
.workspace-gadget-label { max-width: 100%; overflow: hidden; color: #514d55; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.workspace-gadget-grid.is-editing .workspace-gadget-link { cursor: grab; user-select: none; }
.workspace-gadget-grid.is-editing .workspace-gadget-link:active { cursor: grabbing; }
.workspace-gadget-empty { border-style: dashed; border-color: #d9d7dc; color: #85818a; background: rgba(255,255,255,.42); box-shadow: none; font-size: 13px; font-weight: 600; }
.workspace-gadget-empty:hover { transform: none; border-color: #cdbfc0; background: rgba(255,255,255,.7); box-shadow: none; }
.workspace-gadget-grid.is-dense .workspace-gadget-link { gap: 0; padding: 5px 2px; }
.workspace-gadget-grid.is-dense .workspace-gadget-label { display: none; }
.workspace-gadget-grid.is-dense .workspace-gadget-link svg { width: 28px; height: 28px; }

.workspace-gadget-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #e5e2e7;
  border-radius: 50%;
  color: #8f1010;
  background: #fff;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.workspace-layout-editor,
.workspace-gadget-dialog {
  position: absolute;
  z-index: 40;
  width: min(330px, calc(100% - 20px));
  padding: 18px;
  border: 1px solid var(--workspace-line);
  border-radius: 14px;
  color: var(--workspace-text);
  background: #fff;
  box-shadow: 0 14px 44px rgba(23,22,25,.17);
}

.workspace-layout-editor[hidden],
.workspace-gadget-dialog[hidden] { display: none; }
.workspace-layout-editor { top: 67px; left: 10px; }
.workspace-layout-editor-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.workspace-layout-editor-header .workspace-gadget-dialog-kicker { margin: 0; }
.workspace-layout-close { width: 30px; height: 30px; display: grid; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid #dedbe1; border-radius: 50%; color: #6d6871; background: #fff; font: inherit; font-size: 21px; line-height: 1; cursor: pointer; }
.workspace-layout-close:hover { border-color: #c50000; color: #a30d18; background: #fff8f8; }
.workspace-layout-close:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.workspace-gadget-dialog { top: 50%; left: 50%; max-height: min(82svh, 600px); overflow: auto; transform: translate(-50%, -50%); }
.workspace-gadget-dialog-kicker { margin: 0 0 6px; color: #a30d18; font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.workspace-layout-title,
.workspace-gadget-dialog-title { margin: 0 0 15px; font-size: 19px; line-height: 1.25; }
.workspace-layout-dimension { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid #efeff1; }
.workspace-layout-label { font-size: 15px; font-weight: 650; }
.workspace-layout-stepper { display: flex; align-items: center; gap: 11px; }
.workspace-layout-step { width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 1px solid #dfdce2; border-radius: 50%; color: #514d55; background: #fff; font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.workspace-layout-step:hover:not(:disabled) { border-color: #c50000; color: #a30d18; }
.workspace-layout-step:disabled { opacity: .4; cursor: not-allowed; }
.workspace-layout-value { min-width: 18px; text-align: center; font-size: 15px; font-weight: 700; }
.workspace-layout-hint { margin: 12px 0 0; color: var(--workspace-muted); font-size: 14px; line-height: 1.5; }
.workspace-gadget-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.workspace-gadget-option { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid #e5e3e7; border-radius: 10px; color: var(--workspace-text); background: #fff; font: inherit; font-size: 14px; font-weight: 650; text-align: left; cursor: pointer; }
.workspace-gadget-option:hover { border-color: #d8bfc1; background: #fffafa; }
.workspace-gadget-option svg { width: 28px; height: 28px; flex: 0 0 auto; }
.workspace-gadget-link-form { display: grid; gap: 12px; }
.workspace-gadget-link-label { display: grid; gap: 7px; color: #514d55; font-size: 14px; font-weight: 650; }
.workspace-gadget-link-input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #d9d6dd; border-radius: 8px; color: #302d34; background: #fff; font: inherit; font-size: 14px; }
.workspace-gadget-link-input:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.workspace-gadget-link-error { margin: -5px 0 0; color: #9b101c; font-size: 13px; line-height: 1.4; }
.workspace-gadget-link-error[hidden] { display: none; }
.workspace-gadget-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 3px; }
.workspace-gadget-primary,
.workspace-gadget-secondary { min-height: 38px; padding: 0 12px; border: 1px solid #dedbe1; border-radius: 8px; color: #514d55; background: #fff; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.workspace-gadget-primary { border-color: #b31320; color: #fff; background: #b31320; }
.workspace-gadget-primary:hover:not(:disabled) { background: #930c17; }
.workspace-gadget-primary:disabled { opacity: .5; cursor: not-allowed; }
.workspace-gadget-secondary:hover { border-color: #c8c4cc; background: #f8f8f9; }
.workspace-gadget-cancel { margin-top: 12px; }

/* Keep the right side as a stack of up to two independent node cards. */
.network-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.network-detail-card {
  flex: 0 0 auto;
  padding: 20px;
  border: 1px solid var(--workspace-line);
  border-radius: 14px;
  color: var(--workspace-text);
  background: var(--workspace-surface);
  box-shadow: 0 10px 34px rgba(23,22,25,.09);
}

@media (max-width: 1100px) and (min-width: 761px) {
  .workspace-canvas { display: grid; grid-template-columns: 30% 50% 20%; gap: 0; padding: 20px 0 28px; }
  .workspace-canvas.has-node-details { display: grid; grid-template-columns: 30% 50% 20%; gap: 0; padding: 20px 0 28px; }
  .workspace-gadget-panel { grid-column: 1; min-height: calc(100svh - 96px); padding: 0 7px; }
  .workspace-canvas.has-node-details .workspace-gadget-panel { grid-column: 1; }
  .network-shell { grid-column: 2; width: 100%; margin: 0; }
  .workspace-canvas.has-node-details .network-shell { grid-column: 2; width: 100%; margin: 0; }
  .network-detail-panel { grid-column: 3; width: calc(100% - 10px); margin: 0 0 0 10px; }
  .workspace-canvas.has-node-details .network-detail-panel { grid-column: 3; width: calc(100% - 10px); margin: 0 0 0 10px; }
}

@media (max-width: 760px) {
  .workspace-canvas.has-node-details { display: flex; grid-template-columns: none; flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 0 24px; }
  .workspace-canvas.has-node-details .network-shell { width: 100%; margin: 0; }
  .workspace-canvas.has-node-details .workspace-gadget-panel,
  .workspace-canvas.has-node-details .network-detail-panel { width: 100%; margin: 0; }
  .workspace-gadget-panel { width: 100%; min-height: 250px; padding: 50px 12px 12px; }
  .workspace-gadget-grid { grid-auto-rows: 82px; }
  .workspace-gadget-grid.is-single { min-height: 170px; }
  .workspace-layout-toggle { top: 0; left: 0; }
  .workspace-layout-editor { top: 64px; left: 8px; }
  .workspace-gadget-dialog { position: fixed; top: 50%; left: 50%; width: min(390px, calc(100vw - 32px)); }
  .network-detail-panel { position: relative; top: auto; width: 100%; max-height: none; margin: 0; overflow: visible; }
}

/* Keep the workspace proportions: 30% gadgets, 50% graph, 20% node details. */
@media (min-width: 761px) {
  body.workspace-page { --workspace-left-pane-width: 30vw; }

  .workspace-layout {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: 30% 50% 20%;
    grid-template-rows: auto auto auto;
    align-content: start;
  }

  .workspace-topbar {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0 clamp(8px, 1vw, 22px);
  }

  .workspace-topbar::after { display: none; }

  .workspace-preview-mode {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    margin: 10px 0 0;
  }

  .workspace-canvas {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: 30% 50% 20%;
    margin: 0;
    padding: 24px 0 30px;
  }

  .workspace-canvas.has-node-details {
    grid-template-columns: 30% 50% 20%;
    gap: 0;
  }

  .network-shell,
  .workspace-canvas.has-node-details .network-shell {
    grid-column: 2;
    width: 100%;
    margin: 0;
  }

  .network-detail-panel,
  .workspace-canvas.has-node-details .network-detail-panel {
    grid-column: 3;
    width: 100%;
    margin: 0;
  }

  .workspace-gadget-panel {
    --gadget-corner-size: clamp(76px, 6.5vw, 100px);
    position: fixed;
    z-index: 12;
    inset: 0 auto 0 0;
    width: var(--workspace-left-pane-width);
    height: 100svh;
    min-height: 100svh;
    padding: 0;
  }

  .workspace-layout-toggle {
    top: 0;
    left: 0;
    width: var(--gadget-corner-size);
    height: var(--gadget-corner-size);
    padding: 9px 0 0 9px;
  }

  .workspace-layout-toggle svg { width: 30px; height: 30px; }

  .workspace-layout-editor {
    top: 120px;
    left: 4vw;
    width: 74vw;
    height: 128px;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .workspace-layout-editor-header { position: absolute; top: 6px; right: 6px; margin: 0; }
  .workspace-layout-editor-header .workspace-gadget-dialog-kicker { display: none; }
  .workspace-layout-title,
  .workspace-layout-hint { display: none; }
  .workspace-layout-close { width: 28px; height: 28px; font-size: 19px; }
  .workspace-layout-dimension {
    position: relative;
    left: 4vw;
    width: min(404px, calc(100% - 32px));
    min-height: 46px;
    flex: 0 0 46px;
    gap: 8px;
    margin: 0 auto;
    padding: 4px 12px;
    border: 1px solid var(--workspace-line);
    border-radius: 0;
    background: var(--workspace-surface);
    box-sizing: border-box;
  }
  .workspace-layout-editor > .workspace-layout-dimension:nth-of-type(2) { border-radius: 8px 8px 0 0; }
  .workspace-layout-editor > .workspace-layout-dimension + .workspace-layout-dimension { border-top: 0; border-radius: 0 0 8px 8px; }
  .workspace-layout-label { font-size: 14px; }
  .workspace-layout-stepper { gap: 10px; }
  .workspace-layout-step { width: 36px; height: 36px; font-size: 20px; }

  .workspace-layout-editor:not([hidden]) ~ .workspace-gadget-grid {
    height: calc(100svh - 256px);
    min-height: 0;
    margin-top: 256px;
    padding-top: 18px;
  }

  body.workspace-page:has(.workspace-layout-editor:not([hidden])) .network-shell { padding-top: 144px; }

  .workspace-gadget-grid {
    width: 100%;
    height: 100%;
    min-height: 100svh;
    align-content: center;
    padding: clamp(18px, 2vw, 32px);
  }

  .workspace-gadget-grid.is-single {
    height: 100%;
    min-height: 100svh;
    grid-template-columns: minmax(150px, 180px);
    grid-auto-rows: minmax(150px, 180px);
    align-content: center;
    justify-content: center;
  }

  .workspace-gadget-grid.is-single .workspace-gadget-slot:not(.has-gadget) {
    border-color: transparent;
    border-radius: 0;
    background: transparent;
  }

  .workspace-gadget-grid.is-single .workspace-gadget-slot:not(.has-gadget):hover {
    border-color: transparent;
    background: transparent;
  }

  .workspace-gadget-grid.is-single .workspace-gadget-add {
    position: relative;
    width: 84px;
    height: 84px;
    padding: 0 0 5px;
    border: 1px solid #ead4d6;
    border-radius: 50%;
    color: #b31320;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23,22,25,.12);
    font-size: 46px;
    font-weight: 350;
  }

  .workspace-gadget-grid.is-single .workspace-gadget-add:hover {
    transform: translateY(-2px) scale(1.04);
    border-color: #b31320;
    background: #fff9f9;
    box-shadow: 0 11px 28px rgba(179,19,32,.18);
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .workspace-canvas,
  .workspace-canvas.has-node-details { grid-template-columns: 30% 50% 20%; }
}

@media (max-width: 760px) {
  .workspace-gadget-panel {
    --gadget-corner-size: 82px;
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-height: 250px;
    padding: 50px 12px 12px;
  }

  .workspace-topbar,
  .workspace-preview-mode,
  .workspace-canvas,
  .workspace-canvas.has-node-details {
    width: min(calc(100vw - 24px), 1080px);
    margin-right: auto;
    margin-left: auto;
  }
  .workspace-preview-mode { margin-top: 8px; }
  .workspace-gadget-grid.is-single { min-height: 170px; }
  .workspace-layout-editor {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 40px 0 12px;
    overflow: visible;
    box-sizing: border-box;
  }
  .workspace-gadget-grid.is-single .workspace-gadget-slot:not(.has-gadget),
  .workspace-gadget-grid.is-single .workspace-gadget-slot:not(.has-gadget):hover { border-color: transparent; background: transparent; }
  .workspace-gadget-grid.is-single .workspace-gadget-add {
    position: relative;
    width: 72px;
    height: 72px;
    padding: 0 0 4px;
    border: 1px solid #ead4d6;
    border-radius: 50%;
    color: #b31320;
    background: #fff;
    box-shadow: 0 7px 20px rgba(23,22,25,.11);
    font-size: 42px;
    font-weight: 350;
  }
}

/* Header actions stay grouped against the right edge as the toolbar grows. */
.workspace-brand { position: relative; z-index: 1; flex: 0 0 auto; }
.workspace-actions { position: relative; z-index: 1; flex: 0 0 auto; margin-left: auto; }
.workspace-topbar { justify-content: flex-start; }
.workspace-topbar.tutorial-raised { z-index: 1010; }
.workspace-tutorial-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--workspace-line);
  border-radius: 999px;
  color: var(--workspace-text);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.workspace-tutorial-button svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.workspace-tutorial-button:hover,
.workspace-icon-button:hover,
.workspace-profile-button:hover { border-color: var(--workspace-line); background: #f2f1f3; }
.workspace-icon-button.workspace-settings-button svg { width: 23px; height: 23px; stroke-width: 1.9; }
.workspace-icon-button.workspace-theme-button { color: #9b6c00; }
.workspace-icon-button.workspace-theme-button[aria-pressed="true"] { color: #e6c56a; }
.workspace-tutorial-button:focus-visible { outline: 2px solid #c50000; outline-offset: 3px; }

@media (max-width: 560px) {
  .workspace-topbar { padding-right: 8px; padding-left: 8px; gap: 6px; }
  .workspace-actions { gap: 2px; }
  .workspace-wordmark { gap: 4px; }
  .workspace-wordmark strong,
  .workspace-wordmark span { font-size: 12px; }
  .workspace-logo { width: 21px; height: 21px; }
  .workspace-tutorial-button,
  .workspace-icon-button { width: 32px; min-width: 32px; height: 34px; min-height: 34px; padding: 0; }
  .workspace-profile-button { width: 32px; min-width: 32px; height: 34px; justify-content: center; padding: 0; }
  .workspace-avatar { width: 27px; height: 27px; }
  .workspace-tutorial-button span { display: none; }
  .workspace-icon-button.workspace-settings-button svg { width: 20px; height: 20px; }
}

@media (min-width: 761px) and (max-width: 1300px) {
  .workspace-topbar { padding: 0 12px; gap: 8px; }
  .workspace-brand { gap: 6px; }
  .workspace-logo { width: 22px; height: 22px; }
  .workspace-wordmark { gap: 4px; }
  .workspace-wordmark strong { font-size: 15px; }
  .workspace-actions { gap: 4px; }
  .workspace-tutorial-button span { display: none; }
  .workspace-tutorial-button { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; }
  .workspace-icon-button,
  .workspace-profile-button { width: 34px; min-width: 34px; height: 36px; min-height: 36px; padding: 0; }
  .workspace-profile-button { justify-content: center; }
  .workspace-avatar { width: 27px; height: 27px; }
  .workspace-profile-name,
  .workspace-caret { display: none; }
}

@media (min-width: 761px) and (max-width: 900px) {
  .workspace-wordmark span { display: none; }
  .workspace-wordmark strong { font-size: 14px; }
}

@media (max-width: 760px) {
  .workspace-topbar { padding: 0 clamp(8px, 2vw, 16px); gap: 8px; }
  .workspace-brand { gap: 6px; }
  .workspace-actions { gap: 3px; }
  .workspace-tutorial-button span,
  .workspace-profile-name,
  .workspace-caret { display: none; }
  .workspace-tutorial-button,
  .workspace-icon-button,
  .workspace-profile-button { width: 32px; min-width: 32px; height: 34px; min-height: 34px; padding: 0; }
  .workspace-tutorial-button { padding: 0; }
  .workspace-profile-button { justify-content: center; }
  .workspace-avatar { width: 27px; height: 27px; }
}

@media (max-width: 420px) {
  .workspace-wordmark span { display: none; }
}

@media (max-width: 360px) {
  .workspace-topbar { padding: 0 4px; gap: 4px; }
  .workspace-logo { width: 18px; height: 18px; }
  .workspace-wordmark { gap: 3px; }
  .workspace-wordmark strong { font-size: 11px; }
  .workspace-actions { gap: 1px; }
  .workspace-tutorial-button,
  .workspace-icon-button,
  .workspace-profile-button { width: 28px; min-width: 28px; height: 32px; min-height: 32px; }
  .workspace-avatar { width: 24px; height: 24px; }
}

/* Dark mode is the default; collaborators can switch to light mode. */
body.workspace-page.theme-dark {
  color-scheme: dark;
  --workspace-bg: #17161a;
  --workspace-surface: #232127;
  --workspace-line: #3b3841;
  --workspace-text: #f2f0f4;
  --workspace-muted: #aaa5b0;
  background: var(--workspace-bg);
}
body.workspace-page.theme-dark .workspace-layout { background: var(--workspace-bg); }
body.workspace-page.theme-dark .workspace-topbar,
body.workspace-page.theme-dark .workspace-topbar::after { background: rgba(31, 29, 34, .96); }
body.workspace-page.theme-dark .workspace-icon-button,
body.workspace-page.theme-dark .workspace-profile-button { color: var(--workspace-text); }
body.workspace-page.theme-dark .workspace-tutorial-button,
body.workspace-page.theme-dark .workspace-icon-button:hover,
body.workspace-page.theme-dark .workspace-profile-button:hover,
body.workspace-page.theme-dark .workspace-icon-button[aria-expanded="true"],
body.workspace-page.theme-dark .workspace-profile-button[aria-expanded="true"] { color: var(--workspace-text); background: #302d35; }
body.workspace-page.theme-dark .workspace-icon-button.workspace-theme-button { color: #f0d47f; }
body.workspace-page.theme-dark .workspace-avatar { border-color: #6c4145; color: #ffc1c5; background: #332126; }
body.workspace-page.theme-dark .workspace-popover,
body.workspace-page.theme-dark .network-help-popover,
body.workspace-page.theme-dark .workspace-layout-editor,
body.workspace-page.theme-dark .workspace-gadget-dialog { border-color: var(--workspace-line); color: var(--workspace-text); background: var(--workspace-surface); }
@media (min-width: 761px) {
  body.workspace-page.theme-dark .workspace-layout-editor { border-color: transparent; background: transparent; box-shadow: none; }
}
body.workspace-page.theme-dark .network-detail-panel { border: 0; color: var(--workspace-text); background: transparent; box-shadow: none; }
body.workspace-page.theme-dark .workspace-role { border-color: #684047; color: #ffc1c5; background: #35232a; }
body.workspace-page.theme-dark .workspace-menu-button { color: var(--workspace-text); }
body.workspace-page.theme-dark .workspace-menu-button:hover { color: #ffc1c5; background: #35232a; }
body.workspace-page.theme-dark .workspace-preview-mode { color: #ff929a; }
body.workspace-page.theme-dark .network-example-toggle,
body.workspace-page.theme-dark .network-filter-action,
body.workspace-page.theme-dark .network-help-trigger,
body.workspace-page.theme-dark .network-detail-close,
body.workspace-page.theme-dark .network-detail-action,
body.workspace-page.theme-dark .workspace-gadget-add,
body.workspace-page.theme-dark .workspace-layout-close,
body.workspace-page.theme-dark .workspace-layout-step,
body.workspace-page.theme-dark .workspace-gadget-option,
body.workspace-page.theme-dark .workspace-gadget-secondary,
body.workspace-page.theme-dark .workspace-gadget-link {
  border-color: var(--workspace-line);
  color: var(--workspace-text);
  background: #2b2930;
}
body.workspace-page.theme-dark .workspace-gadget-grid.is-single .workspace-gadget-add {
  border-color: #594047;
  color: #ff818b;
  background: #262329;
  box-shadow: 0 8px 25px rgba(0,0,0,.32), inset 0 0 0 1px rgba(255,255,255,.025);
}
body.workspace-page.theme-dark .workspace-gadget-grid.is-single .workspace-gadget-add:hover {
  border-color: #b64e59;
  color: #ffadb3;
  background: #30262c;
  box-shadow: 0 10px 28px rgba(197,0,0,.19);
}
body.workspace-page.theme-dark .network-example-toggle:hover,
body.workspace-page.theme-dark .network-filter-action:hover,
body.workspace-page.theme-dark .network-help-trigger:hover,
body.workspace-page.theme-dark .network-detail-close:hover,
body.workspace-page.theme-dark .workspace-gadget-option:hover,
body.workspace-page.theme-dark .workspace-gadget-secondary:hover { border-color: #815057; background: #352b31; }
body.workspace-page.theme-dark .network-control { color: var(--workspace-text); }
body.workspace-page.theme-dark .network-help-popover { background: var(--workspace-surface); }
body.workspace-page.theme-dark .network-detail-kind,
body.workspace-page.theme-dark .network-detail-meta-label,
body.workspace-page.theme-dark .network-detail-footnote,
body.workspace-page.theme-dark .network-detail-copy,
body.workspace-page.theme-dark .network-detail-meta-value,
body.workspace-page.theme-dark .workspace-gadget-link-label { color: var(--workspace-text); }
body.workspace-page.theme-dark .workspace-layout-hint,
body.workspace-page.theme-dark .network-empty-state,
body.workspace-page.theme-dark .network-example-status,
body.workspace-page.theme-dark .network-gesture-hint { color: var(--workspace-muted); }
body.workspace-page.theme-dark .workspace-gadget-dialog-kicker,
body.workspace-page.theme-dark .workspace-gadget-link-error,
body.workspace-page.theme-dark .network-detail-kind { color: #ff929a; }
body.workspace-page.theme-dark .network-entity-label { fill: #eeeaf1; }
body.workspace-page.theme-dark .network-entity-type { fill: #b3aeb9; }
body.workspace-page.theme-dark .network-edge { stroke: #77717e; }
body.workspace-page.theme-dark .network-edge-current { stroke: #ef6470; }
body.workspace-page.theme-dark .network-edge-highlighted-base { opacity: .18; }
body.workspace-page.theme-dark .network-edge-highlight-red { stroke: #ff6875; }
body.workspace-page.theme-dark .network-edge-highlight-blue { stroke: #72afff; }
body.workspace-page.theme-dark .network-detail-route-badge-red { color: #ff8490; background: #3b252a; }
body.workspace-page.theme-dark .network-detail-route-badge-blue { color: #83baff; background: #242f41; }
body.workspace-page.theme-dark .network-detail-meta { border-color: var(--workspace-line); }
body.workspace-page.theme-dark .network-note-editor,
body.workspace-page.theme-dark .network-chat-url-editor,
body.workspace-page.theme-dark .workspace-gadget-link-input {
  border-color: var(--workspace-line);
  color: var(--workspace-text);
  background: #19181d;
}
body.workspace-page.theme-dark .network-node-editor-input { border-color: var(--workspace-line); color: var(--workspace-text); background: #19181d; }
body.workspace-page.theme-dark .workspace-gadget-slot { border-color: #46424c; background: rgba(255,255,255,.025); }
body.workspace-page.theme-dark .workspace-gadget-slot:hover { border-color: #6d5861; background: #29262e; }
body.workspace-page.theme-dark .workspace-gadget-slot.has-gadget,
body.workspace-page.theme-dark .workspace-gadget-slot.is-intentional-empty { border-color: transparent; background: transparent; }
body.workspace-page.theme-dark .workspace-gadget-slot.is-drop-target { border-color: #c64a55; background: #3c2529; }
body.workspace-page.theme-dark .workspace-gadget-empty { border-color: #514d56; color: #c3bec8; background: rgba(255,255,255,.025); }

.network-add-node-control { cursor: pointer; overflow: visible; }
.network-add-node-control line { stroke: #aaa5ae; stroke-width: 2; }
.network-add-node-control circle { fill: #b92b34; stroke: #fff; stroke-width: 2; transition: fill 140ms ease, transform 140ms ease; transform-box: fill-box; transform-origin: center; }
.network-add-node-control path { fill: none; stroke: #fff; stroke-width: 2.8; stroke-linecap: round; pointer-events: none; }
.network-add-node-control:hover circle,
.network-add-node-control:focus-visible circle { fill: #941b25; transform: scale(1.12); }
.network-add-node-control:focus-visible { outline: none; }
.network-add-node-control:focus-visible circle { stroke: #f0a2a7; stroke-width: 3; }
body.workspace-page.theme-dark .network-add-node-control line { stroke: #817a87; }
body.workspace-page.theme-dark .network-add-node-control circle { stroke: #3a2024; }

.network-node-management-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.network-node-deactivate { border-color: #a64b51; color: #a12c35; }
.network-node-deactivate:hover:not(:disabled) { border-color: #a12c35; background: #a12c35; }
.network-node-editor-backdrop { position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; overflow-y: auto; padding: 18px; background: rgba(18, 16, 20, .58); }
.network-node-editor { display: grid; gap: 13px; width: min(560px, 100%); max-height: min(92svh, 900px); overflow-y: auto; padding: 21px; border: 1px solid var(--workspace-line); border-radius: 16px; color: var(--workspace-text); background: var(--workspace-surface); box-shadow: 0 24px 80px rgba(0,0,0,.26); }
.network-node-editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--workspace-line); }
.network-node-editor-heading h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.network-node-editor-field { display: grid; gap: 6px; color: var(--workspace-text); font-size: 13px; font-weight: 650; }
.network-node-editor-input { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--workspace-line); border-radius: 8px; color: var(--workspace-text); background: var(--workspace-bg); font: inherit; font-size: 14px; }
textarea.network-node-editor-input { min-height: 110px; resize: vertical; }
.network-node-editor-input:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
.network-node-editor-note { margin: 0; color: var(--workspace-muted); font-size: 13px; line-height: 1.45; }
.network-node-editor-recipients { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--workspace-line); border-radius: 10px; }
.network-node-editor-recipients legend { padding: 0 5px; color: var(--workspace-text); font-size: 13px; font-weight: 700; }
.network-node-editor-recipient { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px; border: 1px solid var(--workspace-line); border-radius: 8px; color: var(--workspace-text); font-size: 13px; }
.network-node-editor-recipient input { flex: 0 0 auto; accent-color: #b92b34; }
.network-node-editor-actions { display: flex; justify-content: flex-end; gap: 8px; }
.network-node-editor-cancel { padding: 0 14px; border-color: var(--workspace-line); color: var(--workspace-text); background: var(--workspace-surface); }
body.workspace-page.theme-dark .network-node-deactivate { color: #ff9aa1; }
body.workspace-page.theme-dark .network-node-deactivate:hover:not(:disabled) { color: #fff; }
@media (max-width: 560px) {
  .network-node-editor-backdrop { align-items: end; padding: 8px; }
  .network-node-editor { max-height: 92svh; padding: 17px; }
  .network-node-editor-recipients { grid-template-columns: 1fr; }
}

/* Guided tour: blur the workspace while leaving one panel clear at a time. */
#app.tutorial-active { pointer-events: none; }
#app.tutorial-active .tutorial-target,
#app.tutorial-active .tutorial-target * { pointer-events: auto; }
.tutorial-target { position: relative !important; z-index: 1010 !important; }
.workspace-gadget-panel.tutorial-target { position: fixed !important; }
.workspace-actions.tutorial-target { position: relative !important; }
.tutorial-detail-preview.tutorial-target { position: sticky !important; }
.workspace-canvas.tutorial-show-details { grid-template-columns: minmax(0, 30fr) minmax(0, 50fr) minmax(0, 20fr); }
.tutorial-detail-preview[hidden] { display: none !important; }
.tutorial-detail-preview {
  grid-column: 3;
  position: sticky;
  top: 94px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin-left: 10px;
  padding: 20px;
  border: 1px solid var(--workspace-line);
  border-radius: 14px;
  color: var(--workspace-text);
  background: var(--workspace-surface);
  box-shadow: 0 10px 34px rgba(23,22,25,.09);
}
.tutorial-detail-kicker { margin: 0; color: #9b101c; font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.tutorial-detail-title { margin: 0; font-size: clamp(20px, 1.4vw, 25px); line-height: 1.2; }
.tutorial-detail-copy { margin: 0; color: var(--workspace-muted); font-size: 15px; line-height: 1.55; }
.workspace-tutorial-scrim,
.workspace-tutorial-spotlight,
.workspace-tutorial-card { position: fixed; }
.workspace-tutorial-scrim {
  z-index: 1000;
  inset: 0;
  pointer-events: none;
  background: rgba(20, 19, 23, .56);
  -webkit-backdrop-filter: blur(4px) brightness(.76);
  backdrop-filter: blur(4px) brightness(.76);
}
.workspace-tutorial-scrim[hidden],
.workspace-tutorial-spotlight[hidden],
.workspace-tutorial-card[hidden] { display: none !important; }
.workspace-tutorial-scrim.has-focus {
  -webkit-mask-image: radial-gradient(ellipse var(--tutorial-focus-rx) var(--tutorial-focus-ry) at var(--tutorial-focus-x) var(--tutorial-focus-y), transparent 98%, #000 102%);
  mask-image: radial-gradient(ellipse var(--tutorial-focus-rx) var(--tutorial-focus-ry) at var(--tutorial-focus-x) var(--tutorial-focus-y), transparent 98%, #000 102%);
}
.workspace-tutorial-spotlight {
  z-index: 1011;
  pointer-events: none;
  border: 2px solid rgba(197, 0, 0, .88);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(197, 0, 0, .12), 0 8px 32px rgba(0,0,0,.14);
  transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
}
.workspace-tutorial-card {
  z-index: 1012;
  width: min(410px, calc(100vw - 24px));
  max-height: min(70svh, 460px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--workspace-line);
  border-radius: 16px;
  color: var(--workspace-text);
  background: var(--workspace-surface);
  box-shadow: 0 20px 70px rgba(0,0,0,.28);
}
.workspace-tutorial-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.workspace-tutorial-progress { margin: 0; color: #a30d18; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.workspace-tutorial-close { width: 32px; height: 32px; display: grid; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid var(--workspace-line); border-radius: 50%; color: var(--workspace-text); background: transparent; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.workspace-tutorial-title { margin: 0 0 9px; font-size: 21px; line-height: 1.2; }
.workspace-tutorial-copy { margin: 0; color: var(--workspace-muted); font-size: 15px; line-height: 1.55; }
.workspace-tutorial-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.workspace-tutorial-navigation { display: flex; align-items: center; gap: 8px; }
.workspace-tutorial-exit,
.workspace-tutorial-previous,
.workspace-tutorial-next { min-height: 38px; padding: 0 12px; border: 1px solid var(--workspace-line); border-radius: 9px; color: var(--workspace-text); background: transparent; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.workspace-tutorial-next { border-color: #b31320; color: #fff; background: #b31320; }
.workspace-tutorial-exit:hover,
.workspace-tutorial-previous:hover,
.workspace-tutorial-close:hover { border-color: #c50000; background: rgba(197,0,0,.08); }
.workspace-tutorial-next:hover { background: #930c17; }
.workspace-tutorial-previous:disabled { opacity: .45; cursor: not-allowed; }
.workspace-tutorial-card button:focus-visible { outline: 2px solid #c50000; outline-offset: 2px; }
body.workspace-page.theme-dark .tutorial-detail-preview,
body.workspace-page.theme-dark .workspace-tutorial-card { border-color: var(--workspace-line); color: var(--workspace-text); background: var(--workspace-surface); }
body.workspace-page.theme-dark .workspace-tutorial-progress,
body.workspace-page.theme-dark .tutorial-detail-kicker { color: #ff929a; }

@media (max-width: 760px) {
  .workspace-canvas.tutorial-show-details { display: flex; flex-direction: column; gap: 14px; }
  .tutorial-detail-preview { position: relative; top: auto; width: 100%; margin: 0; }
  .workspace-tutorial-card { left: 12px !important; right: 12px !important; bottom: 12px !important; top: auto !important; width: auto; max-height: min(56svh, 390px); transform: none !important; }
}

/* The left pane owns its layout settings and graph filters; the center stays focused on the map. */
@media (min-width: 761px) {
  .workspace-gadget-panel {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .workspace-panel-tools {
    position: relative;
    z-index: 16;
    display: grid;
    flex: 0 0 auto;
    gap: 9px;
    width: 100%;
    box-sizing: border-box;
    padding: calc(var(--gadget-corner-size) + 14px) clamp(10px, 1.2vw, 22px) 2px;
  }

  .workspace-layout-editor {
    position: relative;
    inset: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    width: 100%;
    height: auto;
    max-width: none;
    padding: 0 10px;
    border: 1px solid var(--workspace-line);
    border-radius: 10px;
    background: var(--workspace-surface);
    box-shadow: none;
    box-sizing: border-box;
  }

  .workspace-layout-editor-header,
  .workspace-layout-title,
  .workspace-layout-hint { display: none; }

  .workspace-layout-dimension {
    position: static;
    left: auto;
    width: 100%;
    min-height: 38px;
    flex: 0 0 auto;
    gap: 8px;
    margin: 0;
    padding: 3px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
  }

  .workspace-panel-tools .workspace-layout-editor > .workspace-layout-dimension + .workspace-layout-dimension {
    border-top: 1px solid var(--workspace-line);
    border-radius: 0;
  }
  .workspace-layout-label { font-size: 13px; }
  .workspace-layout-stepper { gap: 8px; }
  .workspace-layout-step { width: 30px; height: 30px; }

  .workspace-panel-tools .network-filter-bar {
    width: 100%;
    justify-content: flex-start;
    gap: 4px;
    margin: 0;
  }

  .workspace-panel-tools .network-filter-actions {
    flex-wrap: wrap;
    gap: 5px;
    margin: 0 0 0 3px;
  }

  .workspace-panel-tools .network-filter-action { min-height: 30px; padding: 0 8px; }
  .workspace-panel-tools .network-help-popover { left: 0; right: auto; }

  .workspace-gadget-grid {
    flex: 1 1 0;
    width: 100%;
    height: auto;
    min-height: 0;
    grid-template-rows: repeat(var(--gadget-rows, 1), minmax(48px, 1fr));
    grid-auto-rows: minmax(48px, 1fr);
    align-content: stretch;
    padding: 10px clamp(10px, 1.2vw, 22px) 16px;
    box-sizing: border-box;
  }

  .workspace-gadget-grid.is-single {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(96px, 150px);
    grid-template-rows: none;
    grid-auto-rows: minmax(108px, 150px);
    align-content: center;
    justify-content: center;
  }

  body.workspace-page:has(.workspace-layout-editor:not([hidden])) .network-shell { padding-top: 0; }
}

@media (max-width: 760px) {
  .workspace-gadget-panel { display: flex; flex-direction: column; overflow: visible; }
  .workspace-panel-tools { position: relative; display: grid; gap: 8px; margin: 0 0 8px; padding: 0; }
  .workspace-layout-editor { position: relative; inset: auto; width: 100%; max-width: none; margin: 0; }
  .workspace-panel-tools .network-filter-bar { justify-content: flex-start; margin: 0; }
  .workspace-panel-tools .network-filter-actions { flex-wrap: wrap; margin-left: 3px; }
  .workspace-gadget-grid { flex: 0 0 auto; width: 100%; height: auto; min-height: 0; grid-template-rows: none; grid-auto-rows: 82px; }
  .workspace-gadget-grid.is-single { flex: 0 0 auto; min-height: 170px; grid-template-rows: none; grid-auto-rows: 108px; }
}

body.workspace-page.theme-dark .workspace-layout-editor { border-color: var(--workspace-line); background: var(--workspace-surface); }

/* Touch controls and compact mobile panels for the collaborator graph. */
.network-fit-button,
.network-mobile-gadgets-button,
.workspace-mobile-gadgets-close { display: none; }

@media (max-width: 760px) {
  html:has(body.workspace-page) { scrollbar-width: none; }
  html:has(body.workspace-page)::-webkit-scrollbar { display: none; }
  body.workspace-page { overflow-x: hidden; scrollbar-width: none; }
  body.workspace-page::-webkit-scrollbar { display: none; }

  .workspace-canvas,
  .workspace-canvas.has-node-details {
    position: relative;
    display: block;
    min-height: calc(100svh - 64px);
    padding: 8px 10px 20px;
    overflow: visible;
  }
  .workspace-canvas .network-shell,
  .workspace-canvas.has-node-details .network-shell { width: 100%; margin: 0; }
  .network-filter-bar { margin-top: 4px; }
  .network-filter-actions { flex-wrap: wrap; justify-content: center; }
  .network-controls { margin-bottom: 8px; }
  .network-stage {
    position: relative;
    height: min(56svh, 580px);
    min-height: 350px;
    border-radius: 16px;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }
  .network-stage.is-panning { cursor: grabbing; }
  .network-stage.is-zooming { cursor: zoom-in; }
  .network-svg { touch-action: none; }

  .network-fit-button,
  .network-mobile-gadgets-button {
    position: absolute;
    z-index: 5;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--workspace-line);
    border-radius: 999px;
    color: var(--workspace-text);
    background: var(--workspace-surface);
    box-shadow: 0 4px 16px rgba(0,0,0,.14);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .network-fit-button { right: 12px; }
  .network-mobile-gadgets-button { left: 12px; }
  .network-fit-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

  .workspace-gadget-panel { display: none; }
  .workspace-gadget-panel.is-mobile-open {
    position: fixed !important;
    z-index: 20000 !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    right: auto !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    display: flex !important;
    flex-direction: column;
    width: min(300px, calc(100vw - 24px)) !important;
    height: auto !important;
    min-height: 0 !important;
    box-sizing: border-box;
    padding: 52px 10px 12px;
    overflow: auto;
    border: 1px solid var(--workspace-line);
    border-radius: 18px;
    color: var(--workspace-text);
    background: var(--workspace-surface);
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
  }
  .workspace-mobile-gadgets-close {
    position: absolute;
    top: 9px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--workspace-line);
    border-radius: 999px;
    color: var(--workspace-text);
    background: var(--workspace-surface);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
  }
  .workspace-gadget-panel.is-mobile-open .workspace-mobile-gadgets-close { display: inline-flex !important; }
  .workspace-gadget-grid { grid-auto-rows: 76px; }
  .workspace-layout-toggle { width: 42px; height: 42px; }
  .workspace-layout-toggle svg { width: 22px; height: 22px; }
  .workspace-layout-editor { position: relative; inset: auto; width: 100%; max-width: none; max-height: none; margin: 0 0 10px; overflow: visible; }
  .workspace-gadget-dialog { position: fixed; z-index: 2010; top: 50%; left: 50%; width: min(390px, calc(100vw - 32px)); transform: translate(-50%, -50%); }

  .network-detail-panel,
  .workspace-canvas.has-node-details .network-detail-panel {
    position: fixed;
    z-index: 1100;
    inset: auto 10px max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-height: min(52svh, 450px);
    gap: 10px;
    margin: 0;
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: 20px;
    background: transparent;
    box-shadow: none;
    scrollbar-width: thin;
  }
  .network-detail-header { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding-bottom: 12px; }
  .network-detail-heading { grid-column: 1; grid-row: 1; }
  .network-detail-route-badge { grid-column: 1; grid-row: 2; justify-self: start; margin: 5px 0 0; }
  .network-detail-close { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
  .network-detail-title { font-size: 20px; line-height: 1.25; overflow-wrap: normal; word-break: normal; }
  .network-detail-panel[hidden] { display: none; }
  .network-empty-state { padding: 8px 0; }
}

@media (max-width: 380px) {
  .network-mobile-gadgets-button,
  .network-fit-button { min-height: 38px; padding: 0 9px; font-size: 11px; }
  .network-stage { min-height: 330px; }
  .network-detail-panel,
  .workspace-canvas.has-node-details .network-detail-panel { inset: auto 6px max(6px, env(safe-area-inset-bottom)); }
}


