:root {
    color-scheme: light;
    --bg: #f6f8f5;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-strong: rgba(255, 255, 255, 0.92);
    --border: rgba(34, 53, 47, 0.13);
    --text: #1f2a26;
    --muted: #65736e;
    --accent: #2f7d6b;
    --accent-deep: #213f37;
    --accent-soft: rgba(47, 125, 107, 0.12);
    --shadow: 0 18px 45px rgba(28, 45, 39, 0.08);
    --radius-lg: 14px;
    --radius-md: 10px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f8faf6 0%, #edf3ef 100%);
    line-height: 1.75;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(43, 70, 61, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(43, 70, 61, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(circle at center, black 10%, transparent 82%);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(47, 125, 107, 0.55);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1000;
    transform: translateY(-140%);
    border-radius: 999px;
    background: var(--accent-deep);
    color: #fff;
    padding: 10px 14px;
    text-decoration: none;
    box-shadow: var(--shadow);
}

.skip-link:focus-visible {
    transform: translateY(0);
}

.page-shell {
    position: relative;
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px 24px 80px;
}

.site-footer {
    position: relative;
    margin-top: 0;
    padding: 30px 20px 36px;
    background: linear-gradient(180deg, rgba(237, 243, 239, 0.88) 0%, rgba(226, 237, 231, 0.96) 100%);
    border-top: 1px solid var(--border);
    color: var(--muted);
    text-align: center;
}

.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    min-height: 78px;
}

.site-footer-copyright {
    font-size: 0.95rem;
}

.site-footer-icp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    font-size: 0.95rem;
}

.site-footer-icp:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.site-footer-icp img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 90;
    margin: -18px -24px 28px;
    padding: 18px 24px 14px;
    background: linear-gradient(180deg, rgba(248, 250, 246, 0.96) 0%, rgba(248, 250, 246, 0.88) 72%, rgba(248, 250, 246, 0) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    min-height: 64px;
}

.site-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.site-nav a,
.inline-link {
    color: inherit;
}

.site-nav a {
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.72);
}

.site-nav a:hover,
.inline-link:hover {
    color: var(--accent);
}

.site-nav a.active,
.site-nav a[aria-current="page"] {
    background: var(--accent-soft);
    border-color: rgba(47, 125, 107, 0.3);
    color: var(--accent);
    font-weight: 600;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: var(--shadow);
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.muted,
.document-meta,
.article-meta,
.result-summary,
.meta-table dt,
.breadcrumbs {
    color: var(--muted);
}

.hero,
.toolbar-card,
.sidebar-card,
.document-card,
.article-card,
.resume-card,
.empty-state {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    gap: 24px;
    grid-template-columns: 1.8fr 1fr;
    padding: 34px;
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    font-size: 0.78rem;
}

.hero h1,
.article-header h1 {
    margin: 0;
    line-height: 1.22;
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    max-width: 14ch;
}

.hero-text {
    max-width: 68ch;
    margin-bottom: 0;
}

.hero-stats {
    display: grid;
    gap: 14px;
}

.hero-stats article {
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    border: 1px solid var(--border);
}

.hero-stats strong {
    display: block;
    font-size: 2rem;
}

.home-hero {
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.95fr);
    gap: 18px;
    padding: 24px 26px;
    margin-bottom: 14px;
    align-items: center;
}

.home-hero .eyebrow {
    margin-bottom: 8px;
}

.home-hero h1 {
    font-size: clamp(1.7rem, 3vw, 2.45rem);
    max-width: 16ch;
}

.home-hero .hero-text {
    max-width: 58ch;
    margin-top: 8px;
    font-size: 0.98rem;
    line-height: 1.6;
}

.home-hero .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.home-hero .hero-stats article {
    padding: 14px 16px;
    min-height: 0;
}

.home-hero .hero-stats strong {
    font-size: 1.45rem;
    line-height: 1.1;
}

