:root {
  color-scheme: dark;
  --bg: #060504;
  --panel: rgba(13, 12, 11, 0.78);
  --panel-strong: rgba(18, 16, 14, 0.94);
  --line: rgba(214, 193, 154, 0.12);
  --line-strong: rgba(34, 211, 238, 0.42);
  --text: #f8f1e5;
  --muted: #b4a896;
  --faint: #756b5e;
  --green: #2dd4bf;
  --green-strong: #22d3ee;
  --green-text: #031b17;
  --blue: #22d3ee;
  --violet: #8b5cf6;
  --amber: #d97706;
  --rose: #be5b7a;
  --brass: #d6c19a;
  --copper: #c08457;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.66);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% 14%, rgba(34, 211, 238, 0.11), transparent 31%),
    radial-gradient(circle at 88% 16%, rgba(214, 193, 154, 0.105), transparent 27%),
    radial-gradient(circle at 56% 90%, rgba(14, 165, 233, 0.075), transparent 34%),
    linear-gradient(140deg, #030507 0%, #070606 48%, #02050a 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(214, 193, 154, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 193, 154, 0.028) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 78%);
}

button,
a,
input {
  font: inherit;
}

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

button {
  cursor: pointer;
}

.shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(1900px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(18, 16, 14, 0.86), rgba(7, 7, 9, 0.82));
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  border-radius: 28px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 16px;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(214, 193, 154, 0.22);
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 20%, rgba(248, 231, 193, 0.18), transparent 32%),
    linear-gradient(145deg, rgba(192, 132, 87, 0.2), rgba(34, 211, 238, 0.1));
  color: #f8e7c1;
  box-shadow: 0 16px 56px rgba(192, 132, 87, 0.15), 0 0 30px rgba(34, 211, 238, 0.1);
}

.brand-mark::after {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid #18181b;
  border-radius: 999px;
  background: #22d3ee;
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.eyebrow {
  margin: 0;
  color: #67e8f9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

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

h1 {
  margin-top: 3px;
  overflow: hidden;
  color: #fff;
  font-size: 34px;
  font-weight: 760;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand p:last-child,
.panel-head p,
.graph-toolbar p,
.status {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr));
  gap: 12px;
  width: min(640px, 100%);
}

.metrics article,
.mini-grid article {
  min-width: 0;
  padding: 15px;
  border: 1px solid rgba(214, 193, 154, 0.11);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(192, 132, 87, 0.025));
}

.metrics span,
.mini-grid span {
  display: block;
  color: var(--faint);
  font-size: 12px;
}

.metrics strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: #fff;
  font-size: 22px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  align-items: start;
  flex: 1;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.panel {
  min-width: 0;
  border-radius: 28px;
}

.side-panel,
.detail-panel {
  display: flex;
  flex-direction: column;
  height: min(900px, calc(100vh - 178px));
  min-height: 620px;
  overflow: hidden;
}

.side-panel {
  gap: 16px;
  padding: 16px;
}

.panel-head,
.list-head,
.graph-toolbar,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h2,
.graph-toolbar h2,
.detail-header h2 {
  color: #fff;
  font-size: 18px;
  font-weight: 720;
  letter-spacing: 0;
}

.ghost-link,
.toolbar-actions button,
.list-head button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(214, 193, 154, 0.14);
  border-radius: 14px;
  background: rgba(248, 231, 193, 0.035);
  color: #d6c19a;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: 160ms ease;
}

.ghost-link:hover,
.toolbar-actions button:hover,
.list-head button:hover {
  border-color: rgba(34, 211, 238, 0.36);
  background: rgba(34, 211, 238, 0.09);
  color: #cffafe;
}

.ghost-link:focus-visible,
.toolbar-actions button:focus-visible,
.list-head button:focus-visible,
.search input:focus,
.node-card:focus-visible,
.area-button:focus-visible,
.graph-node:focus-visible,
.related-card:focus-visible,
.detail-footer a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.13);
  border-color: rgba(34, 211, 238, 0.58);
}

.search {
  position: relative;
  display: block;
}

.search svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--faint);
  transform: translateY(-50%);
}

.search input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 231, 193, 0.035);
  color: var(--text);
  transition: 160ms ease;
}

