:root {
    --bg: #f4efe7;
    --bg-deep: #ebe1d4;
    --surface: rgba(255, 252, 246, 0.88);
    --surface-strong: rgba(255, 253, 249, 0.96);
    --surface-soft: rgba(248, 242, 233, 0.84);
    --surface-accent: rgba(39, 71, 58, 0.08);
    --line: rgba(71, 58, 42, 0.1);
    --line-strong: rgba(71, 58, 42, 0.16);
    --text: #2f261b;
    --muted: #736756;
    --muted-strong: #5a4f41;
    --accent: #29473a;
    --accent-soft: rgba(41, 71, 58, 0.1);
    --gold: #946a31;
    --new: #176957;
    --update: #8f5d1f;
    --background: #5f6f2d;
    --retained: #4f6379;
    --placeholder: #7d6955;
    --review: #8a4c3f;
    --empty: #7b7771;
    --danger: #8a4c3f;
    --shadow-soft: 0 24px 60px rgba(59, 46, 29, 0.08);
    --shadow-card: 0 16px 34px rgba(59, 46, 29, 0.05);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(82, 67, 50, 0.18) transparent;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(148, 106, 49, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(41, 71, 58, 0.12), transparent 24%),
        linear-gradient(180deg, #f8f3eb 0%, #efe6d9 100%);
    font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.menu-open {
    overflow: hidden;
}

body::-webkit-scrollbar,
.main-panel::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

body::-webkit-scrollbar-thumb,
.main-panel::-webkit-scrollbar-thumb {
    background: rgba(82, 67, 50, 0.18);
    border-radius: 999px;
}

body::-webkit-scrollbar-track,
.main-panel::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll,
.table-scroll,
.meta-drawer[open] {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-scroll::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.meta-drawer[open]::-webkit-scrollbar {
    width: 0;
    height: 0;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

p,
ul,
ol {
    margin-top: 0;
}

::selection {
    background: rgba(41, 71, 58, 0.16);
}

.app-shell {
    display: grid;
    grid-template-columns: 304px minmax(0, 1fr);
    min-height: 100vh;
}

.mobile-nav-toggle,
.mobile-backdrop,
.drawer-close {
    display: none;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    padding: 22px 18px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(252, 249, 243, 0.92), rgba(244, 237, 228, 0.98));
    border-right: 1px solid var(--line);
    z-index: 50;
}

.drawer-shell {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 10px 0;
}

.sidebar-header-copy {
    min-width: 0;
}

.sidebar-title {
    margin: 4px 0 0;
    font-size: 1.32rem;
    line-height: 1.35;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.brand-kicker,
.topbar-kicker,
.section-kicker,
.meta-label,
.nav-group-title,
.topbar-mode-label {
    margin: 0;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
}

.sidebar-mode-text,
.brand-note,
.section-description,
.hero-subtitle,
.card-note,
.card-status-text,
.timeline-item p,
.file-notes p,
.meta-box p,
.sidebar-tool-note {
    color: var(--muted);
    line-height: 1.78;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 4px 0 2px;
}

.sidebar-intro,
.sidebar-tools {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(247, 241, 232, 0.94));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
}

.sidebar-intro h2 {
    margin: 6px 0 10px;
    font-size: 1.22rem;
    line-height: 1.5;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.brand-note {
    margin: 0;
    font-size: 0.94rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 0 10px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-group-caption {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.65;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    color: var(--text);
    background: transparent;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.nav-link::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 999px;
    background: rgba(104, 84, 65, 0.22);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
    transform: translateY(-1px);
    border-color: rgba(104, 84, 65, 0.1);
    background: rgba(255, 252, 247, 0.62);
}

.nav-link:focus-visible {
    outline: none;
    border-color: rgba(104, 84, 65, 0.14);
    background: rgba(255, 252, 247, 0.78);
    box-shadow: 0 0 0 3px rgba(104, 84, 65, 0.08);
}

.nav-link.active {
    transform: translateY(-1px);
    color: var(--text);
    border-color: rgba(104, 84, 65, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 241, 233, 0.96));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 8px 20px rgba(67, 52, 36, 0.05);
}

.nav-link.active::before {
    opacity: 1;
    transform: scaleY(1);
}

.nav-group-secondary .nav-link,
.nav-group-secondary .nav-link-index {
    opacity: 0.82;
}

.nav-link.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: rgba(127, 119, 113, 0.08);
}

.nav-link-index {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(104, 84, 65, 0.08);
    color: var(--muted-strong);
    font-size: 0.76rem;
    font-weight: 700;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover .nav-link-index,
.nav-link:focus-visible .nav-link-index {
    background: rgba(104, 84, 65, 0.12);
    color: var(--accent);
}

.nav-link.active .nav-link-index {
    background: rgba(255, 255, 255, 0.78);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(104, 84, 65, 0.08);
}

.nav-link-text {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.5;
}

.sidebar-footer {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.muted-tools {
    background: rgba(246, 240, 231, 0.84);
}

.sidebar-fold {
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(247, 241, 232, 0.94));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.sidebar-fold[open] {
    border-color: rgba(41, 71, 58, 0.16);
}

.sidebar-fold summary {
    list-style: none;
    cursor: pointer;
}

.sidebar-fold summary::-webkit-details-marker {
    display: none;
}

.sidebar-fold-summary {
    padding: 14px 16px;
}

.sidebar-fold:hover .sidebar-fold-summary {
    background: rgba(41, 71, 58, 0.03);
}

.sidebar-tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
}

.sidebar-fold-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.sidebar-fold-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.fold-chevron {
    width: 10px;
    height: 10px;
    border-right: 1.5px solid rgba(71, 58, 42, 0.5);
    border-bottom: 1.5px solid rgba(71, 58, 42, 0.5);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.sidebar-fold[open] .fold-chevron {
    transform: rotate(225deg);
}

.sidebar-fold-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px 16px;
    border-top: 1px solid rgba(71, 58, 42, 0.08);
}

.mode-mini {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(127, 119, 113, 0.12);
    color: var(--muted-strong);
    font-size: 0.8rem;
    font-weight: 700;
}

.mode-mini.is-active {
    background: rgba(23, 105, 87, 0.12);
    color: var(--new);
}

.view-switcher-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.view-switcher-buttons.compact .view-chip {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 72px;
}

.view-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid rgba(41, 71, 58, 0.12);
    background: rgba(255, 253, 248, 0.9);
    color: var(--muted-strong);
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.view-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(41, 71, 58, 0.18);
}

.view-chip.active {
    background: var(--accent);
    color: #f7f0df;
    border-color: transparent;
}

.full-width {
    width: 100%;
}

.main-panel {
    min-width: 0;
    padding: 28px clamp(18px, 3vw, 38px) 34px;
}

.topbar {
    display: flex;
    position: relative;
    z-index: 20;
    isolation: isolate;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding: 24px 26px;
    border-radius: var(--radius-xl);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    overflow: visible;
}

.topbar-main {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    min-width: 0;
}

.topbar-copy {
    min-width: 0;
}

.topbar-copy h2,
.section-header h3,
.hero-head h3,
.detail-head h3,
.history-card h4,
.section-card h4,
.archive-head h4,
.result-head h4,
.group-header h4,
.sidebar-intro h2,
.debug-preview h4 {
    margin: 6px 0 0;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.topbar-copy h2 {
    font-size: clamp(1.4rem, 2.2vw, 1.92rem);
    line-height: 1.35;
}

.topbar-mode {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(41, 71, 58, 0.07);
    border: 1px solid rgba(41, 71, 58, 0.08);
    min-width: 120px;
}

.topbar-mode strong {
    font-size: 0.98rem;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.topbar-actions,
.detail-actions,
.archive-actions,
.flash-actions,
.form-actions,
.meta-line,
.history-tags,
.status-group,
.reading-meta,
.insight-meta,
.result-meta,
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.primary-button,
.ghost-button,
.card-link,
.filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.primary-button,
.ghost-button,
.filter-chip,
.danger-button {
    border: none;
    cursor: pointer;
}

.primary-button {
    background: var(--accent);
    color: #f8f1e2;
}

.ghost-button,
.card-link {
    background: rgba(41, 71, 58, 0.08);
    color: var(--accent);
}

.primary-button:hover,
.ghost-button:hover,
.card-link:hover,
.filter-chip:hover {
    transform: translateY(-1px);
}

.small {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 0.92rem;
}

.danger-button {
    background: rgba(138, 76, 63, 0.1);
    color: var(--danger);
}

.danger-button:hover {
    background: rgba(138, 76, 63, 0.16);
}

.hero-card,
.page-card,
.detail-hero {
    margin-bottom: 22px;
    padding: 28px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.hero-card {
    background:
        linear-gradient(135deg, rgba(41, 71, 58, 0.07), rgba(255, 253, 249, 0.92)),
        var(--surface);
}

.detail-hero {
    background:
        linear-gradient(135deg, rgba(148, 106, 49, 0.06), rgba(255, 253, 249, 0.92)),
        var(--surface);
}

.hero-head,
.section-header,
.detail-head,
.archive-head,
.card-top,
.timeline-head,
.result-head,
.debug-card-head,
.debug-head-meta,
.group-header,
.insight-top,
.table-block-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.info-chip,
.status-pill,
.meta-chip,
.group-category,
.group-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
}

.info-chip,
.group-index {
    background: rgba(41, 71, 58, 0.08);
    color: var(--accent);
}

.info-chip.muted,
.meta-chip {
    background: rgba(127, 119, 113, 0.12);
    color: var(--muted-strong);
}

.meta-chip.soft,
.group-category {
    background: rgba(41, 71, 58, 0.08);
    color: var(--accent);
}

.tag-new {
    background: rgba(23, 105, 87, 0.12);
    color: var(--new);
}

.tag-update {
    background: rgba(143, 93, 31, 0.12);
    color: var(--update);
}

.tag-background {
    background: rgba(95, 111, 45, 0.12);
    color: var(--background);
}

.tag-retained {
    background: rgba(79, 99, 121, 0.12);
    color: var(--retained);
}

.tag-placeholder {
    background: rgba(125, 105, 85, 0.12);
    color: var(--placeholder);
}

.tag-review {
    background: rgba(138, 76, 63, 0.12);
    color: var(--review);
}

.tag-deleted-soft {
    background: rgba(127, 119, 113, 0.14);
    color: var(--muted-strong);
}

.tag-empty {
    background: rgba(127, 119, 113, 0.12);
    color: var(--empty);
}

.large {
    padding: 10px 16px;
    font-size: 0.94rem;
}

.brief-content {
    margin-top: 24px;
    padding: 28px 30px;
    border-radius: calc(var(--radius-xl) - 6px);
    background: rgba(255, 252, 247, 0.92);
    border: 1px solid rgba(71, 58, 42, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brief-content h4 {
    margin: 0 0 14px;
    font-size: clamp(1.42rem, 2vw, 1.82rem);
    line-height: 1.55;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.meta-line {
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 0.92rem;
}

.rich-text,
.detail-content,
.reading-paragraph {
    font-size: 1.02rem;
    line-height: 1.95;
}

.rich-text p,
.detail-content p {
    margin: 0 0 1em;
}

.rich-text h1,
.rich-text h2,
.rich-text h3,
.detail-content h1,
.detail-content h2,
.detail-content h3 {
    margin: 1.2em 0 0.6em;
    line-height: 1.5;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.overview-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.overview-tile,
.section-card,
.archive-card,
.history-card,
.library-card,
.timeline-item,
.meta-box,
.result-card,
.insight-card,
.drawer-item,
.debug-preview {
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    border: 1px solid rgba(71, 58, 42, 0.08);
    box-shadow: var(--shadow-card);
}

.overview-tile span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.84rem;
    letter-spacing: 0.04em;
}

.overview-tile strong,
.meta-box strong,
.drawer-item strong {
    display: block;
    line-height: 1.6;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.section-grid,
.archive-grid,
.detail-meta-grid,
.drawer-grid,
.debug-meta-grid,
.debug-preview-grid,
.debug-facts,
.card-grid {
    display: grid;
    gap: 16px;
}

.section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drawer-grid,
.debug-meta-grid,
.debug-preview-grid,
.card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.debug-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 20px 0;
}

.debug-facts div {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(127, 119, 113, 0.08);
    border: 1px solid rgba(71, 58, 42, 0.06);
}

.debug-facts span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

.debug-facts strong {
    display: block;
    line-height: 1.6;
}

.debug-preview pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.8;
    color: var(--text);
    font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.section-card,
.library-card,
.result-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-preview-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-preview-card {
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 250, 242, 0.92);
    border: 1px solid rgba(71, 58, 42, 0.07);
}

.section-preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.section-preview-head h5 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.6;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.section-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.section-preview-why {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.72;
    font-size: 0.9rem;
}

.history-list,
.timeline-list,
.result-list,
.debug-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(59, 46, 29, 0.08);
}

.card-excerpt,
.timeline-excerpt {
    margin: 0;
    line-height: 1.82;
}

.card-link {
    width: fit-content;
    margin-top: auto;
}

.disabled-link {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.empty-panel,
.inline-note {
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    background: rgba(127, 119, 113, 0.08);
    border: 1px dashed rgba(71, 58, 42, 0.12);
    color: var(--muted);
    line-height: 1.8;
}

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.flash-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    box-shadow: var(--shadow-card);
}

.flash-success {
    border-color: rgba(23, 105, 87, 0.16);
}

.flash-error {
    border-color: rgba(143, 93, 31, 0.18);
}

.flash-copy h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.flash-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.76;
}

.flash-path {
    margin-top: 4px !important;
    word-break: break-all;
}

.reading-hero {
    padding-bottom: 22px;
}

.reading-note {
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 18px;
    background: rgba(41, 71, 58, 0.08);
    color: var(--accent);
}

.reading-note p {
    margin: 0;
    line-height: 1.82;
}

.warning-panel {
    border-color: rgba(143, 93, 31, 0.18);
    background: rgba(255, 248, 238, 0.88);
}

.warning-panel p {
    margin: 0;
    color: var(--update);
    line-height: 1.82;
}

.reading-stage {
    padding: 30px;
}

.filter-toolbar {
    align-items: center;
    margin-bottom: 22px;
}

.filter-label {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.filter-chip {
    min-height: 38px;
    padding: 8px 14px;
    background: rgba(255, 253, 249, 0.92);
    color: var(--muted-strong);
    border: 1px solid rgba(71, 58, 42, 0.08);
}

.filter-chip.active {
    background: var(--accent);
    color: #f8f1e2;
    border-color: transparent;
}

.content-group + .content-group {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid rgba(71, 58, 42, 0.08);
}

.group-header h4 {
    font-size: 1.24rem;
    line-height: 1.56;
}

.group-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.insight-card {
    padding: 22px;
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(248, 242, 233, 0.96));
}

.paragraph-card {
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(250, 247, 241, 0.96));
}

.card-rule {
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(239, 246, 242, 0.96));
}

.card-monitor {
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(245, 240, 233, 0.96));
}

.insight-top h5 {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.68;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.paragraph-card .insight-top h5 {
    color: var(--muted);
}

.insight-body p,
.insight-why p {
    margin: 0;
    line-height: 1.9;
}

.insight-why {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(71, 58, 42, 0.08);
}

.insight-why span {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.table-drawer {
    margin-top: 2px;
    padding: 10px 14px;
}

.table-drawer summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
    list-style: none;
}

.table-drawer summary::-webkit-details-marker {
    display: none;
}

.table-drawer[open] summary {
    margin-bottom: 12px;
}

.table-scroll {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.detail-table th,
.detail-table td {
    padding: 14px 12px;
    vertical-align: top;
    text-align: left;
    line-height: 1.8;
    white-space: normal;
    word-break: break-word;
    border-bottom: 1px solid rgba(71, 58, 42, 0.08);
}

.detail-table th {
    position: sticky;
    top: 0;
    background: #f8f1e5;
    color: var(--text);
    font-weight: 700;
}

.meta-drawer {
    margin: 18px 0 22px;
    border-radius: var(--radius-lg);
    background: rgba(255, 252, 246, 0.56);
    border: 1px solid rgba(71, 58, 42, 0.08);
}

.meta-drawer summary {
    cursor: pointer;
    padding: 16px 18px;
    color: var(--muted);
    font-weight: 700;
    list-style: none;
}

.meta-drawer summary::-webkit-details-marker {
    display: none;
}

.drawer-grid {
    padding: 0 18px 18px;
}

.drawer-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.76;
    word-break: break-all;
}

.path-muted {
    word-break: break-all;
    color: var(--muted);
    font-size: 0.88rem;
}

.compact {
    gap: 8px;
}

.tag-active {
    background: rgba(41, 71, 58, 0.12);
    color: var(--accent);
}

.tag-archived {
    background: rgba(148, 106, 49, 0.14);
    color: var(--gold);
}

.tag-withdrawn {
    background: rgba(138, 76, 63, 0.14);
    color: var(--danger);
}

.archive-actions form,
.detail-actions form {
    margin: 0;
}

.library-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.upload-form,
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-card {
    max-width: 760px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-group span {
    color: var(--muted-strong);
    font-weight: 700;
}

.field-group input {
    width: 100%;
    padding: 15px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(71, 58, 42, 0.12);
    background: rgba(255, 253, 249, 0.96);
    color: var(--text);
}

.field-group input:focus {
    outline: 2px solid rgba(41, 71, 58, 0.16);
    border-color: rgba(41, 71, 58, 0.24);
}

.dropzone {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 34px 30px;
    border-radius: var(--radius-xl);
    border: 1.5px dashed rgba(41, 71, 58, 0.28);
    background: linear-gradient(135deg, rgba(41, 71, 58, 0.05), rgba(255, 252, 246, 0.9));
    cursor: pointer;
}

.dropzone input {
    display: none;
}

.dropzone-title {
    font-size: 1.2rem;
    line-height: 1.6;
    font-weight: 700;
}

.dropzone-note,
.selected-files {
    color: var(--muted);
    line-height: 1.78;
}

.dropzone.dragover {
    border-color: var(--gold);
    background: linear-gradient(135deg, rgba(148, 106, 49, 0.12), rgba(255, 252, 246, 0.9));
}

.debug-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 1280px) {
    .app-shell {
        grid-template-columns: 286px minmax(0, 1fr);
    }

    .overview-strip,
    .library-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .debug-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .topbar,
    .hero-head,
    .section-header,
    .detail-head,
    .archive-head,
    .timeline-head,
    .debug-card-head,
    .debug-head-meta {
        flex-direction: column;
    }

    .topbar-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .archive-grid,
    .detail-meta-grid,
    .drawer-grid,
    .debug-meta-grid,
    .debug-preview-grid,
    .card-grid {
        grid-template-columns: 1fr;
    }
}

.view-mobile .app-shell {
    grid-template-columns: 1fr;
}

.view-mobile .mobile-nav-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 130;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(71, 58, 42, 0.1);
    background: rgba(255, 253, 249, 0.96);
    color: var(--text);
    box-shadow: 0 14px 30px rgba(59, 46, 29, 0.08);
    cursor: pointer;
}

.view-mobile body.menu-open .mobile-nav-toggle {
    opacity: 0;
    pointer-events: none;
}

.menu-toggle-icon {
    display: inline-grid;
    gap: 4px;
}

.menu-toggle-icon span {
    display: block;
    width: 14px;
    height: 1.5px;
    border-radius: 999px;
    background: currentColor;
}

.menu-toggle-label {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.view-mobile .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    opacity: 0;
    pointer-events: none;
    background: rgba(47, 38, 27, 0.14);
    backdrop-filter: blur(2px);
    transition: opacity 0.24s ease;
}

.view-mobile body.menu-open .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.view-mobile .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 360px);
    max-width: 360px;
    height: 100svh;
    padding: 0;
    background: transparent;
    border-right: none;
    transform: translateX(-104%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: none;
    z-index: 120;
    pointer-events: none;
    overflow: hidden;
}

.view-mobile body.menu-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
}

