:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #66716c;
  --line: #dce2df;
  --surface: #ffffff;
  --soft: #f4f7f5;
  --green: #146b4a;
  --green-soft: #e4f2eb;
  --blue: #245a8d;
  --amber: #946400;
  --coral: #a84635;
  --shadow: 0 10px 30px rgba(25, 38, 32, .08);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--soft); color: var(--ink); }
body { font-size: 14px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(36, 90, 141, .28); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 9px 12px; background: var(--ink); color: white; }
.skip-link:focus { top: 8px; }

.app-header { height: 64px; display: flex; align-items: center; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 205px; color: inherit; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--ink); color: white; font-weight: 800; border-radius: 6px; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 15px; }
.brand small { font-size: 11px; color: var(--muted); margin-top: 1px; }
.header-meta { flex: 1; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.header-actions a { color: var(--muted); text-decoration: none; padding: 8px; }
.header-actions a:hover { color: var(--ink); }

.button { min-height: 36px; border: 1px solid transparent; border-radius: 6px; padding: 7px 13px; cursor: pointer; font-weight: 650; letter-spacing: 0; }
.button.primary { background: var(--green); color: white; }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button:hover { filter: brightness(.96); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.full { width: 100%; }
.icon-button { width: 34px; height: 34px; border: 0; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; border-radius: 5px; }

.workspace { display: grid; grid-template-columns: minmax(460px, 42%) minmax(620px, 58%); height: calc(100vh - 64px); max-width: 1680px; margin: 0 auto; background: var(--surface); border-inline: 1px solid var(--line); }
.catalog { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.catalog-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 22px 24px 14px; }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 11px; font-weight: 750; text-transform: uppercase; }
h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: 0; }
.tier-control { flex: none; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tier-control button { border: 0; background: var(--surface); padding: 7px 10px; color: var(--muted); cursor: pointer; }
.tier-control button + button { border-left: 1px solid var(--line); }
.tier-control button.active { background: var(--ink); color: white; }

.search-row { display: flex; gap: 8px; padding: 0 24px 14px; }
.search-box { height: 40px; min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; border: 1px solid #bfc8c4; border-radius: 6px; padding: 0 12px; background: white; }
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36, 90, 141, .12); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }

