/* Atlas Design System */
:root {
  --bg: #05070b;
  --panel-bg: #0a0f1a;
  --card-bg: #0f1520;
  --card-border: #262c38;
  --accent: #c144d2;
  --accent-soft: #9f6bff;
  --text-main: #ffffff;
  --text-muted: #a6bec8;
  --pill-bg: #1f2933;
  --pill-text: #e5e7eb;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.6);
  --radius-lg: 18px;
  --radius-pill: 999px;
  --transition-fast: 160ms ease-out;
  --max-width: 1120px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Lexend", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 16px;
}

.main-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header */
header {
  border-bottom: 1px solid #111827;
  background: radial-gradient(circle at top left, rgba(193, 68, 210, 0.18), transparent 55%);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
}

.header-row-nav {
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 30px;
  width: auto;
}

.brand-texts,
.brand-labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-text-main {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-text-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

.nav-chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.nav-chip-row::-webkit-scrollbar {
  height: 6px;
}

.nav-chip-row::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 999px;
}

.nav-chip {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid #1f2937;
  background: #111827;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-chip:hover {
  color: var(--text-main);
  border-color: #4b5563;
  background: #1f2937;
  transform: translateY(-1px);
}

.nav-chip.is-active {
  color: var(--text-main);
  border-color: var(--accent);
  background: rgba(17, 24, 39, 0.9);
  box-shadow: 0 0 0 1px rgba(193, 68, 210, 0.4);
}

.nav-link {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-link strong {
  color: var(--text-main);
}

/* Timelines */
.timeline-body {
  background: radial-gradient(1200px 600px at 20% 0%, #14264b 0%, transparent 60%),
    radial-gradient(900px 500px at 80% 10%, #1a2a5a 0%, transparent 55%),
    #0b1220;
}

.timeline-app {
  max-width: 1200px;
  margin: 22px auto;
  padding: 0 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.timeline-header-card {
  gap: 12px;
}

.timeline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  justify-content: flex-end;
}

.timeline-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  flex: 1;
}

.timeline-control-label {
  font-size: 12px;
  color: var(--text-muted);
}

.timeline-controls .btn {
  align-self: flex-end;
}

.timeline-topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  position: sticky;
  top: 84px;
  z-index: 10;
  backdrop-filter: blur(10px);
  width: 100%;
}

.timeline-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 240px;
}

.timeline-logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7aa2ff, #b58cff);
  box-shadow: 0 10px 22px rgba(122, 162, 255, 0.25);
}

.timeline-brand h1 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.2px;
  line-height: 1.1;
}

.timeline-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #9bb0d3;
}

.timeline-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.timeline-field {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-field label {
  font-size: 12px;
  color: #9bb0d3;
  white-space: nowrap;
}

.timeline-field select {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e8eefc;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 13px;
  outline: none;
  min-width: 190px;
}

.timeline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #9bb0d3;
  padding: 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(122, 162, 255, 0.14);
  color: #e8eefc;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
}

.timeline-btn:active {
  transform: translateY(1px);
}

.timeline-nav {
  gap: 8px;
  padding-left: 4px;
}

.timeline-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  width: 100%;
  position: relative;
}

.timeline-panel-header {
  padding: 14px 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
}

.timeline-titleblock h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.timeline-meta {
  margin-top: 6px;
  color: #9bb0d3;
  font-size: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.timeline-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #7aa2ff;
  box-shadow: 0 0 0 6px rgba(122, 162, 255, 0.12);
}

.timeline-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  color: #9bb0d3;
  font-size: 12px;
}

.timeline-swatch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
}

.timeline-swatch i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.timeline-wrap {
  position: relative;
  padding: 12px 0 16px;
}

