/* P4-LUCAT Dataset Access — visual layer on top of local Bootstrap 5.3.3.
   No external fonts or assets; CSP allows only same-origin styles and data: images. */

/* ---------- Tokens ---------- */
:root {
  --p4-navy: #0e2747;
  --p4-blue: #1b4f8f;
  --p4-blue-hover: #153f74;
  --p4-blue-soft: #e8eff8;
  --p4-ink: #1c2633;
  --p4-muted: #556274;
  --p4-line: #d9e0ea;
  --p4-line-strong: #c3cddb;
  --p4-surface: #ffffff;
  --p4-canvas: #f3f5f8;
  --p4-subtle: #f7f9fb;
  --p4-focus: #124db1;
  --p4-success: #1d6b43;
  --p4-success-soft: #e3f3ea;
  --p4-warning: #7a5200;
  --p4-warning-soft: #fff4d6;
  --p4-danger: #9b2335;
  --p4-danger-soft: #fbe9ec;
  --p4-radius: .5rem;
  --p4-radius-sm: .375rem;
  --p4-shadow: 0 1px 2px rgba(14, 39, 71, .06);
  --p4-reading: 46rem;

  --bs-body-color: var(--p4-ink);
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.6;
  --bs-secondary-color: var(--p4-muted);
  --bs-border-color: var(--p4-line);
  --bs-border-radius: var(--p4-radius-sm);
  --bs-link-color: var(--p4-blue);
  --bs-link-color-rgb: 27, 79, 143;
  --bs-link-hover-color: var(--p4-navy);
  --bs-link-hover-color-rgb: 14, 39, 71;
  --bs-heading-color: var(--p4-navy);
  --bs-primary: var(--p4-blue);
  --bs-primary-rgb: 27, 79, 143;
}
body { background-color: var(--p4-canvas) !important; }
a { text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--p4-navy); font-weight: 600; letter-spacing: -.005em; line-height: 1.25; }
h1, .h1 { font-size: calc(1.4rem + .9vw); }
@media (min-width: 1200px) { h1, .h1 { font-size: 2.15rem; } }
h2, .h2 { font-size: calc(1.25rem + .45vw); }
@media (min-width: 1200px) { h2, .h2 { font-size: 1.6rem; } }
h3, .h3 { font-size: 1.2rem; }
.h4 { font-size: 1.15rem; }
.h5 { font-size: 1.05rem; }
.h6 { font-size: .95rem; }
code { color: var(--p4-navy); background: var(--p4-blue-soft); padding: .1em .35em; border-radius: .25rem; font-size: .85em; }
.text-secondary { color: var(--p4-muted) !important; }

/* ---------- Accessibility ---------- */
.skip-link { position: fixed; z-index: 1000; top: .5rem; left: .5rem; transform: translateY(-200%); background: #fff; color: #123b72; padding: .55rem .8rem; border: 2px solid #123b72; border-radius: var(--p4-radius-sm); font-weight: 600; }
.skip-link:focus { transform: none; }
:is(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--p4-focus); outline-offset: 3px; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--p4-blue); box-shadow: 0 0 0 .2rem rgba(27, 79, 143, .2); }
main:focus { outline: none; }