.view-mobile .drawer-shell {
    gap: 0;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(245, 239, 230, 0.98));
    border-right: 1px solid rgba(71, 58, 42, 0.08);
    border-radius: 0 26px 26px 0;
    box-shadow: 0 20px 54px rgba(59, 46, 29, 0.12);
}

.view-mobile .sidebar-header {
    padding: 18px 18px 14px;
    background: rgba(255, 252, 247, 0.9);
    border-bottom: 1px solid rgba(71, 58, 42, 0.08);
}

.view-mobile .sidebar-title {
    font-size: 1.16rem;
}

.view-mobile .drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(71, 58, 42, 0.08);
    background: rgba(41, 71, 58, 0.08);
    color: var(--accent);
    font-size: 1.45rem;
    cursor: pointer;
}

.view-mobile .sidebar-scroll {
    padding: 16px 16px 16px;
}

.view-mobile .sidebar-intro {
    padding: 16px 16px 18px;
    border-radius: 20px;
}

.view-mobile .sidebar-nav {
    padding: 16px 0 18px;
    gap: 16px;
}

.view-mobile .nav-link {
    min-height: 52px;
    padding: 13px 14px;
    border-radius: 18px;
}

.view-mobile .nav-link:hover,
.view-mobile .nav-link.active {
    transform: none;
}

