:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #637067;
  --subtle: #89948c;
  --paper: #f7f4ec;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --line: #ded8cb;
  --charcoal: #232725;
  --green: #008f6f;
  --green-soft: #dff4ed;
  --blue: #2156d9;
  --blue-soft: #e5ecff;
  --gold: #b98116;
  --gold-soft: #fff1ce;
  --rose: #c6425a;
  --rose-soft: #ffe5ea;
  --violet: #6e4fd8;
  --shadow: 0 18px 55px rgba(31, 36, 32, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(33, 86, 217, 0.04), transparent 32%),
    linear-gradient(180deg, #fbfaf5 0%, var(--paper) 48%, #f3efe6 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

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

.side-rail,
.brand,
.rail-nav,
main,
.topbar,
.search-wrap,
.top-actions,
.command,
.command-copy,
.hero-metrics {
  min-width: 0;
  max-width: 100%;
}

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid rgba(23, 33, 29, 0.12);
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--charcoal);
  color: #fffaf0;
  font-weight: 800;
  font-size: 1.35rem;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.04rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.rail-nav {
  display: grid;
  gap: 6px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
}

.rail-nav a:hover,
.rail-nav a.active {
  background: var(--green-soft);
  color: var(--ink);
}

.rail-nav svg,
.topbar svg,
button svg,
.panel-title svg,
.lab-meta svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.atlas-mini {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(31, 36, 32, 0.08);
}

.agent-chip {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fffaf0;
}

.atlas-mini p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.atlas-mini strong {
  display: block;
  margin: 4px 0 8px;
  font-size: 1rem;
}

.atlas-mini span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

main {
  min-width: 0;
  padding: 22px clamp(18px, 4vw, 48px) 56px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 20px;
  background: linear-gradient(180deg, rgba(251, 250, 245, 0.97) 72%, rgba(251, 250, 245, 0));
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(620px, 100%);
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-wrap input::placeholder {
  color: var(--subtle);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.language-switch {
  display: inline-flex;
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.language-switch button {
  min-width: 44px;
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.language-switch button:hover,
.language-switch button.active {
  background: var(--ink);
  color: #fffaf0;
}

.icon-btn,
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
}

.icon-btn {
  width: 42px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.primary-btn {
  min-width: 136px;
  padding: 0 16px;
  background: var(--ink);
  color: #fffaf0;
}

.primary-btn span {
  white-space: nowrap;
}

.secondary-btn {
  padding: 0 14px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.command {
  display: grid;
  grid-template-columns: minmax(430px, 1fr) minmax(380px, 0.95fr);
  gap: clamp(24px, 3vw, 42px);
  align-items: stretch;
  min-height: calc(100vh - 116px);
  padding: clamp(26px, 5vw, 54px) 0 36px;
}

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

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.eyebrow span,
.kicker,
.lab-status,
.agent-badge,
.schema-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #05644f;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.eyebrow span:nth-child(2) {
  background: var(--gold-soft);
  color: #76530f;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 22px;
  font-size: clamp(2.4rem, 4.45vw, 4.6rem);
  line-height: 1.03;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.command-copy p {
  max-width: 680px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.8;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 640px;
}

.hero-metrics div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.hero-metrics strong,
.hero-metrics span {
  display: block;
}

.hero-metrics strong {
  margin-bottom: 3px;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.hero-metrics span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.graph-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, 0.15);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #fffdf8, #f1eadf);
  box-shadow: var(--shadow);
}

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

.graph-card {
  position: absolute;
  display: grid;
  gap: 2px;
  max-width: 230px;
  padding: 13px 14px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 38px rgba(31, 36, 32, 0.12);
  backdrop-filter: blur(12px);
}

.graph-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.graph-card strong {
  font-size: 0.94rem;
}

.graph-card-a {
  top: 22px;
  right: 22px;
}

.graph-card-b {
  left: 24px;
  bottom: 24px;
}

.workspace-section {
  scroll-margin-top: 86px;
  margin-top: 34px;
  padding: clamp(24px, 4vw, 36px) 0;
}

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

.section-head h2 {
  max-width: 980px;
  margin: 10px 0 0;
  font-size: clamp(1.85rem, 3.6vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.segmented button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: var(--ink);
  color: #fffaf0;
}

.problem-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.problem-list {
  display: grid;
  gap: 10px;
}

.problem-card,
.problem-detail,
.talent-panel,
.lab-grid article,
.translation-card,
.risk-matrix,
.atlas-console .console-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 12px 28px rgba(31, 36, 32, 0.06);
}

.problem-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  min-height: 158px;
  padding: 18px;
  text-align: left;
  color: inherit;
}

.problem-card:hover,
.problem-card.selected {
  border-color: rgba(0, 143, 111, 0.55);
  box-shadow: 0 20px 42px rgba(0, 143, 111, 0.13);
}

.problem-card h3 {
  margin-bottom: 8px;
  font-size: 1.22rem;
}

.problem-card p {
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.62;
}

.card-tags,
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f0ede4;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.problem-score {
  display: grid;
  place-items: center;
  align-self: start;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), #ece5d8 0);
}

.problem-score span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  font-weight: 900;
}

.score-83 {
  --score: 83;
}

.score-86 {
  --score: 86;
}

.score-88 {
  --score: 88;
}

.score-91 {
  --score: 91;
}

.score-94 {
  --score: 94;
}

.problem-detail {
  position: sticky;
  top: 82px;
  min-height: 420px;
  padding: 20px;
}

.detail-empty {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 360px;
  color: var(--subtle);
  font-weight: 800;
}

.detail-empty svg {
  width: 28px;
  height: 28px;
}

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

.detail-head h3 {
  margin-bottom: 6px;
  font-size: 1.38rem;
}

.detail-head span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.detail-box {
  padding: 14px;
  border-radius: var(--radius);
  background: #f8f5ee;
}

.detail-box strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.detail-box p,
.detail-box li {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.detail-box ul {
  margin: 0;
  padding-left: 18px;
}

.talent-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr 0.9fr;
  gap: 14px;
}

.talent-panel {
  min-height: 320px;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-title h3 {
  margin: 0;
}

.passport-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.passport-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
}

.passport-card strong,
.passport-card span {
  display: block;
}

.passport-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.score {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--blue);
  font-weight: 950;
}