/* ---------- Buttons ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-padding-x: 1rem; --bs-btn-border-radius: var(--p4-radius-sm); }
.btn-lg { --bs-btn-padding-x: 1.35rem; --bs-btn-font-size: 1.05rem; }
.btn-primary {
  --bs-btn-bg: var(--p4-blue); --bs-btn-border-color: var(--p4-blue);
  --bs-btn-hover-bg: var(--p4-blue-hover); --bs-btn-hover-border-color: var(--p4-blue-hover);
  --bs-btn-active-bg: var(--p4-navy); --bs-btn-active-border-color: var(--p4-navy);
  --bs-btn-disabled-bg: var(--p4-blue); --bs-btn-disabled-border-color: var(--p4-blue);
  --bs-btn-focus-shadow-rgb: 27, 79, 143;
}
.btn-outline-primary {
  --bs-btn-color: var(--p4-blue); --bs-btn-border-color: var(--p4-line-strong);
  --bs-btn-hover-color: var(--p4-navy); --bs-btn-hover-bg: var(--p4-blue-soft); --bs-btn-hover-border-color: var(--p4-blue);
  --bs-btn-active-color: var(--p4-navy); --bs-btn-active-bg: #d6e3f3; --bs-btn-active-border-color: var(--p4-blue);
  background: var(--p4-surface);
}
.btn-success { --bs-btn-bg: var(--p4-success); --bs-btn-border-color: var(--p4-success); --bs-btn-hover-bg: #165536; --bs-btn-hover-border-color: #165536; }
.btn-warning { --bs-btn-bg: #f2c14e; --bs-btn-border-color: #e5b13a; --bs-btn-hover-bg: #e5b13a; --bs-btn-hover-border-color: #d9a42c; --bs-btn-color: #3a2a00; --bs-btn-hover-color: #2a1f00; }
.btn-secondary { --bs-btn-bg: #4d5b6d; --bs-btn-border-color: #4d5b6d; --bs-btn-hover-bg: #3b4757; --bs-btn-hover-border-color: #3b4757; }

/* ---------- Header ---------- */
.site-header { background: var(--p4-surface); border-bottom: 1px solid var(--p4-line); box-shadow: var(--p4-shadow); }
.site-header::before { content: ''; display: block; height: 3px; background: var(--p4-navy); }
.site-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; padding-block: .7rem; }
.brand { display: flex; align-items: center; gap: .85rem; color: var(--p4-navy); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--p4-navy); text-decoration: none; }
.brand-logo { width: 38px; height: auto; flex: 0 0 38px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--p4-muted); }
.brand-title { font-size: 1.2rem; font-weight: 700; color: var(--p4-navy); }
.brand-subtitle { font-size: .78rem; color: var(--p4-muted); }
.brand:hover .brand-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }

.site-nav ul, .management-nav ul { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.site-nav a { display: inline-block; padding: .45rem .8rem; border-radius: var(--p4-radius-sm); color: var(--p4-ink); font-weight: 500; font-size: .95rem; text-decoration: none; }
.site-nav a:hover { background: var(--p4-blue-soft); color: var(--p4-navy); }
.site-nav a[aria-current="page"] { color: var(--p4-navy); background: var(--p4-blue-soft); box-shadow: inset 0 -2px 0 var(--p4-blue); }
.site-nav .nav-emphasis { color: var(--p4-blue); font-weight: 600; }

.management-bar { background: var(--p4-navy); color: #dbe5f2; }
.management-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; padding-block: .35rem; }
.management-label { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #a9bbd3; }
.management-nav ul { flex: 1 1 auto; align-items: center; }
.management-nav a, .management-nav .btn-logout { display: inline-block; padding: .3rem .7rem; border-radius: var(--p4-radius-sm); color: #fff; font-size: .9rem; font-weight: 500; text-decoration: none; background: transparent; border: 0; line-height: 1.5; }
.management-nav a:hover, .management-nav .btn-logout:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.management-nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); box-shadow: inset 0 -2px 0 #8fb3e3; }
.management-nav .nav-logout { margin-left: auto; }
.management-nav .btn-logout { border: 1px solid rgba(255, 255, 255, .35); }
.management-nav :is(a, button):focus-visible { outline-color: #fff; }

@media (max-width: 767.98px) {
  .site-header-inner { padding-block: .55rem; }
  .brand-subtitle { display: none; }
  .site-nav { width: 100%; margin-inline: -.35rem; }
  .site-nav a { padding: .35rem .6rem; font-size: .92rem; }
  .management-nav .nav-logout { margin-left: 0; }
}

/* ---------- Page structure ---------- */
.site-main { padding-block: 2rem 3rem; }
@media (min-width: 992px) { .site-main { padding-block: 2.5rem 3.5rem; } }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: .35rem; }
.page-header .lead, .page-lead { color: var(--p4-muted); font-size: 1.05rem; margin-bottom: 0; max-width: var(--p4-reading); }
.page-header-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.eyebrow { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--p4-blue); margin-bottom: .4rem; }
.breadcrumb-trail { font-size: .88rem; color: var(--p4-muted); margin-bottom: .6rem; }
.breadcrumb-trail a { color: var(--p4-muted); }
.breadcrumb-trail a:hover { color: var(--p4-navy); }

.panel { background: var(--p4-surface); border: 1px solid var(--p4-line); border-radius: var(--p4-radius); box-shadow: var(--p4-shadow); padding: 1.25rem; }
@media (min-width: 768px) { .panel { padding: 1.75rem 2rem; } }
.panel-compact { padding: 1rem 1.25rem; }
@media (min-width: 768px) { .panel-compact { padding: 1.15rem 1.35rem; } }
.panel + .panel, .panel + section, section + .panel { margin-top: 1.25rem; }
:is(.hero, .dashboard-grid, .stats-grid, .review-layout, .kpi-grid) > * { margin-top: 0 !important; }
.panel-title { font-size: 1.05rem; margin-bottom: .75rem; }
.panel-subtle { background: var(--p4-subtle); box-shadow: none; }
.panel-accent { border-top: 3px solid var(--p4-blue); }
.research-intro, .reading-width { max-width: 52rem; margin-inline: auto; }
.prose { max-width: var(--p4-reading); }
.prose h2 { font-size: 1.2rem; margin-top: 2rem; }
.prose h2:first-of-type { margin-top: 1.5rem; }
.section-title { font-size: 1.15rem; margin-bottom: .75rem; }
.section-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; margin-bottom: .75rem; }
.section-title-row .section-title { margin-bottom: 0; }
.section-note { color: var(--p4-muted); font-size: .9rem; }
.stack-lg > * + * { margin-top: 1.5rem; }