.search input::placeholder {
  color: #52525b;
}

.area-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.area-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(248, 231, 193, 0.03);
  color: #b4a896;
  text-align: left;
  transition: 160ms ease;
}

.area-button:hover,
.area-button.active {
  border-color: rgba(34, 211, 238, 0.34);
  background: rgba(34, 211, 238, 0.08);
  color: #f8f1e5;
}

.area-label {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  font-size: 13px;
  font-weight: 680;
}

.area-label span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  display: inline-flex;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.area-count {
  color: var(--faint);
  font-size: 12px;
}

.list-head h3 {
  color: #e4e4e7;
  font-size: 14px;
  font-weight: 740;
}

.node-list {
  flex: 1;
  min-height: 0;
  padding-right: 4px;
  overflow: hidden;
}

.node-card {
  display: block;
  width: 100%;
  margin-bottom: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(248, 231, 193, 0.035), rgba(0, 0, 0, 0.06));
  color: inherit;
  text-align: left;
  transition: 160ms ease;
}

.node-card:hover,
.node-card.active {
  border-color: rgba(34, 211, 238, 0.36);
  background:
    linear-gradient(145deg, rgba(34, 211, 238, 0.08), rgba(192, 132, 87, 0.04));
}

.node-card strong,
.related-card strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 740;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-card small,
.related-card small {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  max-width: 120px;
  height: 24px;
  margin-left: 10px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #d4d4d8;
  font-size: 11px;
  font-weight: 700;
}

.node-card-main,
.related-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
}

.node-card-main > span,
.related-card > span {
  min-width: 0;
}

.graph-panel {
  position: relative;
  height: min(980px, calc(100vh - 156px));
  min-height: 700px;
  overflow: hidden;
  border-color: rgba(125, 211, 252, 0.20);
  background:
    radial-gradient(circle at 49% 48%, rgba(14, 165, 233, 0.14), transparent 30%),
    radial-gradient(circle at 18% 76%, rgba(34, 211, 238, 0.07), transparent 30%),
    radial-gradient(circle at 78% 24%, rgba(214, 193, 154, 0.06), transparent 28%),
    linear-gradient(145deg, rgba(5, 6, 8, 0.985), rgba(2, 5, 10, 0.995));
  box-shadow:
    0 30px 100px rgba(0, 0, 0, 0.62),
    inset 0 0 90px rgba(34, 211, 238, 0.035),
    inset 0 0 120px rgba(192, 132, 87, 0.045);
}

.graph-panel::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background:
    linear-gradient(rgba(214, 193, 154, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 48%, black 12%, transparent 78%);
  pointer-events: none;
}

.graph-panel::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background:
    radial-gradient(circle at 50% 50%, transparent 0 46%, rgba(3, 3, 4, 0.72) 100%),
    linear-gradient(120deg, rgba(34, 211, 238, 0.035), transparent 40%, rgba(192, 132, 87, 0.05));
  pointer-events: none;
}

.graph-toolbar {
  position: absolute;
  z-index: 20;
  top: 18px;
  left: 18px;
  right: 18px;
  pointer-events: none;
}

.graph-toolbar > *,
.toolbar-actions {
  pointer-events: auto;
}

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

.graph {
  position: absolute;
  inset: 0;
  padding-top: 0;
}

.galaxy-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  border-radius: inherit;
}

#galaxy-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#galaxy-canvas.dragging {
  cursor: grabbing;
}

.galaxy-popover {
  position: absolute;
  z-index: 18;
  right: 20px;
  bottom: 86px;
  width: min(380px, calc(100% - 40px));
  padding: 16px;
  border: 1px solid rgba(214, 193, 154, 0.18);
  border-radius: 22px;
  background:
    radial-gradient(circle at 16% 0%, rgba(34, 211, 238, 0.075), transparent 42%),
    radial-gradient(circle at 82% 18%, rgba(192, 132, 87, 0.1), transparent 38%),
    linear-gradient(145deg, rgba(13, 10, 8, 0.86), rgba(5, 7, 12, 0.8));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.5), 0 0 56px rgba(34, 211, 238, 0.07);
  backdrop-filter: blur(18px);
  pointer-events: none;
}

.galaxy-popover[hidden] {
  display: none;
}

.galaxy-popover h3 {
  margin-top: 8px;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
}