.proof-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.proof-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.proof-list span {
  color: var(--muted);
}

.challenge-list {
  display: grid;
  gap: 10px;
}

.challenge-list button {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  text-align: left;
}

.challenge-list button:hover {
  border-color: var(--green);
}

.challenge-list span {
  font-weight: 800;
  line-height: 1.45;
}

.challenge-list strong {
  color: var(--green);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.signal-bars {
  display: grid;
  gap: 16px;
  padding-top: 8px;
}

.value-61 {
  --value: 61;
}

.value-69 {
  --value: 69;
}

.value-74 {
  --value: 74;
}

.value-88 {
  --value: 88;
}

.signal-bars div {
  position: relative;
  min-height: 42px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f1ede4;
}

.signal-bars div::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--value) * 1%);
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.signal-bars span {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 1px 7px rgba(23, 33, 29, 0.35);
}

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

.lab-grid article {
  display: grid;
  align-content: start;
  min-height: 260px;
  padding: 18px;
}

.lab-status {
  justify-self: start;
  margin-bottom: 18px;
}

.lab-status.amber {
  background: var(--gold-soft);
  color: #76530f;
}

.lab-status.rose {
  background: var(--rose-soft);
  color: #8f2637;
}

.lab-grid h3 {
  font-size: 1.28rem;
}

.lab-grid p {
  color: var(--muted);
  line-height: 1.7;
}

.lab-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.lab-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f1ede4;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.capital-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
}

.translation-card,
.risk-matrix,
.atlas-console .console-grid article {
  padding: 18px;
}

.opportunity-list {
  display: grid;
  gap: 12px;
}

.opportunity-list div {
  padding: 14px;
  border-radius: var(--radius);
  background: #f8f5ee;
}

.opportunity-list strong,
.opportunity-list span {
  display: block;
}

.opportunity-list span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.matrix {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.matrix span {
  color: var(--muted);
}

.matrix strong {
  min-width: 82px;
  padding: 7px 10px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.8rem;
}

.matrix .low {
  background: var(--green-soft);
  color: #05644f;
}

.matrix .medium {
  background: var(--gold-soft);
  color: #76530f;
}

.matrix .high {
  background: var(--rose-soft);
  color: #8f2637;
}

.agent-badge {
  gap: 7px;
  background: var(--blue-soft);
  color: #163d9d;
}

.console-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.queue-list {
  display: grid;
  gap: 11px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.queue-list li::marker {
  color: var(--green);
  font-weight: 900;
}

.schema-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.schema-tags span:nth-child(2n) {
  background: var(--blue-soft);
  color: #163d9d;
}

.schema-tags span:nth-child(3n) {
  background: var(--gold-soft);
  color: #76530f;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 33, 29, 0.34);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden],
.toast[hidden] {
  display: none;
}

.signal-modal {
  width: min(640px, 100%);
  max-height: min(780px, calc(100vh - 36px));
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin: 10px 0 0;
  font-size: 1.6rem;
}

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

.signal-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 850;
}

.signal-form input,
.signal-form select,
.signal-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: #fffdf8;
  color: var(--ink);
}

.signal-form textarea {
  resize: vertical;
  line-height: 1.55;
}

.signal-form input:focus,
.signal-form select:focus,
.signal-form textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 143, 111, 0.12);
}

.signal-form .primary-btn {
  justify-self: start;
  margin-top: 4px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 40px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fffaf0;
  box-shadow: var(--shadow);
  font-weight: 800;
}

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

  .side-rail {
    position: static;
    height: auto;
    padding: 14px clamp(18px, 4vw, 48px);
    border-right: 0;
    border-bottom: 1px solid rgba(23, 33, 29, 0.12);
  }

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

  .rail-nav a {
    justify-content: center;
  }

  .atlas-mini {
    display: none;
  }

  .command {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .graph-stage {
    min-height: 440px;
  }

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

  .problem-layout,
  .talent-grid,
  .capital-layout {
    grid-template-columns: 1fr;
  }

  .problem-detail {
    position: static;
  }
}

@media (max-width: 720px) {
  main {
    padding-inline: 14px;
  }

  .side-rail {
    padding-inline: 14px;
  }

  .brand {
    grid-template-columns: 40px 1fr;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .rail-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .rail-nav a {
    flex: 0 0 auto;
  }

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

  .top-actions {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    justify-content: stretch;
  }

  .language-switch {
    grid-column: 1 / -1;
    order: -1;
    width: 100%;
  }

  #refreshIntel {
    grid-column: 1;
  }

  #submitSignal {
    grid-column: 2;
  }

  .language-switch button {
    flex: 1 1 0;
  }

  .primary-btn {
    width: 100%;
    min-width: 0;
  }

  .primary-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  h1 {
    font-size: 2.7rem;
  }

  .hero-metrics,
  .lab-grid,
  .console-grid {
    grid-template-columns: 1fr;
  }

  .graph-stage {
    min-height: 380px;
  }

  .graph-card {
    max-width: 190px;
  }

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

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1 1 auto;
  }

  .problem-card {
    grid-template-columns: 1fr;
  }

  .problem-score {
    width: 56px;
    height: 56px;
  }

  .problem-score span {
    width: 44px;
    height: 44px;
  }
}
