/* ==========================================================================
   Design tokens: Bootstrap's variables, re-tuned. theme.js sets data-bs-theme.
   No web fonts (the CSP allows only 'self'): the system UI face is the brand.
   ========================================================================== */
:root, [data-bs-theme=light] {
    --font-sans: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Iowan Old Style", Charter, "Bitstream Charter", "PT Serif", Georgia, serif;
    --surface: #fff;
    --surface-raised: #fff;
    --header-bg: rgba(250, 250, 251, .78);
    --shadow-sm: 0 1px 2px rgba(16, 16, 24, .04), 0 1px 1px rgba(16, 16, 24, .03);
    --shadow-md: 0 1px 2px rgba(16, 16, 24, .04), 0 6px 20px -6px rgba(16, 16, 24, .10);
    --accent-soft: #eef0ff;

    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: .9375rem;
    --bs-body-line-height: 1.55;
    --bs-body-bg: #fafafb;
    --bs-body-bg-rgb: 250, 250, 251;
    --bs-body-color: #1b1b22;
    --bs-body-color-rgb: 27, 27, 34;
    --bs-heading-color: #111118;
    --bs-emphasis-color: #0b0b10;
    --bs-secondary-color: #6b6b78;
    --bs-secondary-color-rgb: 107, 107, 120;
    --bs-secondary-bg: #ececf1;
    --bs-tertiary-bg: #f3f3f6;
    --bs-border-color: #e4e4ea;
    --bs-border-color-translucent: rgba(16, 16, 32, .08);

    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-primary-text-emphasis: #312e81;
    --bs-primary-bg-subtle: #eef0ff;
    --bs-primary-border-subtle: #c7cbfb;
    --bs-link-color: #4338ca;
    --bs-link-color-rgb: 67, 56, 202;
    --bs-link-hover-color: #312e81;
    --bs-link-hover-color-rgb: 49, 46, 129;
    --bs-focus-ring-color: rgba(79, 70, 229, .22);

    --bs-success-bg-subtle: #e9f8ef;
    --bs-success-border-subtle: #b4e4c6;
    --bs-success-text-emphasis: #11643a;

    --bs-border-radius: .5rem;
    --bs-border-radius-sm: .375rem;
    --bs-border-radius-lg: .75rem;
    --bs-border-radius-xl: 1rem;
}

[data-bs-theme=dark] {
    --surface: #16161c;
    --surface-raised: #1c1c23;
    --header-bg: rgba(14, 14, 18, .72);
    --shadow-sm: 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-md: 0 0 0 1px rgba(255, 255, 255, .03), 0 8px 24px -8px rgba(0, 0, 0, .6);
    --accent-soft: #1f1d45;

    --bs-body-bg: #0e0e12;
    --bs-body-bg-rgb: 14, 14, 18;
    --bs-body-color: #e3e3e8;
    --bs-body-color-rgb: 227, 227, 232;
    --bs-heading-color: #f4f4f7;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: #9a9aa8;
    --bs-secondary-color-rgb: 154, 154, 168;
    --bs-secondary-bg: #26262f;
    --bs-tertiary-bg: #1b1b22;
    --bs-border-color: #2a2a34;
    --bs-border-color-translucent: rgba(255, 255, 255, .08);

    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-primary-text-emphasis: #c7cbfb;
    --bs-primary-bg-subtle: #1f1d45;
    --bs-primary-border-subtle: #3c3a8a;
    --bs-link-color: #a5b0fc;
    --bs-link-color-rgb: 165, 176, 252;
    --bs-link-hover-color: #c9cffd;
    --bs-link-hover-color-rgb: 201, 207, 253;
    --bs-focus-ring-color: rgba(129, 140, 248, .3);
}