.galaxy-popover small {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  color: var(--faint);
  font-size: 12px;
}

.galaxy-popover p:last-child {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 10px;
  color: #d4d4d8;
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.galaxy-popover-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.galaxy-popover-grid span {
  min-width: 0;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: #e4e4e7;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.galaxy-help {
  position: absolute;
  z-index: 17;
  left: 22px;
  bottom: 96px;
  max-width: min(360px, calc(100% - 44px));
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(9, 9, 11, 0.58);
  color: rgba(244, 244, 245, 0.68);
  font-size: 12px;
  backdrop-filter: blur(14px);
}

.graph svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.graph-node {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.82);
  color: #f4f4f5;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%);
  transition: 180ms ease;
}

.graph-node:hover {
  z-index: 30;
  border-color: rgba(255, 255, 255, 0.24);
  transform: translate(-50%, -50%) scale(1.08);
}

.graph-node.active {
  z-index: 31;
  border-color: #d1fae5;
  background: var(--green);
  color: var(--green-text);
}

.graph-node.related {
  z-index: 25;
  border-color: rgba(110, 231, 183, 0.64);
  background: rgba(16, 185, 129, 0.24);
  color: #ecfdf5;
}

.graph-node.muted {
  opacity: 0.34;
}

.graph-node-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  height: 100%;
  padding: 8px;
  overflow: hidden;
}

.graph-node-content span:last-child {
  display: -webkit-box;
  overflow: hidden;
  max-width: 100%;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.15;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.legend {
  position: absolute;
  z-index: 20;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(7, 6, 6, 0.78);
  backdrop-filter: blur(16px);
}

.legend button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(248, 231, 193, 0.035);
  color: #a1a1aa;
  font-size: 12px;
  transition: 160ms ease;
}

.legend button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.detail-panel {
  position: fixed;
  z-index: 80;
  top: 118px;
  right: 24px;
  width: min(430px, calc(100vw - 48px));
  height: min(780px, calc(100vh - 142px));
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 34px));
  transition: opacity 180ms ease, transform 220ms ease;
}

.detail-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.detail-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.detail-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(214, 193, 154, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .035);
  color: #d6c19a;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.detail-close svg {
  width: 17px;
  height: 17px;
}

.detail-close:hover {
  border-color: rgba(125, 211, 252, .46);
  background: rgba(56, 189, 248, .11);
  color: #e0f2fe;
}

.detail-close:active {
  transform: scale(.97);
}

.detail-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .13);
  border-color: rgba(34, 211, 238, .58);
}

.detail-header h2 {
  margin-top: 9px;
  line-height: 1.2;
}

#detail-path {
  margin-top: 9px;
  overflow-wrap: anywhere;
  color: var(--faint);
  font-size: 12px;
}

.detail-body {
  flex: 1;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mini-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: #fff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-box {
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(248, 231, 193, 0.035), rgba(34, 211, 238, 0.018));
}

.info-box h3 {
  color: #fff;
  font-size: 14px;
  font-weight: 740;
}

.info-box p,
.empty {
  margin-top: 10px;
  color: #a1a1aa;
  font-size: 14px;
  line-height: 1.6;
}

.section-title span {
  min-width: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(110, 231, 183, 0.12);
  color: #a7f3d0;
  font-size: 12px;
  text-align: center;
}

