:root {
  --ink: #17212b;
  --muted: #637181;
  --line: #dfe4e8;
  --surface: #ffffff;
  --canvas: #f3f5f6;
  --navy: #12314a;
  --teal: #137d78;
  --teal-soft: #e7f3f1;
  --amber: #b57516;
  --amber-soft: #fbf1dd;
  --red: #a53a35;
  --red-soft: #f9e9e7;
  --blue-soft: #e8f0f7;
  --shadow: 0 12px 30px rgba(24, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px 22px;
  background: var(--navy);
  color: #f4f7f8;
  display: flex;
  flex-direction: column;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-block strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0;
}

.brand-block p {
  margin: 1px 0 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 7px;
  display: grid;
  place-items: center;
  grid-template-columns: repeat(3, 4px);
  gap: 3px;
}

.brand-mark span {
  width: 4px;
  border-radius: 2px;
  background: #72cfc6;
}

.brand-mark span:nth-child(1) {
  height: 11px;
}

.brand-mark span:nth-child(2) {
  height: 21px;
}

.brand-mark span:nth-child(3) {
  height: 15px;
}

.step-nav {
  display: grid;
  gap: 5px;
  margin-top: 26px;
}

.step-link {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  text-align: left;
  padding: 10px 9px;
  cursor: pointer;
}

.step-link span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.38);
}

.step-link strong {
  font-size: 13px;
  font-weight: 600;
}

.step-link:hover,
.step-link.active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.step-link.active span {
  color: #72cfc6;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-foot p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.83);
  font-size: 12px;
}

.status-line i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #72cfc6;
  box-shadow: 0 0 0 4px rgba(114, 207, 198, 0.12);
}

.main-content {
  min-width: 0;
  padding: 28px 30px 54px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.engine-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.engine-strip div {
  min-width: 0;
  background: #ffffff;
  padding: 12px 15px;
}

.engine-strip span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.engine-strip p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.eyebrow,
.section-label {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(25px, 2.3vw, 36px);
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.data-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.data-status.online {
  color: var(--teal);
  font-weight: 700;
}

.data-status.offline {
  color: var(--red);
  font-weight: 700;
}

.primary-button {
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: #ffffff;
  padding: 10px 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(19, 125, 120, 0.2);
}

.primary-button:hover {
  background: #0e6965;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
}

.product-panel,
.decision-summary,
.control-panel,
.evidence-panel,
.risk-panel,
.experiment-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-panel {
  display: grid;
  grid-template-columns: 190px 1fr;
  min-height: 280px;
  overflow: hidden;
}

.product-visual {
  position: relative;
  display: grid;
  place-items: center;
  background: #dfe9ec;
  overflow: hidden;
}

.product-visual::before {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(18, 49, 74, 0.12);
  border-radius: 50%;
}

.product-visual::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 16px;
  height: 1px;
  background: rgba(18, 49, 74, 0.18);
}

.water-ring {
  position: absolute;
  width: 105px;
  height: 28px;
  top: 72px;
  border: 2px solid #348d93;
  border-radius: 50%;
  background: #f6fbfb;
}

.fountain-body {
  position: relative;
  z-index: 2;
  width: 78px;
  height: 103px;
  margin-top: 42px;
  border-radius: 10px 10px 18px 18px;
  background: #f8fbfc;
  border: 1px solid #b6c6cd;
  box-shadow: 0 14px 25px rgba(25, 52, 66, 0.15);
}

.water-slot {
  width: 36px;
  height: 12px;
  margin: 20px auto;
  border-radius: 8px;
  background: #348d93;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.fountain-foot {
  position: absolute;
  left: -10px;
  right: -10px;
  bottom: -8px;
  height: 15px;
  border-radius: 50%;
  background: #e5edf0;
  border: 1px solid #b6c6cd;
}

.feature-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  border-radius: 4px;
  background: #ffffff;
  padding: 3px 8px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
}

.product-copy {
  padding: 28px 25px 24px;
  display: flex;
  flex-direction: column;
}

.scenario-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  padding: 7px 9px 7px 11px;
}