.view-mobile .sidebar-footer {
    padding: 14px 16px 18px;
    background: rgba(255, 252, 247, 0.92);
}

.view-mobile .sidebar-tools {
    padding: 14px 16px;
    border-radius: 20px;
}

.view-mobile .sidebar-fold-summary {
    padding: 13px 14px;
}

.view-mobile .sidebar-fold-panel {
    padding: 0 14px 14px;
}

.view-mobile .view-switcher-buttons.compact .view-chip {
    min-width: 0;
}

.view-mobile .main-panel {
    padding: 78px 14px 24px;
}

.view-mobile .topbar,
.view-mobile .hero-card,
.view-mobile .page-card,
.view-mobile .detail-hero {
    padding: 20px 18px;
    border-radius: 24px;
}

.view-mobile .topbar,
.view-mobile .hero-head,
.view-mobile .section-header,
.view-mobile .detail-head,
.view-mobile .archive-head,
.view-mobile .card-top,
.view-mobile .timeline-head,
.view-mobile .history-card,
.view-mobile .result-head,
.view-mobile .debug-card-head,
.view-mobile .debug-head-meta,
.view-mobile .group-header,
.view-mobile .insight-top,
.view-mobile .flash-card {
    flex-direction: column;
}

.view-mobile .topbar-main {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.view-mobile .topbar-mode {
    min-width: 0;
    align-self: flex-start;
}

.view-mobile .topbar-actions,
.view-mobile .archive-actions,
.view-mobile .detail-actions,
.view-mobile .form-actions,
.view-mobile .flash-actions {
    width: 100%;
}

.view-mobile .topbar-actions > *,
.view-mobile .archive-actions > *,
.view-mobile .detail-actions > *,
.view-mobile .form-actions > *,
.view-mobile .flash-actions > * {
    width: 100%;
}

.view-mobile .overview-strip,
.view-mobile .section-grid,
.view-mobile .archive-grid,
.view-mobile .detail-meta-grid,
.view-mobile .drawer-grid,
.view-mobile .debug-meta-grid,
.view-mobile .debug-preview-grid,
.view-mobile .debug-facts,
.view-mobile .card-grid,
.view-mobile .library-summary {
    grid-template-columns: 1fr;
}

.view-mobile .history-tags,
.view-mobile .meta-line,
.view-mobile .reading-meta,
.view-mobile .insight-meta,
.view-mobile .result-meta,
.view-mobile .status-group {
    width: 100%;
    gap: 8px;
}

.view-mobile .info-chip,
.view-mobile .status-pill,
.view-mobile .meta-chip,
.view-mobile .group-category,
.view-mobile .group-index {
    max-width: 100%;
    white-space: normal;
    justify-content: flex-start;
}

.view-mobile .brief-content {
    padding: 22px 18px;
}

.view-mobile .brief-content h4 {
    font-size: 1.34rem;
    line-height: 1.68;
}

.view-mobile .overview-tile,
.view-mobile .section-card,
.view-mobile .archive-card,
.view-mobile .history-card,
.view-mobile .library-card,
.view-mobile .timeline-item,
.view-mobile .meta-box,
.view-mobile .result-card,
.view-mobile .insight-card,
.view-mobile .drawer-item,
.view-mobile .debug-preview {
    padding: 18px 16px;
    border-radius: 20px;
}

.view-mobile .reading-stage {
    padding: 22px 18px;
}

.view-mobile .section-preview-head {
    flex-direction: column;
}

.view-mobile .group-header h4 {
    font-size: 1.12rem;
}

.view-mobile .rich-text,
.view-mobile .detail-content,
.view-mobile .reading-paragraph,
.view-mobile .insight-body p,
.view-mobile .insight-why p {
    font-size: 0.98rem;
    line-height: 1.9;
}

.view-mobile .detail-table {
    min-width: 560px;
}

.view-mobile .dropzone {
    padding: 24px 20px;
}

.view-desktop body {
    overflow-x: auto;
}

.view-desktop .mobile-nav-toggle,
.view-desktop .mobile-backdrop,
.view-desktop .drawer-close {
    display: none !important;
}

.view-desktop .app-shell {
    grid-template-columns: 304px minmax(0, 1fr);
    min-width: 1180px;
}

.view-desktop .sidebar {
    position: sticky;
    top: 0;
    width: auto;
    height: 100vh;
    transform: none;
    pointer-events: auto;
}

.auth-stage {
    max-width: 760px;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-form.stacked {
    max-width: 720px;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field span {
    font-size: 0.92rem;
    color: var(--text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(23, 37, 42, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    font: inherit;
    color: var(--text-main);
}

.inline-check {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sidebar-utility-stack {
    display: grid;
    gap: 10px;
}

.sidebar-tool-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(107, 87, 67, 0.08);
}

.sidebar-utility-stack .ghost-button.active {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 241, 236, 0.96));
    border: 1px solid rgba(107, 87, 67, 0.14);
    color: var(--text);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 10px 22px rgba(33, 42, 55, 0.05);
}

.evidence-drawer {
    margin-top: 14px;
    border-top: 1px solid rgba(23, 37, 42, 0.08);
    padding-top: 12px;
}

.evidence-drawer summary {
    cursor: pointer;
    list-style: none;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.evidence-drawer summary::-webkit-details-marker {
    display: none;
}

.evidence-grid {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.supporting-source-list {
    display: grid;
    gap: 10px;
}

.supporting-source {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(244, 241, 235, 0.7);
    border: 1px solid rgba(23, 37, 42, 0.06);
}

.supporting-source strong {
    display: block;
    margin-bottom: 6px;
}

.warning-text {
    color: #9a4d14;
}

@media (max-width: 960px) {
    .form-actions {
        flex-direction: column;
    }
}

/* Phase 4 shell and page refresh */

:root {
    --bg: #f5f3ee;
    --bg-deep: #ebe7df;
    --surface: #fcfbf8;
    --surface-strong: rgba(255, 255, 255, 0.88);
    --surface-soft: #f7f4ee;
    --surface-accent: rgba(85, 104, 133, 0.08);
    --line: rgba(52, 63, 79, 0.09);
    --line-strong: rgba(52, 63, 79, 0.16);
    --text: #202734;
    --muted: #687282;
    --muted-strong: #4b5563;
    --accent: #4d617e;
    --accent-soft: rgba(77, 97, 126, 0.1);
    --gold: #98714b;
    --shadow-soft: 0 20px 48px rgba(33, 42, 55, 0.08);
    --shadow-card: 0 12px 30px rgba(33, 42, 55, 0.05);
}

body {
    background:
        radial-gradient(circle at top left, rgba(152, 113, 75, 0.08), transparent 26%),
        radial-gradient(circle at bottom right, rgba(77, 97, 126, 0.08), transparent 22%),
        linear-gradient(180deg, #f7f5f1 0%, #efebe4 100%);
}

body::-webkit-scrollbar,
.main-panel::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

body::-webkit-scrollbar-thumb,
.main-panel::-webkit-scrollbar-thumb {
    background: rgba(75, 85, 99, 0.12);
}

.sidebar {
    background: linear-gradient(180deg, rgba(250, 248, 244, 0.94), rgba(243, 239, 232, 0.98));
    border-right: 1px solid rgba(52, 63, 79, 0.07);
}

.sidebar-intro,
.sidebar-fold {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(248, 245, 240, 0.92));
    border-color: rgba(52, 63, 79, 0.07);
    box-shadow: 0 10px 26px rgba(33, 42, 55, 0.045);
}

.nav-group-caption,
.topbar-summary {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.72;
    font-size: 0.88rem;
}

.nav-group-caption {
    margin-bottom: 4px;
}

.nav-link {
    min-height: 48px;
    border-radius: 16px;
    transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.nav-link-index {
    background: rgba(104, 84, 65, 0.08);
    color: var(--muted-strong);
}

.topbar {
    align-items: center;
    padding: 20px 22px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow:
        0 18px 40px rgba(33, 42, 55, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.topbar-actions {
    align-items: center;
}

.topbar-mode {
    background: rgba(255, 255, 255, 0.52);
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.topbar-mode strong {
    color: var(--accent);
}

.hero-card,
.page-card,
.detail-hero {
    background: rgba(252, 251, 248, 0.96);
    border: 1px solid rgba(52, 63, 79, 0.08);
    box-shadow: var(--shadow-card);
    backdrop-filter: none;
}

.hero-card {
    background:
        linear-gradient(135deg, rgba(77, 97, 126, 0.06), rgba(252, 251, 248, 0.98)),
        rgba(252, 251, 248, 0.96);
}

.detail-hero {
    background:
        linear-gradient(135deg, rgba(152, 113, 75, 0.05), rgba(252, 251, 248, 0.98)),
        rgba(252, 251, 248, 0.96);
}

.primary-button,
.ghost-button,
.card-link,
.filter-chip,
.view-chip {
    transition:
        transform 0.16s ease,
        background-color 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        box-shadow 0.16s ease;
}

.primary-button {
    background: linear-gradient(180deg, #5e7696, #506783);
    box-shadow: 0 10px 24px rgba(77, 97, 126, 0.18);
}

.primary-button:hover,
.ghost-button:hover,
.card-link:hover,
.filter-chip:hover,
.view-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(33, 42, 55, 0.08);
}

.ghost-button,
.card-link,
.filter-chip,
.view-chip {
    background: rgba(77, 97, 126, 0.08);
    border: 1px solid rgba(77, 97, 126, 0.1);
    color: var(--accent);
}

.overview-tile,
.section-card,
.archive-card,
.history-card,
.library-card,
.timeline-item,
.meta-box,
.result-card,
.insight-card,
.debug-preview {
    background: #fffdf9;
    border-color: rgba(52, 63, 79, 0.07);
    box-shadow: 0 10px 26px rgba(33, 42, 55, 0.045);
}

.section-card,
.history-card,
.library-card,
.result-card,
.insight-card {
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.section-card:hover,
.history-card:hover,
.library-card:hover,
.result-card:hover,
.insight-card:hover {
    transform: translateY(-2px);
    border-color: rgba(77, 97, 126, 0.14);
    box-shadow: 0 16px 34px rgba(33, 42, 55, 0.07);
}

.dashboard-hero,
.library-hero {
    padding-bottom: 24px;
}

.dashboard-metrics {
    margin-top: 24px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.spotlight-stage .section-grid,
.spotlight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.spotlight-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 244, 240, 0.98));
}

.section-cluster + .section-cluster {
    margin-top: 2px;
}

.soft-hidden-collection .meta-drawer {
    margin: 0;
}

.soft-hidden-list {
    padding: 0 18px 18px;
}

.soft-hidden-note {
    margin-top: -6px;
}

.upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
    gap: 16px;
    margin-bottom: 18px;
}

.upload-tip-card {
    height: 100%;
}

.upload-tip-card strong {
    margin-bottom: 10px;
}

.dropzone {
    background: linear-gradient(135deg, rgba(77, 97, 126, 0.05), rgba(255, 255, 255, 0.88));
    border-color: rgba(77, 97, 126, 0.24);
}

.dropzone.dragover {
    border-color: rgba(152, 113, 75, 0.48);
    background: linear-gradient(135deg, rgba(152, 113, 75, 0.12), rgba(255, 255, 255, 0.88));
}

.evidence-sheet {
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.44);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(16px) saturate(138%);
    -webkit-backdrop-filter: blur(16px) saturate(138%);
}

.evidence-sheet summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: var(--muted-strong);
    font-weight: 700;
}

.evidence-sheet .evidence-grid {
    padding: 0 14px 14px;
}

.evidence-sheet .drawer-item,
.supporting-source {
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.38);
    box-shadow: none;
}

.meta-drawer {
    background: rgba(248, 246, 241, 0.78);
}

.path-muted {
    font-size: 0.82rem;
    opacity: 0.82;
}

.view-mobile .mobile-nav-toggle {
    top: 14px;
    left: 14px;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.46);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
    box-shadow:
        0 14px 30px rgba(33, 42, 55, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px) saturate(145%);
    -webkit-backdrop-filter: blur(16px) saturate(145%);
}

.menu-toggle-icon span {
    width: 13px;
    height: 1.4px;
}

.menu-toggle-label {
    font-size: 0.68rem;
}

.view-mobile .mobile-backdrop {
    background: rgba(20, 28, 38, 0.16);
    backdrop-filter: blur(3px);
}

.view-mobile .drawer-shell {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(246, 243, 238, 0.88));
    border-right: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow:
        0 22px 56px rgba(33, 42, 55, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.46);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.view-mobile .sidebar-header,
.view-mobile .sidebar-footer {
    background: rgba(255, 255, 255, 0.28);
}

.view-mobile .main-panel {
    padding-top: 74px;
}

@media (max-width: 1280px) {
    .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .upload-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .dashboard-metrics,
    .spotlight-stage .section-grid,
    .spotlight-grid {
        grid-template-columns: 1fr;
    }

    .topbar-summary,
    .nav-group-caption {
        font-size: 0.84rem;
    }

    .evidence-sheet summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Phase 4-D security and polish */

.dashboard-hero .hero-subtitle,
.library-page .section-description,
.reading-note p,
.file-notes p,
.audit-log-meta {
    color: var(--muted);
    line-height: 1.72;
}

.dashboard-hero .hero-meta,
.library-detail-hero .history-tags {
    gap: 10px;
}

.dashboard-metrics .overview-tile strong,
.detail-meta-grid .meta-box strong,
.auth-side-panel strong,
.audit-log-card strong {
    color: var(--text);
}

.detail-meta-grid .meta-box,
.upload-tip-card,
.auth-side-panel,
.audit-log-card,
.upload-feedback-block,
.debug-drawer .drawer-item {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 243, 237, 0.9));
    border: 1px solid rgba(52, 63, 79, 0.07);
    box-shadow: 0 12px 28px rgba(33, 42, 55, 0.05);
}

.auth-stage {
    padding: 28px;
}

.auth-stage-grid,
.access-manage-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
    gap: 18px;
}

.auth-stage-main,
.audit-stage {
    min-width: 0;
}

.auth-side-panel {
    border-radius: 20px;
    padding: 20px 22px;
    display: grid;
    gap: 12px;
    align-content: start;
}

.auth-side-panel p {
    margin: 0;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
    outline: none;
    border-color: rgba(77, 97, 126, 0.28);
    box-shadow:
        0 0 0 4px rgba(77, 97, 126, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.access-manage-layout {
    align-items: start;
    margin-bottom: 18px;
}

.audit-stage {
    min-height: 100%;
}

.audit-log-list {
    display: grid;
    gap: 12px;
}

.audit-log-card {
    border-radius: 18px;
    padding: 16px 18px;
}

.audit-log-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 6px;
}

.audit-log-meta {
    margin: 0;
    font-size: 0.9rem;
}

.library-card,
.result-card,
.insight-card,
.timeline-item {
    border-radius: 20px;
}

.library-card .archive-head,
.result-head,
.insight-top,
.timeline-head {
    align-items: flex-start;
}

.archive-actions,
.detail-actions,
.form-actions {
    gap: 10px;
}

.archive-actions form,
.detail-actions form {
    margin: 0;
}

.library-detail-hero,
.debug-hero,
.upload-page,
.reading-stage {
    overflow: hidden;
}

.library-detail-hero .detail-actions,
.reading-hero .detail-actions {
    row-gap: 10px;
}

.detail-meta-grid {
    gap: 14px;
}

/* Phase 5-A: welcome page + intelligence workbench */

body.page-home {
    background:
        radial-gradient(circle at top left, rgba(94, 118, 150, 0.14), transparent 26%),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.48), transparent 20%),
        radial-gradient(circle at bottom right, rgba(148, 106, 49, 0.1), transparent 24%),
        linear-gradient(180deg, #f8f5ef 0%, #eee7db 100%);
}

.page-home .topbar-home {
    padding: 16px 18px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.38);
    box-shadow:
        0 12px 28px rgba(33, 42, 55, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.44);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.topbar-home-main {
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.topbar-home-copy {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-home-copy .topbar-kicker {
    white-space: nowrap;
}

.topbar-home-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar-mode-compact {
    padding: 8px 12px;
    background: rgba(94, 118, 150, 0.08);
}

.welcome-hero {
    padding: 34px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(247, 243, 237, 0.92)),
        linear-gradient(180deg, rgba(94, 118, 150, 0.08), rgba(252, 251, 248, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow:
        0 20px 48px rgba(33, 42, 55, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.welcome-hero-main {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.86fr);
    gap: 22px;
    align-items: stretch;
}

.welcome-copy h3 {
    margin: 8px 0 0;
    font-size: clamp(2.1rem, 3.2vw, 3.25rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.welcome-hero-reading .welcome-copy h3 {
    max-width: 12ch;
}

.welcome-hero-reading .welcome-hero-main {
    grid-template-columns: 1fr;
}

.welcome-copy .hero-subtitle {
    max-width: 720px;
    margin: 14px 0 0;
    font-size: 1rem;
    line-height: 1.9;
}

.welcome-meta,
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.welcome-meta {
    margin-top: 18px;
}

.hero-actions {
    margin-top: 22px;
}

.workbench-shortcuts-panel .workbench-entry-card {
    min-height: 184px;
}

.hero-actions .primary-button,
.hero-actions .ghost-button {
    min-height: 46px;
    padding: 12px 20px;
}

.welcome-status-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
}

.welcome-status-item {
    padding: 16px 16px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 26px rgba(33, 42, 55, 0.05);
}

.welcome-status-item span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

.welcome-status-item strong {
    display: block;
    margin-top: 12px;
    font-size: 1.58rem;
    line-height: 1.1;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.dashboard-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1.72fr) minmax(280px, 0.92fr);
    gap: 20px;
    align-items: start;
}

.workbench-main,
.workbench-side {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.workbench-panel,
.side-summary-card,
.side-action-card,
.section-stage {
    background: rgba(252, 251, 248, 0.96);
}

.core-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.workbench-entry-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    padding: 22px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 243, 237, 0.96));
    border: 1px solid rgba(52, 63, 79, 0.08);
    box-shadow: 0 12px 28px rgba(33, 42, 55, 0.05);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        background-color 0.16s ease;
}

.workbench-entry-card:hover {
    transform: translateY(-2px);
    border-color: rgba(94, 118, 150, 0.16);
    box-shadow: 0 18px 36px rgba(33, 42, 55, 0.08);
}

.workbench-entry-card h4 {
    margin: 0;
    font-size: 1.16rem;
    line-height: 1.52;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.workbench-entry-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.78;
}

.primary-entry {
    background:
        linear-gradient(180deg, rgba(250, 252, 255, 0.98), rgba(240, 245, 250, 0.94));
}

.entry-kicker,
.entry-meta {
    font-size: 0.82rem;
    line-height: 1.55;
}

.entry-kicker {
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.entry-meta {
    margin-top: auto;
    color: var(--muted-strong);
    font-weight: 700;
}

.workspace-history-list .history-card {
    align-items: flex-start;
}

.side-summary-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.side-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(94, 118, 150, 0.05);
    border: 1px solid rgba(94, 118, 150, 0.08);
}

.side-summary-row span {
    color: var(--muted);
    font-size: 0.9rem;
}

.side-summary-row strong {
    font-size: 1rem;
    line-height: 1.4;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.quick-action-grid {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.quick-action-grid .ghost-button,
.quick-action-grid .primary-button {
    width: 100%;
}

.section-stage .status-group {
    justify-content: flex-end;
}

.section-cluster-follow {
    margin-top: 22px;
    padding-top: 4px;
    border-top: 1px solid rgba(52, 63, 79, 0.06);
}

.section-cluster-muted {
    opacity: 0.88;
}

.section-card .section-kicker {
    margin-bottom: 8px;
}

.page-home .sidebar-intro {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 241, 232, 0.94));
}

.page-home .sidebar-title {
    letter-spacing: -0.01em;
}

.page-home .primary-button {
    background: linear-gradient(180deg, #6e85a1, #5d748f);
    color: #f8f7f3;
    box-shadow: 0 12px 24px rgba(77, 97, 126, 0.16);
}

.page-home .ghost-button,
.page-home .card-link,
.page-home .filter-chip,
.page-home .view-chip {
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(94, 118, 150, 0.12);
    color: var(--accent);
}

.page-home .ghost-button:hover,
.page-home .card-link:hover {
    background: rgba(255, 255, 255, 0.74);
}

@media (max-width: 1280px) {
    .welcome-hero-main,
    .dashboard-workbench {
        grid-template-columns: 1fr;
    }

    .core-entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workbench-side {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .core-entry-grid,
    .workbench-side {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .page-home .topbar-home {
        padding: 14px 16px;
    }

    .topbar-home-main,
    .topbar-home-copy {
        flex-direction: column;
        align-items: flex-start;
    }

    .welcome-hero {
        padding: 26px 20px;
    }

    .welcome-copy h3 {
        font-size: 2rem;
        line-height: 1.18;
    }

    .welcome-status-panel,
    .core-entry-grid {
        grid-template-columns: 1fr;
    }

    .welcome-status-item strong {
        font-size: 1.4rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .primary-button,
    .hero-actions .ghost-button {
        width: 100%;
    }
}

.view-mobile.page-home .main-panel {
    padding-top: 72px;
}

.view-mobile .page-home .topbar-home {
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 20px;
}

.view-mobile .page-home .topbar-mode-compact {
    padding: 7px 10px;
}

.view-mobile .welcome-hero {
    padding: 22px 18px;
}

.view-mobile .welcome-copy .hero-subtitle {
    font-size: 0.96rem;
    line-height: 1.82;
}

.view-mobile .welcome-meta {
    margin-top: 14px;
}

.view-mobile .welcome-status-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.view-mobile .welcome-status-item {
    padding: 14px;
    border-radius: 18px;
}

.view-mobile .dashboard-workbench {
    grid-template-columns: 1fr;
    gap: 16px;
}

.view-mobile .workbench-main,
.view-mobile .workbench-side {
    gap: 16px;
}

.view-mobile .core-entry-grid {
    grid-template-columns: 1fr;
}

.view-mobile .workbench-entry-card {
    min-height: 0;
    padding: 18px 16px;
    border-radius: 18px;
}

.view-mobile .workbench-entry-card h4 {
    font-size: 1.06rem;
}

.view-mobile .quick-action-grid {
    gap: 8px;
}

/* Phase 5-B: tools pages tightening + global language unification */

.topbar-utility {
    display: flex;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.topbar-support {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.topbar-tools-drawer {
    position: relative;
    z-index: 30;
}

.topbar-tools-drawer summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(94, 118, 150, 0.12);
    color: var(--accent);
    cursor: pointer;
    font-weight: 700;
    transition:
        transform 0.16s ease,
        background-color 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.topbar-tools-drawer summary::-webkit-details-marker {
    display: none;
}

.topbar-tools-drawer[open] summary,
.topbar-tools-drawer summary:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 8px 18px rgba(33, 42, 55, 0.08);
}

.topbar-tools-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
    display: grid;
    gap: 8px;
    min-width: 220px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow:
        0 18px 34px rgba(33, 42, 55, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(18px) saturate(138%);
    -webkit-backdrop-filter: blur(18px) saturate(138%);
}

.library-hero-panel,
.upload-hero-panel {
    padding-bottom: 26px;
}

.library-card-type {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.library-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.library-record-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 244, 239, 0.96));
}

.library-record-card.is-muted {
    background:
        linear-gradient(180deg, rgba(251, 249, 244, 0.96), rgba(245, 241, 235, 0.94));
}

.library-section-card .section-description,
.upload-feedback-stage .section-description,
.upload-history-stage .section-description,
.section-history-stage .section-description {
    max-width: 760px;
}

.upload-intro-grid,
.detail-intro-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.upload-flow-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.upload-form-stage .dropzone {
    padding: 34px 28px;
}

.upload-feedback-summary {
    margin-bottom: 18px;
}

.result-card.success {
    border-color: rgba(23, 105, 87, 0.14);
}

.result-card.failed {
    border-color: rgba(138, 76, 63, 0.14);
}

.upload-feedback-block {
    border-radius: 18px;
    padding: 14px 16px;
}

.upload-feedback-block strong {
    display: block;
    margin-bottom: 10px;
    line-height: 1.5;
}

.upload-feedback-block ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted-strong);
    line-height: 1.82;
}

.upload-feedback-block.is-error {
    background: rgba(138, 76, 63, 0.08);
    border: 1px solid rgba(138, 76, 63, 0.14);
}

.upload-feedback-block.is-warning {
    background: rgba(148, 106, 49, 0.08);
    border: 1px solid rgba(148, 106, 49, 0.14);
}

.reading-hero-refined {
    padding-bottom: 22px;
}

.detail-actions-muted {
    margin-top: 14px;
}

.detail-actions-muted .ghost-button {
    min-height: 38px;
    padding: 9px 16px;
}

.detail-intro-card {
    height: 100%;
}

.reading-stage-refined .filter-toolbar {
    margin-bottom: 20px;
}

.paragraph-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 243, 238, 0.94));
}

.insight-card .status-pill,
.timeline-item .status-pill,
.library-record-card .status-pill {
    white-space: nowrap;
}

.detail-tools-drawer {
    margin-bottom: 22px;
}

.drawer-action-stack {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}

.section-history-stage {
    margin-bottom: 6px;
}

.meta-drawer summary {
    list-style: none;
    cursor: pointer;
}

.meta-drawer summary::-webkit-details-marker {
    display: none;
}

.meta-drawer > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 18px;
    color: var(--muted-strong);
    font-weight: 700;
}