.timeline-scroller {
  overflow: auto;
  padding: 10px 10px 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.timeline-canvas {
  position: relative;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 240px;
  /* width set by JS */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.timeline-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timeline-year-row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: flex-end;
  padding: 10px 10px 8px;
  gap: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
}

.timeline-year-row span {
  color: rgba(232, 238, 252, 0.85);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.timeline-month-line {
  position: absolute;
  top: 44px;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.timeline-year-line {
  position: absolute;
  top: 44px;
  bottom: 0;
  width: 2px;
  width: 2px;
  background: rgba(122, 162, 255, 0.22);
}

.timeline-year-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.015);
  border-left: 1px solid rgba(255, 255, 255, 0.04);
  /* Optional: highlight alternate years lightly or just provide structure */
}

.timeline-year-bg:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.timeline-year-label {
  position: absolute;
  top: 10px;
  font-size: 11px;
  color: rgba(155, 176, 211, 0.85);
  font-weight: 600;
  pointer-events: none;
}

.timeline-rows {
  position: relative;
  padding-top: 52px;
  padding-bottom: 16px;
}

.timeline-lane {
  position: relative;
  margin: 10px 10px 0;
  padding: 10px 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-lane-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.timeline-lane-title strong {
  font-size: 13px;
  letter-spacing: 0.2px;
}

.timeline-lane-title small {
  color: #9bb0d3;
  font-size: 12px;
}

.timeline-bars {
  position: relative;
  min-height: 90px;
}

.timeline-bar {
  position: absolute;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 10px;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  color: #e8eefc;
}

.timeline-bar:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.timeline-bar:focus {
  outline: 2px solid rgba(122, 162, 255, 0.7);
  outline-offset: 2px;
}

.timeline-bar .bar-tag {
  font-size: 11px;
  opacity: 0.9;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

.timeline-bar .bar-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}

.timeline-bar .bar-text b {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-bar .bar-text span {
  font-size: 11px;
  color: rgba(232, 238, 252, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

.timeline-empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px 28px;
  color: #9bb0d3;
}

.timeline-empty strong {
  color: #e8eefc;
  font-size: 14px;
}

.timeline-footer-note {
  margin-top: 10px;
  color: #9bb0d3;
  font-size: 12px;
  padding: 0 4px;
}

.timeline-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: rgba(15, 26, 46, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  min-width: 220px;
  max-width: 280px;
  left: 0;
  top: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.timeline-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.tooltip-subtitle {
  color: #9bb0d3;
  font-size: 12px;
  margin-bottom: 6px;
}

.tooltip-meta {
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tooltip-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(232, 238, 252, 0.92);
}

.tooltip-topics {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tooltip-topics-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9bb0d3;
}

.tooltip-empty {
  font-size: 12px;
  color: #9bb0d3;
}

.timeline-scroller::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.timeline-scroller::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.2);
}

.timeline-scroller::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.12);
}

@media (max-width: 720px) {
  .timeline-brand {
    min-width: auto;
  }

  .timeline-field select {
    min-width: 160px;
  }

  .timeline-legend {
    justify-content: flex-start;
  }

  .timeline-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .timeline-control {
    min-width: unset;
  }
}

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

.badge {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .brand-text-sub {
    display: none;
  }

  .brand-text-main {
    font-size: 15px;
  }

  .header-row-nav .chips-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .header-row-nav .chips-row::-webkit-scrollbar {
    height: 6px;
  }

  .header-row-nav .chips-row::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
  }

  .header-row-nav .chip-link {
    flex: 0 0 auto;
  }
}

@media (max-width: 720px) {
  .header-inner {
    padding-inline: 16px;
  }
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: center;
}

.hero.panel {
  background: radial-gradient(circle at 10% 10%, rgba(193, 68, 210, 0.12), rgba(15, 23, 42, 0.85));
  padding: 20px 18px;
}

.hero-card,
.panel,
.card,
.form-surface {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.hero-card {
  padding: 16px;
  background: radial-gradient(circle at 10% 20%, rgba(193, 68, 210, 0.1), rgba(15, 23, 42, 0.85));
}

.hero-card-title {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 10px;
}

.hero-card-body {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-lg);
  padding: 14px;
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
}

.hero-title {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
}