.scenario-control label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.scenario-control select {
  min-width: 150px;
  border: 0;
  background: transparent;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.product-copy > p:not(.section-label) {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: auto 0 0;
}

.profile-metrics div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.profile-metrics dt,
.mini-metrics dt {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.profile-metrics dd {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.product-visual.pillow .water-ring {
  width: 112px;
  height: 78px;
  top: 69px;
  border: 1px solid #b6c6cd;
  background: #f8fbfc;
  box-shadow: 0 13px 24px rgba(25, 52, 66, 0.13);
  transform: rotate(-7deg);
}

.product-visual.pillow .fountain-body {
  width: 116px;
  height: 78px;
  margin-top: 38px;
  border-radius: 48% 52% 44% 56%;
  transform: rotate(-7deg);
}

.product-visual.pillow .water-slot,
.product-visual.pillow .fountain-foot {
  display: none;
}

.decision-summary {
  padding: 24px;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.confidence-badge,
.market-context,
.source-count,
.risk-badge {
  border-radius: 5px;
  background: var(--blue-soft);
  color: #315a75;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.decision-text {
  margin: 20px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

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

.reason-list > div {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.reason-list span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
}

.reason-list p {
  margin: 0;
  font-size: 13px;
}

.reason-list b {
  color: var(--muted);
  font-size: 11px;
}

.section-block {
  margin-top: 28px;
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 14px;
}

.method-note,
.panel-intro {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.market-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.market-card:hover,
.market-card.selected {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.market-card.winner {
  border-color: var(--teal);
  background: #fbfefe;
}

.market-card-top,
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.country-code {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 24px;
  border-radius: 4px;
  background: var(--navy);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.rank {
  color: var(--muted);
  font-size: 11px;
}

.market-card h3 {
  margin-top: 15px;
  font-size: 18px;
}

.score-row {
  justify-content: flex-start;
  align-items: baseline;
  gap: 5px;
  margin-top: 10px;
}

.score-row strong {
  font-size: 34px;
  line-height: 1;
  color: var(--navy);
}

.score-row span {
  color: var(--muted);
  font-size: 12px;
}

.score-track {
  height: 5px;
  overflow: hidden;
  margin: 13px 0 16px;
  border-radius: 3px;
  background: #e9edef;
}

.score-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 650ms ease;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0;
}

.mini-metrics div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.mini-metrics dd {
  margin: 1px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.sandbox-layout,
.risk-experiment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}

.control-panel,
.evidence-panel,
.risk-panel,
.experiment-panel {
  padding: 22px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.slider-field {
  display: block;
  margin-top: 20px;
}

.slider-field > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.slider-field > span b {
  color: var(--teal);
}

.slider-field input {
  width: 100%;
  margin: 12px 0 2px;
  accent-color: var(--teal);
}

.slider-field small {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.slider-field i {
  font-style: normal;
}

.score-note {
  margin-top: 20px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  padding: 10px 12px;
  color: #74501a;
  font-size: 12px;
}

.evidence-list {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.evidence-item {
  display: grid;
  grid-template-columns: 47px 1fr 60px;
  gap: 12px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.evidence-item:last-child {
  border-bottom: 0;
}

.evidence-item strong {
  display: block;
  font-size: 13px;
}

.evidence-item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.evidence-type {
  border-radius: 4px;
  padding: 3px 6px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
}

.evidence-type.market {
  color: #315a75;
  background: var(--blue-soft);
}

.evidence-type.demand {
  color: #0b6b66;
  background: var(--teal-soft);
}

.evidence-type.review {
  color: #74501a;
  background: var(--amber-soft);
}

.evidence-type.policy {
  color: #83342f;
  background: var(--red-soft);
}

.evidence-date {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.localization-section {
  border-top: 1px solid var(--line);
  padding-top: 26px;
}

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

.strategy-card {
  position: relative;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px 20px 18px 58px;
}

.card-number {
  position: absolute;
  top: 20px;
  left: 18px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.strategy-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.risk-list {
  display: grid;
  gap: 9px;
  margin-top: 17px;
}

.risk-list > div {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.risk-list p {
  margin: 0;
  font-size: 12px;
}

.risk-level {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}

.risk-level.low {
  color: #0b6b66;
  background: var(--teal-soft);
}

.risk-level.medium {
  color: #74501a;
  background: var(--amber-soft);
}

.risk-level.high {
  color: #83342f;
  background: var(--red-soft);
}

.inline-action {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 11px;
  cursor: pointer;
}

.experiment-list {
  position: relative;
  display: grid;
  gap: 0;
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
}

.experiment-list::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 5px;
  width: 1px;
  background: var(--line);
}

.experiment-list li {
  position: relative;
  padding: 0 0 14px 24px;
}

.experiment-list li::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 1px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  background: #ffffff;
}

.experiment-list span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
}

.experiment-list p {
  margin: 2px 0 0;
  font-size: 12px;
}

.agent-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #fafbfb;
  display: flex;
  flex-direction: column;
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.agent-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--navy);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.agent-identity strong {
  display: block;
  font-size: 13px;
}

.agent-identity p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.online-dot {
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
}

.online-dot::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--teal);
}

.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.message {
  max-width: 92%;
  margin-bottom: 13px;
  border-radius: 8px;
  padding: 12px 13px;
  font-size: 12px;
}

.message p {
  margin: 0;
}

.message.agent {
  border: 1px solid var(--line);
  background: #ffffff;
}

.message.agent > span {
  display: block;
  margin-top: 8px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 800;
}

.message.user {
  margin-left: auto;
  background: var(--navy);
  color: #ffffff;
}

.message.system-note {
  max-width: 100%;
  border: 1px dashed #bed2d1;
  background: var(--teal-soft);
  color: #38615f;
  text-align: center;
}

.quick-prompts {
  display: grid;
  gap: 7px;
  padding: 0 18px 12px;
}

.quick-prompts button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #3b4b59;
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  cursor: pointer;
}

.quick-prompts button:hover {
  border-color: #a9c5c3;
  background: #f8fcfb;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.composer input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  outline: none;
}

.composer input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(19, 125, 120, 0.1);
}

.composer button {
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #ffffff;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 1260px) {
  .app-shell {
    grid-template-columns: 204px minmax(650px, 1fr) 310px;
  }

  .product-panel {
    grid-template-columns: 155px 1fr;
  }
}

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

  .agent-panel {
    position: fixed;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 10;
    width: 340px;
    height: 520px;
    border: 1px solid var(--line);
    box-shadow: 0 18px 45px rgba(18, 49, 74, 0.22);
  }

  .main-content {
    padding-right: 24px;
  }
}

@media (max-width: 840px) {
  .app-shell {
    display: block;
  }

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

  .step-nav {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 16px;
  }

  .step-link {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .sidebar-foot {
    display: none;
  }

  .main-content {
    padding: 20px 16px 40px;
  }

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

  .overview-grid,
  .sandbox-layout,
  .risk-experiment-grid,
  .engine-strip {
    grid-template-columns: 1fr;
  }

  .product-panel {
    grid-template-columns: 1fr;
  }

  .product-visual {
    min-height: 190px;
  }

  .market-grid,
  .localization-grid {
    grid-template-columns: 1fr;
  }

  .agent-panel {
    position: static;
    width: auto;
    height: 560px;
    margin: 18px;
  }
}
