:root {
  --paper: #f7f2e7;
  --panel: rgba(255, 252, 245, 0.88);
  --panel-strong: rgba(255, 250, 241, 0.95);
  --ink: #221d18;
  --muted: #6a6259;
  --accent: #7a3520;
  --accent-soft: #edd8c4;
  --line: rgba(77, 60, 44, 0.16);
  --shadow: 0 22px 60px rgba(45, 30, 17, 0.12);
  --font-sans: Arial, "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(195, 128, 86, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(117, 72, 52, 0.12), transparent 22%),
    linear-gradient(180deg, #f5ead9 0%, #efe3d0 100%);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  background: rgba(122, 53, 32, 0.08);
  border-radius: 0.35rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.92em;
}

pre {
  background: #201a17;
  color: #f7efe4;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem;
}

.sidebar,
.content {
  backdrop-filter: blur(8px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 1.25rem 1rem;
  position: sticky;
  top: 1rem;
  height: calc(100vh - 2rem);
  overflow-y: auto;
}

.content {
  padding: 1.6rem 1.8rem 2rem;
}

.brand {
  padding: 0.3rem 0.35rem 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.brand-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.brand-topbar .eyebrow {
  margin: 0;
}

.home-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  padding: 0.42rem 0.68rem 0.42rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 53, 32, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 240, 229, 0.92) 100%);
  color: #5d2618;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(75, 45, 24, 0.08);
}

.home-logo-link:hover {
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 242, 232, 0.96) 100%);
}

.home-logo-mark {
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 auto;
  border-radius: 0.5rem;
  overflow: hidden;
}

.home-logo-text {
  font-family: var(--font-sans);
  letter-spacing: 0.03em;
}

.brand h1,
.page-header h1,
.dashboard-hero h1 {
  margin: 0;
  line-height: 1.08;
  font-weight: 700;
}

.brand h1 {
  font-size: 1.75rem;
}

.subtle,
.meta-chip,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  margin: 0 0 0.35rem;
  font-family: var(--font-sans);
}