.meta-drawer[open] > summary {
    border-bottom: 1px solid rgba(52, 63, 79, 0.06);
    border-radius: 18px 18px 0 0;
}

.soft-hidden-collection .meta-drawer {
    margin-top: 6px;
}

.soft-hidden-collection .meta-drawer > summary,
.detail-tools-drawer > summary,
.table-drawer > summary {
    background: rgba(255, 255, 255, 0.52);
}

.table-drawer > summary {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(52, 63, 79, 0.07);
}

.table-drawer[open] > summary {
    border-radius: 16px 16px 0 0;
}

.table-drawer .table-scroll {
    padding: 0 8px 8px;
}

.empty-panel {
    background: linear-gradient(180deg, rgba(248, 246, 241, 0.88), rgba(243, 239, 233, 0.9));
    border: 1px dashed rgba(94, 118, 150, 0.18);
}

.flash-card {
    border-radius: 20px;
}

.flash-success {
    border: 1px solid rgba(23, 105, 87, 0.12);
}

.flash-error {
    border: 1px solid rgba(138, 76, 63, 0.12);
}

@media (max-width: 1080px) {
    .upload-intro-grid,
    .detail-intro-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .topbar-utility {
        align-items: stretch;
    }

    .topbar-support,
    .topbar-actions {
        width: 100%;
    }

    .topbar-actions {
        gap: 8px;
    }

    .topbar-actions > .ghost-button,
    .topbar-actions > .primary-button,
    .topbar-tools-drawer {
        width: 100%;
    }

    .topbar-tools-drawer summary {
        width: 100%;
    }

    .topbar-tools-panel {
        position: static;
        min-width: 0;
        margin-top: 8px;
    }

    .upload-form-stage .dropzone {
        padding: 26px 20px;
    }

    .library-record-card,
    .result-card,
    .detail-intro-card {
        border-radius: 18px;
    }
}