/* ==========================================================================
   Base
   ========================================================================== */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 650;
    letter-spacing: -.015em;
}
h5, .h5, h6, .h6 { letter-spacing: -.005em; }
a { text-decoration: none; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .list-group-item-action:hover, .brand:hover { text-decoration: none; }
::selection { background: rgba(var(--bs-primary-rgb), .2); }

.tabular { font-variant-numeric: tabular-nums; }
.eyebrow {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.section-title { font-size: 1rem; font-weight: 650; margin: 0 0 .75rem; }
.page-head { margin-bottom: 1.75rem; }
.page-title { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.2; margin: .25rem 0 .5rem; }
.page-lead { color: var(--bs-secondary-color); margin: 0; max-width: 48rem; }

/* ==========================================================================
   Bootstrap components, re-tuned
   ========================================================================== */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: var(--bs-border-radius);
    --bs-btn-focus-box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
    transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: color-mix(in srgb, var(--bs-primary) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--bs-primary) 88%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--bs-primary) 80%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--bs-primary) 80%, #000);
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
    box-shadow: 0 1px 2px rgba(var(--bs-primary-rgb), .25), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-bg: var(--surface);
    --bs-btn-hover-color: var(--bs-link-color);
    --bs-btn-hover-bg: var(--accent-soft);
    --bs-btn-hover-border-color: var(--bs-primary-border-subtle);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bs-primary);
    --bs-btn-active-border-color: var(--bs-primary);
}
.btn-outline-secondary {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: var(--surface);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-hover-bg: var(--bs-tertiary-bg);
    --bs-btn-hover-border-color: var(--bs-border-color);
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-bg: var(--bs-secondary-bg);
    --bs-btn-active-border-color: var(--bs-border-color);
    box-shadow: var(--shadow-sm);
}
.btn-link { --bs-btn-color: var(--bs-link-color); --bs-btn-hover-color: var(--bs-link-hover-color); font-weight: 500; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }

.form-control, .form-select {
    background-color: var(--surface);
    border-color: var(--bs-border-color);
    box-shadow: var(--shadow-sm);
}
.form-control::placeholder { color: var(--bs-secondary-color); opacity: .8; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    background-color: var(--surface);
    border-color: rgba(var(--bs-primary-rgb), .55);
    box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
}
.form-check-input { border-color: color-mix(in srgb, var(--bs-border-color) 60%, var(--bs-secondary-color)); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.form-label { font-weight: 500; }

.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--bs-border-color);
    --bs-card-cap-bg: transparent;
    --bs-card-border-radius: var(--bs-border-radius-lg);
    --bs-card-inner-border-radius: calc(var(--bs-border-radius-lg) - 1px);
    box-shadow: var(--shadow-sm);
}
.list-group {
    --bs-list-group-bg: var(--surface);
    --bs-list-group-border-color: var(--bs-border-color);
    --bs-list-group-border-radius: var(--bs-border-radius-lg);
    --bs-list-group-action-hover-bg: var(--bs-tertiary-bg);
    --bs-list-group-action-active-bg: var(--bs-secondary-bg);
    box-shadow: var(--shadow-sm);
}
.progress, .progress-stacked {
    --bs-progress-bg: var(--bs-secondary-bg);
    --bs-progress-bar-bg: var(--bs-primary);
    --bs-progress-border-radius: 999px;
}
.progress { margin-bottom: 3px; }
.alert { --bs-alert-border-radius: var(--bs-border-radius-lg); }

/* Tabs as an underline, not boxed folders. */
.nav-tabs {
    --bs-nav-tabs-border-width: 0;
    --bs-nav-link-color: var(--bs-secondary-color);
    --bs-nav-link-hover-color: var(--bs-body-color);
    gap: 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.nav-tabs .nav-link {
    padding: .625rem 0;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    font-weight: 500;
}
.nav-tabs .nav-link.active {
    color: var(--bs-heading-color);
    background: none;
    border-bottom-color: var(--bs-primary);
}

/* A segmented control. */
.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: var(--bs-border-radius);
    background: var(--bs-secondary-bg);
}
.segmented a {
    padding: .25rem .75rem;
    border-radius: calc(var(--bs-border-radius) - 2px);
    color: var(--bs-secondary-color);
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
}
.segmented a:hover { color: var(--bs-body-color); text-decoration: none; }
.segmented a.active { background: var(--surface); color: var(--bs-heading-color); box-shadow: var(--shadow-md); }

