:root {
  color-scheme: light;
  color: #192f35;
  background: #f5f8f7;
  font: 15px/1.55 Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --ink: #15363a;
  --accent: #0f766e;
  --accent-deep: #125d57;
  --muted: #52666b;
  --rule: #d7e3df;
  --wash: #edf5f2;
  --white: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { width: min(1250px, calc(100% - 3rem)); margin-inline: auto; }
a { color: var(--accent-deep); text-underline-offset: .18em; }
.skip { position: absolute; left: 1rem; top: -6rem; z-index: 2; }
.skip:focus { top: .5rem; background: white; padding: .5rem; }
.site-header { background: var(--white); border-bottom: 1px solid var(--rule); }
.site-nav, .nav-links { display: flex; align-items: center; gap: .65rem 1.4rem; }
.site-nav { min-height: 62px; }
.brand { color: var(--ink); font-size: 1.22rem; font-weight: 750; letter-spacing: -.03em; text-decoration: none; }
.brand span { color: var(--accent); }
.nav-links { font-size: .88rem; }
.nav-links a { color: var(--muted); text-decoration: none; }
.nav-links a:hover { color: var(--accent-deep); text-decoration: underline; }
.language { margin-inline-start: auto; }
.search-page { width: min(1080px, calc(100% - 3rem)); padding-block: clamp(1.5rem, 4vw, 3rem) 4rem; }
h1 { margin: 0 0 1.3rem; color: var(--ink); font-size: clamp(1.75rem, 4vw, 2.55rem); line-height: 1.12; font-weight: 750; letter-spacing: -.028em; text-wrap: balance; }
h2 { font-size: 1.13rem; line-height: 1.3; margin: 0 0 .7rem; color: var(--ink); }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
p { margin: .4rem 0; }
button, input, textarea { font: inherit; }
button { border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: white; padding: .47rem .9rem; cursor: pointer; }
button:hover { background: var(--accent-deep); }
button:disabled { opacity: .58; cursor: wait; }
button.secondary { background: var(--white); color: var(--ink); border-color: #b9ceca; font-size: .87rem; }
button.secondary:hover { background: var(--wash); color: var(--accent-deep); }
:focus-visible { outline: 2px solid #0b6a78; outline-offset: 3px; }
#search { display: grid; grid-template-columns: minmax(0, 1fr) 240px; align-items: start; gap: 1rem; }
.query-box, .filters { background: white; border: 1px solid var(--rule); border-radius: 12px; padding: 1rem 1.15rem; }
.query-box { background: var(--wash); }
.query-actions button, .site-nav button { min-height: 44px; }
.query-note { color: var(--muted); font-size: .84rem; margin-block-start: .7rem; }
.query-box textarea { caret-color: var(--accent); }
::selection { background: #cdeae1; color: var(--ink); }
.query-box label, .filters summary { font-weight: 720; color: var(--ink); }
.query-box textarea { display: block; width: 100%; min-height: 100px; border: 1px solid #abc3bf; border-radius: 8px; resize: vertical; padding: .78rem; margin-top: .5rem; color: var(--ink); background: #fcfefd; }
.query-box textarea::placeholder { color: #587174; }
.query-actions { display: flex; justify-content: end; margin-top: .7rem; }
.filters summary { cursor: pointer; }
.filters fieldset { margin: .7rem 0 0; border: 0; padding: 0; min-width: 0; }
.filters legend { color: var(--muted); font-weight: 620; font-size: .79rem; padding: 0 0 .15rem; }
.filters label { display: flex; align-items: baseline; gap: .3rem; font-size: .84rem; margin: .25rem 0; cursor: pointer; }
.filters input { accent-color: var(--accent); flex: none; margin: 0 .15rem 0 0; align-self: center; }
#status { margin: .8rem 0; color: var(--muted); }
#status:empty { display: none; }
#results { margin-top: 1.2rem; }
.result-panel { background: white; border: 1px solid var(--rule); border-radius: 12px; margin-bottom: 1rem; padding: 1.35rem clamp(1rem, 3vw, 1.8rem); min-width: 0; }
.result-panel > h2 { font-size: 1.26rem; letter-spacing: -.015em; margin-bottom: .9rem; }
.assistant-panel { background: var(--wash); }
.assistant-panel > div { max-width: 76ch; }
.scope-panel { background: transparent; border: 0; padding: 0; }
.scope-panel > h2 { font-size: .85rem; margin-bottom: .15rem; }
.scope-panel p { color: var(--muted); }
.layer-panel { border: 0; border-radius: 0; padding: 0; margin: 1.25rem 0 0; }
.layer-panel + .layer-panel { padding-top: 1.15rem; border-top: 1px solid var(--rule); }
.layer-panel > h3 { color: var(--ink); font-size: 1rem; margin: 0 0 .7rem; }
.evidence-panel, .literature-panel { scroll-margin-block-start: 1rem; }
.online-panel { background: #fbfdfc; }
.assistant-panel :is(p, li) { overflow-wrap: anywhere; }
.assistant-panel ul { margin-block: .45rem; padding-inline-start: 1.3rem; }
.assistant-panel li + li { margin-top: .35rem; }
.scope-panel p { overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .86rem; }
.scope { color: #705020; font-size: .86rem; }
.section-head, .detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.results-heading { margin: 1.5rem 0 .4rem; font-size: 1.5rem; letter-spacing: -.02em; }
.result-navigation { display: flex; flex-wrap: wrap; gap: .2rem 1.4rem; margin-bottom: .9rem; border-bottom: 1px solid var(--rule); }
.result-navigation a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 640; }
.record { border-top: 1px solid var(--rule); padding: .9rem 0; overflow-wrap: anywhere; }
.record-title { font-size: 1.04rem; font-weight: 700; color: var(--ink); line-height: 1.35; margin: .22rem 0; }
.record-kind { display: inline-block; padding: .18rem .45rem; border-radius: 5px; background: var(--wash); color: var(--accent-deep); font-size: .8rem; font-weight: 680; }
.record-subject, .record-locator { color: var(--muted); font-size: .81rem; line-height: 1.5; }
.record-observation { color: var(--muted); max-width: 68ch; line-height: 1.55; }
.record-provenance { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 .85rem; }
.record-sources { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .85rem; font-size: .85rem; }
.record-sources a { font-weight: 620; }
.record-actions button { min-height: 34px; font-size: .83rem; }
.record:last-child { padding-bottom: 0; }
button.record-link { border: 0; color: var(--accent-deep); background: transparent; padding: 0; font-weight: 680; text-align: start; overflow-wrap: anywhere; }
button.record-link:hover { text-decoration: underline; }
.table-scroll { max-width: 100%; border: 1px solid var(--rule); border-radius: 9px; }
.results-table { border-collapse: collapse; table-layout: fixed; width: 100%; font-size: .87rem; }
.results-table th, .results-table td { text-align: start; vertical-align: top; padding: .75rem .85rem; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.results-table th { background: var(--wash); color: var(--ink); font-size: .83rem; }
.results-table th:first-child { width: 52%; border-top-left-radius: 8px; }
.results-table th:nth-child(2) { width: 21%; }
.results-table th:last-child { border-top-right-radius: 8px; }
.results-table tbody tr:focus-within { background: #edf6f3; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table .record-title { margin-top: 0; }
.section-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; margin-top: .7rem; }
#record-detail { margin: 0 0 0 auto; height: 100dvh; width: min(100%, 465px); max-height: none; max-width: none; padding: 0; border: 0; border-left: 1px solid var(--rule); color: var(--ink); background: white; }
#record-detail::backdrop { background: #12313566; }
.detail-toolbar { position: sticky; inset-block-start: 0; border-bottom: 1px solid var(--rule); padding: .9rem 1.15rem; background: white; }
.detail-toolbar h2 { margin: 0; }
.detail-content { padding: 1rem 1.15rem 1.6rem; overflow-wrap: anywhere; }
.detail-content h3 { font-size: 1.11rem; }
.detail-content h4 { margin: .9rem 0 .2rem; font-size: .86rem; }
.detail-content .record { border-top: 0; padding: .3rem 0; }
.detail-content .record + .record { border-top: 1px solid var(--rule); margin-top: .8rem; padding-top: .8rem; }
@media (max-width: 760px) {
  .shell { width: calc(100% - 2rem); }
  .site-nav { min-height: 55px; flex-wrap: wrap; gap: .55rem .75rem; padding-block: .55rem; }
  .nav-links { gap: .55rem; font-size: .8rem; }
  .search-page { padding-top: 1.35rem; }
  #search { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .filters { padding-block: .63rem; }
  .query-box, .result-panel { padding-inline: .92rem; }
  .query-actions { justify-content: end; }
}
@media (max-width: 640px) {
  .results-table, .results-table tbody { display: block; }
  .results-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .results-table tbody tr { display: block; padding: .85rem .9rem .35rem; }
  .results-table tbody tr + tr { border-top: 1px solid var(--rule); }
  .results-table td { display: block; border: 0; padding: 0; }
  .results-table td + td { margin-top: .4rem; }
  .results-table td:last-child { border-top: 1px solid var(--rule); }
  .record-provenance, .record-sources { align-items: center; }
  .record-sources { gap: 0 .85rem; }
  .record-sources a, .record-actions button { display: inline-flex; align-items: center; min-height: 44px; }
}