.meta-drawer {
    border-radius: 18px;
    border: 1px solid rgba(52, 63, 79, 0.07);
    box-shadow: 0 10px 26px rgba(33, 42, 55, 0.04);
}

.meta-drawer summary {
    padding: 14px 18px;
    color: var(--muted-strong);
    font-weight: 700;
}

.drawer-grid {
    gap: 14px;
}

.drawer-item p {
    margin: 6px 0 0;
    word-break: break-word;
}

.inline-note {
    padding: 16px 18px;
    border-style: dashed;
}

.inline-note p {
    margin: 0;
    color: var(--muted-strong);
}

.upload-page .section-description,
.upload-note p {
    max-width: 70ch;
}

.result-card {
    gap: 14px;
}

.result-card.success {
    border-color: rgba(77, 97, 126, 0.16);
}

.result-card.failed {
    border-color: rgba(152, 113, 75, 0.24);
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 0.9rem;
    color: var(--muted-strong);
}

.upload-feedback-block {
    margin-top: 2px;
}

.upload-feedback-block strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
}

.upload-feedback-block ul {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.reading-note {
    border-radius: 18px;
    background: rgba(255, 253, 249, 0.74);
    border: 1px solid rgba(52, 63, 79, 0.06);
}

.filter-toolbar {
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(248, 246, 241, 0.86);
    border: 1px solid rgba(52, 63, 79, 0.06);
}

.insight-card .insight-body p,
.timeline-excerpt,
.card-excerpt {
    line-height: 1.78;
}

.section-preview-card,
.supporting-source {
    border-radius: 16px;
}

.debug-hero {
    margin-bottom: 14px;
}

.debug-drawer {
    margin-bottom: 16px;
}

.debug-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 244, 238, 0.96));
}