.quadrants { display: grid; grid-template-columns: repeat(5, 1fr); border-block: 1px solid var(--line); }
.quadrants button { min-width: 0; height: 53px; border: 0; border-right: 1px solid var(--line); background: var(--soft); color: var(--muted); cursor: pointer; }
.quadrants button:last-child { border-right: 0; }
.quadrants button span, .quadrants button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quadrants button span { font-size: 12px; }
.quadrants button small { margin-top: 3px; font-size: 10px; color: #84908b; }
.quadrants button.active { box-shadow: inset 0 -3px var(--green); background: white; color: var(--ink); font-weight: 700; }

.list-toolbar { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 24px; border-bottom: 1px solid var(--line); }
.list-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.list-toolbar select { max-width: 180px; height: 30px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: white; }
.skill-list { flex: 1; overflow: auto; }
.skill-card { width: 100%; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; padding: 16px 24px; border: 0; border-bottom: 1px solid var(--line); background: white; color: inherit; text-align: left; cursor: pointer; }
.skill-card:hover { background: #f9fbfa; }
.skill-card.active { background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.skill-score { width: 42px; height: 42px; display: grid; place-items: center; align-content: center; border: 1px solid #bcd1c5; border-radius: 6px; color: var(--green); font-weight: 800; }
.skill-score small { display: block; font-size: 8px; color: var(--muted); font-weight: 500; }
.skill-main { min-width: 0; }
.skill-main h2 { margin: 0; font-size: 15px; line-height: 1.4; letter-spacing: 0; overflow-wrap: anywhere; }
.skill-main p { margin: 5px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.skill-context { display: flex; gap: 8px; color: #7a8580; font-size: 10px; }
.skill-context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-matched { display: inline-block; margin-top: 6px; background: #eef3ff; color: #3b6ee0; border-radius: 4px; padding: 2px 8px; font-size: 10.5px; font-weight: 650; }
.skill-brand { display: inline-block; margin-left: 6px; color: #9a6a2f; font-size: 10px; font-weight: 650; }
.tier-badge { align-self: start; border: 1px solid #b8d5c4; color: var(--green); padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 750; }
.tier-badge.b { border-color: #d8c89c; color: var(--amber); }
.load-more { flex: none; margin: 10px 24px; height: 34px; border: 1px solid var(--line); background: white; border-radius: 6px; cursor: pointer; }
.state-message { padding: 64px 24px; text-align: center; color: var(--muted); }
.state-message strong { display: block; color: var(--ink); margin-bottom: 6px; }

.detail { min-width: 0; overflow: auto; background: #fbfcfb; }
.detail-empty { height: 100%; display: grid; place-content: center; justify-items: center; color: var(--muted); text-align: center; padding: 24px; }
.detail-empty-mark { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid #b7c5be; border-radius: 7px; font-size: 24px; color: var(--green); }
.detail-empty h2 { margin: 14px 0 4px; color: var(--ink); font-size: 18px; }
.detail-empty p { margin: 0; }
.detail-article { max-width: 900px; margin: 0 auto; padding: 30px 42px 72px; }
.mobile-back { display: none; }
.detail-topline { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 11px; }
.detail-topline span + span { position: relative; }
.detail-topline span + span::before { content: ""; position: absolute; left: -7px; top: 50%; width: 2px; height: 2px; border-radius: 50%; background: #9aa49f; }
.quality-pill { color: var(--green); font-weight: 750; }
.detail-title { margin: 10px 0 18px; font-size: 28px; line-height: 1.35; letter-spacing: 0; overflow-wrap: anywhere; }
.standalone-page-link { display: inline-block; margin: -8px 0 16px; font-size: 13px; font-weight: 700; color: var(--green); border: 1px solid var(--green); border-radius: 999px; padding: 5px 13px; background: var(--green-soft); }
.standalone-page-link:hover { background: var(--green); color: #fff; text-decoration: none; }
.detail-lead { padding: 0 0 20px 16px; border-left: 3px solid var(--green); }
.detail-lead h3 { margin: 3px 0 7px; font-size: 16px; }
.detail-description { margin: 0; color: #4d5953; line-height: 1.75; max-width: 720px; }
.section-label { margin: 0; color: var(--green); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.command-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 0; background: rgba(251, 252, 251, .97); border-bottom: 1px solid var(--line); }
.command-bar .button { font-size: 12px; }
.command-download { display: inline-flex; align-items: baseline; gap: 6px; }
.command-download small { color: var(--muted); font-size: 9px; font-weight: 500; }
.entitlement-strip { margin: 18px 0 4px; padding: 15px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.entitlement-strip.preview-access { border-color: #d7c99f; background: #fffaf0; }
.entitlement-strip.full-access { border-color: #bcd8c8; background: #f2f8f4; }
.entitlement-strip strong { font-size: 13px; }
.entitlement-strip p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.entitlement-actions { flex: none; display: flex; align-items: center; gap: 9px; }
.entitlement-check { color: var(--green); font-size: 11px; font-weight: 700; }
.text-button { border: 0; padding: 4px 0; background: transparent; color: var(--blue); font-size: 11px; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.detail-section { padding: 24px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.detail-section.wide { grid-column: 1 / -1; }
.detail-section h3 { margin: 0 0 10px; font-size: 14px; color: var(--ink); }
.detail-section p, .detail-section li { line-height: 1.75; overflow-wrap: anywhere; }
.detail-section ul, .detail-section ol { margin: 0; padding-left: 20px; }
.fact-section { padding-right: 10px; }
.fact-section h3 { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.outcome-section { padding: 18px 20px; margin-top: 18px; border: 1px solid #cbd8d1; border-radius: 6px; background: white; }
.output-text { margin: 0; white-space: pre-wrap; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.section-heading h3 { margin: 3px 0 0; }
.section-state { flex: none; padding: 3px 7px; border-radius: 4px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 700; }
.section-state.locked { background: #fff3d7; color: #775b11; }
.step-list { list-style: none; padding: 0 !important; counter-reset: step; }
.step-list li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; gap: 11px; margin: 0; padding: 11px 0; border-top: 1px solid #edf0ee; }
.step-list li:first-child { border-top: 0; }
.step-list li::before { content: counter(step); width: 28px; height: 28px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); border-radius: 50%; font-size: 11px; font-weight: 750; }
.reveal-note { margin-top: 14px; padding: 12px 14px; border-left: 2px solid #d2b966; background: #fffaf0; color: #6b5930; font-size: 11px; }
.example-box { white-space: pre-wrap; background: white; border: 1px solid var(--line); border-radius: 6px; padding: 14px; max-height: 320px; overflow: auto; }
.source-card { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; }
.source-card img { width: 54px; height: 70px; object-fit: cover; border-radius: 4px; background: #e8ecea; }
.source-card strong, .source-card small { display: block; }
.source-card small { color: var(--muted); margin-top: 4px; }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.related-card { min-width: 0; display: grid; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: white; color: inherit; text-align: left; cursor: pointer; }
.related-card:hover { border-color: #a9c5b5; background: #f7fbf8; }
.related-tier { color: var(--green); font-size: 10px; font-weight: 750; }
.related-card strong { overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; }
.related-card span:not(.related-tier) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.5; }
.related-card small { color: #7a8580; font-size: 10px; }
.detail-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%); background: var(--ink); color: white; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); }
dialog { width: min(430px, calc(100% - 24px)); border: 0; border-radius: 7px; padding: 0; box-shadow: 0 22px 70px rgba(0,0,0,.22); }
dialog::backdrop { background: rgba(18, 25, 22, .5); }
.dialog-shell { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-kicker { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.dialog-shell > label { display: grid; gap: 5px; margin: 12px 0; color: var(--muted); font-size: 12px; }
.dialog-shell input:not([type=checkbox]) { height: 38px; border: 1px solid var(--line); border-radius: 5px; padding: 0 10px; color: var(--ink); }
.dialog-shell .check-row { display: flex; align-items: center; }
.dialog-note, .form-error { color: var(--muted); font-size: 12px; }
.form-error { min-height: 18px; color: #a43030; }
.form-error.success-message { color: var(--green); }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.auth-switch button { min-height: 34px; border: 0; background: white; color: var(--muted); cursor: pointer; }
.auth-switch button + button { border-left: 1px solid var(--line); }
.auth-switch button.active { background: var(--ink); color: white; font-weight: 700; }
.plan-dialog { width: min(920px, calc(100vw - 24px)); }
#plansDialog { width: min(920px, calc(100% - 24px)); max-width: none; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan-card { display: flex; flex-direction: column; min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.plan-card.featured { border-color: #94baa7; box-shadow: inset 0 3px var(--green); }
.plan-card .plan-label { margin: 0 0 5px; color: var(--green); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.plan-card .plan-price { font-size: 22px; line-height: 1.25; }
.plan-card .plan-price span { font-size: 12px; font-weight: 600; }
.plan-card .plan-period { min-height: 17px; margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.plan-card ul { flex: 1; margin: 15px 0 18px; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.plan-footnote { margin: 15px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.one-time-key { margin-top: 16px; padding: 12px; background: #fff8e5; border: 1px solid #e1ce94; border-radius: 6px; }
.one-time-key p { margin: 0 0 8px; color: #775b11; font-size: 12px; }
.one-time-key code { display: block; padding: 8px; margin-bottom: 8px; background: white; overflow-wrap: anywhere; user-select: all; }
.key-list { margin-top: 14px; }
.key-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.key-row small { display: block; color: var(--muted); margin-top: 3px; }
.key-row button { border: 0; color: #9e3d31; background: transparent; cursor: pointer; }

@media (max-width: 960px) {
  .app-header { padding: 0 14px; }
  .header-meta, .header-actions a { display: none; }
  .header-actions #plansButton, .header-actions #apiKeyButton { display: none; }
  .brand { min-width: 0; flex: 1; }
  .workspace { display: block; height: calc(100vh - 64px); border: 0; }
  .catalog, .detail { height: 100%; border: 0; }
  .catalog.detail-open { display: none; }
  .detail { display: none; }
  .detail.detail-open { display: block; }
  .mobile-back { display: inline-flex; border: 0; background: transparent; color: var(--blue); padding: 0 0 10px; cursor: pointer; }
  .detail-article { padding: 18px 18px 54px; }
}

@media (max-width: 560px) {
  .app-header { height: 58px; }
  .header-actions { gap: 5px; }
  .header-actions .button { min-height: 32px; padding: 5px 8px; font-size: 12px; }
  .workspace { height: calc(100vh - 58px); }
  .catalog-head { padding: 16px 14px 12px; align-items: start; }
  h1 { font-size: 20px; }
  .tier-control button { padding: 6px 7px; font-size: 11px; }
  .search-row { padding: 0 14px 12px; }
  .quadrants { overflow-x: auto; grid-template-columns: repeat(5, minmax(84px, 1fr)); }
  .quadrants button { height: 48px; }
  .list-toolbar { padding-inline: 14px; }
  .list-toolbar select { max-width: 132px; }
  .skill-card { padding: 14px; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 9px; }
  .skill-score { width: 38px; height: 38px; }
  .detail-title { font-size: 22px; }
  .detail-lead { padding-left: 12px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-section.wide { grid-column: auto; }
  .related-grid { grid-template-columns: 1fr; }
  .command-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .command-bar .button { width: 100%; min-width: 0; justify-content: center; }
  .command-bar #copyApiCall { grid-column: 1 / -1; }
  .entitlement-strip { align-items: start; flex-direction: column; }
  .entitlement-actions { width: 100%; justify-content: space-between; }
  .plan-grid { grid-template-columns: 1fr; }
  #plansDialog { max-height: calc(100vh - 20px); }
  .plan-dialog { overflow: auto; max-height: calc(100vh - 20px); }
}

/* 搜索联想 + 详情语义标签 */
.search-suggest { position: relative; z-index: 50; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggest-item { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.suggest-item:hover { border-color: var(--green); color: var(--green); }
.suggest-item small { color: #9aa5a0; margin-left: 4px; }
.detail-keywords { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 2px; }
.detail-keywords-label { font-size: 11.5px; color: #7a8580; font-weight: 700; margin-right: 2px; }
.detail-keyword { background: #eef3ff; color: #3b6ee0; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 650; }

/* ========= KMAP v1.2 publication trace ========= */
.v12-pub { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; margin-left: 6px; }
.v12-pub.v12-showcase, .v12-pub.v12-public { background: #dcfce7; color: #166534; }
.v12-pub.v12-pending { background: #fef3c7; color: #92400e; }
.v12-pub.v12-internal { background: #f1f5f9; color: #64748b; }

.v12-trace { margin: 18px 0 8px; padding: 16px 18px; border: 1px solid var(--border, #e2e8f0); border-radius: 14px; background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%); }
.v12-trace[data-stage="featured"] { border-color: #16a34a; background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%); }
.v12-trace[data-stage="unstarted"] { border-color: #fde68a; background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%); }
.v12-trace-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.v12-stage-label { font-size: 13px; font-weight: 700; color: #0f172a; }
.v12-stage-rule { font-size: 11.5px; color: #64748b; }
.v12-trace-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; }
.v12-step { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; background: #ffffff; }
.v12-step.ok { border-color: #bbf7d0; background: #f0fdf4; }
.v12-step.pending { border-color: #fde68a; background: #fffbeb; }
.v12-step-no { width: 22px; height: 22px; border-radius: 999px; background: #0f172a; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.v12-step.ok .v12-step-no { background: #16a34a; }
.v12-step.pending .v12-step-no { background: #d97706; }
.v12-step-label { font-weight: 700; font-size: 13px; color: #0f172a; }
.v12-step small { font-size: 11.5px; color: #64748b; }
.v12-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 4px; vertical-align: middle; }
.v12-dot.ok { background: #16a34a; }
.v12-dot.pending { background: #d97706; }
@media (max-width: 720px) { .v12-trace-list { grid-template-columns: 1fr; } }

/* Home showcase: v1.2 strip */
.v12-trace-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e2e8f0; align-items: center; }
.v12-strip-label { font-size: 11px; font-weight: 700; color: #475569; margin-right: 4px; }
.v12-strip-status { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.v12-strip-status.ok { background: #dcfce7; color: #166534; }
.v12-strip-status.pending { background: #fef3c7; color: #92400e; }

/* KMAP v1.3 detail renderer: source -> ontology -> skill -> boundary. */
#detailContent { max-width: 980px; margin: 0 auto; padding: 28px 34px 72px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-head .detail-title { min-width: 0; margin: 0; font-size: inherit; line-height: normal; }
.detail-head .detail-title h2 { margin: 10px 0 8px; font-size: clamp(25px, 2.15vw, 34px); line-height: 1.24; letter-spacing: -.02em; overflow-wrap: anywhere; }
.detail-head .detail-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.detail-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.detail-head .qd-meta { max-width: 760px; }
.qd-grid { display: grid; gap: 16px; margin: 18px 0 8px; }
.qd-grid.qd-grid-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "source source" "ontology ontology" "skill boundary"; }
.qd-source { grid-area: source; }
.qd-ontology { grid-area: ontology; }
.qd-skill { grid-area: skill; }
.qd-boundary { grid-area: boundary; }
.qd-section { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(25, 38, 32, .035); }
.qd-section.qd-main { padding: 20px; border: 2px solid #71ad8c; background: linear-gradient(180deg, #f7fcf9 0%, #fff 160px); }
.qd-section > header { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.qd-section h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.qd-num { width: 25px; height: 25px; display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 800; }
.qd-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: #eef2f0; color: #53605a; font-size: 11px; font-weight: 700; line-height: 1.35; }
.qd-pill.ok { background: #dcfce7; color: #166534; }
.qd-pill.pending { background: #fef3c7; color: #92400e; }
.qd-pill.tier-a { background: #dcfce7; color: #166534; }
.qd-pill.tier-b { background: #fff4ce; color: #795900; }
.qd-count { margin-left: auto; color: var(--muted); font-size: 11px; }
.qd-meta { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.qd-quote { margin: 8px 0 10px; padding: 12px 14px; border-left: 3px solid var(--green); border-radius: 0 8px 8px 0; background: var(--soft); color: #33413b; font-size: 13px; line-height: 1.7; }
.qd-meta-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.qd-meta-list li { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; }
.qd-concepts { display: grid; gap: 12px; }
.qd-concept { min-width: 0; padding: 15px; border: 1px solid #dce7e1; border-radius: 10px; background: #fff; }
.qd-concept > header { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.qd-concept h4 { min-width: 220px; flex: 1; margin: 0; color: var(--ink); font-size: 15px; line-height: 1.45; }
.qd-concept-id { padding: 2px 7px; border-radius: 5px; background: #e9f1ff; color: #245a8d; font-size: 10px; font-weight: 800; letter-spacing: .03em; }
.qd-concept p, .qd-skill p { display: flex; align-items: flex-start; gap: 8px; margin: 7px 0; color: #34413b; font-size: 12.5px; line-height: 1.7; overflow-wrap: anywhere; }
.qd-tag { min-width: 28px; flex: none; padding: 2px 6px; border-radius: 5px; background: #18201d; color: #fff; text-align: center; font-size: 10px; font-weight: 800; line-height: 1.5; }
.qd-mech .qd-tag { background: #176b75; }
.qd-trig .qd-tag { background: #6d4bb4; }
.qd-bnd .qd-tag { background: #9a6512; }
.qd-keyword { display: inline-block; margin: 0 4px 4px 0; padding: 2px 7px; border-radius: 999px; background: #eef3ff; color: #3b6ee0; font-size: 11px; }
.qd-detail { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.qd-detail summary, .qd-principles summary { cursor: pointer; color: var(--green); font-size: 12px; font-weight: 700; }
.qd-cells { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px 12px; margin: 12px 0 0; font-size: 12px; }
.qd-cells dt { color: var(--muted); font-weight: 800; }
.qd-cells dd { margin: 0; color: #34413b; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.qd-principles { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line); }
.qd-principles .qd-concepts { margin-top: 10px; }
.qd-concepts-source .qd-concept { border-color: #cadcf0; background: #f8fbff; }
.qd-boundary-list { display: grid; gap: 8px; margin: 0; padding-left: 19px; color: #34413b; font-size: 12.5px; line-height: 1.65; }
.qd-empty { margin: 0; padding: 10px 12px; border: 1px dashed #e7bd55; border-radius: 8px; background: #fff9e9; color: #835d08; font-size: 12px; }
.qd-locked { margin-top: 16px; }
@media (max-width: 1180px) {
  #detailContent { padding: 24px 24px 64px; }
  .detail-head { display: block; }
  .detail-head .detail-actions { justify-content: flex-start; margin-top: 14px; }
  .qd-grid.qd-grid-main { grid-template-columns: 1fr; grid-template-areas: "source" "ontology" "skill" "boundary"; }
}
@media (max-width: 720px) {
  #detailContent { padding: 18px 16px 52px; }
  .detail-head .detail-title h2 { font-size: 24px; }
  .detail-head .detail-actions .button { flex: 1; }
  .qd-section, .qd-section.qd-main { padding: 14px; }
  .qd-count { width: 100%; margin-left: 32px; }
  .qd-concept h4 { min-width: 0; flex-basis: calc(100% - 64px); }
  .qd-cells { grid-template-columns: 1fr; }
}

/* 知识本体 R 段：主标题 + 子要点（去 markdown 标记后列点） */
.qd-prop.qd-prop-list { align-items: stretch; }
.qd-prop-body { flex: 1; min-width: 0; }
.qd-prop-lead { margin: 0 0 6px; color: #1d2622; font-size: 13px; font-weight: 700; line-height: 1.55; }
.qd-r-list { margin: 0; padding-left: 18px; display: grid; gap: 5px; color: #34413b; font-size: 12.5px; line-height: 1.7; overflow-wrap: anywhere; }
.qd-r-list li { margin: 0; }
