:root {
  --paper: #f6f7f3;
  --paper-deep: #eef0ea;
  --surface: #ffffff;
  --surface-soft: #f2f6f3;
  --ink: #14211c;
  --ink-soft: #33453c;
  --muted: #65746c;
  --line: #d6dfd9;
  --line-strong: #bdcbc3;
  --pine: #0f5b46;
  --pine-deep: #093d30;
  --pine-soft: #e2f0e9;
  --blue: #245d91;
  --blue-soft: #edf4fb;
  --gold: #8b6017;
  --gold-soft: #fcf2db;
  --red: #9d3d34;
  --red-soft: #fdf0ed;
  --radius-xs: 5px;
  --radius-sm: 9px;
  --radius-md: 14px;
  --shadow-1: 0 1px 1px rgba(13, 37, 28, .05), 0 7px 18px rgba(13, 37, 28, .04);
  --shadow-2: 0 18px 42px rgba(13, 37, 28, .12), 0 2px 8px rgba(13, 37, 28, .06);
  --display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  --body: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(.2,.75,.2,1);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.6 var(--body); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, h3, p { margin-top: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(36,93,145,.36); outline-offset: 3px; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 9px 12px; color: #fff; background: var(--pine-deep); border-radius: var(--radius-xs); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; z-index: 20; top: 0; border-bottom: 1px solid rgba(214,223,217,.92); background: rgba(246,247,243,.92); backdrop-filter: blur(16px); }
.nav-wrap { display: flex; align-items: center; min-height: 72px; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; color: var(--ink); font-size: 19px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; color: #fff; background: var(--pine); border-radius: 9px 9px 9px 2px; font: 16px var(--display); }
.site-nav { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.site-nav a { position: relative; padding: 25px 0 22px; color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.site-nav a::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; content: ""; background: transparent; transition: background .18s var(--ease); }
.site-nav a:hover, .site-nav a.is-active { color: var(--pine); }
.site-nav a.is-active::after { background: var(--pine); }
.header-ask { padding: 9px 13px; color: #fff; background: var(--pine); border: 1px solid var(--pine); border-radius: var(--radius-xs); font-size: 14px; font-weight: 800; transition: transform .18s var(--ease), background .18s var(--ease); }
.header-ask:hover { background: var(--pine-deep); transform: translateY(-1px); }

.page { padding: clamp(36px, 6vw, 78px) 0 74px; }
.library-intro { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: end; gap: 45px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 15px; color: var(--pine); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.eyebrow::before { width: 23px; height: 1px; content: ""; background: currentColor; }
h1 { margin-bottom: 15px; font: 700 clamp(39px,5.2vw,66px)/1.1 var(--display); letter-spacing: -.07em; }
h1 em { color: var(--pine); font-style: normal; }
.library-intro p:not(.eyebrow) { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.85; }
.intro-note { display: grid; gap: 6px; padding: 18px 19px; color: var(--pine-deep); background: var(--pine-soft); border: 1px solid #c3ddd0; border-radius: var(--radius-sm); box-shadow: var(--shadow-1); transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.intro-note strong { font-size: 15px; }
.intro-note span { font-size: 13px; }
.intro-note:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }

.search-panel { margin-top: 44px; padding: 19px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-1); }
.search-field { display: grid; grid-template-columns: minmax(0,1fr) auto; min-height: 54px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
.search-field:focus-within { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(15,91,70,.10); }
.search-field input { min-width: 0; padding: 0 16px; color: var(--ink); border: 0; outline: 0; font-size: 16px; }
.search-field input::placeholder { color: #87938d; }
.search-field button, .primary-button { padding: 0 22px; color: #fff; background: var(--pine); border: 1px solid var(--pine); border-radius: var(--radius-xs); font-weight: 800; transition: background .18s var(--ease), transform .18s var(--ease); }
.search-field button { margin: 5px; }
.search-field button:hover, .primary-button:hover { background: var(--pine-deep); transform: translateY(-1px); }
.quick-row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.quick-row button { min-height: 31px; padding: 4px 10px; color: var(--ink-soft); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 99px; font-size: 13px; transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease); }
.quick-row button:hover, .quick-row button.is-active { color: var(--pine-deep); background: var(--pine-soft); border-color: #bad8ca; }
.advanced-filter { margin-top: 17px; border-top: 1px solid var(--line); }
.advanced-filter summary { padding: 12px 2px 0; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 700; }
.filter-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding-top: 15px; }
.filter-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-grid select, .filter-grid input, .sort-label select { width: 100%; min-height: 39px; padding: 0 9px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); outline: 0; }
.filter-actions { display: flex; justify-content: flex-end; padding-top: 12px; }
.text-button { padding: 5px 0; color: var(--pine); background: transparent; border: 0; font-size: 13px; font-weight: 800; }
.text-button:hover { color: var(--pine-deep); text-decoration: underline; }

.result-section { margin-top: 34px; }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 13px; border-bottom: 1px solid var(--line-strong); }
.result-bar strong { margin-right: 10px; font-size: 15px; }
.result-bar span { color: var(--muted); font-size: 12px; }
.sort-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.sort-label select { width: auto; min-height: 34px; }
.policy-list { display: grid; }
.policy-row { display: grid; grid-template-columns: minmax(0,1fr) 225px 116px; gap: 22px; align-items: center; padding: 21px 10px; border-bottom: 1px solid var(--line); transition: background .16s var(--ease), transform .16s var(--ease); }
.policy-row:hover { background: rgba(255,255,255,.7); transform: translateX(3px); }
.policy-main { min-width: 0; }
.policy-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.tag, .state-chip { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 7px; border-radius: 99px; font-size: 11px; font-weight: 800; line-height: 1.2; }
.tag { color: var(--ink-soft); background: #eef2ef; border: 1px solid #dce5df; }
.state-chip.current { color: #146145; background: var(--pine-soft); border: 1px solid #c2dfd1; }
.state-chip.basis { color: #315d82; background: var(--blue-soft); border: 1px solid #d7e5f3; }
.state-chip.review { color: var(--gold); background: var(--gold-soft); border: 1px solid #edddb8; }
.state-chip.history, .state-chip.inactive { color: #785a58; background: #f8eeee; border: 1px solid #ead9d8; }
.policy-title { color: var(--ink); font-size: 16px; font-weight: 800; line-height: 1.5; transition: color .16s var(--ease); }
.policy-row:hover .policy-title { color: var(--pine); }
.policy-meta { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.policy-side { display: grid; gap: 8px; color: var(--muted); font-size: 12px; }
.policy-side strong { color: var(--ink-soft); font-size: 13px; }
.policy-action { justify-self: end; padding: 8px 10px; color: var(--pine); border: 1px solid #b9d8ca; border-radius: var(--radius-xs); font-size: 13px; font-weight: 800; transition: background .16s var(--ease), color .16s var(--ease); }
.policy-action:hover { color: #fff; background: var(--pine); }
.empty-state { padding: 62px 20px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 8px; color: var(--ink-soft); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 7px; padding-top: 24px; }
.pagination button { display: grid; min-width: 33px; min-height: 33px; place-items: center; padding: 0 8px; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xs); font-size: 13px; }
.pagination button:hover, .pagination button.is-active { color: #fff; background: var(--pine); border-color: var(--pine); }
.pagination button:disabled { cursor: not-allowed; opacity: .45; }

.back-link { display: inline-flex; margin-bottom: 24px; color: var(--pine); font-size: 14px; font-weight: 800; }
.back-link:hover { color: var(--pine-deep); transform: translateX(-2px); }
.loading-block { min-height: 180px; padding: 56px 0; color: var(--muted); text-align: center; }
.detail-top { padding-bottom: 29px; border-bottom: 1px solid var(--line-strong); }
.detail-top h1 { max-width: 900px; margin: 15px 0; font-size: clamp(36px,4.4vw,57px); }
.detail-lead { max-width: 760px; margin: 0; color: var(--muted); font-size: 17px; }
.detail-layout { display: grid; grid-template-columns: minmax(0,1fr) 278px; gap: clamp(35px,6vw,85px); padding-top: 34px; }
.detail-content { min-width: 0; }
.fact-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 30px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.fact-grid div { min-height: 79px; padding: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.fact-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.fact-grid strong { color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.detail-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.detail-section h2 { margin-bottom: 13px; font: 700 24px/1.35 var(--display); letter-spacing: -.04em; }
.detail-section p { margin: 0; color: var(--ink-soft); white-space: pre-wrap; }
.detail-aside { align-self: start; position: sticky; top: 95px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-1); }
.detail-aside h3 { margin: 0; padding: 14px 16px; color: var(--pine-deep); background: var(--pine-soft); font-size: 14px; }
.aside-item { display: grid; gap: 4px; padding: 14px 16px; border-top: 1px solid var(--line); }
.aside-item span { color: var(--muted); font-size: 11px; font-weight: 700; }
.aside-item strong, .aside-item a { color: var(--ink-soft); font-size: 13px; line-height: 1.55; word-break: break-word; }
.aside-item a { color: var(--pine); font-weight: 800; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 35px; padding-bottom: 25px; border-bottom: 1px solid var(--line-strong); }
.page-heading h1 { margin-bottom: 0; font-size: clamp(36px,4.6vw,58px); }
.page-heading > p { max-width: 340px; margin: 0; color: var(--muted); font-size: 14px; }
.ask-layout { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: 610px; margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-1); overflow: hidden; }
.conversation-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface-soft); border-right: 1px solid var(--line); }
.side-heading { display: flex; align-items: center; justify-content: space-between; padding: 19px 17px; border-bottom: 1px solid var(--line); }
.side-heading span, .chat-header span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.side-heading strong { display: block; margin-top: 3px; font-size: 16px; }
.side-heading button { display: grid; width: 32px; height: 32px; place-items: center; color: #fff; background: var(--pine); border: 0; border-radius: var(--radius-xs); font-size: 22px; }
.conversation-list { display: grid; gap: 4px; padding: 10px; overflow: auto; }
.conversation-item { width: 100%; padding: 10px; color: var(--ink-soft); background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs); text-align: left; }
.conversation-item:hover, .conversation-item.is-active { background: #fff; border-color: var(--line); }
.conversation-item strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; line-height: 1.45; }
.conversation-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.chat-panel { display: grid; grid-template-rows: auto auto minmax(260px,1fr) auto; min-width: 0; min-height: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.chat-header h2 { margin: 3px 0 0; font-size: 18px; }
.profile-link { padding: 6px 8px; color: var(--pine); font-size: 13px; font-weight: 800; }
.profile-summary { margin: 14px 20px 0; padding: 10px 12px; color: var(--ink-soft); background: var(--pine-soft); border: 1px solid #c4dfd2; border-radius: var(--radius-xs); font-size: 12px; }
.messages { min-height: 0; padding: 23px; overflow: auto; }
.message { max-width: 760px; margin-bottom: 19px; }
.message.user { margin-left: auto; }
.message-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.message.user .message-label { text-align: right; }
.message-bubble { padding: 13px 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; color: var(--ink-soft); white-space: pre-wrap; }
.message.user .message-bubble { color: #fff; background: var(--pine); border-color: var(--pine); border-radius: 12px 4px 12px 12px; }
.answer-card { margin-top: 12px; padding: 16px; background: #fff; border: 1px solid #c8dfd4; border-radius: var(--radius-sm); box-shadow: var(--shadow-1); }
.answer-card h3 { margin-bottom: 8px; color: var(--pine-deep); font-size: 16px; }
.answer-card p { margin-bottom: 12px; color: var(--ink-soft); white-space: pre-wrap; }
.recommendation { padding: 13px 0; border-top: 1px solid var(--line); }
.recommendation strong { display: block; margin-bottom: 4px; }
.recommendation small { display: block; color: var(--muted); }
.recommendation a { color: var(--pine); font-size: 13px; font-weight: 800; }
.evidence-list { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.composer { display: grid; gap: 10px; padding: 15px 20px 18px; border-top: 1px solid var(--line); }
.composer textarea { width: 100%; min-height: 58px; max-height: 180px; padding: 11px 12px; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-xs); outline: 0; resize: vertical; }
.composer textarea:focus { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(15,91,70,.1); }
.composer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.composer-actions span { margin-right: auto; color: var(--muted); font-size: 12px; }
.primary-button { min-height: 38px; padding: 0 15px; }

.profile-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 34px; margin-top: 30px; }
.profile-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-1); }
.profile-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 800; }
.profile-form input, .profile-form select, .profile-form textarea { width: 100%; padding: 9px 10px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); outline: 0; font-weight: 500; }
.profile-form textarea { resize: vertical; }
.profile-wide { grid-column: 1 / -1; }
.profile-actions { display: flex; align-items: center; gap: 16px; grid-column: 1 / -1; padding-top: 3px; }
.profile-aside { align-self: start; padding: 20px; background: var(--pine-soft); border: 1px solid #c7dfd4; border-radius: var(--radius-sm); }
.profile-aside strong { color: var(--pine-deep); }
.profile-aside ul { margin: 13px 0; padding-left: 18px; color: var(--ink-soft); font-size: 13px; }
.profile-aside li + li { margin-top: 6px; }
.profile-aside p { margin: 0; color: var(--muted); font-size: 12px; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: min(380px,calc(100% - 44px)); padding: 12px 14px; color: #fff; background: var(--pine-deep); border-radius: var(--radius-xs); box-shadow: var(--shadow-2); font-size: 13px; }
.toast.error { background: var(--red); }

@media (max-width: 820px) {
  .site-shell { width: min(100% - 32px, 680px); }
  .nav-wrap { min-height: 62px; gap: 14px; }
  .site-nav { gap: 14px; }
  .site-nav a { padding: 20px 0 17px; font-size: 13px; }
  .header-ask { display: none; }
  .library-intro, .page-heading, .detail-layout, .profile-layout { grid-template-columns: 1fr; display: grid; }
  .intro-note { max-width: 360px; }
  .page-heading { align-items: start; gap: 11px; }
  .page-heading > p { max-width: 650px; }
  .policy-row { grid-template-columns: minmax(0,1fr) auto; gap: 12px; }
  .policy-side { display: none; }
  .fact-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-aside { position: static; }
  .ask-layout { grid-template-columns: 1fr; }
  .conversation-side { max-height: 200px; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-form { grid-template-columns: 1fr; }
  .profile-wide, .profile-actions { grid-column: auto; }
}

@media (max-width: 540px) {
  .site-shell { width: calc(100% - 28px); }
  .brand { font-size: 17px; }
  .brand-mark { width: 30px; height: 30px; }
  .site-nav { margin-left: auto; gap: 12px; }
  .site-nav a { font-size: 12px; }
  .page { padding: 31px 0 50px; }
  h1 { font-size: 37px; }
  .library-intro p:not(.eyebrow) { font-size: 15px; }
  .search-panel { padding: 12px; }
  .search-field { min-height: 48px; }
  .search-field input { padding: 0 10px; font-size: 14px; }
  .search-field button { padding: 0 12px; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .result-bar { align-items: start; flex-direction: column; }
  .policy-row { padding: 17px 0; }
  .policy-title { font-size: 15px; }
  .policy-action { align-self: end; padding: 6px 7px; font-size: 12px; }
  .fact-grid { grid-template-columns: 1fr; }
  .conversation-list { grid-template-columns: 1fr; }
  .messages { padding: 16px; }
  .composer { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