.debug-facts div {
    background: rgba(255, 255, 255, 0.62);
    border-radius: 16px;
    padding: 12px 14px;
}

.debug-preview pre {
    min-height: 140px;
    border-radius: 16px;
    background: rgba(247, 243, 236, 0.84);
}

.flash-card {
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(33, 42, 55, 0.06);
}

@media (max-width: 1080px) {
    .auth-stage-grid,
    .access-manage-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .auth-stage {
        padding: 22px;
    }

    .audit-log-head,
    .result-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

.topbar-auth-shell {
    padding-block: 18px 8px;
}

.topbar-auth-main {
    align-items: flex-end;
}

.topbar-auth-copy h2 {
    margin-bottom: 8px;
}

.history-hero-panel,
.history-current-hero,
.library-detail-stage,
.access-manage-hero,
.debug-stage-hero {
    margin-bottom: 18px;
}

.history-summary-strip,
.debug-summary-strip {
    margin-top: 18px;
}

.history-current-hero .hero-head,
.history-trajectory-head,
.library-detail-stage .hero-head,
.access-manage-hero .hero-head,
.debug-stage-hero .hero-head {
    align-items: flex-start;
}

.timeline-note {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.timeline-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 12px;
}

.history-trajectory-list,
.library-detail-version-list,
.access-identity-list {
    gap: 16px;
}

.history-trajectory-card,
.library-detail-version-card,
.access-identity-card {
    border-radius: 26px;
    padding: 22px 22px 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 244, 238, 0.97));
    border: 1px solid rgba(52, 63, 79, 0.07);
    box-shadow: 0 14px 34px rgba(33, 42, 55, 0.05);
}