/* Tables: light rules, quiet headers, no zebra. */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--bs-tertiary-bg);
    --bs-table-border-color: var(--bs-border-color);
    margin-bottom: 0;
}
.table > thead > tr > th {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    border-bottom-color: var(--bs-border-color);
    white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .625rem .75rem; }
.table-sm > :not(caption) > * > * { padding: .5rem .625rem; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table-card {
    overflow-x: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.table-card > .table > thead > tr > th { background: var(--bs-tertiary-bg); }
.table-card > .table > thead > tr > th:first-child { border-top-left-radius: var(--bs-border-radius-lg); }
.table-card > .table > thead > tr > th:last-child { border-top-right-radius: var(--bs-border-radius-lg); }

.doc-title-cell { min-width: 16rem; }
.doc-author-cell { min-width: 9rem; font-weight: 500; }
.type-tag {
    display: inline-block;
    margin-left: .25rem;
    padding: 0 .4em;
    border-radius: .25rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: .75rem;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: 1px;
}
.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border: 1px solid var(--bs-success-border-subtle);
    border-radius: 999px;
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
    font-size: .8125rem;
    font-weight: 600;
    white-space: nowrap;
}
.pdf-link:hover { text-decoration: none; filter: brightness(.97); color: var(--bs-success-text-emphasis); }

.people-cell { min-width: 13rem; }
@media (max-width: 575.98px) {
    .doc-table thead { display: none; }
    .doc-table tr { display: grid; grid-template-columns: 1fr auto; column-gap: .75rem; padding: .75rem .875rem; border-bottom: 1px solid var(--bs-border-color); }
    .doc-table tr:last-child { border-bottom: 0; }
    .doc-table > tbody > tr > td { padding: 0; border: 0; min-width: 0; }
    .doc-table td:nth-child(1) { grid-column: 1; }
    .doc-table td:nth-child(2) { grid-column: 1 / -1; margin-top: .125rem; }
    .doc-table td:nth-child(3) { grid-column: 1; font-size: .8125rem; margin-top: .25rem; }
    .doc-table td:nth-child(4) { grid-column: 2; grid-row: 1; }
}
.pager { display: flex; gap: .5rem; margin-top: 1rem; }
.empty-state {
    padding: 2.5rem 1.5rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    color: var(--bs-secondary-color);
    text-align: center;
}

/* ==========================================================================
   Site chrome
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
}
.site-header-inner { display: flex; align-items: center; gap: 2rem; height: 3.5rem; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    flex: none;
    color: var(--bs-heading-color);
    font-weight: 700;
    letter-spacing: -.02em;
}
.brand:hover { color: var(--bs-heading-color); }
.brand-mark {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: .5rem;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff;
    font-size: .875rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(67, 56, 202, .4);
}
.brand-tld { color: var(--bs-secondary-color); font-weight: 500; }
.site-nav { display: flex; gap: .25rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.site-nav a, .site-signout {
    padding: .375rem .75rem;
    border: 0;
    border-radius: var(--bs-border-radius);
    background: none;
    color: var(--bs-secondary-color);
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
}
.site-nav a:hover, .site-signout:hover { color: var(--bs-body-color); background: var(--bs-tertiary-bg); text-decoration: none; }
.site-nav a[aria-current=page] { color: var(--bs-heading-color); background: var(--bs-secondary-bg); }
.site-signout-form { margin-left: auto; }
.site-main { padding-top: 2rem; padding-bottom: 4rem; }

@media (max-width: 575.98px) {
    .site-header-inner { gap: .5rem; }
    .brand-text { display: none; }
    .site-nav { gap: 0; }
    .site-nav a, .site-signout { padding: .375rem .45rem; font-size: .8125rem; }
    .site-main { padding-top: 1.25rem; }
}

/* ==========================================================================
   Home: search hero and archive numbers
   ========================================================================== */
.hero { max-width: 52rem; margin: 2.5rem auto 3rem; text-align: center; }
.hero-title { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem); line-height: 1.1; letter-spacing: -.03em; margin-bottom: .75rem; }
.hero-lead { color: var(--bs-secondary-color); font-size: 1.0625rem; margin-bottom: 2rem; }
.hero form { text-align: left; }
.hero-compact { margin: 0 0 1.75rem; max-width: none; }

