:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #172f32;
    background: #f3f6f3;
    --accent: #176350;
    --border: #d8e3de;
}
* { box-sizing: border-box; }
body { margin: 0; }
.site-header { border-bottom: 1px solid var(--border); background: #fff; }
.bar, .nav, .content { width: min(100% - 3rem, 76rem); margin-inline: auto; }
.bar { min-height: 4.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding-block: .6rem; }
.wordmark { color: #173c36; text-decoration: none; font-weight: 800; letter-spacing: .09em; }
.demo { font-size: .875rem; color: #465c56; }
.nav { display: flex; gap: 1.75rem; }
.nav a { padding-block: .8rem; color: #304b45; text-decoration: none; border-bottom: 3px solid transparent; }
.nav a[aria-current="page"] { color: var(--accent); border-color: var(--accent); font-weight: 650; }
.content { padding-block: 2.25rem 4rem; }
.section-heading { margin-bottom: 1.4rem; }
h1 { font-size: clamp(1.65rem, 3.5vw, 2.4rem); letter-spacing: -.035em; margin: 0 0 .35rem; }
p { margin-block: .5rem; color: #405952; }
.table-frame { overflow-x: auto; border: 1px solid var(--border); border-radius: .7rem; background: #fff; }
table { width: 100%; border-collapse: collapse; text-align: left; line-height: 1.4; }
th, td { padding: .75rem 1rem; border-bottom: 1px solid #e7eee9; }
thead { background: #e8f1ec; }
thead th, .number { white-space: nowrap; }
tbody th { min-width: 10rem; font-weight: 650; }
tbody td { color: #39534c; }
tbody tr:last-child > * { border-bottom: 0; }
.number { font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid #217c66; outline-offset: 3px; }
@media (max-width: 760px) {
    .bar, .nav, .content { width: calc(100% - 1.5rem); }
    .content { padding-top: 1.5rem; }
}

[hidden] { display: none !important; }
.visually-hidden {
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
}
.filter-panel, .detail-panel {
    border: 1px solid var(--border);
    border-radius: .8rem;
    padding: clamp(.9rem, 2vw, 1.4rem);
    background: #fff;
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .85rem 1rem;
}
.field { min-width: 0; }
.field label { display: block; margin-bottom: .35rem; font-size: .875rem; font-weight: 650; }
.field input, .field select {
    width: 100%;
    min-height: 2.55rem;
    border: 1px solid #b9cdc3;
    border-radius: .4rem;
    padding-inline: .65rem;
    background: #fff;
    color: inherit;
    font: inherit;
}
.field [aria-invalid="true"] { border-color: #a34231; }
.filter-actions, .action-group, .results-heading, .results-meta, .dialog-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .85rem;
}
.filter-actions { margin-top: 1rem; }
.button {
    min-height: 2.4rem;
    border: 1px solid #a9c2b7;
    border-radius: .45rem;
    padding: .4rem .75rem;
    background: #fff;
    color: #21483d;
    font: inherit;
    font-size: .875rem;
    font-weight: 650;
    cursor: pointer;
}
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); padding-inline: 1.25rem; }
.button.selection-button { background: #e2eee8; }
.button:hover:not(:disabled) { border-color: var(--accent); }
.button.primary:hover { background: #0f4f3e; }
.button:disabled { opacity: .6; cursor: default; }
#draft-indicator { font-size: .875rem; color: #744915; }
.error-notice { padding: .75rem 1rem; color: #772d23; background: #faeee9; border-radius: .45rem; }
.catalog-results-section { margin-top: 1.75rem; }
.results-heading, .results-meta, .dialog-heading { justify-content: space-between; }
h2 { font-size: 1.25rem; margin: 0 0 .6rem; }
.results-heading h2, .dialog-heading h2 { margin: 0; }
.results-meta { padding-block: .75rem; font-size: .9rem; color: #39534c; }
.check-cell { width: 2.75rem; text-align: center; }
.check-cell input { width: 1rem; height: 1rem; accent-color: var(--accent); cursor: pointer; }
.selected-row { background: #eff7f2; }
.publication-link { text-underline-offset: .18em; }
.pagination { display: flex; justify-content: flex-end; gap: .65rem; padding-top: .8rem; }
.empty-state { background: #fff; border: 1px solid var(--border); border-radius: .8rem; padding: 1.4rem; }
.empty-state h3 { margin: 0; font-size: 1rem; }
dialog {
    width: min(36rem, calc(100% - 2rem));
    max-height: 85vh;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: .8rem;
    color: inherit;
    background: #fff;
}
dialog::backdrop { background: #163c34a3; }
.selected-list { max-height: 48vh; overflow: auto; margin: .9rem 0; padding: .25rem; list-style: none; }
.selected-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .6rem; align-items: center; padding: .5rem; border-bottom: 1px solid var(--border); }
.back-link { display: inline-block; margin-bottom: 1.25rem; text-underline-offset: .18em; }
.publication-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 1.25rem; align-items: start; }
.publication-facts { margin-bottom: 0; }
.publication-facts div { display: grid; grid-template-columns: 10rem 1fr; gap: .6rem; padding-block: .7rem; border-top: 1px solid var(--border); }
.publication-facts dd { margin: 0; overflow-wrap: anywhere; }
.publication-facts dt { font-weight: 650; }
.publication-grid tbody th { min-width: 0; }
table td, table tbody th { overflow-wrap: anywhere; }

@media (max-width: 900px) {
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .publication-grid { grid-template-columns: minmax(0, 1fr); }
    .catalog-results-section table { min-width: 720px; }
}
@media (max-width: 460px) {
    .filter-grid { grid-template-columns: minmax(0, 1fr); }
    .selected-list li { grid-template-columns: minmax(0, 1fr) auto; }
    .selected-list li .number { display: none; }
    .publication-facts div { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
}

.field textarea {
    width: 100%;
    border: 1px solid #b9cdc3;
    border-radius: .4rem;
    padding: .55rem .65rem;
    background: #fff;
    color: inherit;
    font: inherit;
    resize: vertical;
}
.collection-editor { max-width: 64rem; }
.collection-editor fieldset { border: 0; padding: 0; margin: 1rem 0 0; min-width: 0; }
.collection-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.collection-members { margin-top: 1.25rem; }
.collection-members h3 { margin: 0; font-size: 1rem; }
.members-list { max-height: none; }
.members-list li { padding-inline: 0; }
.editor-actions { margin-top: 1rem; }
.editor-actions .danger { margin-inline-start: auto; }
.button.danger { color: #873225; border-color: #d6ada4; }
.button.danger:hover:not(:disabled) { border-color: #873225; background: #fbefec; }
.success-notice, .collection-visit {
    padding: .75rem 1rem;
    color: #154d3e;
    background: #e5f1eb;
    border-radius: .45rem;
}
.collection-visit { margin-bottom: .9rem; }
.collection-visit p { margin-top: 0; }
.collection-visit a.button { display: inline-flex; align-items: center; text-decoration: none; }
#collection-dirty { color: #744915; font-size: .875rem; }
.collection-target-list li { grid-template-columns: 1fr; }
.collection-target-list button { width: 100%; text-align: left; }
.confirm-actions, .selection-actions { margin-top: .9rem; }
@media (max-width: 768px) {
    .collection-fields-grid { grid-template-columns: 1fr; }
}

.report-filters input, .report-filters select { color-scheme: light; }
.report-advanced { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: .8rem; }
.report-advanced summary { width: fit-content; cursor: pointer; font-weight: 650; }
.report-advanced .filter-grid { margin-top: .75rem; }
.report-validation:empty, .report-validation.validation-summary-valid { display: none; }
.report-validation { margin-bottom: .9rem; color: #772d23; }
.report-validation ul { padding-left: 1.2rem; margin-block: .35rem; }
.report-filters a.button { display: inline-flex; align-items: center; text-decoration: none; }
.report-table table { min-width: 64rem; }
.report-table th, .report-table td { padding-inline: .65rem; }
.report-table thead th { white-space: normal; }
.report-table tbody td:nth-child(2) { min-width: 8rem; }
.report-table tbody th { min-width: 0; }
.report-table td.report-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-table tfoot { background: #e8f1ec; font-weight: 750; }
.field-hint { font-size: .875rem; color: #465c56; margin-block: .6rem; }
.nav { flex-wrap: wrap; }

/* Account and access management */
.auth-card { max-width: 480px; margin: 3rem auto; padding: 2rem; background: #fff; border: 1px solid #ddd; border-radius: 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: #656d74; font-size: .8rem; }
.access-form { display: grid; gap: 1rem; }
.access-panel { max-width: 760px; margin: 2rem 0; padding: 1.5rem; }
.permission-list { display: grid; gap: .7rem; padding: 1rem; border: 1px solid #d4dce1; }
.permission-list label { display: flex; gap: .6rem; align-items: center; }
.permission-list input { width: auto; }
.delete-confirm { margin-top: 1.5rem; }
.nav { flex-wrap: wrap; }
.nav form { margin: 0; display: inline-flex; align-items: center; }
.nav-logout { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: .7rem; }
@media(max-width:600px) { .auth-card { margin: 1rem auto; padding: 1rem; } .access-panel { padding: 1rem; } }

.roles-table { min-width: 850px; }
.roles-table th:first-child { min-width: 155px; overflow-wrap: normal; }
.roles-table td:last-child { min-width: 175px; overflow-wrap: normal; }
.roles-table td:nth-child(2) { min-width: 180px; }
