:root {
  --ink: #111827;
  --muted: #667085;
  --line: rgba(17, 24, 39, 0.1);
  --paper: #f7f8f4;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --jade: #0f9f8e;
  --blue: #2563eb;
  --gold: #d3912c;
  --coral: #d96a43;
  --violet: #6d5bd0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(15, 159, 142, 0.12), transparent 32%),
    linear-gradient(245deg, rgba(217, 106, 67, 0.1), transparent 34%),
    linear-gradient(180deg, #fbfcf8 0%, var(--paper) 52%, #eef4ef 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.94), transparent 78%);
}

#network-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0.86;
}

::selection {
  color: white;
  background: var(--jade);
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.mt-6 {
  margin-top: 24px;
}

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  min-height: 78px;
  color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(90deg, rgba(32, 35, 46, 0.96), rgba(48, 50, 61, 0.94)),
    rgba(32, 35, 46, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.12);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.nav-inner {
  min-height: 78px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  box-shadow: 0 12px 28px rgba(15, 159, 142, 0.24);
}

.nav-links,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link,
.nav-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  font-weight: 700;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.nav-link:hover,
.nav-link.is-active,
.nav-button:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.09);
}

.nav-button {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.nav-button.primary {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--jade));
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.24);
}

.page-hero {
  padding: 130px 0 42px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 42px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.09);
  background: rgba(255, 255, 255, 0.62);
  padding: 7px 12px;
  color: rgba(17, 24, 39, 0.62);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-title {
  margin: 26px 0 0;
  max-width: 820px;
  color: #050816;
}

.hero-copy {
  margin: 0;
  color: #4d5f76;
  font-size: 19px;
  line-height: 1.75;
}

.hero-panel,
.content-card,
.insight-card,
.signal-card,
.empty-card {
  border-radius: 8px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background:
    radial-gradient(circle at 14% 0%, var(--card-glow, rgba(15, 159, 142, 0.14)), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.42));
  box-shadow: 0 22px 58px rgba(17, 24, 39, 0.08);
  backdrop-filter: blur(18px) saturate(155%);
  -webkit-backdrop-filter: blur(18px) saturate(155%);
}

.hero-panel {
  padding: 26px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 108px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.56);
}

.metric strong {
  display: block;
  color: #101828;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.metric span {
  display: block;
  margin-top: 10px;
  color: rgba(17, 24, 39, 0.56);
  font-size: 12px;
  font-weight: 700;
}

.section {
  padding: 58px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.section-title {
  margin: 0;
  color: #050816;
}

.section-copy {
  max-width: 620px;
  margin: 0;
  color: #53657c;
  font-size: 16px;
  line-height: 1.7;
}

.dispatch-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
  margin: 0 0 24px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(244, 248, 251, 0.72));
  box-shadow: 0 26px 72px rgba(17, 24, 39, 0.1);
  padding: 24px;
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.dispatch-copy {
  align-self: center;
}

.panel-kicker {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(15, 159, 142, 0.2);
  background: rgba(255, 255, 255, 0.62);
  padding: 7px 11px;
  color: #08766d;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.dispatch-copy h2 {
  margin: 16px 0 0;
  color: #070b1b;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 600;
}

.dispatch-copy p {
  margin: 14px 0 0;
  color: #53657c;
  line-height: 1.75;
}

.dispatch-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-self: start;
}

.dispatch-input {
  min-height: 52px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 0 15px;
  color: #101828;
  font: inherit;
  font-weight: 700;
  outline: none;
}

.dispatch-input:focus {
  border-color: rgba(15, 159, 142, 0.42);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(15, 159, 142, 0.1);
}

.dispatch-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #111827, #08766d);
  padding: 0 18px;
  color: white;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(15, 159, 142, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.dispatch-button:hover,
.dispatch-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 22px 46px rgba(15, 159, 142, 0.28);
}

