:root {
  --bg-main: #071421;
  --bg-panel: #0f2233;
  --bg-panel-soft: #142b41;
  --text-main: #edf3f8;
  --text-dim: #9db0be;
  --accent: #f08f5f;
  --accent-strong: #ff6f3c;
  --line: #23435a;
  --ok: #6de2b7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 10%, #1f3e57 0%, #071421 60%);
  color: var(--text-main);
}

.background-glow {
  position: fixed;
  inset: -25vmax;
  background: radial-gradient(circle at 85% 10%, rgba(240, 143, 95, 0.25), transparent 35%),
    radial-gradient(circle at 15% 80%, rgba(109, 226, 183, 0.2), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  padding: 24px;
}

.topbar {
  background: linear-gradient(135deg, rgba(20, 43, 65, 0.92), rgba(10, 26, 40, 0.92));
  border: 1px solid rgba(35, 67, 90, 0.95);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
  animation: fade-up 400ms ease;
}

.topbar-main {
  display: grid;
  gap: 4px;
}

.topbar-right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 8px;
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(35, 67, 90, 0.85);
  background: rgba(8, 21, 33, 0.85);
}

.user-label {
  color: var(--text-dim);
}

.auth-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(11, 27, 42, 0.85);
  color: var(--text-main);
  text-decoration: none;
  transition: border-color 120ms ease;
}

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

.hidden {
  display: none;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(24px, 3.5vw, 34px);
}

.topbar-subtitle {
  margin: 2px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.status {
  margin: 0;
  color: var(--text-main);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(109, 226, 183, 0.38);
  background: rgba(17, 48, 43, 0.55);
}

.status.status-ok {
  color: #b7f6dd;
  border-color: rgba(109, 226, 183, 0.38);
  background: rgba(17, 48, 43, 0.55);
}

.status.status-error {
  color: #ffd0d0;
  border-color: rgba(255, 123, 123, 0.45);
  background: rgba(67, 24, 28, 0.55);
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr minmax(280px, 360px);
  gap: 16px;
}

.card {
  background: linear-gradient(180deg, var(--bg-panel-soft), var(--bg-panel));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(6px);
}

.search-panel form {
  display: grid;
  gap: 10px;
}

.search-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 25, 39, 0.72);
  padding: 6px 10px 10px;
}

.search-block > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 2px 0 8px;
}

.search-block > summary::-webkit-details-marker {
  display: none;
}

.search-block > summary::after {
  content: "v";
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.search-block:not([open]) > summary::after {
  content: ">";
}

.search-block-body {
  display: grid;
  gap: 8px;
}

label {
  font-size: 12px;
  color: var(--text-dim);
}

input,
select,
textarea,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1b2a;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}

input,
select,
textarea {
  padding: 10px 12px;
}

textarea {
  resize: vertical;
  min-height: 44px;
}

button {
  padding: 10px 12px;
  font-weight: 600;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  border: none;
  cursor: pointer;
  color: #1d1a18;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ghost {
  background: rgba(11, 27, 42, 0.9);
  border: 1px solid var(--line);
  color: var(--text-main);
}

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

.ghost.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 143, 95, 0.25);
}

.quick-wrap {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.result-wrap {
  margin-top: 16px;
}

.result-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.quick-section summary,
.result-wrap h2,
.overview-panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.quick-section {
  border: 1px solid rgba(35, 67, 90, 0.85);
  border-radius: 12px;
  background: rgba(10, 25, 39, 0.58);
  padding: 8px 10px 10px;
}

.quick-section summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-main);
}

.quick-section summary::-webkit-details-marker {
  display: none;
}

.quick-section summary::after {
  content: "v";
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.quick-section:not([open]) summary::after {
  content: ">";
}

.quick-section:not([open]) ul {
  display: none;
}

#pins,
#recent,
#saved-views,
#collections-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
}

#results {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 360px);
  overflow: auto;
}

#pins li,
#recent li,
#saved-views li,
#collections-list li,
#results li {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a1927;
}

#results li {
  cursor: pointer;
}

#pins li:hover,
#recent li:hover,
#saved-views li:hover,
#collections-list li:hover {
  border-color: rgba(240, 143, 95, 0.55);
}

#results li:hover,
#results li.active {
  border-color: var(--accent);
}