.search-box {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    transition: border-color .12s, box-shadow .12s;
}
.search-box:focus-within { border-color: rgba(var(--bs-primary-rgb), .55); box-shadow: var(--shadow-md), 0 0 0 4px var(--bs-focus-ring-color); }
.search-box .form-select, .search-box .form-control {
    border: 0;
    background-color: transparent;
    box-shadow: none;
}
.search-box .form-select:focus, .search-box .form-control:focus { box-shadow: none; }
.search-scope {
    flex: none;
    width: auto;
    max-width: 14rem;
    padding-left: 1rem;
    border-right: 1px solid var(--bs-border-color) !important;
    border-radius: var(--bs-border-radius-xl) 0 0 var(--bs-border-radius-xl);
    color: var(--bs-secondary-color);
    font-size: .875rem;
    font-weight: 500;
}
.search-field { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.search-field svg { position: absolute; left: 1rem; color: var(--bs-secondary-color); pointer-events: none; }
.search-field .form-control { padding: .875rem 1rem .875rem 2.75rem; font-size: 1.0625rem; }
.search-box > .btn { margin: .375rem; padding-inline: 1.25rem; border-radius: var(--bs-border-radius); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-top: .875rem; }
.filter-bar .form-select, .filter-bar .form-control { width: auto; }
.filter-bar .form-check { margin: 0 0 0 .25rem; }
.filter-bar .year-input { width: 6.5rem; }
.hero .filter-bar { justify-content: center; }
.hero-compact .filter-bar { justify-content: flex-start; }

@media (max-width: 575.98px) {
    .stat { padding: .875rem 1rem; }
    .stat-value { font-size: 1.375rem; }
    .hero { margin-top: 1rem; margin-bottom: 2rem; }
    .search-box { flex-wrap: wrap; }
    .search-scope { max-width: none; width: 100%; border-right: 0 !important; border-bottom: 1px solid var(--bs-border-color) !important; border-radius: var(--bs-border-radius-xl) var(--bs-border-radius-xl) 0 0; padding-block: .625rem; }
    .search-field { flex-basis: 100%; }
    .search-box > .btn { flex: 1; margin-top: 0; }
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    gap: .75rem;
}
.stat {
    padding: 1.125rem 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.stat-value { font-size: 1.625rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--bs-heading-color); }
.stat-value small { font-size: .9375rem; font-weight: 500; color: var(--bs-secondary-color); letter-spacing: 0; }
.stat-label { color: var(--bs-secondary-color); font-size: .875rem; margin-top: .125rem; }
.stat .progress { height: .375rem; margin: .625rem 0 0; }
.stat-warn .stat-value { color: var(--bs-warning-text-emphasis); }

.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .75rem; }
.shortcut {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.125rem 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--bs-body-color);
    transition: border-color .12s, box-shadow .12s, transform .12s;
}
.shortcut:hover { border-color: var(--bs-primary-border-subtle); box-shadow: var(--shadow-md); color: var(--bs-body-color); text-decoration: none; transform: translateY(-1px); }
.shortcut-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .625rem;
    background: var(--accent-soft);
    color: var(--bs-link-color);
}
.shortcut-title { font-weight: 600; color: var(--bs-heading-color); }
.shortcut-text { font-size: .875rem; color: var(--bs-secondary-color); }

/* ==========================================================================
   Document
   ========================================================================== */
.doc-head { margin-bottom: 1.75rem; max-width: 56rem; }
.doc-title { font-size: clamp(1.375rem, 1.1rem + 1.1vw, 1.875rem); line-height: 1.25; margin: .375rem 0 .625rem; }
.doc-author { font-size: 1.125rem; font-weight: 500; color: var(--bs-body-color); }
.doc-author small { color: var(--bs-secondary-color); font-size: .9375rem; font-weight: 400; }

