:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #66736d;
  --paper: #f4f2eb;
  --surface: #fffdf8;
  --line: #dcd8cd;
  --forest: #174c3c;
  --forest-2: #236a55;
  --lime: #c8ef73;
  --amber: #f1c86b;
  --red: #d96c58;
  --blue: #6e9dcc;
  --shadow: 0 18px 50px rgba(34, 50, 43, 0.1);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 42px 64px; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: var(--lime); background: var(--forest); font-weight: 800; letter-spacing: -.04em; }
.brand h1 { margin: 2px 0 0; font-size: 21px; }
.eyebrow { margin: 0; color: var(--forest-2); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.version { max-width: 54%; color: var(--muted); font-size: 13px; text-align: right; overflow-wrap: anywhere; }
.hero { margin-top: 34px; padding: 48px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: end; border-radius: 32px; color: white; background: var(--forest); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 340px; height: 340px; right: -100px; top: -180px; border: 70px solid rgba(200,239,115,.13); border-radius: 50%; }
.hero .eyebrow { color: var(--lime); }
.hero h2 { margin: 14px 0 18px; font-size: clamp(34px, 4vw, 58px); line-height: 1.08; letter-spacing: -.045em; }
.hero-copy { max-width: 650px; margin: 0; color: #dbe8e2; line-height: 1.75; }
.search-box { position: relative; z-index: 1; padding: 22px; border: 1px solid rgba(255,255,255,.18); border-radius: 22px; background: rgba(255,255,255,.09); backdrop-filter: blur(12px); }
.search-box label { display: block; margin-bottom: 10px; color: #e7f1ec; font-size: 13px; font-weight: 700; }
.search-row { display: flex; gap: 8px; }
.search-row input { min-width: 0; flex: 1; padding: 14px 16px; border: 0; border-radius: 13px; background: white; outline: none; }
.search-row input:focus { box-shadow: 0 0 0 4px rgba(200,239,115,.3); }
.search-row button { padding: 0 20px; border: 0; border-radius: 13px; color: #15372d; background: var(--lime); font-weight: 800; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-links button { padding: 6px 10px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: #e7f1ec; background: transparent; font-size: 12px; }
.metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 24px 0 30px; }
.metric { min-height: 112px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 12px; font-size: 30px; letter-spacing: -.04em; }
.metric.done { background: #e8f3df; border-color: #cfe1bf; }
.metric.partial { background: #fff3d7; border-color: #ead39c; }
.metric.planned { background: #e9eef4; border-color: #ccd6df; }
.tabs { display: flex; gap: 6px; padding: 6px; width: fit-content; border: 1px solid var(--line); border-radius: 15px; background: #e9e6de; }
.tab { padding: 10px 16px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 700; }
.tab.active { color: white; background: var(--forest); }
.view { display: none; padding-top: 34px; }
.view.active { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 6px 0 0; font-size: 30px; letter-spacing: -.03em; }
.filters { display: flex; gap: 10px; }
select, .compact-search { padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--surface); outline: none; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-card { min-height: 220px; padding: 22px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); text-align: left; transition: transform .18s ease, box-shadow .18s ease; }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.feature-id { color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }
.status { padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status.done { color: #1b5a42; background: #dff1d8; }
.status.partial { color: #8b5e13; background: #fff0c9; }
.status.planned { color: #4f6576; background: #e6edf3; }
.status.blocked { color: #8a352a; background: #f5ddd8; }
.status.deferred { color: #65568c; background: #ebe5f6; }
.feature-card h3 { margin: 22px 0 10px; font-size: 20px; line-height: 1.35; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
.feature-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 20px; color: var(--muted); font-size: 12px; }
.result-list, .commit-list, .history-list { display: grid; gap: 10px; }
.result-item, .commit-item, .history-item { width: 100%; padding: 18px 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); text-align: left; }
button.result-item:hover, button.commit-item:hover { border-color: var(--forest-2); }
.result-head, .commit-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.result-kind { color: var(--forest-2); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.result-title, .commit-title { margin: 7px 0; font-size: 17px; font-weight: 800; }
.result-snippet, .commit-meta { color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.result-snippet mark { color: inherit; background: #e4f5b8; }
.result-count { color: var(--muted); }
.commit-sha { color: var(--forest-2); font-family: ui-monospace, monospace; font-weight: 800; }
.history-item { display: grid; grid-template-columns: 190px 1fr auto; gap: 22px; align-items: center; }
.history-stats { color: var(--muted); font-size: 13px; }
.empty-state { padding: 70px 20px; display: grid; gap: 7px; place-items: center; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); }
.empty-state strong { color: var(--ink); }
dialog { width: min(1060px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 90px rgba(18,35,29,.3); }
dialog::backdrop { background: rgba(13,28,23,.66); backdrop-filter: blur(4px); }
.dialog-shell { position: relative; padding: 34px; }
.dialog-close { position: sticky; z-index: 4; top: 0; float: right; width: 38px; height: 38px; border: 0; border-radius: 50%; color: white; background: var(--forest); font-size: 25px; line-height: 1; }
.detail-title { margin: 8px 50px 8px 0; font-size: 32px; letter-spacing: -.035em; }
.detail-summary { max-width: 820px; color: var(--muted); line-height: 1.75; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.detail-fact { padding: 14px; border-radius: 12px; background: #f0eee7; }
.detail-fact span { display: block; color: var(--muted); font-size: 11px; }
.detail-fact strong { display: block; margin-top: 7px; overflow-wrap: anywhere; }
.detail-section { margin-top: 28px; }
.detail-section h3 { margin-bottom: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { padding: 6px 9px; border-radius: 8px; background: #edf0eb; font-family: ui-monospace, monospace; font-size: 12px; overflow-wrap: anywhere; }
.relation-list { display: grid; gap: 8px; }
.relation-row { display: grid; grid-template-columns: 1fr 130px 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: #f3f1eb; font-size: 12px; }
.relation-row strong { color: var(--forest-2); text-align: center; }
.graph-wrap { overflow-x: auto; padding-bottom: 6px; }
.graph { min-width: 850px; width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 16px; background: #f8f7f2; }
.graph line { stroke: #aab7b1; stroke-width: 1.5; }
.graph .edge-label { fill: #596a63; font-size: 10px; }
.graph .node { cursor: pointer; }
.graph .node rect { fill: white; stroke: #c9d1cc; stroke-width: 1.2; }
.graph .node.center rect { fill: var(--forest); stroke: var(--forest); }
.graph .node text { fill: var(--ink); font-size: 11px; font-weight: 700; pointer-events: none; }
.graph .node.center text { fill: white; }
.file-list { display: grid; gap: 6px; }
.file-row { padding: 9px 11px; display: flex; gap: 10px; border-radius: 9px; background: #f3f1eb; font-family: ui-monospace, monospace; font-size: 12px; overflow-wrap: anywhere; }
.file-change { min-width: 20px; color: var(--forest-2); font-weight: 900; }
.error-banner { padding: 18px; border: 1px solid #e6b4aa; border-radius: 13px; color: #7f2f25; background: #fbe8e4; }

@media (max-width: 980px) {
  .shell { padding-inline: 22px; }
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 36px; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .shell { padding: 0 14px 40px; }
  .topbar { min-height: 82px; }
  .version { display: none; }
  .hero { margin-top: 18px; padding: 28px 20px; border-radius: 23px; }
  .hero h2 { font-size: 35px; }
  .search-row { flex-direction: column; }
  .search-row button { min-height: 46px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 98px; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 1fr; gap: 7px; }
  .dialog-shell { padding: 22px 16px; }
  .detail-title { font-size: 26px; }
  .detail-grid { grid-template-columns: 1fr; }
  .relation-row { grid-template-columns: 1fr; }
  .relation-row strong { text-align: left; }
}