.dispatch-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.dispatch-status {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 28px;
  color: rgba(17, 24, 39, 0.62);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
}

.dispatch-results {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dispatch-result {
  min-height: 206px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.dispatch-result h3 {
  margin: 16px 0 0;
  color: #070b1b;
  font-size: 20px;
  line-height: 1.22;
  font-weight: 700;
}

.dispatch-result p {
  margin: 12px 0 0;
  color: #53657c;
  line-height: 1.68;
}

.dispatch-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}

.search-input {
  width: min(440px, 100%);
  min-height: 48px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 0 14px;
  color: #101828;
  outline: none;
  box-shadow: 0 14px 36px rgba(17, 24, 39, 0.05);
}

.filter-select {
  min-width: 168px;
  min-height: 48px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0 38px 0 13px;
  color: #101828;
  font: inherit;
  font-weight: 700;
  outline: none;
  box-shadow: 0 14px 36px rgba(17, 24, 39, 0.05);
}

.result-status {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  color: rgba(17, 24, 39, 0.58);
  font-size: 13px;
  font-weight: 700;
}

.search-input:focus,
.filter-select:focus {
  border-color: rgba(15, 159, 142, 0.42);
  box-shadow: 0 0 0 4px rgba(15, 159, 142, 0.1);
}

.node-grid,
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.content-card {
  --card-glow: rgba(15, 159, 142, 0.16);
  position: relative;
  display: flex;
  min-height: 300px;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
}

body[data-page="tools"] .content-card {
  --card-glow: rgba(109, 91, 208, 0.16);
}

body[data-page="cases"] .content-card {
  --card-glow: rgba(211, 145, 44, 0.18);
}

.content-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 18%, rgba(255, 255, 255, 0.38) 45%, transparent 70%);
  opacity: 0;
  transform: translateX(-120%);
  pointer-events: none;
}

.content-card:hover::before {
  animation: sheen 1.25s ease-out forwards;
}

.card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.card-label,
.trust-badge,
.tag {
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.58);
  padding: 6px 10px;
  color: rgba(17, 24, 39, 0.58);
  font-size: 11px;
  font-weight: 700;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.trust-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--coral));
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.36);
}

.content-card h3 {
  margin: 22px 0 0;
  color: #070b1b;
  font-size: 23px;
  line-height: 1.2;
  font-weight: 700;
}

.content-card p {
  margin: 16px 0 0;
  color: #53657c;
  line-height: 1.75;
}

.reason {
  color: #62748d;
  font-size: 14px;
  font-weight: 700;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
}

.card-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
}

.detail-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 159, 142, 0.26);
  border-radius: 8px;
  background: rgba(15, 159, 142, 0.1);
  padding: 0 13px;
  color: #08766d;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.detail-button:hover,
.detail-button:focus-visible {
  border-color: rgba(15, 159, 142, 0.48);
  background: rgba(15, 159, 142, 0.16);
  transform: translateY(-1px);
}

.insight-card,
.signal-card {
  min-height: 218px;
  padding: 24px;
}

.insight-card h3,
.signal-card h3 {
  margin: 0;
  color: #070b1b;
  font-size: 22px;
  font-weight: 700;
}

.insight-card p,
.signal-card p {
  margin: 14px 0 0;
  color: #53657c;
  line-height: 1.75;
}

.community-layout {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 20px;
  align-items: start;
}

.community-only {
  display: none;
}

body[data-page="community"] .community-only {
  display: grid;
}

body[data-page="community"] #insight-grid {
  display: none;
}

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

.action-panel {
  position: sticky;
  top: 104px;
  padding: 26px;
  border-radius: 8px;
  color: white;
  background:
    radial-gradient(circle at 18% 18%, rgba(15, 159, 142, 0.24), transparent 30%),
    radial-gradient(circle at 82% 0%, rgba(109, 91, 208, 0.22), transparent 32%),
    linear-gradient(145deg, rgba(9, 14, 25, 0.96), rgba(21, 34, 45, 0.94));
  box-shadow: 0 30px 92px rgba(17, 24, 39, 0.25);
  overflow: hidden;
}