.facts { margin: 0; }
.facts > div {
    display: grid;
    grid-template-columns: 13rem 1fr;
    gap: .25rem 1.5rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { font-weight: 500; color: var(--bs-secondary-color); font-size: .875rem; padding-top: .1rem; }
.facts dd { grid-column: 2; margin: 0; }
.facts dd + dd { margin-top: .25rem; }
.fact-note { color: var(--bs-secondary-color); font-size: .875rem; }
@media (max-width: 767.98px) {
    .facts > div { grid-template-columns: 1fr; }
    .facts dd { grid-column: 1; }
}

.doc-aside { position: sticky; top: 4.5rem; display: grid; gap: 1rem; }
.download-card { padding: 1.25rem; }
.download-card .btn { width: 100%; padding-block: .625rem; }
.download-meta { margin-top: .5rem; color: var(--bs-secondary-color); font-size: .8125rem; text-align: center; }
.doc-state { display: flex; gap: .75rem; align-items: center; font-weight: 600; }
.doc-state-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--bs-secondary-color); flex: none; }
.source-list { list-style: none; margin: 0; padding: 0; }
.source-list li { padding: .75rem 1.25rem; border-bottom: 1px solid var(--bs-border-color); }
.source-list li:last-child { border-bottom: 0; }
.source-list a { font-weight: 500; }
.source-list div { color: var(--bs-secondary-color); font-size: .8125rem; }
.card-label { padding: .875rem 1.25rem 0; }

/* ==========================================================================
   Person
   ========================================================================== */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
    display: inline-flex;
    align-items: baseline;
    gap: .35rem;
    padding: .25rem .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--surface);
    font-size: .875rem;
    color: var(--bs-secondary-color);
}
.chip b { color: var(--bs-heading-color); font-weight: 600; font-variant-numeric: tabular-nums; }
.own-work { list-style: none; padding: 0; margin: 0; }
.own-work li { padding: .875rem 1.25rem; border-bottom: 1px solid var(--bs-border-color); }
.own-work li:last-child { border-bottom: 0; }

/* ==========================================================================
   Sign-in and errors
   ========================================================================== */
.auth { max-width: 24rem; margin: 3rem auto; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head .brand-mark { width: 2.75rem; height: 2.75rem; font-size: 1.25rem; border-radius: .75rem; margin: 0 auto 1rem; }
.auth .card-body { padding: 1.5rem; }
.not-found { text-align: center; margin: 4rem auto; max-width: 28rem; }
.not-found-code { font-size: 4rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; color: var(--bs-secondary-bg); }

/* ==========================================================================
   Verdict colours: one set of tokens per level, used by the headline, badges and cards
   ========================================================================== */
.verdict-low  { --v-bg: var(--bs-success-bg-subtle); --v-border: var(--bs-success-border-subtle); --v-text: var(--bs-success-text-emphasis); }
.verdict-mid  { --v-bg: var(--bs-warning-bg-subtle); --v-border: var(--bs-warning-border-subtle); --v-text: var(--bs-warning-text-emphasis); }
.verdict-high { --v-bg: var(--bs-danger-bg-subtle);  --v-border: var(--bs-danger-border-subtle);  --v-text: var(--bs-danger-text-emphasis); }
.verdict-none { --v-bg: var(--bs-tertiary-bg);       --v-border: var(--bs-border-color);          --v-text: var(--bs-secondary-color); }

.verdict {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--v-border);
    border-radius: var(--bs-border-radius-xl);
    background: var(--v-bg);
}
.verdict:not(:has(.verdict-figure)) { display: block; }
.verdict-figure {
    flex: none;
    min-width: 4.5ch;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--v-text);
    font-variant-numeric: tabular-nums;
}
.verdict-title { font-size: 1.125rem; font-weight: 650; color: var(--v-text); }
.verdict-detail { margin-top: .25rem; color: var(--bs-body-color); }