#results .result-main {
  display: grid;
  gap: 6px;
}

#results .result-title {
  font-size: 14px;
  color: var(--text-main);
}

#results .result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(35, 67, 90, 0.9);
  background: rgba(11, 27, 42, 0.72);
  font-size: 11px;
  color: var(--text-dim);
}

.result-badge strong {
  color: var(--text-main);
  font-size: 11px;
}

.result-badge.hierarchy {
  border-color: rgba(109, 226, 183, 0.42);
}

.result-badge.links {
  border-color: rgba(240, 143, 95, 0.48);
}

.result-badge.meta {
  border-color: rgba(157, 176, 190, 0.38);
}

.result-badge.kind {
  border-color: rgba(149, 213, 255, 0.42);
}

.result-badge.kg {
  border-color: rgba(255, 223, 111, 0.42);
}

.result-badge.match {
  border-color: rgba(255, 223, 111, 0.72);
  color: var(--text-main);
}

#pins .meta,
#recent .meta,
#saved-views .meta,
#collections-list .meta,
#results .meta {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 12px;
}

.saved-row,
.collection-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.saved-main,
.collection-main {
  min-width: 0;
}

.saved-title,
.collection-title {
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px dashed rgba(237, 243, 248, 0.35);
}

.saved-title:hover,
.collection-title:hover {
  color: var(--accent);
  border-bottom-color: rgba(240, 143, 95, 0.7);
}

.saved-actions,
.collection-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-btn {
  width: auto;
  min-height: 28px;
  padding: 4px 9px;
  font-size: 11px;
  border-radius: 999px;
}

.quick-actions {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-nav {
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px dashed rgba(237, 243, 248, 0.35);
}

.quick-nav:hover {
  border-bottom-color: rgba(240, 143, 95, 0.7);
  color: var(--accent);
}

.quick-outline {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}

.quick-outline:hover {
  text-decoration: underline;
}

.quick-pin {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
}

.quick-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13px;
}

.graph-panel {
  position: relative;
  display: grid;
  /* toolbar + context + active-filters + graph canvas */
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 72vh;
}

.graph-toolbar {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(35, 67, 90, 0.92);
  background: rgba(9, 23, 35, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  margin-bottom: 10px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(35, 67, 90, 0.82);
  background: rgba(12, 28, 43, 0.82);
}

.toolbar-title {
  margin-right: 4px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.graph-toolbar button,
.graph-toolbar select {
  width: auto;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 9px;
}

.graph-toolbar button:not(.ghost) {
  background: linear-gradient(120deg, #f0a071, #f07a4d);
  color: #201916;
}

.toolbar-select {
  background: rgba(11, 27, 42, 0.9);
}

#graph-meta {
  margin: 0;
  margin-left: auto;
  color: var(--text-main);
  font-size: 12px;
  border: 1px solid rgba(35, 67, 90, 0.92);
  border-radius: 999px;
  background: rgba(8, 21, 33, 0.8);
  padding: 7px 12px;
  white-space: nowrap;
}

.view-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(35, 67, 90, 0.86);
  background: rgba(9, 23, 35, 0.7);
}

.view-breadcrumb {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.view-breadcrumb .crumb {
  color: var(--text-main);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-breadcrumb .crumb.view-mode {
  color: #b7f6dd;
}

.view-breadcrumb .crumb-sep {
  color: var(--text-dim);
  opacity: 0.7;
}

.focus-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(35, 67, 90, 0.86);
  background: rgba(7, 20, 33, 0.74);
  font-size: 12px;
  white-space: nowrap;
}

.focus-pill strong {
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}

.focus-pill span {
  color: var(--text-main);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.graph-empty-guard {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(240, 143, 95, 0.45);
  border-radius: 12px;
  background: rgba(64, 31, 22, 0.38);
}

.graph-empty-title {
  margin: 0;
  font-size: 13px;
  color: #ffd8c8;
}

.graph-empty-reasons {
  margin: 8px 0 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
  color: var(--text-main);
  font-size: 12px;
}

.graph-empty-reasons li {
  line-height: 1.35;
}

.graph-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.filter-chip {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(11, 27, 42, 0.75);
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.filter-chip:hover {
  border-color: rgba(240, 143, 95, 0.75);
  color: var(--accent);
}

.filter-chip .x {
  font-weight: 700;
  opacity: 0.85;
}

#graph {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #071421;
  min-height: 0;
}

.graph-tooltip {
  position: fixed;
  z-index: 40;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(35, 67, 90, 0.95);
  background: rgba(8, 21, 33, 0.95);
  color: var(--text-main);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}

.graph-tooltip .tip-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.graph-tooltip .tip-meta {
  color: var(--text-dim);
  font-size: 11px;
}

#overview {
  color: var(--text-dim);
  line-height: 1.5;
}

#overview h3 {
  margin: 0 0 8px;
  color: var(--text-main);
}

#overview .overview-sticky-top {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 0 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(35, 67, 90, 0.88);
  background: linear-gradient(180deg, rgba(10, 25, 39, 0.94), rgba(8, 21, 33, 0.92));
}