.home-hero .hero-stats span {
    font-size: 0.88rem;
}

.library-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
    gap: 14px;
    margin-bottom: 16px;
}

.overview-panel {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}

.overview-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.overview-header h2 {
    margin: 0;
    font-size: 1.12rem;
}

.overview-header span {
    color: var(--muted);
    font-size: 0.92rem;
}

.section-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.section-overview-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.62);
    color: inherit;
    text-decoration: none;
}

.section-overview-item:hover {
    background: var(--accent-soft);
    border-color: rgba(47, 125, 107, 0.28);
}

.overview-title {
    min-width: 0;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.section-overview-item strong {
    color: var(--accent-deep);
    line-height: 1.4;
}

.section-overview-item small {
    grid-column: 1 / -1;
    min-width: 0;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.type-count-list {
    display: grid;
    gap: 8px;
}

.type-count-list span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid var(--border);
    color: var(--muted);
}

.type-count-list strong {
    color: var(--text);
    font-size: 1.05rem;
}

.quick-entry-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.quick-entry-list a {
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.72);
}

.quick-entry-list a:hover {
    background: var(--accent-soft);
}

.home-topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.section-chip-more {
    border-style: dashed;
}

.toolbar-card {
    padding: 18px 20px;
    margin-bottom: 20px;
}

.home-tools-sticky {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.home-tools-sticky .toolbar-card {
    margin-bottom: 0;
}

.top-filter-card {
    padding: 22px 24px;
}

.compact-home-toolbar {
    padding: 20px 22px;
}

.compact-toolbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.compact-toolbar-head .eyebrow {
    margin: 0;
}

.compact-result-summary {
    margin-top: 0;
    align-items: center;
}

.top-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.top-filter-header h2 {
    margin: 0;
}

.toolbar-hint {
    margin: 8px 0 0;
    color: var(--muted);
}

.jump-filter-form {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.compact-select {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.9rem;
}

.compact-select select {
    min-width: 220px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.88);
    font: inherit;
    color: var(--text);
}

.jump-filter-form button {
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    color: #fff;
    padding: 0 18px;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 14px;
    font: inherit;
}

.compact-jump-form {
    gap: 8px;
}

.compact-select-inline {
    gap: 0;
}

.compact-select-inline select {
    min-width: 180px;
    min-height: 40px;
    padding: 0 12px;
}

.compact-jump-form button {
    min-height: 40px;
    padding: 0 14px;
}

.section-chip-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
    transition: all 0.15s ease;
}

.section-chip small {
    color: var(--muted);
}

.section-chip:hover,
.section-chip.active {
    background: var(--accent-soft);
    border-color: rgba(47, 125, 107, 0.28);
}

.overflow-filter {
    width: 100%;
    margin-top: 6px;
}

.overflow-filter summary {
    display: inline-flex;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.88rem;
    list-style: none;
    padding: 4px 0;
}

.overflow-filter summary::-webkit-details-marker {
    display: none;
}

.overflow-filter[open] summary {
    color: var(--accent);
}

.overflow-filter .section-chip-group,
.overflow-filter .pill-group,
.overflow-filter .tag-cloud,
.overflow-filter .mini-list {
    margin-top: 6px;
}