.verdict-badge {
    display: inline-block;
    padding: .2em .65em;
    border: 1px solid var(--v-border);
    border-radius: 999px;
    background: var(--v-bg);
    color: var(--v-text);
    font-size: .8125rem;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Check list --- */
.check-meta { font-size: .8125rem; color: var(--bs-secondary-color); }
.check-row { display: flex; align-items: center; gap: 1rem; padding: .875rem 1.125rem; }
.check-row-main { flex: 1; min-width: 0; }
.check-row-name { font-weight: 500; }
.check-row-status { flex: none; display: flex; align-items: center; gap: .5rem; }
.progress-slim { width: 6rem; height: .375rem; margin: 0; }
.lock-icon { vertical-align: -1px; }

/* --- New Check --- */
.new-check > summary { list-style: none; }
.new-check > summary::-webkit-details-marker { display: none; }
.new-check[open] > summary { display: none; }
.new-check .card-body { padding: 1.5rem; }
.rate-picker { gap: .375rem; }
.rate-picker > .btn { min-width: 3.75rem; font-variant-numeric: tabular-nums; border-radius: var(--bs-border-radius) !important; margin: 0 !important; }

/* --- Running Check --- */
.status-card {
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.status-card .progress { height: .5rem; margin: 0; }

/* --- Evidence --- */
.match { overflow: hidden; }
.match[open] { border-color: var(--bs-primary-border-subtle); }
.match-header, .weak-matches > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem 1rem;
    padding: .875rem 1.125rem;
    cursor: pointer;
    list-style: none;
}
.match:not([open]) > .match-header, .weak-matches:not([open]) > summary { border-bottom: 0; }
.match-header:hover, .weak-matches > summary:hover { background: var(--bs-tertiary-bg); }
.match-header::-webkit-details-marker, .weak-matches > summary::-webkit-details-marker { display: none; }
.match-header::before, .weak-matches > summary::before {
    content: "";
    align-self: center;
    width: .45rem;
    height: .45rem;
    border-right: 1.5px solid var(--bs-secondary-color);
    border-bottom: 1.5px solid var(--bs-secondary-color);
    transform: rotate(-45deg);
    transition: transform .15s;
}
details[open] > .match-header::before, .weak-matches[open] > summary::before { transform: rotate(45deg); }
.match-title { font-weight: 600; }
.match-type { color: var(--bs-secondary-color); font-size: .875rem; }
.match-count { margin-left: auto; font-size: .875rem; font-variant-numeric: tabular-nums; color: var(--bs-secondary-color); }

.hit-page {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 1rem;
    padding: .875rem 0;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}
.hit-page:last-child { border-bottom: 0; padding-bottom: 0; }
.hit-page-number { font-weight: 600; font-variant-numeric: tabular-nums; }
.page-button.htmx-request::after { content: " — загружаем…"; }
.page-images { margin-top: .5rem; }
.page-image { max-width: 100%; border-radius: var(--bs-border-radius); }
.hit-quote {
    margin: 0 0 .5rem;
    padding: .125rem 0 .125rem .875rem;
    border-left: 3px solid var(--bs-primary-border-subtle);
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    line-height: 1.55;
}

@media (max-width: 575.98px) {
    .verdict { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .hit-page { grid-template-columns: 1fr; gap: .25rem; }
    .check-row { flex-direction: column; align-items: flex-start; gap: .375rem; }
}

/* --- Annotated text --- */
.source-number {
    display: inline-block;
    min-width: 1.5em;
    padding: 0 .35em;
    border-radius: .375rem;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    font-size: .8125rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.text-legend { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; color: var(--bs-secondary-color); }
.text-legend > div { flex-basis: 100%; }
.annotated-text {
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    line-height: 1.75;
    max-width: 46rem;
}
.text-line { margin: 0 0 .5rem; white-space: pre-wrap; overflow-wrap: anywhere; }
mark.seg-hit {
    padding: .05em .1em;
    border-radius: .2em;
    background: var(--v-bg);
    box-shadow: inset 0 -2px 0 var(--v-border);
    color: inherit;
    cursor: pointer;
}
mark.seg-hit:hover, mark.seg-hit.is-open { box-shadow: inset 0 -2px 0 var(--v-text); }
.seg-refs {
    margin-left: .1em;
    color: var(--v-text);
    font-family: var(--bs-body-font-family);
    font-size: .65em;
    font-weight: 600;
}
.seg-clean {
    text-decoration: underline dotted var(--bs-success-border-subtle);
    text-decoration-thickness: 2px;
    text-underline-offset: .2em;
}
.text-legend .seg-hit { cursor: default; }
/* Showing one source: the other marks fade to plain text. */
.annotated-text.is-filtered mark.seg-hit:not(.is-shown) { background: none; box-shadow: none; }
.annotated-text.is-filtered mark.seg-hit:not(.is-shown) .seg-refs { color: var(--bs-secondary-color); }
mark.seg-hit.is-current { outline: 2px solid var(--v-text); outline-offset: 1px; }
.source-filter {
    position: sticky;
    top: 4rem;
    z-index: 1;
    padding: .5rem .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}
.run-panel {
    margin: 0 0 .75rem;
    padding: .5rem .875rem;
    border-left: 3px solid var(--bs-primary);
    background: var(--surface);
    border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0;
    box-shadow: var(--shadow-sm);
    font-family: var(--bs-body-font-family);
    font-size: .9375rem;
    line-height: 1.5;
}
.run-source { padding: .375rem 0; }
.run-source + .run-source { border-top: 1px solid var(--bs-border-color-translucent); }
.run-source-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .5rem; }
.run-source-page { margin-left: 2.25rem; color: var(--bs-secondary-color); }

/* --- Specialty landscape --- */
.landscape-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; }
.landscape-stats .stat-value { font-size: 1.375rem; }
.chart-card { padding: 1.25rem; }
.year-chart {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 9rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.year-col { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; border-radius: 3px 3px 0 0; }
.year-bar { width: 100%; background: rgba(var(--bs-primary-rgb), .75); border-radius: 3px 3px 0 0; }
.year-col:hover .year-bar { background: var(--bs-primary); }
.year-col:hover { background: var(--bs-tertiary-bg); }
.year-axis { display: flex; justify-content: space-between; margin-top: .25rem; }
.year-table { max-width: 32rem; }
.ranking-card { height: 100%; padding: 1.125rem 1.25rem; }
.ranking-card h3 { font-size: .9375rem; font-weight: 650; margin-bottom: .75rem; }
.ranking { list-style: none; counter-reset: rank; padding: 0; margin: 0; }
.ranking li { counter-increment: rank; display: flex; gap: .625rem; padding: .3rem 0; font-size: .875rem; border-top: 1px solid var(--bs-border-color-translucent); }
.ranking li:first-child { border-top: 0; }
.ranking li::before { content: counter(rank); flex: none; width: 1.25rem; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; text-align: right; }
.ranking-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ranking-count { flex: none; color: var(--bs-secondary-color); }

/* --- Academic family tree --- */
.lineage-generations { list-style: none; padding: 0; margin: 0; font-size: .875rem; }
.lineage-generations li { position: relative; padding: 0 0 .75rem 1.25rem; }
.lineage-generations li::before {
    content: "";
    position: absolute;
    left: .25rem;
    top: .4rem;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--bs-primary);
}
.lineage-generations li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: calc(.5rem - 1px);
    top: 1rem;
    bottom: 0;
    width: 2px;
    background: var(--bs-border-color);
}

/* --- Specialty index --- */
.spec-filter { max-width: 22rem; }
.spec-table td:nth-child(n+3), .spec-table th:nth-child(n+3) { width: 7rem; }
.spec-group { margin-bottom: .5rem; }
.council-table td:nth-child(n+4), .council-table th:nth-child(n+4) { width: 7rem; }
.spec-group > summary {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding: .875rem 1.125rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
}
.spec-group > summary::-webkit-details-marker { display: none; }
.spec-group > summary::before {
    content: "";
    align-self: center;
    flex: none;
    width: .45rem;
    height: .45rem;
    border-right: 1.5px solid var(--bs-secondary-color);
    border-bottom: 1.5px solid var(--bs-secondary-color);
    transform: rotate(-45deg);
    transition: transform .15s;
}
.spec-group[open] > summary::before { transform: rotate(45deg); }
.spec-group > summary:hover { background: var(--bs-tertiary-bg); border-radius: var(--bs-card-inner-border-radius); }
.spec-group[open] > summary { border-bottom: 1px solid var(--bs-border-color); border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; }
.spec-group-count { margin-left: auto; font-size: .8125rem; font-weight: 400; color: var(--bs-secondary-color); }