#overview .overview-sticky-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

#overview .overview-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

#overview .overview-tab-btn {
  width: auto;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(35, 67, 90, 0.9);
  background: rgba(11, 27, 42, 0.84);
  color: var(--text-main);
  font-size: 12px;
}

#overview .overview-tab-btn:hover {
  border-color: rgba(240, 143, 95, 0.75);
}

#overview .overview-tab-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(240, 143, 95, 0.24);
}

#overview .overview-tab-panel {
  display: none;
}

#overview .overview-tab-panel.active {
  display: block;
  animation: fade-up 180ms ease;
}

#overview .overview-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

#overview .overview-title-wrap {
  min-width: 0;
}

#overview .overview-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  color: var(--text-dim);
}

#overview .overview-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

#overview .outline-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(240, 143, 95, 0.65);
  background: rgba(240, 143, 95, 0.14);
  color: #ffd7c3;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

#overview .outline-cta:hover {
  border-color: rgba(240, 143, 95, 0.95);
}

#overview .outline-cta.disabled {
  border-color: rgba(35, 67, 90, 0.9);
  background: rgba(11, 27, 42, 0.78);
  color: var(--text-dim);
}

#overview .overview-summary {
  margin: 10px 0;
}

#overview .overview-facts {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-bottom: 10px;
}

#overview .overview-fact {
  border: 1px solid rgba(35, 67, 90, 0.86);
  border-radius: 10px;
  padding: 8px 9px;
  background: rgba(10, 25, 39, 0.72);
}

#overview .overview-fact span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

#overview .overview-fact strong {
  color: var(--text-main);
  font-size: 13px;
}

#overview .overview-tags {
  margin-bottom: 10px;
}

#overview .overview-tags strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-main);
}

#overview .kg-override {
  margin-top: 14px;
  border: 1px solid rgba(35, 67, 90, 0.86);
  border-radius: 12px;
  background: rgba(10, 25, 39, 0.72);
  padding: 8px 10px 10px;
}

#overview .kg-override summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
}

#overview .kg-override summary::-webkit-details-marker {
  display: none;
}

#overview .kg-override summary::after {
  content: "v";
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

#overview .kg-override:not([open]) summary::after {
  content: ">";
}

#overview .kg-override-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(240, 143, 95, 0.65);
  background: rgba(240, 143, 95, 0.12);
  color: #ffd7c3;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

#overview .kg-override-pill.inactive {
  border-color: rgba(35, 67, 90, 0.9);
  background: rgba(11, 27, 42, 0.78);
  color: var(--text-dim);
}

#overview .kg-override-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

#overview .kg-override-help {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

#overview .kg-override-meta {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

#overview .kg-override-grid {
  display: grid;
  gap: 10px;
}

#overview .kg-override-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

#overview .kg-override-actions button {
  width: auto;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

#overview .ghost.danger {
  border: 1px solid rgba(255, 90, 90, 0.55);
  background: rgba(255, 90, 90, 0.12);
  color: #ffd0d0;
}

#overview .ghost.danger:hover {
  border-color: rgba(255, 90, 90, 0.85);
}

#overview .overview-glance {
  margin-top: 4px;
}

#overview .overview-glance h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-main);
}

#overview .overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

#overview .overview-header h3 {
  margin: 0;
}

#overview .overview-header + p {
  margin-top: 8px;
}

#overview p {
  margin: 0 0 10px;
}

#overview a {
  color: var(--accent);
}