.compact-filter-grid {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.compact-filter-group {
    display: grid;
    gap: 8px;
}

.compact-filter-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.compact-filter-title {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.compact-chip-group {
    gap: 8px;
}

.compact-pill-group {
    gap: 8px;
}

.compact-chip-group .section-chip,
.compact-pill-group .pill {
    padding: 8px 12px;
}

.top-filter-row {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 16px;
}

.top-filter-block {
    display: grid;
    gap: 12px;
}

.top-filter-block h3,
.active-filter-label {
    margin: 0;
    font-size: 0.92rem;
    color: var(--muted);
}

.home-search-card {
    padding-top: 20px;
    padding-bottom: 20px;
}

.active-filter-panel {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.resume-card {
    padding: 24px 26px;
    margin-bottom: 20px;
}

.resume-card-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.resume-card-header h2 {
    margin: 0;
}

.resume-link,
.action-link {
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.72);
}

.resume-link {
    border-radius: 999px;
    padding: 10px 14px;
}

.resume-link:hover,
.action-link:hover {
    background: var(--accent-soft);
}

.resume-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.resume-page-grid {
    display: grid;
    gap: 16px;
}

.resume-page-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px;
}

.resume-page-card h2 {
    margin: 10px 0 8px;
    font-size: 1.3rem;
}

.resume-page-card h2 a {
    color: inherit;
    text-decoration: none;
}

.resume-page-card h2 a:hover {
    color: var(--accent);
}

.resume-page-card p {
    margin: 0 0 14px;
}

.resume-page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.resume-toolbar-card,
.resume-filter-card {
    margin-bottom: 20px;
}

.resume-item {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.resume-item h3 {
    margin: 10px 0 8px;
    font-size: 1.2rem;
}

.resume-item h3 a {
    color: inherit;
    text-decoration: none;
}

.resume-item h3 a:hover {
    color: var(--accent);
}

.resume-item p {
    margin: 0;
}

.resume-item .resume-page-actions {
    margin-top: 14px;
}

.search-form {
    display: flex;
    gap: 12px;
}

.search-form input,
.search-form button {
    border-radius: 14px;
    border: 1px solid var(--border);
    font: inherit;
}

.search-form input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.88);
}

.compact-home-toolbar .search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 10px;
}

.compact-home-toolbar .search-form input {
    padding: 12px 14px;
}

.search-form button,
.empty-state a,
.pagination a {
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    color: #fff;
    padding: 0 18px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    text-decoration: none;
}

.compact-home-toolbar .search-form button {
    min-height: 44px;
    min-width: 88px;
    border-radius: 14px;
}

.result-summary {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.result-actions,
.empty-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.result-summary a,
.filter-link,
.pill,
.document-card h2 a,
.breadcrumbs a,
.mini-list a {
    color: inherit;
    text-decoration: none;
}

.index-content-stack {
    display: block;
}

.more-tools-card {
    padding: 0;
    margin-bottom: 16px;
    overflow: hidden;
}

.more-tools-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 14px 18px;
}

.more-tools-summary::-webkit-details-marker {
    display: none;
}

.more-tools-summary strong,
.more-tools-summary small {
    display: block;
}

.more-tools-summary small,
.more-tools-toggle {
    color: var(--muted);
}

.more-tools-card[open] .more-tools-summary {
    border-bottom: 1px solid var(--border);
}

.more-tools-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
    padding: 16px 18px 18px;
}

.more-tools-grid h2 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.compact-tag-cloud {
    gap: 6px;
}

.compact-mini-list {
    gap: 6px;
}

.compact-mini-list a {
    padding: 8px 10px;
}

.layout-grid,
.detail-layout {
    display: grid;
    gap: 20px;
    align-items: start;
}

.content-column,
.sidebar-card {
    min-width: 0;
}

.layout-grid {
    grid-template-columns: 320px minmax(0, 1fr);
}

.detail-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
}

.archive-layout {
    display: grid;
    gap: 18px;
}

.value-hero {
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.7fr);
}

.value-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.value-main {
    min-width: 0;
}

.value-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.value-toolbar h2 {
    margin: 0 0 4px;
}

.value-search-form {
    min-width: min(100%, 360px);
}

.value-document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.archive-toolbar {
    padding: 18px 20px;
}

.archive-year-card {
    padding: 24px;
}

.archive-year-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.archive-year-header::-webkit-details-marker {
    display: none;
}

.archive-year-header h2 {
    margin: 0;
}

.archive-year-header span {
    color: var(--muted);
    font-size: 0.9rem;
}