.stack {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.signal-card {
  padding: 11px 12px;
  border: 1px solid rgba(110, 231, 183, 0.16);
  border-radius: 14px;
  background: rgba(110, 231, 183, 0.07);
  color: #d4d4d8;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.related-card {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  color: inherit;
  transition: 160ms ease;
}

.related-card:hover {
  border-color: rgba(110, 231, 183, 0.42);
  background: rgba(110, 231, 183, 0.1);
}

.related-card em {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips span {
  max-width: 100%;
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #d4d4d8;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-footer {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.detail-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  border-radius: 18px;
  background: var(--green);
  color: var(--green-text);
  font-size: 14px;
  font-weight: 780;
  text-decoration: none;
  transition: 160ms ease;
}

.detail-footer a:hover {
  background: #a7f3d0;
}

.detail-footer a:active,
.toolbar-actions button:active,
.ghost-link:active,
.area-button:active,
.node-card:active,
.related-card:active {
  transform: scale(0.985);
}

.status {
  padding: 0 4px 4px;
  font-size: 12px;
}

.tone-all .dot,
.tone-all.dot { background: var(--green); }
.tone-root .dot,
.tone-root.dot { background: #d4d4d8; }
.tone-projects .dot,
.tone-projects.dot { background: var(--blue); }
.tone-agents .dot,
.tone-agents.dot { background: var(--violet); }
.tone-procedures .dot,
.tone-procedures.dot { background: var(--amber); }
.tone-decisions .dot,
.tone-decisions.dot { background: var(--rose); }
.tone-servers .dot,
.tone-servers.dot { background: #5eead4; }
.tone-people .dot,
.tone-people.dot { background: #bef264; }

@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    min-height: 420px;
  }
}

@media (max-width: 820px) {
  .shell {
    padding: 14px;
  }

  .hero {
    align-items: stretch;
    flex-direction: column;
    border-radius: 24px;
  }

  .brand {
    align-items: flex-start;
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .side-panel,
  .graph-panel,
  .detail-panel {
    height: auto;
    max-height: none;
    min-height: auto;
  }

  .side-panel {
    max-height: 640px;
  }

  .graph-panel {
    min-height: 560px;
  }

  .graph-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .legend {
    max-height: 116px;
    overflow: hidden;
  }

  .galaxy-popover {
    right: 14px;
    bottom: 86px;
    width: calc(100% - 28px);
  }

  .galaxy-help {
    display: none;
  }
}

@media (max-width: 480px) {
  .shell {
    gap: 14px;
    padding: 10px;
  }

  .hero,
  .panel {
    border-radius: 22px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 17px;
  }

  h1 {
    font-size: 25px;
  }

  .metrics {
    gap: 9px;
  }

  .metrics article,
  .mini-grid article,
  .info-box {
    padding: 12px;
  }

  .area-tabs {
    grid-template-columns: 1fr;
  }

  .graph-panel {
    min-height: 520px;
  }

  .graph-toolbar {
    top: 14px;
    left: 14px;
    right: 14px;
  }

  .graph {
    padding-top: 0;
  }

  .legend {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .galaxy-popover {
    bottom: 126px;
  }
}

/* 2026-09-03: cleaner Brain Map, fullscreen mode, mobile brain-first view */
.galaxy-popover {
  right: clamp(14px, 2vw, 24px);
  bottom: clamp(72px, 8vh, 104px);
  opacity: 0;
  transform: translateY(10px) scale(.985);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: auto;
}

.galaxy-popover.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.galaxy-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  min-height: 36px;
  padding: 9px 12px;
  border: 1px solid rgba(56, 189, 248, .28);
  border-radius: 999px;
  background: rgba(14, 165, 233, .12);
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 0 22px rgba(56, 189, 248, .08);
}

.galaxy-open-link:hover {
  border-color: rgba(147, 197, 253, .55);
  background: rgba(56, 189, 248, .18);
}

body.galaxy-fullscreen {
  overflow: hidden;
}

body.galaxy-fullscreen .shell {
  width: 100vw;
  max-width: none;
  min-height: 100svh;
  padding: 0;
}

body.galaxy-fullscreen .hero,
body.galaxy-fullscreen .side-panel,
body.galaxy-fullscreen .detail-panel,
body.galaxy-fullscreen .status {
  display: none;
}

body.galaxy-fullscreen .workspace {
  display: block;
  width: 100vw;
  min-height: 100svh;
}

body.galaxy-fullscreen .graph-panel {
  width: 100vw;
  height: 100svh;
  min-height: 100svh;
  border-radius: 0;
}

body.galaxy-fullscreen .graph-toolbar {
  top: 18px;
  left: 18px;
  right: 18px;
}

body.galaxy-fullscreen .legend {
  right: 18px;
  bottom: 18px;
  left: 18px;
}

@media (max-width: 820px) {
  body {
    background: #05070a;
  }

  .shell {
    width: 100vw;
    max-width: none;
    min-height: 100svh;
    gap: 0;
    padding: 0;
  }

  .hero,
  .side-panel,
  .detail-panel,
  .status {
    display: none;
  }

  .workspace {
    display: block;
    width: 100vw;
    min-height: 100svh;
  }

  .graph-panel {
    width: 100vw;
    min-height: 100svh;
    height: 100svh;
    border-radius: 0;
    border: 0;
  }

  .graph-toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
    gap: 10px;
    padding: 0;
  }

  .graph-toolbar h2 {
    font-size: 18px;
  }

  .graph-toolbar p {
    max-width: 220px;
    font-size: 12px;
  }

  .toolbar-actions {
    align-self: stretch;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .toolbar-actions button {
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 14px;
    backdrop-filter: blur(16px);
  }

  .legend {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-height: 86px;
    padding: 8px;
    overflow: auto;
    border-radius: 18px;
    background: rgba(7, 10, 14, .58);
    backdrop-filter: blur(18px);
  }

  .legend-chip {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .galaxy-popover {
    right: 10px;
    bottom: 104px;
    left: 10px;
    width: auto;
    max-height: 38svh;
    overflow: auto;
    padding: 14px;
    border-radius: 20px;
  }

  .galaxy-popover h3 {
    font-size: 16px;
  }
}

/* 2026-09-04: Vault Galaxy v2, cleaner product shell and click-only details */
.graph-panel {
  isolation: isolate;
}

.detail-panel {
  position: fixed;
  z-index: 80;
  top: 118px;
  right: 24px;
  display: flex;
  width: min(430px, calc(100vw - 48px));
  height: min(780px, calc(100vh - 142px));
  min-height: 0;
  border-color: rgba(125, 211, 252, .2);
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 189, 248, .12), transparent 36%),
    radial-gradient(circle at 92% 12%, rgba(214, 193, 154, .08), transparent 32%),
    linear-gradient(145deg, rgba(8, 10, 14, .92), rgba(4, 6, 10, .88));
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 34px));
  transition: opacity 180ms ease, transform 220ms ease;
}

.detail-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.detail-panel .info-box,
.detail-panel .mini-grid article,
.detail-panel .related-card,
.detail-panel .signal-card {
  background: rgba(255, 255, 255, .035);
}

.detail-panel .detail-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 211, 252, .36) transparent;
}