.relation-glance {
  border: 1px solid rgba(35, 67, 90, 0.86);
  border-radius: 12px;
  background: rgba(10, 25, 39, 0.72);
  padding: 10px;
}

.relation-metrics {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}

.relation-metric {
  border: 1px solid rgba(35, 67, 90, 0.86);
  border-radius: 10px;
  background: rgba(8, 21, 33, 0.78);
  padding: 8px;
}

.relation-metric span {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
}

.relation-metric strong {
  color: var(--text-main);
  font-size: 15px;
}

.relation-columns {
  display: grid;
  gap: 8px;
}

.relation-columns section {
  border: 1px solid rgba(35, 67, 90, 0.76);
  border-radius: 10px;
  background: rgba(8, 21, 33, 0.72);
  padding: 8px;
}

.relation-columns h5 {
  margin: 0 0 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.tag-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(35, 67, 90, 0.9);
  background: rgba(11, 27, 42, 0.75);
  color: var(--text-main);
  font-size: 12px;
  text-decoration: none;
}

.tag-chip:hover {
  border-color: rgba(240, 143, 95, 0.7);
  color: var(--accent);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(35, 67, 90, 0.9);
  background: rgba(11, 27, 42, 0.75);
  color: var(--text-main);
  font-size: 12px;
  text-decoration: none;
}

.meta-chip:hover {
  border-color: rgba(240, 143, 95, 0.7);
  color: var(--accent);
}

.meta-chip.kind-chip {
  border-color: rgba(149, 213, 255, 0.35);
}

.meta-chip.kg-chip {
  border-color: rgba(255, 223, 111, 0.35);
}

.meta-chip.override-chip {
  border-color: rgba(240, 143, 95, 0.65);
  background: rgba(240, 143, 95, 0.14);
  color: #ffd7c3;
  cursor: default;
}

.meta-chip.override-chip:hover {
  color: #ffd7c3;
  border-color: rgba(240, 143, 95, 0.95);
}

.tag-empty {
  color: var(--text-dim);
  font-size: 12px;
}

.why-related {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.why-related h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-main);
}

.why-grid {
  display: grid;
  gap: 10px;
}

.why-section {
  background: rgba(10, 25, 39, 0.75);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.why-section h5 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.why-row {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.why-row strong {
  color: var(--text-main);
  font-weight: 600;
}

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

.why-item {
  display: grid;
  gap: 3px;
}

.why-actions {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.why-nav {
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px dashed rgba(237, 243, 248, 0.35);
}

.why-nav:hover {
  border-bottom-color: rgba(240, 143, 95, 0.7);
  color: var(--accent);
}

.why-outline {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}

.why-outline:hover {
  text-decoration: underline;
}

.why-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.why-evidence {
  margin-top: 3px;
  font-size: 12px;
  color: rgba(237, 243, 248, 0.72);
  line-height: 1.35;
  border-left: 2px solid rgba(240, 143, 95, 0.55);
  padding-left: 8px;
}

.why-evidence-wrap {
  margin-top: 4px;
  border: 1px solid rgba(35, 67, 90, 0.76);
  border-radius: 8px;
  background: rgba(8, 21, 33, 0.6);
  padding: 5px 8px;
}

.why-evidence-wrap > summary {
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  color: var(--text-dim);
}

.why-evidence-wrap > summary::-webkit-details-marker {
  display: none;
}

.why-evidence-wrap > summary::after {
  content: "v";
  margin-left: 6px;
  font-size: 10px;
  color: var(--text-dim);
}

.why-evidence-wrap:not([open]) > summary::after {
  content: ">";
}

.why-evidence-wrap .why-evidence {
  margin-top: 6px;
}

.why-more {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

@keyframes fade-up {
  from {
    transform: translateY(8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

  .topbar-right {
    width: 100%;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .graph-toolbar {
    position: static;
  }

  #graph-meta {
    margin-left: 0;
  }

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

  .graph-panel {
    min-height: 58vh;
  }

  #results {
    max-height: 280px;
  }
}

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

  .toolbar-group {
    width: 100%;
  }

  .auth-box {
    flex-wrap: wrap;
    border-radius: 12px;
  }

  .view-context {
    flex-direction: column;
    align-items: flex-start;
  }

  .focus-pill {
    width: 100%;
  }

  #graph-meta {
    width: 100%;
    text-align: left;
  }
}
