:root {
  --page: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #fbfbf8;
  --ink: #17211f;
  --muted: #65706d;
  --faint: #87918d;
  --line: #d9dfda;
  --line-strong: #b8c3bd;
  --teal: #096d66;
  --teal-soft: #e3f1ee;
  --blue: #2f5b9c;
  --blue-soft: #e8eef7;
  --amber: #80620d;
  --amber-soft: #f7efd6;
  --red: #a0443e;
  --red-soft: #f8e7e4;
  --green: #2d7048;
  --green-soft: #e4f0e8;
  --shadow: 0 14px 36px rgba(26, 38, 35, 0.08);
  --sticky-offset: 116px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 180px),
    var(--page);
  color: var(--ink);
  font-family: "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

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

.app-shell {
  min-height: 100vh;
}

.search-pane {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.94);
  backdrop-filter: blur(14px);
  padding: 14px max(20px, calc((100vw - 1160px) / 2));
}

.product-strip {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.product-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.search-box input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 15px;
  outline: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.search-box input::placeholder {
  color: #8a9692;
}

.search-box input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(9, 109, 102, 0.14);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.result-meta {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  margin-top: 8px;
}

#statusText {
  color: var(--teal);
  font-weight: 750;
}

.disease-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.disease-list:empty {
  display: none;
}

.disease-list li {
  flex: 0 0 auto;
}

.disease-button {
  min-width: 164px;
  max-width: 220px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
  display: grid;
  align-content: center;
}

.disease-button:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(26, 38, 35, 0.07);
}

.disease-button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.disease-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
  line-height: 1.2;
}

.disease-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.disease-domain {
  display: none;
}

.detail-pane {
  min-width: 0;
  padding: 24px max(20px, calc((100vw - 1160px) / 2)) 52px;
}

.empty-state {
  max-width: 760px;
  margin: 16vh auto 0;
  padding: 0;
}

.empty-state h2 {
  margin: 0;
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: 0;
}

.empty-state p {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.query-result {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 7px 0 0;
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: 0;
}

.detail-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--green-soft);
  color: var(--green);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 850;
}

.count-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 360px;
}

.count-item {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.count-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.count-item strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.sections-root {
  display: grid;
  gap: 18px;
}

.section-block {
  display: grid;
  gap: 9px;
  scroll-margin-top: calc(var(--sticky-offset) + 52px);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.section-heading span {
  color: var(--faint);
  font-size: 12px;
}

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

.treatment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: 0 5px 18px rgba(26, 38, 35, 0.045);
  display: grid;
  gap: 9px;
}

.card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.card-head h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.38;
  letter-spacing: 0;
}

.status-pill {
  min-height: 24px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 850;
  color: var(--teal);
  background: var(--teal-soft);
  white-space: nowrap;
}

.status-pill.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.danger {
  color: var(--red);
  background: var(--red-soft);
}

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

.fact-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.fact-list-secondary {
  padding-top: 7px;
}

.fact-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.fact-row dt {
  color: var(--muted);
  font-weight: 850;
}

.fact-row dd {
  margin: 0;
  min-width: 0;
  white-space: pre-line;
}

.card-details {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.card-details summary {
  cursor: pointer;
  color: var(--teal);
  font-size: 13px;
  font-weight: 850;
}

.drilldown {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  display: grid;
  gap: 7px;
}

.drilldown summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 850;
}

.drilldown-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.drilldown-item {
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  border-radius: 6px;
  padding: 8px 9px;
  font-size: 13px;
  line-height: 1.48;
}

.evidence-digest {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.evidence-digest-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.evidence-digest-row span {
  color: var(--blue);
  font-weight: 850;
}

.evidence-digest-row p {
  margin: 0;
}

.digest-more {
  margin-top: 6px;
}

.digest-more summary {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.evidence-digest-full {
  margin-top: 6px;
}

.empty-section {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 13px 14px;
  line-height: 1.55;
}

@media (max-width: 820px) {
  .search-pane {
    padding: 9px 14px 8px;
  }

  .product-strip {
    gap: 8px;
  }

  .result-meta {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .detail-pane {
    padding: 14px 14px 42px;
  }

  .detail-header {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
  }

  .count-panel {
    justify-content: flex-start;
    max-width: none;
  }

}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .product-strip {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
  }

  .product-name {
    font-size: 12px;
  }

  .search-box {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .search-box input {
    height: 40px;
    padding: 0 11px;
  }

  .icon-button {
    width: 39px;
    height: 39px;
  }

  .disease-button {
    min-width: 142px;
    height: 38px;
  }

  body.has-result .disease-list {
    display: none;
  }

  .empty-state {
    margin-top: 12vh;
  }

  .empty-state h2 {
    font-size: 23px;
  }

  .detail-header {
    padding-bottom: 11px;
  }

  .detail-header h2 {
    font-size: 22px;
  }

  .detail-header p,
  .result-meta {
    font-size: 12px;
  }

  #resultCount,
  .count-panel {
    display: none;
  }

  .section-heading {
    display: grid;
  }

  .section-heading h3 {
    font-size: 16px;
  }

  .treatment-card {
    padding: 12px;
    gap: 8px;
  }

  .card-head {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .card-head h4 {
    font-size: 15px;
  }

  .status-pill {
    width: max-content;
    min-height: 23px;
    font-size: 11px;
  }

  .scenario,
  .fact-row,
  .drilldown-item {
    font-size: 12px;
  }

  .fact-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
    line-height: 1.48;
  }

  .evidence-digest-row {
    grid-template-columns: 1fr;
    gap: 1px;
  }
}
