:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --teal: #0071e3;
  --teal-dark: #005bb5;
  --blue: #0071e3;
  --amber: #b05a00;
  --rose: #c41e3a;
  --green-soft: #eaf7ee;
  --blue-soft: #e8f2ff;
  --amber-soft: #fff4df;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0, #f5f5f7 320px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #101827;
  border-right: 1px solid rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.brand p,
.eyebrow {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.nav-tab {
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dbeafe;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-tab span {
  width: 22px;
  text-align: center;
  color: #93c5fd;
}

.nav-tab.is-active,
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.pathway-block {
  margin-top: 12px;
  border: 1px solid rgba(0, 113, 227, 0.18);
  border-radius: 8px;
  background: #f7fbff;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1fr) minmax(220px, 1.2fr);
  gap: 10px;
}

.result-list .pathway-block {
  grid-template-columns: 1fr;
  margin-top: 0;
  align-self: start;
}

.result-list .pathway-block::before {
  content: "当前项目临床路径";
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: -2px;
}

.pathway-block-head,
.pathway-track,
.pathway-node {
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.pathway-block-head span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.pathway-block-head strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.pathway-track {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.pathway-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: #0071e3;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.pathway-track span,
.pathway-node span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.pathway-track strong,
.pathway-node strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.pathway-node p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.source-meter {
  margin-top: auto;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.source-meter div {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.source-meter strong,
.source-meter span {
  display: block;
}

.source-meter strong {
  font-size: 21px;
}

.source-meter span {
  margin-top: 4px;
  color: #b6c5d8;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 18px 22px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

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

.toolbar h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 760;
  letter-spacing: 0;
}

.workspace .eyebrow {
  color: var(--muted);
}

.sidebar .eyebrow,
.sidebar .brand p {
  color: #9fb1c9;
}

.icon-button,
.ghost-button,
.primary-button {
  border-radius: 8px;
  border: 1px solid var(--line);
  height: 36px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 20px;
}

.primary-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: #a9b8ca;
}

.search-panel,
.editor-panel,
.table-panel,
.detail-pane,
.notice {
  background: var(--panel);
  border: 1px solid rgba(210, 210, 215, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(520px, 660px);
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

input,
select {
  height: 36px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.14);
}

.search-box input {
  font-size: 16px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink);
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.toggle-line span {
  line-height: 1.35;
}

.form-toggle {
  justify-content: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #f8fafc;
}

.notice {
  margin: 10px 0;
  padding: 9px 12px;
  color: #424245;
  background: #fbfbfd;
  border-color: rgba(210, 210, 215, 0.9);
  box-shadow: none;
  font-size: 13px;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.result-list {
  display: grid;
  align-content: start;
  gap: 12px;
}

.result-section-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.result-card {
  border: 1px solid rgba(210, 210, 215, 0.9);
  border-radius: 8px;
  padding: 11px;
  background: var(--panel);
  text-align: left;
  display: grid;
  gap: 7px;
}

.result-card.is-active {
  border-color: rgba(0, 113, 227, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.result-card h3,
.detail-pane h3,
.editor-panel h3,
.table-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.result-card h3 {
  font-size: 16px;
}

.result-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.alias-line {
  color: #526173;
}

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

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
}

.tag.reagent {
  background: var(--green-soft);
  color: #0f766e;
}

.tag.standard {
  background: #eef2ff;
  color: #4338ca;
}

.tag.guideline {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.tag.consensus {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.in-use {
  background: #dcfce7;
  color: #166534;
}

.tag.not-in-use {
  background: #f1f5f9;
  color: #475569;
}

.tag.draft {
  background: #ffe4e6;
  color: var(--rose);
}

.detail-pane {
  padding: 16px;
  min-width: 0;
}

.empty-state {
  height: 100%;
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 18px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-head h3 {
  font-size: 22px;
}

.code-badge {
  min-width: 58px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #1d1d1f;
  color: #fff;
  font-weight: 800;
}

.detail-section {
  margin-top: 12px;
}

.detail-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.detail-section p {
  margin: 0;
  line-height: 1.65;
}

.evidence-box {
  border-left: 4px solid var(--teal);
  background: #fbfbfd;
  padding: 10px 12px;
  line-height: 1.6;
}

.boundary-section {
  border: 1px solid #f3d08b;
  border-radius: 8px;
  background: #fffaf0;
  padding: 10px 12px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.detail-section:has(.related-list) {
  margin-top: 34px;
}

.section-title-row h4 {
  margin: 0;
}

.section-title-row span,
.compact-empty {
  color: var(--muted);
  font-size: 12px;
}

.compact-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.related-item {
  border: 1px solid rgba(210, 210, 215, 0.88);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 9px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
}

.related-item:hover {
  border-color: rgba(0, 113, 227, 0.55);
  background: #ffffff;
}

.related-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.related-topline > span {
  border-radius: 999px;
  background: #f5f5f7;
  color: #6e6e73;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.related-item strong {
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0;
}

.related-item strong span {
  color: var(--muted);
  font-size: 12px;
}

.related-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.compare-grid > div {
  border: 1px solid #e8e8ed;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.compare-grid em {
  display: block;
  color: #1d1d1f;
  font-style: normal;
  font-weight: 760;
  font-size: 12px;
  margin-bottom: 5px;
}

.compare-grid ul {
  margin: 0;
  padding-left: 16px;
  color: #6e6e73;
  font-size: 12px;
  line-height: 1.45;
}

.compare-grid li + li {
  margin-top: 3px;
}

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

.meta-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.two-column {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 12px;
}

.two-column.wide-left {
  grid-template-columns: minmax(360px, 500px) minmax(0, 1fr);
}

.editor-panel,
.table-panel {
  padding: 14px;
}

.editor-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.source-list,
.entry-table {
  display: grid;
  gap: 8px;
}

.source-row,
.entry-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 7px;
  background: #fff;
}

.row-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.row-head strong {
  font-size: 15px;
}

.row-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
  padding: 4px 0;
}

.text-button.danger {
  color: var(--rose);
}

@media (max-width: 980px) {
  .app-shell,
  .search-panel,
  .results-layout,
  .two-column,
  .two-column.wide-left {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 14px;
  }

  .nav-tabs,
  .source-meter {
    grid-template-columns: repeat(3, 1fr);
  }

  .source-meter {
    display: none;
  }

  .workspace {
    padding: 18px;
  }
}

@media (max-width: 620px) {
  .brand {
    align-items: start;
  }

  .toolbar,
  .detail-head,
  .row-head {
    align-items: stretch;
    flex-direction: column;
  }

  .filters,
  .inline-fields,
  .source-meta,
  .pathway-block {
    grid-template-columns: 1fr;
  }

  .nav-tab {
    justify-content: center;
    padding: 0 8px;
  }

  .nav-tab span {
    display: none;
  }
}