.archive-year-card[open] .archive-year-header {
    margin-bottom: 14px;
}

.archive-month-block + .archive-month-block {
    margin-top: 18px;
}

.archive-month-block h3 {
    margin: 0 0 10px;
    color: var(--muted);
}

.archive-list {
    display: grid;
    gap: 10px;
}

.archive-item {
    display: block;
    color: inherit;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
}

.archive-item:hover {
    background: var(--accent-soft);
}

.archive-item strong,
.archive-item small {
    display: block;
}

.sidebar-card {
    padding: 22px;
    position: sticky;
    top: 24px;
}

.sidebar-card section + section {
    margin-top: 24px;
}

.sidebar-card h2 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.filter-link {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
}

.filter-link:hover,
.filter-link.active,
.pill.active,
.pill:hover,
.mini-list a:hover,
.mini-list a.active {
    background: var(--accent-soft);
}

.filter-scroll {
    max-height: 320px;
    overflow: auto;
    padding-right: 2px;
}

.tag-filter-scroll {
    max-height: 240px;
}

.pill-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
}

.mini-list {
    display: grid;
    gap: 8px;
}

.mini-list a {
    display: block;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
}

.mini-list strong,
.mini-list small {
    display: block;
}

.document-list {
    display: grid;
    gap: 16px;
}

.document-card {
    padding: 22px;
}

.document-meta,
.article-meta,
.document-card footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 0.92rem;
}

.document-card h2 {
    margin: 10px 0 8px;
    font-size: 1.35rem;
}

.document-card h2 a,
.search-result-card h2 a,
.resume-page-card h2 a,
.resume-item h3 a,
.mini-list strong,
.article-meta span,
.document-card footer span {
    overflow-wrap: anywhere;
}

.document-card p,
.search-result-card p,
.resume-page-card p,
.resume-item p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.document-card h2 a:hover,
.breadcrumbs a:hover,
.result-summary a:hover {
    color: var(--accent);
}

.document-card p {
    margin: 0 0 14px;
}

.document-card footer {
    font-size: 0.85rem;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 12px;
}

.pagination .disabled {
    opacity: 0.45;
}

.empty-state {
    padding: 36px;
}

.breadcrumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.article-card {
    padding: 30px 34px;
}

.document-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.action-link {
    border-radius: 12px;
    padding: 10px 14px;
}

.pdf-preview-shell {
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.86);
}

.pdf-preview {
    width: 100%;
    min-height: 78vh;
    border: 0;
    display: block;
    background: #f3efe9;
}

.doc-preview-body {
    padding: 0;
}

.preview-note {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(47, 125, 107, 0.08);
}

.preview-note strong {
    display: block;
    margin-bottom: 8px;
}

.preview-note ul {
    margin: 0;
    padding-left: 18px;
}

.article-header {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.markdown-body {
    font-size: 1.02rem;
}

.markdown-body > :first-child {
    margin-top: 0;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin-top: 1.8em;
    line-height: 1.35;
}

.markdown-body p,
.markdown-body li {
    color: #34291f;
}

.markdown-body blockquote {
    margin: 1.2rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--accent);
    background: rgba(47, 125, 107, 0.08);
    border-radius: 0 12px 12px 0;
}

.markdown-body pre,
.markdown-body code,
.markdown-body table {
    max-width: 100%;
}

.markdown-body pre {
    overflow: auto;
    padding: 16px;
    border-radius: 14px;
    background: #2b221b;
    color: #f7f2ee;
}

.markdown-body code {
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    background: rgba(47, 36, 27, 0.08);
    border-radius: 6px;
    padding: 0.15em 0.35em;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.markdown-body th,
.markdown-body td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.markdown-body th {
    background: rgba(47, 125, 107, 0.1);
}

.markdown-body img {
    max-width: 100%;
    border-radius: 16px;
}

.mermaid {
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.tag:hover,
.tag.active {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.tag small {
    color: var(--muted);
    font-size: 0.75rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 0;
}

.clear-tag {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--muted);
}

.clear-tag:hover {
    color: var(--accent);
}

.pin-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 500;
}

.featured-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px 26px;
    margin-bottom: 20px;
}