.action-group { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.action-group-end { justify-content: flex-end; }
.divider { border: 0; border-top: 1px solid var(--p4-line); margin: 1.5rem 0; opacity: 1; }

/* ---------- Home ---------- */
.hero { display: grid; gap: 1.25rem; }
@media (min-width: 992px) { .hero { grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; } }
.hero-main h1 { margin-bottom: .6rem; }
.hero-main .lead { font-size: 1.15rem; color: var(--p4-ink); font-weight: 500; }
.hero-main p { max-width: var(--p4-reading); }
.hero-actions { margin-top: 1.5rem; }
.access-note { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; color: var(--p4-muted); margin-top: 1.25rem; max-width: var(--p4-reading); }
.access-note::before { content: 'i'; flex: 0 0 1.25rem; height: 1.25rem; margin-top: .12rem; border-radius: 50%; background: var(--p4-blue-soft); color: var(--p4-blue); font-weight: 700; font-size: .78rem; text-align: center; line-height: 1.25rem; font-family: Georgia, serif; }
.publication-card { font-size: .92rem; }
.publication-card .panel-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--p4-muted); }
.publication-title { font-weight: 600; color: var(--p4-ink); line-height: 1.4; margin-bottom: .35rem; }
.publication-card p { margin-bottom: .5rem; }
.publication-card p:last-child { margin-bottom: 0; }

.process-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 576px) { .process-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .process-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.process-steps li { counter-increment: step; display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; background: var(--p4-subtle); border: 1px solid var(--p4-line); border-radius: var(--p4-radius-sm); font-size: .95rem; line-height: 1.45; }
.process-steps li::before { content: counter(step); flex: 0 0 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--p4-navy); color: #fff; font-weight: 700; font-size: .85rem; text-align: center; line-height: 1.75rem; }

/* ---------- Metadata lists ---------- */
.meta-list { display: grid; grid-template-columns: 1fr; gap: .1rem 1.5rem; margin: 0; }
.meta-list dt { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--p4-muted); margin-top: .65rem; }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 576px) {
  .meta-list { grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); }
  .meta-list dt { margin-top: 0; padding-block: .5rem; border-bottom: 1px solid var(--p4-line); text-transform: none; letter-spacing: 0; font-size: .9rem; }
  .meta-list dd { padding-block: .5rem; border-bottom: 1px solid var(--p4-line); }
  .meta-list dt:last-of-type, .meta-list dd:last-of-type { border-bottom: 0; }
}
.request-code, .management-table th:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.request-code-tag { display: inline-flex; align-items: baseline; gap: .5rem; padding: .3rem .7rem; border: 1px solid var(--p4-line-strong); border-radius: var(--p4-radius-sm); background: var(--p4-subtle); font-size: .95rem; }
.request-code-tag strong { font-family: var(--bs-font-monospace); color: var(--p4-navy); letter-spacing: .02em; }

