:root {
  --bg: #f7f6f1;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #666b73;
  --line: #d9d5ca;
  --accent: #167c80;
  --accent-dark: #0f5b5f;
  --shadow: 0 10px 30px rgba(32, 33, 36, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(10px);
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.text-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  border-color: var(--accent);
}

.stats span {
  min-width: 96px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
  color: var(--muted);
  text-align: center;
}

.stats strong {
  color: var(--ink);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(320px, 1fr) 340px;
  gap: 12px;
  padding: 12px;
}

.sidebar,
.detail-panel,
.graph-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar,
.detail-panel {
  overflow: auto;
  padding: 16px;
}

.graph-panel {
  overflow: hidden;
}

#cy {
  width: 100%;
  height: calc(100vh - 102px);
  min-height: 620px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

input[type="search"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
  color: var(--ink);
}

input[type="search"]:focus {
  outline: 2px solid rgba(22, 124, 128, 0.22);
  border-color: var(--accent);
}

.segmented,
.button-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.legend {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.legend h2 {
  font-size: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.detail-panel {
  font-size: 14px;
}

#detailDescription {
  color: var(--muted);
  line-height: 1.65;
}

.meta-list {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.meta-list div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.meta-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meta-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.connections {
  margin-top: 20px;
}

.connections ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.connections li {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
  line-height: 1.45;
}

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

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 240px 1fr;
  }

  .detail-panel {
    grid-column: 1 / -1;
    max-height: 320px;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

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

  #cy {
    height: 72vh;
    min-height: 460px;
  }
}