.pinned-card {
    border-left: 4px solid var(--accent);
}

.featured-header {
    margin-bottom: 16px;
}

.featured-header h2 {
    margin: 0;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.featured-item {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.featured-item h3 {
    margin: 10px 0 8px;
    font-size: 1.15rem;
}

.featured-item h3 a {
    color: inherit;
    text-decoration: none;
}

.featured-item h3 a:hover {
    color: var(--accent);
}

.featured-item p {
    margin: 0 0 10px;
    font-size: 0.95rem;
}

.pinned-item {
    border-left: 3px solid var(--accent);
}

.document-card.pinned {
    border-left: 3px solid var(--accent);
}

/* Search page styles */
.search-hero {
    grid-template-columns: 2fr 1fr;
}

.search-layout {
    align-items: start;
}

.filter-toolbar {
    padding: 14px 20px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 0.9rem;
}

.filter-chip a {
    color: var(--muted);
    text-decoration: none;
    font-weight: bold;
    padding: 0 4px;
}

.filter-chip a:hover {
    color: var(--accent);
}

.search-results {
    display: grid;
    gap: 16px;
}

.search-result-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px;
}

.search-result-card h2 {
    margin: 10px 0 8px;
    font-size: 1.3rem;
}

.search-result-card h2 a {
    color: inherit;
    text-decoration: none;
}

.search-result-card h2 a:hover {
    color: var(--accent);
}

.search-snippet {
    margin: 12px 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    line-height: 1.7;
}

.search-snippet :first-child {
    margin-top: 0;
}

.search-snippet :last-child {
    margin-bottom: 0;
}

.search-snippet mark,
.search-highlight {
    background: rgba(47, 125, 107, 0.2);
    color: inherit;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-weight: 500;
}

.match-sources {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}

.match-source-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(47, 125, 107, 0.1);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 500;
}

.search-tips {
    margin-top: 20px;
    color: var(--muted);
}

.search-tips-list {
    color: var(--muted);
    padding-left: 20px;
}

.search-tips-list li {
    margin: 6px 0;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section h3 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: var(--muted);
}

/* Knowledge base page */
.kb-hero {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
}

.kb-updated-stat strong {
    font-size: 1.08rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.kb-console,
.kb-answer-card,
.kb-source-panel {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.kb-console {
    padding: 18px 20px;
    margin-bottom: 20px;
}

.kb-question-form {
    display: grid;
    gap: 12px;
}

.kb-question-box textarea {
    width: 100%;
    min-height: 130px;
    resize: vertical;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font: inherit;
    line-height: 1.65;
}

.kb-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.kb-topk-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

.kb-topk-control input {
    width: 86px;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    font: inherit;
}

.kb-controls button {
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    color: #fff;
    font: inherit;
}

.kb-controls button:disabled {
    cursor: wait;
    opacity: 0.78;
}

.kb-question-form.is-loading .kb-controls button {
    background: #8d4a3a;
}

.kb-question-form.is-loading .kb-controls button:hover {
    background: #753d31;
}

.kb-example-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.kb-example-list a {
    padding: 7px 10px;
    border: 1px solid rgba(47, 125, 107, 0.18);
    border-radius: 999px;
    background: rgba(47, 125, 107, 0.08);
    color: var(--accent-deep);
    font-size: 0.9rem;
    text-decoration: none;
}

.kb-example-list a:hover {
    border-color: rgba(47, 125, 107, 0.36);
    color: var(--accent);
}

.kb-index-note {
    margin: -2px 0 20px;
}

.kb-index-note p {
    margin: 0;
}

.kb-index-note p + p {
    margin-top: 8px;
}

.kb-result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 20px;
    align-items: start;
}

.kb-live-result[hidden],
#kb-static-state[hidden] {
    display: none;
}