.hero-highlight {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.6;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.pill {
  font-size: 11px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--pill-bg);
  color: var(--pill-text);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-app {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #4ade80;
}

/* Buttons */
.btn {
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(17, 24, 39, 0.9);
  color: var(--text-main);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(120deg, #c144d2, #fda24f);
  border-color: transparent;
  color: #0b0f18;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(193, 68, 210, 0.6);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-main);
}

/* Panels and cards */
.panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-title {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.card-link,
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover,
.card-link:hover {
  border-color: rgba(193, 68, 210, 0.5);
  transform: translateY(-1px);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.card-link-action {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* Forms */
.form-surface {
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--card-border);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

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

.input,
.select,
.search-input,
.select-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--card-border);
  background: #0b1220;
  color: var(--text-main);
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--panel-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.page-title {
  font-size: 22px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--card-border);
}

.table thead th {
  color: var(--text-main);
  font-weight: 600;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  color: var(--text-muted);
}

.page-btn,
.page-current {
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
}

.page-btn {
  border: 1px solid var(--card-border);
  background: var(--panel-bg);
  color: var(--text-main);
}

.page-current {
  background: rgba(193, 68, 210, 0.14);
  border: 1px solid rgba(193, 68, 210, 0.4);
  color: var(--text-main);
}

/* Graph layout */
.layout {
  flex: 1;
  display: flex;
  min-height: calc(100vh - 52px);
}

.graph-area {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px;
  background: radial-gradient(circle at top left, rgba(193, 68, 210, 0.12), #020617 35%, #000000 100%);
  position: relative;
}

.graph-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.98), #020617);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

#cy {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#topic-graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.graph-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(31, 41, 55, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(31, 41, 55, 0.28) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.24;
}

.graph-label {
  position: absolute;
  left: 16px;
  top: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  z-index: 5;
}

.graph-caption {
  position: absolute;
  left: 16px;
  bottom: 10px;
  font-size: 10px;
  color: var(--text-muted);
  z-index: 5;
}

#side-panel {
  width: 340px;
  max-width: 100%;
  background: var(--panel-bg);
  border-left: 1px solid #111827;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#panel-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

#panel-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 2px;
}

#panel-content {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
}

#panel-content p {
  margin: 4px 0;
}

#panel-content ul {
  margin: 4px 0;
  padding-left: 16px;
}

#panel-content li {
  margin-bottom: 3px;
}

.panel-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #111827;
}

.panel-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-item input {
  accent-color: #f7931a;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-item input {
  accent-color: var(--accent);
}

#legend {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #374151;
}

.legend-color.central {
  background: #f7931a;
}

.legend-color.persona {
  background: #e8a87c;
}

.legend-color.inst-padre {
  background: #4b5563;
}

.legend-color.topic {
  background: #f59e0b;
}

.legend-color.inst-central {
  background: #a855f7;
}

.legend-color.inst-hija {
  background: #6366f1;
}

.legend-color.personas {
  background: #e8a87c;
}

.legend-color.line {
  border-radius: 2px;
  background: #9aa0a6;
}

.chip-pill,
.person-chip,
.chip-link {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #111827;
  border: 1px solid #1f2937;
  color: var(--text-main);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 120ms ease;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip-pill:hover,
.person-chip:hover,
.chip-link:hover {
  background: #1f2937;
  border-color: #4b5563;
  transform: translateY(-1px);
}

#related-people,
#related-institutions,
#people-chips,
#institutions-chips,
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips-row {
  margin-bottom: 6px;
}

#debug {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 320px;
  max-height: 25vh;
  background: rgba(0, 0, 0, 0.85);
  color: #e5e7eb;
  font-size: 11px;
  padding: 4px 8px;
  overflow: auto;
  z-index: 9999;
  white-space: pre-wrap;
}

footer {
  border-top: 1px solid #111827;
  padding: 14px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .graph-area {
    height: 52vh;
  }

  #side-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid #111827;
  }

  #debug {
    right: 0;
  }

  #panel-title {
    font-size: 15px;
  }

  #panel-content {
    font-size: 13px;
  }
}
