:root {
    color-scheme: light;
    --ink: #202426;
    --muted: #697072;
    --line: #dfe2df;
    --line-strong: #c8ceca;
    --paper: #ffffff;
    --surface: #f5f7f5;
    --sidebar: #222927;
    --sidebar-muted: #aeb7b3;
    --green: #216657;
    --green-soft: #e9f3ef;
    --red: #9c433e;
    --red-soft: #f8eceb;
    --gold: #8a682e;
    --gold-soft: #f7f1e5;
    --blue: #3f6177;
    --content-width: 960px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 286px;
    display: flex;
    flex-direction: column;
    padding: 24px 18px 18px;
    background: var(--sidebar);
    color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 8px; }
.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 6px;
    background: #f2f4f1;
    color: #26302d;
    font-size: 14px;
    font-weight: 800;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { margin-top: 3px; color: var(--sidebar-muted); font-size: 12px; }

.search-box { position: relative; display: block; margin: 26px 0 18px; }
.search-box > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 45px 0 13px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    outline: 0;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 13px;
}
.search-box input::placeholder { color: #9fa9a5; }
.search-box input:focus { border-color: #9cc4b7; background: rgba(255, 255, 255, .12); }
.search-box kbd {
    position: absolute;
    top: 10px;
    right: 10px;
    min-width: 20px;
    height: 20px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 4px;
    color: #bbc4c0;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.doc-nav { flex: 1; overflow-y: auto; }
.doc-nav p { margin: 18px 10px 7px; color: #8f9995; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.doc-nav a {
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    padding: 0 10px;
    border-left: 2px solid transparent;
    border-radius: 0 5px 5px 0;
    color: #d7ddda;
    font-size: 13px;
    text-decoration: none;
}
.doc-nav a span { width: 20px; color: #87928e; font-size: 11px; font-variant-numeric: tabular-nums; }
.doc-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.doc-nav a.active { border-left-color: #8dc2b0; background: rgba(141, 194, 176, .12); color: #fff; }
.doc-nav a.active span { color: #9ed1c0; }
.sidebar-foot { display: flex; justify-content: space-between; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.1); color: #8f9995; font-size: 10px; }

.content-shell { min-height: 100vh; margin-left: 286px; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 34px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
}
.menu-button { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; }
.breadcrumb { min-width: 0; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.breadcrumb b { color: #b6bcba; font-weight: 400; }
.breadcrumb strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.app-link { margin-left: auto; color: var(--green); font-size: 13px; font-weight: 700; text-decoration: none; }
.app-link:hover { text-decoration: underline; }

main { width: min(100%, calc(var(--content-width) + 96px)); margin: 0 auto; padding: 64px 48px 96px; }
.doc-page { display: none; }
.doc-page.active { display: block; }
.page-heading { padding-bottom: 38px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 12px; font-weight: 800; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { max-width: 820px; margin: 0; font-size: 48px; line-height: 1.14; }
.lead { max-width: 820px; margin: 20px 0 0; color: #565e60; font-size: 17px; line-height: 1.8; }
h2 { margin: 0 0 16px; font-size: 23px; line-height: 1.35; }
h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.45; }
p { line-height: 1.8; }

.content-section { padding: 42px 0; border-bottom: 1px solid var(--line); }
.content-section > p { max-width: 840px; color: #50585a; }
.content-section.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
.content-section.rule-block { padding-left: 22px; border-left: 3px solid var(--line-strong); }

.status-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.status-strip div { min-width: 0; padding: 20px 18px; border-right: 1px solid var(--line); }
.status-strip div:last-child { border-right: 0; }
.status-strip span, .status-strip strong { display: block; }
.status-strip span { color: var(--muted); font-size: 11px; }
.status-strip strong { margin-top: 7px; font-size: 14px; overflow-wrap: anywhere; }

.link-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.link-list.single { grid-template-columns: 1fr; }
.link-list a { min-width: 0; display: flex; flex-direction: column; min-height: 130px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; text-decoration: none; }
.link-list a:hover { border-color: var(--green); background: var(--green-soft); }
.link-list strong { font-size: 15px; }
.link-list span { flex: 1; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.link-list code { margin-top: 15px; color: var(--green); font-size: 12px; }

.callout { margin-top: 22px; padding: 17px 19px; border-left: 4px solid; border-radius: 0 6px 6px 0; }
.callout strong { display: block; font-size: 14px; }
.callout p { margin: 5px 0 0; font-size: 13px; line-height: 1.65; }
.callout.neutral { border-color: var(--blue); background: #edf3f6; color: #354e5c; }
.callout.success { border-color: var(--green); background: var(--green-soft); color: #215b4f; }
.callout.warning { border-color: var(--gold); background: var(--gold-soft); color: #6f572b; }

.check-list, .boundary-list, .number-list, .link-bullets { margin: 0; padding: 0; list-style: none; }
.check-list li, .boundary-list li { position: relative; margin: 12px 0; padding-left: 24px; color: #4f5758; line-height: 1.65; }
.check-list li::before, .boundary-list li::before { position: absolute; left: 0; top: 0; font-weight: 800; }
.check-list li::before { content: "✓"; color: var(--green); }
.boundary-list li::before { content: "×"; color: var(--red); }
blockquote { margin: 0; padding: 26px 30px; border-left: 5px solid var(--red); background: var(--red-soft); color: #663d39; font-size: 20px; font-weight: 650; line-height: 1.7; }

.step-list { margin: 0; padding: 22px 0 0; list-style: none; }
.step-list li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 22px; padding: 30px 0; border-bottom: 1px solid var(--line); }
.step-list > li > span { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--green); font-size: 14px; font-weight: 800; }
.step-list h2 { margin-bottom: 8px; }
.step-list p { margin: 0; color: #596163; }

.field-table, .comparison-table, .component-table { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.field-row, .comparison-table > div, .component-table > div { display: grid; align-items: center; min-height: 54px; border-top: 1px solid var(--line); }
.field-row { grid-template-columns: 1fr 2fr 90px; }
.comparison-table > div { grid-template-columns: 150px 1.4fr 1fr; }
.component-table > div { grid-template-columns: 1fr 1.6fr 1fr; }
.field-row:first-child, .comparison-table > div:first-child, .component-table > div:first-child { border-top: 0; }
.field-row > *, .comparison-table > div > *, .component-table > div > * { min-width: 0; padding: 13px 15px; font-size: 13px; line-height: 1.55; }
.field-row.header, .comparison-head, .component-head { background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; }
.field-row em, .component-table em { color: var(--green); font-size: 12px; font-style: normal; }
.footnote { margin-top: 16px; color: var(--muted); font-size: 13px; }

.relationship-map, .request-flow { display: flex; align-items: stretch; gap: 9px; }
.relationship-map div, .request-flow div { min-width: 0; flex: 1; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.relationship-map span, .request-flow strong { display: block; font-size: 14px; font-weight: 800; }
.relationship-map p, .request-flow span { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.relationship-map > b, .request-flow > b { display: grid; place-items: center; color: #a1a9a5; font-size: 12px; }

.definition-list { margin: 0; padding: 0; list-style: none; }
.definition-list li { display: grid; grid-template-columns: 160px 1fr; gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.definition-list li:first-child { border-top: 0; }
.definition-list span { color: var(--muted); line-height: 1.6; }
.number-list { counter-reset: ordered; }
.number-list li { position: relative; padding: 11px 0 11px 36px; color: #50585a; line-height: 1.7; counter-increment: ordered; }
.number-list li::before { content: counter(ordered); position: absolute; left: 0; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); color: var(--green); font-size: 11px; font-weight: 800; line-height: 22px; text-align: center; }

.state-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.state-legend > div { padding: 18px; border: 1px solid var(--line); border-radius: 7px; }
.state-legend i { width: 9px; height: 9px; display: inline-block; margin-right: 8px; border-radius: 50%; }
.state-legend i.unknown { background: #929998; }
.state-legend i.observed { background: var(--gold); }
.state-legend i.confirmed { background: var(--green); }
.state-legend strong { font-size: 14px; }
.state-legend span { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.feature-grid article { min-height: 130px; padding: 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feature-grid p, .admin-columns p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.admin-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.admin-columns > div { padding-top: 14px; border-top: 3px solid var(--line-strong); }

.request-flow { align-items: center; }
.request-flow div { min-height: 80px; background: #fff; }
.request-flow div:nth-of-type(2) { border-color: #a5c8bb; background: var(--green-soft); }
.request-flow div:nth-of-type(3) { border-color: #d6bf92; background: var(--gold-soft); }
pre { margin: 0; overflow-x: auto; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: #262d2a; color: #e9efec; font-size: 12px; line-height: 1.7; }

.stack-list { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.stack-list div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); }
.stack-list div:last-child { border-right: 0; }
.stack-list strong, .stack-list span { display: block; }
.stack-list strong { font-size: 13px; }
.stack-list span { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.directory-list { display: grid; grid-template-columns: 150px 1fr; border-top: 1px solid var(--line); }
.directory-list code, .directory-list span { padding: 14px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.directory-list code { color: var(--green); font-weight: 700; }
.directory-list span { color: var(--muted); }
.link-bullets li { margin: 12px 0; color: #555d5f; line-height: 1.65; }
.link-bullets a { color: var(--green); font-weight: 700; }

.archive-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.archive-groups > div { min-height: 180px; padding: 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.archive-groups a { display: block; margin-top: 9px; color: var(--green); font-size: 13px; line-height: 1.5; }
.search-empty { padding: 120px 20px; text-align: center; }
.search-empty h1 { margin: 0 auto; font-size: 28px; }
.search-empty p { color: var(--muted); }
.search-highlight { border-radius: 2px; background: #ffefae; color: #2c302d; }
.sidebar-backdrop { display: none; }

@media (max-width: 1100px) {
    .status-strip { grid-template-columns: repeat(2, 1fr); }
    .status-strip div:nth-child(2) { border-right: 0; }
    .status-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .stack-list { grid-template-columns: repeat(2, 1fr); }
    .stack-list div { border-bottom: 1px solid var(--line); }
    .stack-list div:nth-child(2n) { border-right: 0; }
    .stack-list div:last-child { border-bottom: 0; }
}

@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 15; display: block; background: rgba(20, 24, 23, .48); }
    .content-shell { margin-left: 0; }
    .topbar { height: 58px; padding: 0 16px; }
    .menu-button { display: grid; place-items: center; }
    main { padding: 42px 22px 72px; }
    h1 { font-size: 34px; }
    .lead { font-size: 15px; }
    .content-section.split, .link-list, .admin-columns { grid-template-columns: 1fr; gap: 26px; }
    .relationship-map, .request-flow { flex-direction: column; }
    .relationship-map > b, .request-flow > b { min-height: 18px; }
    .feature-grid, .archive-groups { grid-template-columns: 1fr; }
    .state-legend { grid-template-columns: 1fr; }
    .comparison-table > div, .component-table > div { grid-template-columns: 1fr; padding: 10px 0; }
    .comparison-head, .component-head { display: none !important; }
    .comparison-table > div > *, .component-table > div > * { padding: 4px 14px; }
}

@media (max-width: 560px) {
    .breadcrumb > span, .breadcrumb > b { display: none; }
    .app-link { font-size: 12px; }
    .status-strip { grid-template-columns: 1fr; }
    .status-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
    .status-strip div:last-child { border-bottom: 0; }
    .step-list li { grid-template-columns: 38px minmax(0, 1fr); gap: 13px; }
    .step-list > li > span { width: 34px; height: 34px; }
    .field-row { grid-template-columns: 1fr; padding: 10px 0; }
    .field-row.header { display: none; }
    .field-row > * { padding: 4px 14px; }
    .definition-list li { grid-template-columns: 1fr; gap: 5px; }
    .stack-list { grid-template-columns: 1fr; }
    .stack-list div { border-right: 0; }
    .directory-list { grid-template-columns: 1fr; }
    .directory-list code { padding-bottom: 4px; border-bottom: 0; }
    .directory-list span { padding-top: 4px; }
    blockquote { padding: 21px; font-size: 17px; }
}

@media print {
    .sidebar, .topbar, .sidebar-backdrop { display: none !important; }
    .content-shell { margin-left: 0; }
    main { width: 100%; padding: 0; }
    .doc-page { display: block !important; page-break-before: always; }
    .doc-page:first-child { page-break-before: auto; }
}