.kb-answer-card,
.kb-source-panel {
    padding: 22px;
}

.kb-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.kb-card-header h2 {
    margin: 0;
    font-size: 1.2rem;
    overflow-wrap: anywhere;
}

.kb-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.kb-search-link {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.kb-search-link:hover {
    color: var(--accent-deep);
}

.kb-mode-badge {
    flex: 0 0 auto;
    border: 1px solid rgba(47, 125, 107, 0.28);
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 600;
}

.kb-answer-body {
    white-space: pre-wrap;
    line-height: 1.8;
    color: #34291f;
    min-height: 3.6em;
    overflow-wrap: anywhere;
}

.kb-answer-body.is-streaming::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 1.1em;
    margin-left: 4px;
    vertical-align: -0.16em;
    border-radius: 2px;
    background: var(--accent);
    animation: kb-caret 0.9s steps(2, end) infinite;
}

.kb-process-panel {
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.62);
}

.kb-process-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.kb-process-head .eyebrow,
.kb-process-head h3 {
    margin: 0;
}

.kb-process-head h3 {
    font-size: 0.98rem;
}

.kb-process-list {
    display: grid;
    gap: 8px;
    max-height: 180px;
    overflow: auto;
    padding-right: 2px;
}

.kb-process-step {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    animation: kb-process-in 0.18s ease-out both;
}

.kb-process-step.error {
    color: #9a3d2f;
}

.kb-process-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(47, 125, 107, 0.12);
}

.kb-process-step.error .kb-process-dot {
    background: #9a3d2f;
    box-shadow: 0 0 0 4px rgba(154, 61, 47, 0.11);
}

@keyframes kb-caret {
    0%,
    45% {
        opacity: 1;
    }
    46%,
    100% {
        opacity: 0;
    }
}

@keyframes kb-process-in {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kb-source-panel {
    position: sticky;
    top: 24px;
}

.kb-source-list {
    display: grid;
    gap: 12px;
}

.kb-source-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.68);
}

.kb-source-card h3 {
    margin: 8px 0;
    font-size: 1rem;
    line-height: 1.4;
}