.history-trajectory-card.is-current,
.library-detail-version-card.is-current {
    border-color: rgba(78, 105, 138, 0.16);
    box-shadow: 0 16px 38px rgba(52, 72, 98, 0.08);
}

.history-trajectory-stage,
.library-detail-meta-stage,
.library-detail-stage-card,
.access-form-stage,
.access-list-stage {
    margin-bottom: 18px;
}

.history-trajectory-card .timeline-head,
.library-detail-version-card .timeline-head {
    align-items: flex-start;
}

.history-trajectory-card .timeline-actions,
.library-detail-version-card .timeline-actions {
    margin-top: 16px;
}

.library-detail-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.library-detail-card {
    min-width: 0;
}

.library-detail-card p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.library-detail-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-section-card .card-note {
    margin-top: 14px;
}

.library-detail-drawer {
    margin-top: 4px;
}

.access-code-callout {
    margin-bottom: 18px;
}

.access-code-banner {
    display: inline-flex;
    align-items: center;
    padding: 14px 18px;
    border-radius: 18px;
    background: rgba(244, 238, 228, 0.92);
    border: 1px solid rgba(125, 107, 87, 0.12);
    box-shadow: 0 10px 26px rgba(43, 49, 58, 0.05);
    font-size: 1rem;
    letter-spacing: 0.03em;
    color: var(--text);
}

.access-stage-layout,
.access-audit-layout {
    margin-bottom: 18px;
}

.access-side-stage,
.access-log-stage {
    min-height: 100%;
}

.access-note-stack {
    display: grid;
    gap: 14px;
}

.access-note-card {
    min-height: 0;
}

.access-note-card p {
    margin: 0;
}

.access-manage-form textarea {
    min-height: 108px;
}

.access-identity-card .card-note {
    margin: 12px 0 0;
}

.auth-gate-stage {
    max-width: 980px;
}

.auth-gate-grid {
    align-items: stretch;
}

.auth-gate-main {
    display: grid;
    gap: 18px;
}

.auth-gate-intro,
.auth-gate-note-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-gate-form {
    padding-top: 4px;
}

.auth-gate-side {
    justify-content: flex-start;
    gap: 14px;
}

.auth-gate-side p {
    margin: 0;
}

.debug-stage-list {
    gap: 18px;
}

.debug-stage-hero .hero-subtitle {
    max-width: 760px;
}

.debug-card .timeline-note {
    max-width: 720px;
}

.debug-card .debug-facts {
    margin-top: 18px;
}

.page-history .topbar-summary,
.page-library .topbar-summary,
.page-access_manage .topbar-summary,
.page-debug .topbar-summary {
    max-width: 720px;
}

.page-history .section-header h3,
.page-library .section-header h3,
.page-access_manage .section-header h3,
.page-debug .section-header h3 {
    letter-spacing: -0.01em;
}

.page-history .overview-tile,
.page-library .overview-tile,
.page-access_manage .overview-tile,
.page-debug .overview-tile {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 244, 238, 0.97));
    border: 1px solid rgba(52, 63, 79, 0.07);
    box-shadow: 0 10px 24px rgba(33, 42, 55, 0.045);
}

@media (max-width: 1180px) {
    .library-detail-overview {
        grid-template-columns: 1fr;
    }

    .library-detail-section-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .topbar-auth-main,
    .history-current-hero .hero-head,
    .history-trajectory-head,
    .library-detail-stage .hero-head,
    .access-manage-hero .hero-head,
    .debug-stage-hero .hero-head {
        flex-direction: column;
    }

    .history-trajectory-card,
    .library-detail-version-card,
    .access-identity-card {
        padding: 20px 18px 18px;
        border-radius: 22px;
    }

    .access-code-banner {
        width: 100%;
        justify-content: center;
        text-align: center;
        word-break: break-all;
    }
}

.view-mobile .history-summary-strip,
.view-mobile .debug-summary-strip,
.view-mobile .library-detail-overview,
.view-mobile .library-detail-section-grid,
.view-mobile .timeline-meta-row,
.view-mobile .auth-gate-intro,
.view-mobile .auth-gate-note-list {
    grid-template-columns: 1fr;
}

.view-mobile .history-summary-strip,
.view-mobile .debug-summary-strip,
.view-mobile .library-detail-overview {
    display: grid;
    gap: 12px;
}

.view-mobile .timeline-meta-row,
.view-mobile .auth-gate-intro,
.view-mobile .auth-gate-note-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.view-mobile .history-trajectory-card,
.view-mobile .library-detail-version-card,
.view-mobile .access-identity-card {
    padding: 18px 16px;
    border-radius: 20px;
}