/* ---------- Notices (Bootstrap alerts, restyled) ---------- */
.alert { border-width: 0 0 0 4px; border-radius: var(--p4-radius-sm); padding: .85rem 1.1rem; }
.alert-info { --bs-alert-color: var(--p4-navy); --bs-alert-bg: var(--p4-blue-soft); --bs-alert-border-color: var(--p4-blue); --bs-alert-link-color: var(--p4-navy); }
.alert-success { --bs-alert-color: #144a2f; --bs-alert-bg: var(--p4-success-soft); --bs-alert-border-color: var(--p4-success); }
.alert-warning { --bs-alert-color: #5c3d00; --bs-alert-bg: var(--p4-warning-soft); --bs-alert-border-color: #c98a00; }
.alert-danger { --bs-alert-color: #6e1626; --bs-alert-bg: var(--p4-danger-soft); --bs-alert-border-color: var(--p4-danger); }
.alert > :last-child { margin-bottom: 0; }

/* ---------- Forms ---------- */
.form-label, .p4-form label:not(.form-check-label) { font-weight: 600; font-size: .93rem; color: var(--p4-ink); margin-bottom: .35rem; }
.form-text { color: var(--p4-muted); font-size: .85rem; margin-top: 0; margin-bottom: .4rem; }
.form-control, .form-select { border-color: var(--p4-line-strong); border-radius: var(--p4-radius-sm); }
.form-control::placeholder { color: #8a95a5; }
textarea.form-control { line-height: 1.55; min-height: 8rem; }
.required-mark { color: var(--p4-danger); font-weight: 700; }
.optional-mark { color: var(--p4-muted); font-weight: 400; font-size: .85em; }
.invalid-feedback { font-weight: 500; }
.form-section { padding-top: 1.25rem; margin-top: 1.25rem; border-top: 1px solid var(--p4-line); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--p4-line); }
.consent-box { background: var(--p4-subtle); border: 1px solid var(--p4-line); border-radius: var(--p4-radius-sm); padding: 1rem 1rem 1rem 2.6rem; }
.consent-box .form-check-input { margin-top: .3rem; }
/* Unclassed Django checkboxes inside .form-check (e.g. Turnstile confirmation). */
.form-check > input[type="checkbox"]:not(.form-check-input) { float: left; margin: .35em 0 0 -1.5em; width: 1em; height: 1em; }
.consent-box .form-check-label { font-size: .93rem; }
/* Selects that use .form-control (filter/revision forms) get a native-looking chevron. */
select.form-control, .p4-form select:not(.form-select) {
  appearance: none; padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23556274' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 14px 10px;
}
select.form-control[multiple], select.form-control[size]:not([size="1"]) { background-image: none; padding-right: .75rem; }
/* Fields rendered with Django's as_p (review/login forms) without widget classes. */
.p4-form p { margin-bottom: 1rem; }
.p4-form p > label { display: block; }
.p4-form :is(select, textarea, input[type="text"], input[type="password"], input[type="email"]):not(.form-control) {
  display: block; width: 100%; padding: .375rem .75rem; font-size: 1rem; line-height: 1.5; color: var(--p4-ink);
  background-color: #fff; border: 1px solid var(--p4-line-strong); border-radius: var(--p4-radius-sm);
}
.p4-form select:not(.form-control) { padding-right: 2.25rem; text-overflow: ellipsis; }
.p4-form .helptext { display: block; color: var(--p4-muted); font-size: .85rem; margin-top: .25rem; }
.p4-form .errorlist { list-style: none; padding: 0; margin: 0 0 .35rem; color: var(--p4-danger); font-weight: 500; font-size: .9rem; }
.form-error-summary h2 { color: inherit; }
.auth-panel { max-width: 28rem; margin-inline: auto; }

/* ---------- Status badges ---------- */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 999px; padding: .35em .7em; }
.management-status { color: #203047; background: #e9eef5; border: 1px solid #d3dce8; }
.management-status-awaiting_signature { color: #3b3f78; background: #ecebfa; border-color: #d8d6f2; }
.management-status-document_uploaded { color: #113f66; background: #d9edf9; border-color: #b9dbf1; }
.management-status-under_review { color: #0f4a5c; background: #dcf1f5; border-color: #bce1e9; }
.management-status-needs_information { color: #684400; background: #fff0c2; border-color: #f2d98a; }
.management-status-approved { color: #145333; background: #d9f3e4; border-color: #b4e2c6; }
.management-status-rejected { color: #6b2630; background: #f7e0e3; border-color: #ecc2c8; }
.management-status-closed_without_access { color: #44505e; background: #eceff3; border-color: #d6dbe2; }
.badge-attention { color: #5c3d00; background: var(--p4-warning-soft); border: 1px solid #f0d48a; }
.badge-version { color: var(--p4-navy); background: var(--p4-blue-soft); border: 1px solid #c9d8ec; }
.badge-muted { color: #44505e; background: #eceff3; border: 1px solid #d6dbe2; }

/* ---------- Management dashboard ---------- */
.kpi-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-card { background: var(--p4-surface); border: 1px solid var(--p4-line); border-radius: var(--p4-radius); padding: .9rem 1rem; box-shadow: var(--p4-shadow); display: flex; flex-direction: column; justify-content: space-between; min-height: 5.5rem; }
.kpi-card h2 { font-size: .82rem; font-weight: 600; color: var(--p4-muted); margin: 0 0 .25rem; line-height: 1.3; }
.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1.1; color: var(--p4-navy); font-variant-numeric: tabular-nums; }
.kpi-card-primary { background: var(--p4-navy); border-color: var(--p4-navy); }
.kpi-card-primary h2 { color: #b8c8dd; }
.kpi-card-primary .kpi-value { color: #fff; }

.quick-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.quick-filters-label { font-size: .85rem; font-weight: 600; color: var(--p4-muted); margin-right: .25rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border: 1px solid var(--p4-line-strong); border-radius: 999px; background: var(--p4-surface); color: var(--p4-navy); font-size: .88rem; font-weight: 500; text-decoration: none; }
.chip:hover { border-color: var(--p4-blue); background: var(--p4-blue-soft); color: var(--p4-navy); text-decoration: none; }
.chip-static { color: var(--p4-ink); background: var(--p4-subtle); }
.chip-static:hover { border-color: var(--p4-line-strong); background: var(--p4-subtle); }

.dashboard-grid { display: grid; gap: 1.25rem; }
@media (min-width: 992px) { .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dashboard-grid > .panel { margin-top: 0; }

.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--p4-line); }
.status-list li:last-child { border-bottom: 0; }
.status-list .status-name { color: var(--p4-ink); }
.status-indicator { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; font-size: .92rem; text-align: right; }
.status-indicator::before { content: ''; flex: 0 0 .6rem; width: .6rem; height: .6rem; border-radius: 50%; background: currentColor; }
.status-ok { color: var(--p4-success); }
.status-warn { color: var(--p4-warning); }
.status-bad { color: var(--p4-danger); }

.turnstile-panel.is-disabled { border-left: 4px solid #c98a00; }
.turnstile-panel.is-enabled { border-left: 4px solid var(--p4-success); }
.turnstile-state { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .75rem; }

.attention-list { list-style: none; padding: 0; margin: 0; }
.attention-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--p4-line); }
.attention-list li:last-child { border-bottom: 0; }
.attention-count { flex: 0 0 auto; min-width: 2rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; border-radius: 999px; padding: .1rem .55rem; font-size: .88rem; color: var(--p4-muted); background: #eceff3; }
.attention-count.has-items { color: #5c3d00; background: var(--p4-warning-soft); }
.attention-list .attention-empty { color: var(--p4-muted); font-size: .85rem; }

/* ---------- Filters, results and pagination ---------- */
.filter-panel { margin-bottom: 1.25rem; }
.filter-panel .form-label { font-size: .85rem; }
.filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1rem; }
.results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: .75rem; }
.results-count { margin: 0; font-weight: 500; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .75rem; font-size: .9rem; }
.active-filters .chip { font-size: .82rem; }
.pagination-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem; margin: .75rem 0; font-size: .92rem; }
.pagination-bar a, .pagination-bar .page-disabled { display: inline-block; padding: .3rem .85rem; border: 1px solid var(--p4-line-strong); border-radius: var(--p4-radius-sm); background: var(--p4-surface); text-decoration: none; font-weight: 500; }
.pagination-bar a:hover { background: var(--p4-blue-soft); border-color: var(--p4-blue); }
.pagination-bar .page-disabled { color: #8a95a5; background: var(--p4-subtle); }
.pagination-bar .page-status { color: var(--p4-muted); }

/* ---------- Tables ---------- */
.table-shell { background: var(--p4-surface); border: 1px solid var(--p4-line); border-radius: var(--p4-radius); box-shadow: var(--p4-shadow); }
.table-shell > .table { --bs-table-bg: var(--p4-surface); }
.table { --bs-table-hover-bg: #f1f5fa; --bs-table-border-color: var(--p4-line); margin-bottom: 0; font-size: .92rem; }
.table > thead th { background: var(--p4-subtle); color: var(--p4-muted); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-bottom: 1px solid var(--p4-line-strong); vertical-align: bottom; white-space: nowrap; }
.table > :not(caption) > * > * { padding: .6rem .7rem; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table td, .table tbody th { vertical-align: middle; }
.table tbody th { font-weight: 600; }
.table caption { caption-side: top; color: var(--p4-muted); font-size: .85rem; padding: .65rem .8rem; }
.table small { color: var(--p4-muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.management-table { min-width: 68rem; }
.management-table th:first-child { white-space: nowrap; }
.management-table td:nth-child(7), .management-table td:nth-child(9), .management-table td:nth-child(10) { white-space: nowrap; }
.management-table td:nth-child(7) .badge { margin-block: .1rem; }
.table .badge { font-size: .76rem; }
/* Request ID stays visible while scrolling the wide table horizontally. */
.management-table > :is(thead, tbody) > tr > :first-child { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--p4-line); }
.management-table > tbody > tr > :first-child { background-color: var(--p4-surface); }
.management-table.table-hover > tbody > tr:hover > :first-child { background-color: var(--bs-table-hover-bg); }
.management-table > tbody > tr > td[colspan] { position: static; box-shadow: none; text-align: center; color: var(--p4-muted); padding-block: 1.5rem; }
.table-link-action { font-weight: 600; white-space: nowrap; }
.stats-grid { display: grid; gap: 1.25rem; }
@media (min-width: 992px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stats-grid > section { min-width: 0; }

/* ---------- Review page ---------- */
.review-layout { display: grid; gap: 1.25rem; }
@media (min-width: 1200px) { .review-layout { grid-template-columns: minmax(0, 1fr) 24rem; align-items: start; } }
.review-layout > * { min-width: 0; }
.review-layout .panel + .panel, .review-aside > * + * { margin-top: 1.25rem; }
.decision-panel { border-top: 3px solid var(--p4-blue); }
.decision-block + .decision-block { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--p4-line); }
.document-links { list-style: none; padding: 0; margin: 0; }
.document-links li { padding: .4rem 0; }
.document-links a::before { content: ''; display: inline-block; width: .75rem; height: .95rem; margin-right: .5rem; vertical-align: -.1rem; border: 1.5px solid currentColor; border-radius: 2px; border-top-right-radius: 5px; }
.intended-use { max-width: var(--p4-reading); }
.intended-use p:last-child { margin-bottom: 0; }
.version-card { border: 1px solid var(--p4-line); border-radius: var(--p4-radius-sm); padding: 1rem 1.15rem; background: var(--p4-surface); }
.version-card + .version-card { margin-top: .85rem; }
.version-card.is-current { border-color: var(--p4-blue); box-shadow: inset 3px 0 0 var(--p4-blue); }
.version-card h3 { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.version-applicant { color: var(--p4-muted); font-size: .9rem; overflow-wrap: anywhere; }
details summary { cursor: pointer; color: var(--p4-blue); font-weight: 500; }
details[open] summary { margin-bottom: .5rem; }

.request-timeline { border-left: 2px solid #d6dfec; list-style: none; padding-left: 1.25rem; margin-bottom: 0; }
.request-timeline li { position: relative; margin-bottom: 1rem; }
.request-timeline li:last-child { margin-bottom: 0; }
.request-timeline li::before { content: ''; position: absolute; left: -1.58rem; top: .45rem; width: .65rem; height: .65rem; background: #4f719e; border-radius: 50%; box-shadow: 0 0 0 3px var(--p4-surface); }
.request-timeline time { color: #536477; font-size: .85rem; }
.request-timeline p { margin: .25rem 0 0; color: var(--p4-ink); font-size: .93rem; }

/* ---------- Applicant progress ---------- */
.applicant-progress { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; list-style: none; padding: 0; margin-bottom: 1.25rem; }
.applicant-progress li { border: 1px solid #ccd7e6; border-top-width: .35rem; border-radius: .4rem; padding: .55rem .65rem; font-size: .87rem; background: var(--p4-surface); font-weight: 600; color: var(--p4-ink); line-height: 1.35; }
.applicant-progress small { display: block; color: #536477; font-weight: 400; margin-top: .15rem; }
.applicant-progress .progress-complete { border-top-color: #26754a; }
.applicant-progress .progress-current { border-top-color: #1255b0; background: var(--p4-blue-soft); }
.applicant-progress .progress-action { border-top-color: #9d6810; background: var(--p4-warning-soft); }
.applicant-progress .progress-unavailable { border-top-color: #777; }
.applicant-progress .progress-upcoming { color: var(--p4-muted); font-weight: 500; }
.applicant-progress .progress-complete small::before { content: '\2713\00a0'; color: #26754a; font-weight: 700; }
@media (max-width: 575px) { .applicant-progress { grid-template-columns: 1fr; } .applicant-progress li { border-top-width: 1px; border-left-width: .35rem; } }
.agreement-steps { counter-reset: agreement; list-style: none; padding: 0; margin: 0 0 1.25rem; }
.agreement-steps li { counter-increment: agreement; display: flex; align-items: center; gap: .75rem; padding: .3rem 0; min-height: 2.4rem; }
.agreement-steps li::before { content: counter(agreement); flex: 0 0 1.65rem; height: 1.65rem; border-radius: 50%; background: var(--p4-blue-soft); color: var(--p4-navy); font-weight: 700; font-size: .85rem; text-align: center; line-height: 1.65rem; }
.upload-box { background: var(--p4-subtle); border: 1px dashed var(--p4-line-strong); border-radius: var(--p4-radius-sm); padding: 1rem 1.15rem; }

/* ---------- Status pages ---------- */
.status-page { max-width: 40rem; margin-inline: auto; text-align: left; }
.status-page h1 { font-size: 1.6rem; }
.status-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; font-weight: 700; font-size: 1.15rem; margin-bottom: .85rem; }
.status-icon-ok { background: var(--p4-success-soft); color: var(--p4-success); }
.status-icon-warn { background: var(--p4-warning-soft); color: var(--p4-warning); }
.status-icon-info { background: var(--p4-blue-soft); color: var(--p4-blue); }

/* ---------- FAQ / contact ---------- */
.faq-list h2 { font-size: 1.05rem; margin: 1.5rem 0 .4rem; padding-top: 1.25rem; border-top: 1px solid var(--p4-line); }
.faq-list h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.faq-list p { color: var(--p4-ink); margin-bottom: 0; }
.contact-card { display: grid; gap: 1rem; }
@media (min-width: 768px) { .contact-card { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.contact-email { font-size: 1.1rem; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: var(--p4-surface); border-top: 1px solid var(--p4-line); color: var(--p4-muted); font-size: .85rem; }
.site-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding-block: 1.1rem; }
.site-footer a { color: var(--p4-muted); }
.site-footer a:hover { color: var(--p4-navy); }
.footer-links { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin: 0; padding: 0; list-style: none; }
.footer-identity strong { color: var(--p4-ink); font-weight: 600; }

/* ---------- Print ---------- */
@media print {
  header, footer, .skip-link, .no-print { display: none !important; }
  body, main { background: #fff !important; }
  main { max-width: none !important; padding: 0 !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: .8em; }
  .panel, .kpi-card, .table-shell, .version-card { box-shadow: none !important; border-color: #bbb !important; }
  .kpi-card-primary { background: #fff !important; }
  .kpi-card-primary h2, .kpi-card-primary .kpi-value { color: #000 !important; }
  .management-table > :is(thead, tbody) > tr > :first-child { position: static; }
  .hero, .review-layout, .dashboard-grid, .stats-grid { display: block; }
}
