:root {
    --ink: #1f2933;
    --muted: #5f6c7b;
    --line: #d9e2ec;
    --paper: #ffffff;
    --soft: #f4f7f9;
    --brand: #28536b;
    --brand-dark: #17384b;
    --donate: #8a3b12;
    --success: #276749;
    --error: #a61b1b;
    --mark: #fff2a8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--brand);
}

.site-header,
.site-footer,
.page-shell {
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 0 16px;
}

.site-title {
    color: var(--ink);
    font-size: 22px;
    font-weight: 700;
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.button,
button {
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    display: inline-block;
    font: inherit;
    font-weight: 700;
    padding: 11px 16px;
    text-decoration: none;
}

.button:hover,
button:hover {
    background: var(--brand-dark);
}

.button-donate {
    background: var(--donate);
}

.button-secondary {
    background: #52606d;
}

.page-shell {
    padding: 18px 0 40px;
}

.search-panel,
.admin-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
}

.eyebrow {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    margin: 0 0 6px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 18px;
}

.browse-filter {
    align-items: end;
    display: grid;
    grid-template-columns: minmax(130px, 180px) minmax(130px, 180px) auto auto;
    gap: 12px;
    margin-top: 18px;
}

.browse-filter label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.clear-link {
    font-weight: 700;
    padding: 11px 0;
}

input[type="search"],
input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"] {
    border: 1px solid #bcccdc;
    border-radius: 6px;
    font: inherit;
    padding: 11px 12px;
    width: 100%;
}

.search-help,
.muted {
    color: var(--muted);
    margin-bottom: 0;
}

.support-strip {
    align-items: center;
    background: #fff8ea;
    border: 1px solid #f3d7a0;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 18px 0;
    padding: 14px 16px;
}

.support-strip span {
    color: #594214;
    flex: 1 1 320px;
}

.results-header h2 {
    font-size: 20px;
    margin: 24px 0 12px;
}

.browse-summary {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.browse-summary h2 {
    margin-bottom: 12px;
}

.table-wrap {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
}

.archive-table {
    border-collapse: collapse;
    width: 100%;
}

.archive-table th,
.archive-table td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
}

.archive-table th {
    background: #edf2f7;
    font-size: 14px;
}

.archive-table tr:last-child td {
    border-bottom: 0;
}

.archive-table a {
    font-weight: 700;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: center;
    margin: 22px 0 0;
}

.pagination a {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-weight: 700;
    padding: 9px 13px;
    text-decoration: none;
}

.result {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 20px;
}

.result h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.article-title {
    color: var(--muted);
    font-style: italic;
}

.snippet {
    margin-bottom: 14px;
}

mark {
    background: var(--mark);
    border-radius: 3px;
    padding: 0 2px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    font-weight: 700;
}

.viewer-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.viewer-header h1 {
    font-size: 22px;
    margin-bottom: 4px;
}

.viewer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-weight: 700;
}

.viewer-page {
    margin-left: calc(50% - 50vw + 16px);
    width: calc(100vw - 32px);
}

.pdf-frame {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: block;
    height: calc(100vh - 170px);
    min-height: 720px;
    width: 100%;
}

.notice {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 18px 0;
    padding: 14px 16px;
}

.notice-success {
    border-color: #9ae6b4;
    color: var(--success);
}

.notice-error {
    border-color: #feb2b2;
    color: var(--error);
}

.notice-warning {
    border-color: #f6c56f;
    color: #6f4d00;
}

.stacked-form {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.stacked-form label {
    font-weight: 700;
    margin-top: 8px;
}

.stacked-form button {
    justify-self: start;
    margin-top: 12px;
}

.admin-heading {
    align-items: start;
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-weight: 700;
}

.check-row {
    align-items: start;
    display: flex;
    gap: 10px;
    line-height: 1.4;
}

.check-row input {
    margin-top: 4px;
    width: auto;
}

.admin-log {
    margin-top: 28px;
}

.admin-log h2 {
    font-size: 20px;
}

.health-groups {
    display: grid;
    gap: 22px;
    margin-top: 22px;
}

.health-group h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

.health-table th:first-child,
.health-table td:first-child {
    width: 150px;
}

.health-status {
    border-radius: 999px;
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 9px;
}

.health-ok {
    background: #e3fcec;
    color: #276749;
}

.health-warning {
    background: #fff4d6;
    color: #6f4d00;
}

.health-error {
    background: #ffe3e3;
    color: #a61b1b;
}

.modal-backdrop {
    align-items: center;
    background: rgba(18, 32, 44, .72);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 20px;
    position: fixed;
    z-index: 10;
}

.agreement-modal {
    background: var(--paper);
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
    max-width: 560px;
    padding: 28px;
}

.agreement-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.site-footer {
    color: var(--muted);
    font-size: 14px;
    padding: 0 0 30px;
}

.sr-only {
    clip: rect(0, 0, 0, 0);
    border: 0;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

@media (max-width: 680px) {
    .site-header,
    .admin-heading,
    .admin-links,
    .search-form,
    .browse-filter,
    .browse-summary,
    .viewer-header {
        display: block;
    }

    .site-nav {
        display: flex;
        margin-top: 14px;
    }

    .admin-links {
        margin-top: 14px;
    }

    .search-form button,
    .browse-filter button {
        margin-top: 10px;
        width: 100%;
    }

    .clear-link {
        display: inline-block;
        padding-bottom: 0;
    }

    .search-panel,
    .admin-panel {
        padding: 20px;
    }

    .viewer-page {
        margin-left: calc(50% - 50vw + 10px);
        width: calc(100vw - 20px);
    }

    .pdf-frame {
        height: calc(100vh - 155px);
        min-height: 520px;
    }
}