.dashboard-link,
.ghost-button,
.view-button,
.tag-chip,
.lang-button,
.card-link,
.search-input,
.page-row-link,
.quick-links a {
  font-family: var(--font-sans);
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.dashboard-link {
  display: inline-flex;
  margin-top: 0.9rem;
  padding: 0.55rem 0.82rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #4f1f12;
  font-size: 0.92rem;
  font-weight: 700;
}

.dashboard-link:hover {
  text-decoration: none;
  background: #e4c6ac;
}

.brand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.brand-actions .dashboard-link {
  margin-top: 0;
}

.dashboard-link.secondary-link {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(122, 53, 32, 0.16);
}

.dashboard-link.secondary-link:hover {
  background: rgba(255, 255, 255, 0.94);
}

.language-toggle {
  margin-top: 0.95rem;
}

.language-buttons {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.lang-button {
  border: 1px solid rgba(77, 60, 44, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.lang-button.active {
  background: linear-gradient(135deg, #8e3c27 0%, #b96845 100%);
  color: white;
  border-color: transparent;
}

.nav-group {
  margin-bottom: 1.1rem;
}

.nav-group h2,
.control-label {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-sans);
}

.nav-group ul,
.quick-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-group li,
.quick-links li {
  margin: 0;
}

.nav-group a,
.quick-links a {
  display: block;
  padding: 0.42rem 0.5rem;
  border-radius: 0.75rem;
  color: var(--ink);
}

.nav-group li.current a {
  background: var(--accent-soft);
  color: #4f1f12;
  font-weight: 700;
}

.nav-group a:hover,
.quick-links a:hover {
  background: rgba(122, 53, 32, 0.07);
  text-decoration: none;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.page-header h1,
.dashboard-hero h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.meta-chip {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.meta-panel {
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.meta-panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.meta-panel dl {
  margin: 0;
}

.meta-panel div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0.5rem 1rem;
  padding: 0.22rem 0;
}

.meta-panel dt {
  font-weight: 700;
  color: var(--muted);
}

.meta-panel dd {
  margin: 0;
}

.page-body > *:first-child {
  margin-top: 0;
}

.page-body h1,
.page-body h2,
.page-body h3,
.page-body h4,
.page-body h5,
.page-body h6 {
  margin-top: 1.6rem;
  margin-bottom: 0.6rem;
  line-height: 1.18;
}

.page-body h2 {
  font-size: 1.55rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
}

.page-body h3 {
  font-size: 1.2rem;
}

.page-body p,
.page-body ul,
.page-body ol,
.page-body pre,
.page-body blockquote {
  margin-top: 0.8rem;
  margin-bottom: 0.8rem;
}

.page-body ul,
.page-body ol {
  padding-left: 1.35rem;
}

.page-body li + li {
  margin-top: 0.28rem;
}

.page-body blockquote {
  margin-left: 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--accent);
  background: rgba(122, 53, 32, 0.06);
  border-radius: 0 0.8rem 0.8rem 0;
}

.dashboard-shell {
  align-items: start;
}

.dashboard-sidebar {
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.97) 0%, rgba(247, 242, 231, 0.88) 100%);
}

.dashboard-content {
  min-height: calc(100vh - 3rem);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.2rem;
}

.hero-copy {
  margin: 0.8rem 0 0;
  max-width: 58ch;
  color: #4e4740;
  font-size: 1.02rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.stat-card,
.side-block,
.status-bar,
.paper-card,
.page-row,
.graph-detail {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.stat-card {
  border-radius: 1.1rem;
  padding: 1rem 1.05rem;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-sans);
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 2rem;
  line-height: 1;
}

.side-block {
  padding: 1rem;
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.search-input {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(77, 60, 44, 0.24);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border-radius: 0.9rem;
  padding: 0.82rem 0.9rem;
  font-size: 1rem;
}

.search-input:focus {
  outline: 2px solid rgba(122, 53, 32, 0.28);
  border-color: rgba(122, 53, 32, 0.38);
}

.small-note {
  font-size: 0.92rem;
  margin-bottom: 0;
}

.view-switch {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.view-state-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.view-button,
.ghost-button,
.tag-chip,
.lang-button,
.card-link {
  appearance: none;
  border: 1px solid rgba(77, 60, 44, 0.18);
  border-radius: 0.85rem;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.view-button,
.ghost-button,
.tag-chip,
.lang-button {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
}

.view-button {
  display: block;
  text-align: left;
  padding: 0.7rem 0.85rem;
  font-size: 0.96rem;
  font-weight: 600;
}

.view-button.active {
  background: linear-gradient(135deg, #8e3c27 0%, #b96845 100%);
  color: white;
  border-color: rgba(142, 60, 39, 0.78);
}

.ghost-button {
  padding: 0.4rem 0.72rem;
  font-size: 0.88rem;
}

.ghost-button:hover,
.view-button:hover,
.tag-chip:hover,
.lang-button:hover,
.card-link:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.chip-list,
.card-tags,
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
}

.tag-chip small {
  color: var(--muted);
}

.tag-chip.active {
  background: var(--accent-soft);
  border-color: rgba(122, 53, 32, 0.34);
  color: #4f1f12;
}

.legend-list {
  display: grid;
  gap: 0.55rem;
}

.legend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}

.legend-dot {
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 999px;
}

.legend-count {
  color: var(--muted);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.status-copy {
  display: flex;
  flex-direction: column;
}

.active-chip,
.mini-chip,
.section-pill,
.year-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-family: var(--font-sans);
}

.active-chip,
.mini-chip {
  background: rgba(122, 53, 32, 0.08);
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
  color: #5a463b;
}

.section-pill {
  padding: 0.28rem 0.58rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: white;
}

.section-core { background: #946448; }
.section-sources { background: #8e3c27; }
.section-concepts { background: #275d5d; }
.section-queries { background: #755f24; }
.section-syntheses { background: #4f3a77; }

.year-pill {
  background: rgba(77, 60, 44, 0.08);
  color: var(--muted);
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
}

.dashboard-view,
.dashboard-view.hidden,
.hidden {
  display: none;
}

#view-tab-papers:checked ~ .dashboard-content #papers-view,
#view-tab-database:checked ~ .dashboard-content #database-view,
#view-tab-pages:checked ~ .dashboard-content #pages-view,
#view-tab-graph:checked ~ .dashboard-content #graph-view {
  display: block;
}

#view-tab-papers:checked ~ .dashboard-sidebar .view-button[data-view="papers"],
#view-tab-database:checked ~ .dashboard-sidebar .view-button[data-view="database"],
#view-tab-pages:checked ~ .dashboard-sidebar .view-button[data-view="pages"],
#view-tab-graph:checked ~ .dashboard-sidebar .view-button[data-view="graph"] {
  background: linear-gradient(135deg, #8e3c27 0%, #b96845 100%);
  color: white;
  border-color: rgba(142, 60, 39, 0.78);
}

.paper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.paper-card,
.page-row,
.graph-detail {
  border-radius: 1.15rem;
}

.paper-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem 1rem 1.05rem;
  min-height: 290px;
}

.paper-card h2 {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.25;
}

.card-topline,
.page-row-head,
.card-actions,
.page-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.card-excerpt,
.page-row-excerpt,
.graph-excerpt {
  margin: 0;
  color: #4e4740;
}

.card-actions {
  margin-top: auto;
}

.card-link {
  display: inline-flex;
  justify-content: center;
  padding: 0.55rem 0.82rem;
  background: linear-gradient(135deg, #8e3c27 0%, #b96845 100%);
  color: white;
  font-size: 0.92rem;
  font-weight: 700;
}

.card-link.secondary {
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

.card-link.tertiary {
  background: rgba(122, 53, 32, 0.08);
  color: #6e2e1d;
}

.page-list {
  display: grid;
  gap: 0.85rem;
}

.database-toolbar,
.database-group {
  display: grid;
  gap: 0.85rem;
}

.database-toolbar {
  margin-bottom: 0.9rem;
}

.database-toolbar-head,
.database-group-header,
.database-inline-controls,
.database-actions,
.database-summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.database-toolbar-head,
.database-group-header {
  justify-content: space-between;
}

.database-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.database-control {
  display: grid;
  gap: 0.45rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.database-control span {
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-sans);
}

.database-control select,
.database-inline-controls .ghost-button {
  font-family: var(--font-sans);
}

.database-control select {
  appearance: none;
  border: 1px solid rgba(77, 60, 44, 0.18);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 0.62rem 0.78rem;
  font-size: 0.94rem;
}

.database-inline-controls {
  flex-wrap: nowrap;
}

.database-inline-controls select {
  flex: 1 1 auto;
}

.database-icon-button {
  min-width: 2.8rem;
  padding: 0.62rem 0.78rem;
}

.database-summary {
  gap: 0.75rem;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.summary-chip strong {
  font-size: 1rem;
}

.summary-chip span {
  color: var(--muted);
  font-size: 0.85rem;
}

.subtle-chip {
  background: rgba(255, 255, 255, 0.72);
}

.database-groups {
  display: grid;
  gap: 1rem;
}

.database-group-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.database-table-wrap {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-x;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.database-table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  font-family: var(--font-sans);
}

#database-view {
  overflow-x: auto;
}

.database-table th,
.database-table td {
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid rgba(77, 60, 44, 0.1);
  vertical-align: top;
  text-align: left;
}

.database-table-wrap.compact .database-table th,
.database-table-wrap.compact .database-table td {
  padding: 0.62rem 0.7rem;
}

.database-table th {
  position: sticky;
  top: 0;
  background: rgba(247, 242, 231, 0.96);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 1;
}

.database-table tbody tr:hover {
  background: rgba(122, 53, 32, 0.04);
}

.database-title-cell {
  min-width: 320px;
}

.database-title-link {
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
}

.database-subtle {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.database-tag-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 180px;
}

.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.48rem 0.72rem;
  border-radius: 0.78rem;
  background: linear-gradient(135deg, #8e3c27 0%, #b96845 100%);
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
}

.table-action.secondary {
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

.table-action.tertiary {
  background: rgba(122, 53, 32, 0.08);
  color: #6e2e1d;
}

.page-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
}

.page-row-link {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.empty-state {
  margin: 1rem 0 0;
  padding: 1rem 1.1rem;
  border: 1px dashed rgba(77, 60, 44, 0.22);
  border-radius: 1rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.graph-toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.graph-toolbar-copy {
  max-width: 82ch;
  font-size: 0.96rem;
}

.graph-controls-panel {
  display: grid;
  gap: 0.7rem;
  padding: 1rem 1.05rem;
  border-radius: 1.15rem;
  border: 1px solid rgba(77, 60, 44, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.92) 0%, rgba(249, 240, 229, 0.88) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.graph-controls-heading {
  margin-bottom: 0;
}

.graph-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
}

.graph-control {
  display: grid;
  gap: 0.45rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.graph-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.graph-control-value {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.graph-range {
  width: 100%;
  margin: 0;
  accent-color: #8e3c27;
}

.graph-control-action {
  align-content: center;
}

.graph-control-action .ghost-button {
  width: 100%;
  padding: 0.72rem 0.85rem;
  font-size: 0.92rem;
}

.graph-toggle {
  align-content: center;
}

.graph-toggle-input {
  width: 100%;
  height: 1.2rem;
  margin: 0.1rem 0 0;
  accent-color: #8e3c27;
}

.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.62fr);
  gap: 1.15rem;
  align-items: start;
}

.graph-stage {
  position: relative;
  height: clamp(420px, 68vh, 720px);
  background:
    radial-gradient(circle at 18% 18%, rgba(250, 209, 174, 0.42), transparent 26%),
    radial-gradient(circle at 82% 20%, rgba(214, 155, 120, 0.24), transparent 22%),
    radial-gradient(circle at 50% 82%, rgba(255, 255, 255, 0.68), transparent 28%),
    linear-gradient(180deg, rgba(255, 251, 246, 0.98) 0%, rgba(245, 236, 224, 0.94) 100%);
  border: 1px solid rgba(77, 60, 44, 0.15);
  border-radius: 1.35rem;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 18px 40px rgba(58, 37, 20, 0.08);
}

.graph-stage::before,
.graph-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.graph-stage::before {
  background-image:
    linear-gradient(rgba(122, 53, 32, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 53, 32, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 92%);
}

.graph-stage::after {
  inset: auto 1.1rem 1rem 1.1rem;
  height: 22%;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.72), transparent 72%);
  filter: blur(30px);
  opacity: 0.7;
}

.graph-stage-header {
  position: absolute;
  top: 0.95rem;
  left: 1rem;
  right: 1rem;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  pointer-events: none;
}

.graph-stage-copy {
  display: grid;
  gap: 0.55rem;
  max-width: min(100%, 840px);
}

.graph-stage-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.34rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(77, 60, 44, 0.14);
  color: #73412c;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 10px 20px rgba(55, 33, 18, 0.08);
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.graph-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.42rem 0.66rem;
  border-radius: 999px;
  border: 1px solid rgba(77, 60, 44, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: #4e433b;
  font-size: 0.82rem;
  box-shadow: 0 10px 18px rgba(55, 33, 18, 0.05);
}

.graph-legend-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  flex: 0 0 auto;
}

.graph-legend-chip small {
  color: var(--muted);
  font-size: 0.76rem;
}

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

.graph-canvas {
  pointer-events: none;
}

.graph-svg {
  touch-action: none;
  cursor: grab;
  background: transparent;
}

.graph-svg.panning,
.graph-svg.dragging {
  cursor: grabbing;
}

.graph-edge {
  stroke: rgba(77, 60, 44, 0.26);
  stroke-linecap: round;
  transition: opacity 160ms ease, stroke 160ms ease;
}

.graph-edge.dimmed {
  opacity: 0.12 !important;
}

.graph-edge.related {
  stroke: rgba(122, 53, 32, 0.5);
}

.graph-node {
  cursor: pointer;
}

.graph-node.static-node {
  cursor: pointer;
}

.graph-node circle {
  transition: stroke-width 120ms ease, opacity 120ms ease;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2.2;
}

.graph-node.dimmed {
  opacity: 0.28;
}

.graph-node:hover circle,
.graph-node.selected circle {
  transform: scale(1.12);
  stroke-width: 3.4;
}

.graph-label {
  fill: #3b3028;
  font-size: 10.5px;
  text-anchor: middle;
  font-family: var(--font-sans);
  paint-order: stroke fill;
  stroke: rgba(255, 252, 245, 0.98);
  stroke-width: 4.5px;
  stroke-linejoin: round;
  opacity: 0.94;
}

.graph-label.hidden {
  opacity: 0;
}

.graph-svg.panning .graph-label,
.graph-svg.dragging .graph-label {
  opacity: 0 !important;
}

.graph-empty {
  fill: #6a6259;
  font-size: 18px;
  font-family: var(--font-sans);
}

.graph-detail {
  padding: 1.15rem 1.15rem 1.2rem;
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.96) 0%, rgba(248, 240, 228, 0.92) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 18px 40px rgba(58, 37, 20, 0.08);
}

.graph-detail h2,
.graph-detail h3 {
  margin-top: 0;
}

.graph-detail h3 {
  font-size: 1rem;
}

.graph-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.95rem 0 0.8rem;
}

.graph-metric-chip {
  display: grid;
  gap: 0.18rem;
  padding: 0.72rem 0.78rem;
  border-radius: 1rem;
  border: 1px solid rgba(77, 60, 44, 0.12);
  background: rgba(255, 255, 255, 0.78);
}

.graph-metric-chip span {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.graph-metric-chip strong {
  font-size: 0.98rem;
  line-height: 1.2;
  color: #30261f;
}

.detail-links {
  margin: 0.75rem 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 0.72rem;
}

.detail-links li {
  padding: 0.82rem 0.88rem;
  border-radius: 1rem;
  border: 1px solid rgba(77, 60, 44, 0.1);
  background: rgba(255, 255, 255, 0.76);
}

.detail-link-title {
  font-weight: 700;
  color: #342b24;
}

.detail-link-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.relation-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(122, 53, 32, 0.08);
  color: var(--ink);
  font-size: 0.78rem;
  font-family: var(--font-sans);
}

.graph-strength {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .dashboard-hero,
  .graph-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .page-header,
  .status-bar,
  .page-row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .graph-controls {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .database-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .graph-stage {
    height: clamp(360px, 56vh, 560px);
  }

  .graph-stage-header {
    top: 0.85rem;
    left: 0.85rem;
    right: 0.85rem;
  }

  .graph-detail-metrics {
    grid-template-columns: 1fr;
  }

  .database-table {
    min-width: 880px;
  }
}