.kb-source-card h3 a {
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.kb-source-card h3 a:hover {
    color: var(--accent);
}

.kb-source-card p {
    margin: 0 0 10px;
    color: #34291f;
    font-size: 0.92rem;
    line-height: 1.65;
}

.kb-source-card footer {
    color: var(--muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.kb-source-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.kb-source-footer span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.kb-source-footer a {
    flex: 0 0 auto;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.kb-source-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 1080px) {
    .search-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1080px) {
    .hero,
    .layout-grid,
    .detail-layout,
    .library-dashboard,
    .value-layout,
    .value-hero,
    .kb-hero,
    .kb-result-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .search-layout .content-column {
        order: 1;
    }

    .search-layout .sidebar-card {
        order: 2;
    }

    .section-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-hero .hero-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .more-tools-grid {
        grid-template-columns: 1fr;
    }

    .home-tools-sticky {
        position: static;
    }

    .top-filter-header {
        align-items: start;
    }

    .compact-toolbar-head,
    .compact-filter-title-row {
        align-items: start;
    }

    .resume-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-card {
        position: static;
    }

    .kb-source-panel {
        position: static;
    }
}

/* Summary panel on document detail */
.summary-panel {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(47, 125, 107, 0.04);
    overflow: hidden;
}

.summary-panel-toggle {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 14px 18px;
}

.summary-panel-toggle::-webkit-details-marker {
    display: none;
}

.summary-panel-toggle strong,
.summary-panel-toggle small {
    display: block;
}

.summary-panel-toggle small {
    color: var(--muted);
    margin-top: 2px;
}

.summary-panel[open] .summary-panel-toggle {
    border-bottom: 1px solid var(--border);
}

.summary-panel-body {
    padding: 16px 18px;
}

.summary-text {
    margin: 0 0 14px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #34291f;
}

.summary-section {
    margin-top: 14px;
}

.summary-section h3 {
    margin: 0 0 8px;
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 600;
}

.summary-key-points {
    margin: 0;
    padding-left: 18px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.summary-key-points li {
    margin: 4px 0;
    color: #34291f;
}

/* Topic pages */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.topic-card {
    display: grid;
    gap: 8px;
    padding: 20px 22px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.topic-card:hover {
    border-color: rgba(47, 125, 107, 0.35);
}

.topic-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topic-card-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.topic-count {
    font-size: 1.5rem;
    color: var(--accent-deep);
    line-height: 1;
}

.topic-year-span {
    color: var(--muted);
    font-size: 0.88rem;
}

.topic-latest {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-header-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px 26px;
    margin-bottom: 20px;
}

.topic-header-card h1 {
    margin: 0;
}

.topic-meta {
    color: var(--muted);
    margin: 8px 0 0;
}

.topic-doc-summary {
    margin: 8px 0;
    font-size: 0.92rem;
    color: var(--muted);
    line-height: 1.6;
}

.topic-key-points {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 0.88rem;
    color: var(--muted);
}

.topic-key-points li {
    margin: 4px 0;
}

.tag-personality {
    background: rgba(47, 125, 107, 0.08);
    border-color: rgba(47, 125, 107, 0.2);
    font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 720px) {
    .page-shell {
        padding: 18px 14px 60px;
    }

    .site-header {
        margin: -12px -14px 22px;
        padding: 12px 14px 10px;
    }

    .site-header-inner {
        align-items: stretch;
        gap: 12px;
        min-height: 0;
    }

    .brand {
        max-width: 100%;
    }

    .brand small {
        display: none;
    }

    .site-nav {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 2px 0 8px;
        scrollbar-width: thin;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .site-nav a {
        flex: 0 0 auto;
        scroll-snap-align: start;
        white-space: nowrap;
    }

    .hero,
    .toolbar-card,
    .sidebar-card,
    .document-card,
    .article-card,
    .resume-card,
    .archive-year-card,
    .empty-state {
        border-radius: 18px;
    }

    .section-overview-grid {
        grid-template-columns: 1fr;
    }

    .hero,
    .article-card,
    .archive-year-card {
        padding: 22px;
    }

    .home-hero {
        gap: 14px;
        padding: 18px;
    }

    .home-hero .hero-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .home-hero .hero-stats article {
        padding: 12px 14px;
    }

    .more-tools-summary,
    .more-tools-grid {
        padding-left: 14px;
        padding-right: 14px;
    }

    .more-tools-summary {
        align-items: start;
        flex-direction: column;
    }

    .search-form {
        flex-direction: column;
    }

    .compact-home-toolbar .search-form {
        grid-template-columns: 1fr;
    }

    .jump-filter-form {
        width: 100%;
        align-items: stretch;
    }

    .compact-jump-form,
    .compact-jump-form .compact-select-inline,
    .compact-jump-form .compact-select-inline select,
    .compact-jump-form button {
        width: 100%;
    }

    .section-chip-group,
    .pill-group,
    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        scrollbar-width: thin;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .section-chip-group > *,
    .pill-group > *,
    .filter-bar > * {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .compact-select,
    .compact-select select,
    .jump-filter-form button {
        width: 100%;
    }

    .search-form button {
        width: 100%;
    }

    .kb-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .kb-topk-control,
    .kb-topk-control input,
    .kb-controls button {
        width: 100%;
    }

    .kb-card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .kb-header-actions {
        justify-content: flex-start;
    }

    .kb-source-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .value-toolbar {
        align-items: stretch;
    }

    .value-search-form {
        width: 100%;
    }

    .pagination {
        flex-direction: column;
    }
}