@media (min-width: 1261px) {
  .workspace {
    grid-template-columns: 330px minmax(0, 1fr);
  }
}

@media (max-width: 1260px) {
  .detail-panel {
    grid-column: auto;
    min-height: 0;
  }
}

@media (max-width: 820px) {
  .detail-panel {
    position: fixed;
    inset: auto 10px 10px 10px;
    display: flex;
    width: auto;
    height: min(46svh, 430px);
    max-height: min(46svh, 430px);
    border-radius: 24px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(100% + 24px));
  }

  .detail-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .detail-header {
    padding: 16px;
  }

  .detail-body {
    padding: 14px;
  }

  .detail-footer {
    padding: 12px 14px 14px;
  }
}

.node-list-heading {
  margin: 14px 2px 8px;
  color: #fcd34d;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.82;
}
.node-recent-time {
  flex: 0 0 auto;
  align-self: center;
  margin-left: 8px;
  color: #fcd34d;
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}


/* ===== Light-Theme (Einstellungen → Darstellung) ===== */
body.light {
  color-scheme: light;
  --bg: #f4f1ea;
  --panel: rgba(255, 253, 248, 0.85);
  --panel-strong: rgba(255, 253, 248, 0.97);
  --line: rgba(70, 58, 40, 0.14);
  --line-strong: rgba(8, 145, 178, 0.45);
  --text: #1c1915;
  --muted: #5c5346;
  --faint: #94897a;
  --brass: #8a6d3b;
  --copper: #9a6b3f;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.22);
  background: #efeae0;
}
body.light .panel,
body.light aside.panel,
body.light .detail-panel {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(246, 242, 234, 0.9));
  border-color: var(--line);
}
body.light .search,
body.light input[type="text"],
body.light input:not([type]) {
  background: #ffffff;
  color: #1c1915;
  border-color: rgba(70, 58, 40, 0.18);
}
/* Graph bleibt dunkel (Weltraum), nur die UI-Chrome wird hell */
body.light .graph { background: radial-gradient(circle at 50% 42%, rgba(14, 116, 144, 0.10), transparent 62%), #0b1020; }