.view-mobile .history-trajectory-head,
.view-mobile .timeline-head,
.view-mobile .debug-card-head,
.view-mobile .archive-head {
    flex-direction: column;
}

.view-mobile .access-stage-layout,
.view-mobile .access-audit-layout {
    grid-template-columns: 1fr;
}

.view-mobile .auth-gate-stage,
.view-mobile .auth-stage {
    padding: 20px 18px;
    border-radius: 24px;
}

.view-mobile .access-code-banner {
    font-size: 0.94rem;
}

/* Phase 5-D: brand warming + access reset */

:root {
    --bg: #f6f0e8;
    --bg-deep: #ece3d8;
    --surface: rgba(255, 250, 244, 0.9);
    --surface-strong: rgba(255, 252, 248, 0.97);
    --surface-soft: rgba(247, 240, 231, 0.88);
    --surface-accent: rgba(109, 89, 69, 0.08);
    --line: rgba(101, 84, 64, 0.1);
    --line-strong: rgba(101, 84, 64, 0.16);
    --text: #30261f;
    --muted: #77695d;
    --muted-strong: #5f5145;
    --accent: #685441;
    --accent-soft: rgba(104, 84, 65, 0.11);
    --gold: #9d7447;
    --background: #6a725f;
    --retained: #6b7381;
    --shadow-soft: 0 28px 64px rgba(72, 57, 39, 0.08);
    --shadow-card: 0 18px 40px rgba(72, 57, 39, 0.06);
}

body {
    background:
        radial-gradient(circle at top left, rgba(167, 131, 89, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(103, 85, 66, 0.12), transparent 24%),
        linear-gradient(180deg, #fbf6ef 0%, #efe6da 100%);
}

.topbar,
.page-home .topbar-home,
.topbar-tools-panel,
.auth-stage,
.auth-side-panel,
.change-code-stage {
    border-color: rgba(112, 94, 73, 0.1);
    box-shadow: 0 18px 42px rgba(67, 52, 36, 0.06);
}

.topbar,
.page-home .topbar-home {
    background:
        linear-gradient(180deg, rgba(255, 252, 248, 0.8), rgba(248, 241, 233, 0.9));
}

.topbar-mode,
.topbar-mode-compact,
.topbar-tools-drawer summary,
.view-chip,
.ghost-button,
.card-link,
.filter-chip {
    background: rgba(255, 248, 241, 0.74);
    border: 1px solid rgba(107, 87, 67, 0.12);
    color: var(--accent);
}

.topbar-tools-drawer[open] summary,
.topbar-tools-drawer summary:hover,
.ghost-button:hover,
.card-link:hover,
.filter-chip:hover,
.view-chip:hover {
    background: rgba(255, 251, 246, 0.92);
    border-color: rgba(107, 87, 67, 0.18);
}

.primary-button,
.page-home .primary-button {
    background: linear-gradient(180deg, #79614a, #654f3d);
    color: #fbf5ee;
    box-shadow: 0 12px 26px rgba(101, 79, 61, 0.18);
}

.primary-button:hover,
.page-home .primary-button:hover {
    box-shadow: 0 14px 30px rgba(101, 79, 61, 0.2);
}

.welcome-hero {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.52), transparent 28%),
        linear-gradient(180deg, rgba(255, 252, 247, 0.62), rgba(247, 241, 233, 0.96)),
        linear-gradient(135deg, rgba(150, 123, 92, 0.08), rgba(255, 255, 255, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.44);
    box-shadow:
        0 18px 46px rgba(72, 57, 39, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.brand-hero-title {
    margin: 4px 0 0;
    font-size: clamp(2.8rem, 5vw, 4.4rem);
    line-height: 1.04;
    letter-spacing: -0.04em;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.brand-hero-subtitle {
    margin: 12px 0 0;
    color: var(--muted-strong);
    font-size: 1.06rem;
    line-height: 1.7;
    letter-spacing: 0.02em;
}

.brand-hero-slogan {
    margin: 10px 0 0;
    color: var(--text);
    font-size: 1.18rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
}

.welcome-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.page-home .topbar-kicker,
.brand-kicker,
.section-kicker,
.meta-label,
.nav-group-title,
.topbar-mode-label {
    color: #857260;
}

.meta-chip,
.info-chip.muted {
    background: rgba(134, 115, 92, 0.11);
    color: var(--muted-strong);
}

.meta-chip.soft,
.info-chip.soft {
    background: rgba(104, 84, 65, 0.08);
    color: var(--accent);
}

.auth-stage,
.change-code-stage {
    background:
        linear-gradient(180deg, rgba(255, 252, 248, 0.92), rgba(247, 240, 232, 0.96));
}

.auth-side-panel {
    background:
        linear-gradient(180deg, rgba(250, 244, 236, 0.9), rgba(245, 237, 228, 0.96));
}

.change-code-form .form-field input {
    background: rgba(255, 252, 248, 0.86);
}

.change-code-stage .meta-chip {
    align-self: flex-start;
}

.flash-card {
    border-color: rgba(112, 94, 73, 0.12);
    box-shadow: 0 14px 30px rgba(67, 52, 36, 0.05);
}

@media (max-width: 960px) {
    .brand-hero-title {
        font-size: clamp(2.3rem, 10vw, 3.1rem);
        line-height: 1.08;
    }

    .brand-hero-subtitle {
        font-size: 0.98rem;
    }

    .brand-hero-slogan {
        font-size: 1.02rem;
        line-height: 1.76;
    }

    .welcome-meta {
        margin-top: 16px;
    }
}

/* Final polish: homepage hero, scroll sections, and layout tightening */

.page-home .welcome-heading {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.16em;
    margin: 8px 0 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-size: clamp(1.92rem, 2.8vw, 2.88rem);
    line-height: 1.06;
    letter-spacing: -0.03em;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
    white-space: nowrap;
}

.page-home .welcome-heading-prefix {
    flex: 0 0 auto;
}

.page-home .welcome-heading-name {
    flex: 0 1 auto;
    display: inline-flex;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-home .welcome-hero-reading .welcome-heading {
    max-width: 100%;
}

.page-home .welcome-copy .hero-subtitle {
    max-width: 720px;
    margin: 6px 0 0;
    color: var(--muted-strong);
    font-size: 1.08rem;
    line-height: 1.5;
    font-weight: 600;
}

.page-home .dashboard-workbench-focus {
    display: grid;
    grid-template-columns: minmax(0, 1.72fr) minmax(280px, 0.92fr);
    gap: 20px;
    align-items: start;
}

.page-home .stage-full-width,
.page-home .stage-compact-width {
    width: 100%;
}

.page-home .stage-grid-single {
    grid-template-columns: 1fr;
}

.page-home .history-archive-stage .section-header {
    align-items: flex-start;
}

.page-home .history-archive-stage .section-description {
    margin: 8px 0 0;
    max-width: 680px;
    color: var(--muted-strong);
    line-height: 1.66;
}

.page-home .history-archive-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.page-home .history-archive-card {
    padding: 20px 22px;
    border-radius: 20px;
    background: #fffdf9;
    border: 1px solid rgba(52, 63, 79, 0.08);
    box-shadow: 0 10px 26px rgba(33, 42, 55, 0.045);
}

.page-home .history-archive-card strong {
    display: block;
    margin-top: 10px;
    font-size: 1.24rem;
    line-height: 1.28;
    font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

.page-home .history-archive-card p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.72;
}

@media (max-width: 1280px) {
    .page-home .dashboard-workbench-focus {
        grid-template-columns: 1fr;
    }

    .page-home .dashboard-workbench-focus .workbench-side {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .page-home .dashboard-workbench-focus .workbench-side,
    .page-home .history-archive-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .page-home .welcome-heading {
        gap: 0.14em;
        font-size: clamp(1.56rem, 6.8vw, 2.12rem);
        line-height: 1.08;
    }

    .page-home .welcome-copy .hero-subtitle {
        margin-top: 5px;
        font-size: 1rem;
        line-height: 1.48;
    }

    .page-home .history-archive-stage .section-header {
        flex-direction: column;
    }
}

.view-mobile .page-home .welcome-copy .hero-subtitle {
    font-size: 0.98rem;
    line-height: 1.48;
}
