:root {
  color-scheme: dark;
  --bg: #111417;
  --panel: #171c20;
  --panel-2: #20272b;
  --line: #334048;
  --text: #eff5ef;
  --muted: #a9b7b1;
  --soft: #d8e2d9;
  --accent: #73d7a4;
  --accent-2: #f0c35a;
  --danger: #ff7b72;
  --focus: #91c8ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(115, 215, 164, 0.08), transparent 34%),
    radial-gradient(circle at 88% 10%, rgba(240, 195, 90, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(17, 20, 23, 0.92);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(115, 215, 164, 0.5);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(115, 215, 164, 0.1);
}

.brand-mark svg {
  width: 33px;
  height: 33px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  border-color: rgba(115, 215, 164, 0.35);
  background: rgba(115, 215, 164, 0.1);
}

.nav-icon {
  width: 24px;
  color: var(--accent);
  text-align: center;
}

.source-strip {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-pills a,
.source-grid a,
.link-action {
  color: var(--soft);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
}

.feed-status {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 28, 32, 0.9);
  padding: 18px;
}

.feed-status p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.status-grid span {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  overflow-wrap: anywhere;
}

.status-grid strong {
  display: block;
  color: var(--accent);
}

main {
  padding: 30px;
}

.panel {
  display: none;
  max-width: 1180px;
  margin: 0 auto;
}

.panel.active {
  display: block;
}

.hero-panel {
  max-width: 1280px;
}

.hero-grid {
  min-height: 390px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: stretch;
}

.hero-copy {
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(32, 39, 43, 0.96), rgba(23, 28, 32, 0.84));
  box-shadow: var(--shadow);
}

.hero-copy h2 {
  margin-bottom: 18px;
  max-width: 720px;
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero-text {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.trust-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
}

.compact-row {
  margin: 0 0 14px;
}

.primary-action,
.secondary-action,
.ghost-action,
.small-action {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 14px;
  cursor: pointer;
}

.primary-action {
  color: #082015;
  background: var(--accent);
  font-weight: 800;
}

.secondary-action {
  color: var(--text);
  border-color: rgba(115, 215, 164, 0.38);
  background: rgba(115, 215, 164, 0.1);
}

.ghost-action,
.small-action {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

.small-action {
  min-height: 34px;
  padding: 6px 10px;
}

.signal-visual {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #141a1d;
  background-size: 26px 26px;
  min-height: 390px;
}

.radar {
  position: absolute;
  inset: 8%;
  border-radius: 999px;
  border: 1px solid rgba(115, 215, 164, 0.4);
  display: grid;
  place-items: center;
}

.ring {
  position: absolute;
  border: 1px solid rgba(115, 215, 164, 0.22);
  border-radius: 999px;
}

.ring-one {
  width: 30%;
  height: 30%;
}

.ring-two {
  width: 58%;
  height: 58%;
}

.ring-three {
  width: 84%;
  height: 84%;
}

.sweep {
  position: absolute;
  width: 50%;
  height: 2px;
  left: 50%;
  top: 50%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), transparent);
  animation: sweep 7s linear infinite;
}

.node {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 24px rgba(240, 195, 90, 0.75);
}

.n1 { left: 23%; top: 32%; }
.n2 { right: 25%; top: 44%; }
.n3 { left: 51%; bottom: 21%; }
.n4 { right: 17%; bottom: 34%; }

@keyframes sweep {
  to { transform: rotate(360deg); }
}

.metrics-row,
.dashboard-grid,
.notes-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.metrics-row article,
.workflow-card,
.notes-layout article,
.output-card,
.research-form,
.story-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 28, 32, 0.9);
}

.metrics-row article {
  padding: 18px;
}

.metrics-row strong {
  display: block;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.metrics-row span,
.workflow-card p,
.notes-layout li {
  color: var(--muted);
}

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

.featured-card {
  border-color: rgba(115, 215, 164, 0.55);
  background: linear-gradient(145deg, rgba(115, 215, 164, 0.13), rgba(23, 28, 32, 0.92));
}

.workflow-card {
  min-height: 140px;
  padding: 20px;
  cursor: pointer;
}

.workflow-card:hover {
  border-color: rgba(115, 215, 164, 0.6);
  transform: translateY(-1px);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: 0;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.guided-layout {
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.guide-step {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 800;
}

.guide-step.active {
  color: #082015;
  border-color: transparent;
  background: var(--accent);
}

.research-form,
.output-card {
  padding: 18px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--soft);
  font-weight: 750;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #101417;
  padding: 11px 12px;
  outline: none;
}

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

.large-textarea {
  min-height: 170px;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(145, 200, 255, 0.44);
  outline-offset: 2px;
}

.output-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.output-toolbar h3 {
  margin-bottom: 0;
}

pre {
  min-height: 410px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--soft);
  background: #0d1113;
  border: 1px solid #29333a;
  border-radius: 8px;
  padding: 16px;
  line-height: 1.55;
}

.guided-output pre {
  min-height: 520px;
}

.section-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.review-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.review-panel label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.review-panel input {
  width: auto;
}

.kev-status {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.kev-status ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.library-layout {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.report-results {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  margin-bottom: 14px;
}

.report-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  cursor: pointer;
}

.report-item:hover {
  border-color: rgba(115, 215, 164, 0.55);
}

.report-item strong,
.report-item span {
  display: block;
}

.report-item span,
.muted-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  border: 1px solid rgba(115, 215, 164, 0.35);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.story-board {
  display: grid;
  gap: 14px;
}

.story-card {
  position: relative;
  padding: 18px 18px 18px 68px;
}

.story-number {
  position: absolute;
  left: 18px;
  top: 18px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(240, 195, 90, 0.16);
  color: var(--accent-2);
  font-weight: 900;
}

.source-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

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

.notes-layout article {
  padding: 22px;
}

.notes-layout li {
  margin-bottom: 10px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(115, 215, 164, 0.4);
  border-radius: 8px;
  background: #17201b;
  color: var(--text);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: relative;
    height: auto;
    padding: 18px;
  }

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

  main {
    padding: 18px;
  }

  .hero-grid,
  .tool-layout,
  .notes-layout,
  .guided-layout {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 30px;
  }

  .dashboard-grid,
  .metrics-row,
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .nav-list,
  .dashboard-grid,
  .metrics-row,
  .status-grid,
  .guide-steps {
    grid-template-columns: 1fr;
  }

  .section-header {
    display: grid;
  }

  .story-card {
    padding-left: 18px;
    padding-top: 62px;
  }
}