.action-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 78%);
  pointer-events: none;
}

.action-panel > * {
  position: relative;
  z-index: 1;
}

.action-panel h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1.18;
  font-weight: 700;
}

.action-panel p {
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.8;
}

.run-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff7d6, #f8b84e);
  padding: 0 18px;
  color: #2a1a05;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 18px 44px rgba(245, 158, 11, 0.24);
}

.run-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.status-line {
  min-height: 26px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.status-line.is-hot {
  color: #fff2b8;
  text-shadow: 0 0 22px rgba(245, 158, 11, 0.6);
}

.validation-result {
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 16px;
}

.validation-result:empty {
  display: none;
}

.validation-result h4 {
  margin: 0 0 12px;
  color: white;
  font-size: 15px;
  font-weight: 700;
}

.validation-result dl {
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) 1fr;
  gap: 8px 12px;
  margin: 0;
}

.validation-result dt {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
}

.validation-result dd {
  margin: 0;
  color: #fff2b8;
  font-size: 13px;
  font-weight: 700;
}

body.detail-open {
  overflow: hidden;
}

.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.detail-panel.is-open {
  opacity: 1;
  pointer-events: auto;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 14, 25, 0.56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.detail-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(82vh, 780px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 14% 0%, rgba(15, 159, 142, 0.16), transparent 30%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 247, 0.92));
  padding: 30px;
  box-shadow: 0 34px 110px rgba(17, 24, 39, 0.32);
}

.detail-close {
  position: sticky;
  top: 0;
  float: right;
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #101828;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}

.detail-header {
  padding-right: 54px;
}

.detail-header h2 {
  margin: 18px 0 0;
  color: #070b1b;
  line-height: 1.08;
  font-weight: 700;
}

.detail-meta,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.detail-tags:empty {
  display: none;
}

.detail-section {
  margin-top: 24px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
  padding-top: 18px;
}

.detail-section h3 {
  margin: 0;
  color: #101828;
  font-size: 14px;
  font-weight: 700;
}

.detail-section p,
.detail-section li {
  color: #53657c;
  line-height: 1.75;
}

.detail-section p {
  margin: 10px 0 0;
}

.detail-section ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.empty-card {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: rgba(17, 24, 39, 0.56);
  font-weight: 700;
}

.footer {
  padding: 54px 0 40px;
  color: rgba(17, 24, 39, 0.52);
  font-size: 13px;
  font-weight: 700;
}

@keyframes sheen {
  0% {
    opacity: 0;
    transform: translateX(-120%);
  }
  20% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
    transform: translateX(120%);
  }
}

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

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

  .action-panel {
    position: relative;
    top: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 28px, 680px);
  }

  .nav-inner {
    justify-content: start;
    padding: 12px 0;
  }

  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-actions {
    margin-left: auto;
  }

  .brand span {
    max-width: 210px;
    white-space: normal;
    line-height: 1.1;
  }

  .page-hero {
    padding-top: 228px;
  }

  .hero-title {
  }

  .hero-copy {
    font-size: 17px;
  }

  .node-grid,
  .insight-grid,
  .signal-grid,
  .dispatch-panel,
  .dispatch-form,
  .dispatch-results {
    grid-template-columns: 1fr;
  }

  .dispatch-copy h2 {
    font-size: 22px;
    line-height: 1.35;
  }

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

  .search-input,
  .filter-select,
  .dispatch-input,
  .dispatch-button {
    width: 100%;
  }

  .result-status {
    min-height: 28px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .detail-panel {
    align-items: end;
    padding: 14px;
  }

  .detail-dialog {
    max-height: calc(100vh - 28px);
    padding: 22px;
  }

  .detail-header {
    padding-right: 0;
  }

  .detail-close {
    margin-bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
