/* Height of the sticky case-context bar, republished by base.js on the pages
   that render one. Stays 0px everywhere else so the sticky offsets and
   scroll-margins below are a no-op outside the case workspace. */
:root {
    --case-bar-height: 0px;
}

/* ========== Common match-checkbox styling used across ALL source tabs ========== */

.source-match-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.source-match-header {
    gap: 0;
}

.idicore-match-header .accordion-button .min-w-0 {
    min-width: 0;
}

.idicore-match-header .accordion-button .record-history-summary {
    font-size: 0.875rem;
    line-height: 1.2;
}

.delete-single-match-btn {
    opacity: 0.35;
    transition: opacity 0.15s;
    z-index: 10;
    padding: 0.15rem 0.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.delete-single-match-btn:hover {
    opacity: 1 !important;
}

.accordion-item.match-deselected {
    opacity: 0.8;
    transition: opacity 0.2s;
}

.idicore-search-section .accordion-item.match-deselected {
    opacity: 1;
}

.idicore-search-section .accordion-item.match-deselected .accordion-button {
    color: #000;
}

.idicore-search-section .accordion-item.match-deselected .accordion-button:not(.collapsed) {
    color: #000;
}

/* ========== Selected Matches tab styling ========== */
.auto-analysis-matches {
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid var(--bs-border-color);
    min-width: 0;
}
.auto-matches-header { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .65rem; margin-bottom: .45rem; }
.auto-analysis-matches h3 { margin: 0; font-size: .95rem; font-weight: 700; text-align: left; }
.auto-matches-caution { flex: 1 1 auto; }
.auto-matches-header .btn { margin-left: auto; }
.auto-matches-controls { display: flex; flex-wrap: wrap; gap: .5rem; }
.auto-matches-controls > div { flex: 1 1 12rem; min-width: 0; }
.auto-matches-controls > div:first-child { flex-grow: 2; }
.auto-matches-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .65rem; margin: .4rem 0; }
.auto-matches-summary > p { flex: 1 1 auto; margin: 0; }
.auto-matches-metadata { min-width: 0; overflow-wrap: anywhere; }
.auto-matches-metadata summary { cursor: pointer; }
.auto-matches-metadata[open] { flex-basis: 100%; }
.auto-matches-metadata p { margin: .3rem 0 0; }
.auto-match-candidate { border: 1px solid var(--bs-border-color); border-radius: .4rem; margin-bottom: .4rem; }
.auto-match-candidate summary { padding: .5rem .65rem; cursor: pointer; overflow-wrap: anywhere; }
.auto-match-candidate summary .badge { margin-left: .65rem; white-space: normal; }
.auto-match-detail { padding: 0 .85rem .85rem; overflow-wrap: anywhere; }
.auto-match-source { border-left: 3px solid var(--bs-border-color); padding: .4rem .75rem; margin-top: .65rem; }
.auto-match-source h4 { font-size: .9rem; font-weight: 700; }
#auto-matches-pagination[hidden] { display: none !important; }
.record-selected-empty-state { padding: .25rem 0; }
@media (max-width: 575px) {
    .auto-matches-caution { order: 3; flex-basis: 100%; }
}

.record-selected-matches-workspace {
    min-width: 0;
}

.record-selected-matches-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}

.record-selected-matches-heading {
    min-width: 0;
}

.record-selected-matches-heading h2 {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0 0 .25rem;
    color: var(--bs-body-color);
    font-size: 1.05rem;
    font-weight: 800;
    text-align: left;
}

.record-selected-matches-heading p {
    max-width: 48rem;
    line-height: 1.45;
}

.record-selected-matches-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
}

.record-selected-run-action {
    white-space: nowrap;
}

.record-selected-analysis-purpose {
    margin-bottom: 1rem;
    padding: .8rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .55rem;
    background: var(--bs-body-bg);
}

.record-selected-analysis-purpose fieldset {
    min-width: 0;
}

.record-selected-analysis-purpose-label {
    margin: 0;
    color: var(--bs-body-color);
    font-size: .82rem;
    font-weight: 800;
}

.record-selected-analysis-purpose-help {
    max-width: 68rem;
    margin: .25rem 0 .65rem;
    color: var(--bs-secondary-color);
    font-size: .73rem;
    line-height: 1.45;
}

.record-selected-analysis-purpose-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
}

.record-selected-purpose-option {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    min-width: 0;
    padding: .65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .45rem;
    cursor: pointer;
}

.record-selected-purpose-option .form-check-input {
    flex: 0 0 auto;
    margin-top: .16rem;
}

.record-selected-purpose-option strong,
.record-selected-purpose-option small {
    display: block;
}

.record-selected-purpose-option small {
    margin-top: .15rem;
    color: var(--bs-secondary-color);
    font-size: .72rem;
    line-height: 1.35;
}

.record-selected-related-context {
    display: grid;
    grid-template-columns: minmax(12rem, .7fr) minmax(0, 1.3fr);
    gap: .75rem 1rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--bs-border-color);
}

.record-selected-related-context[hidden] {
    display: none;
}

.record-selected-related-context .form-label,
.record-selected-relevance-basis legend {
    margin-bottom: .3rem;
    color: var(--bs-body-color);
    font-size: .76rem;
    font-weight: 750;
}

.record-selected-relevance-basis {
    min-width: 0;
}

.record-selected-relevance-basis .form-text {
    margin: 0 0 .35rem;
}

.record-selected-relevance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem .75rem;
}

.record-selected-relevance-grid .form-check {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    min-width: 0;
    margin: 0;
}

.record-selected-relevance-grid .form-check-input {
    flex: 0 0 auto;
    margin-left: 0;
}

.record-selected-relative-warning {
    padding: .55rem .7rem;
    font-size: .75rem;
    line-height: 1.4;
}

.record-selected-analysis-guidance {
    margin-bottom: 1rem;
    padding: .75rem .8rem;
    border: 1px solid var(--bs-border-color);
    border-left: 3px solid var(--bs-info);
    border-radius: .55rem;
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 48%, var(--bs-body-bg));
}

.record-selected-analysis-guidance-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
}

.record-selected-analysis-guidance-label {
    margin: 0;
    color: var(--bs-body-color);
    font-size: .82rem;
    font-weight: 800;
}

.record-selected-analysis-optional {
    margin-left: .3rem;
    color: var(--bs-secondary-color);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.record-selected-analysis-guidance-help {
    max-width: 68rem;
    margin: .25rem 0 .55rem;
    color: var(--bs-secondary-color);
    font-size: .73rem;
    line-height: 1.45;
}

.record-selected-analysis-guidance textarea {
    min-height: 5.75rem;
    resize: vertical;
}

.record-selected-analysis-guidance-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .35rem;
    color: var(--bs-secondary-color);
    font-size: .67rem;
    line-height: 1.35;
}

.record-selected-analysis-guidance-count {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    white-space: nowrap;
}

.selected-source-section {
    border-left: 3px solid #dee2e6;
    padding-left: 12px;
    margin-bottom: 1.5rem;
}

#selected-idicore-section { border-left-color: #0d6efd; }
#selected-tlo-section { border-left-color: #198754; }
#selected-clear-section { border-left-color: #ffc107; }

.selected-match-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    font-size: 0.9rem;
}

.selected-match-card .match-info {
    flex-grow: 1;
}

.selected-match-card .remove-selected-btn {
    opacity: 0.5;
    transition: opacity 0.15s;
    padding: 0.15rem 0.4rem;
    line-height: 1;
}

.selected-match-card .remove-selected-btn:hover {
    opacity: 1;
}

.selected-match-card .match-source-badge {
    font-size: 0.7rem;
    margin-right: 0.5rem;
}

/* ========== Triage tier pill bars ========== */
.idicore-triage-pill,
.tlo-triage-pill {
    font-size: 0.78rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    transition: all 0.15s;
}
.idicore-triage-pill.active,
.tlo-triage-pill.active {
    font-weight: 600;
    box-shadow: 0 0 0 0.15rem rgba(0,0,0,0.08);
}
/* Override bright cyan on Name Match filter pills */
.idicore-triage-pill.btn-outline-info,
.tlo-triage-pill.btn-outline-info {
    color: #5b9bd5;
    border-color: #5b9bd5;
}
.idicore-triage-pill.btn-outline-info:hover,
.tlo-triage-pill.btn-outline-info:hover,
.idicore-triage-pill.btn-outline-info.active,
.tlo-triage-pill.btn-outline-info.active {
    background-color: #5b9bd5;
    border-color: #5b9bd5;
    color: #fff;
}
.idicore-tier-count,
.tlo-tier-count {
    font-size: 0.68rem;
    min-width: 1.2em;
    padding: 0.15em 0.4em;
}

/* ========== Triage tier badges on result cards ========== */
.triage-tier-badge {
    font-size: 0.7rem;
    vertical-align: middle;
}
.triage-tier-badge.bg-info,
.idicore-tier-count.bg-info,
.tlo-tier-count.bg-info {
    background-color: #5b9bd5 !important;
    color: #fff !important;
}

/* Strong match left-border accent */
.accordion-item[data-triage-tier="strong"] {
    border-left: 3px solid #198754;
}
.accordion-item[data-triage-tier="name_match"] {
    border-left: 3px solid #5b9bd5;
}
.accordion-item[data-triage-tier="relative"] {
    border-left: 3px solid #ffc107;
}

/* Dark mode adjustments for triage UI */
.dark-mode .idicore-triage-pill.active,
.dark-mode .tlo-triage-pill.active {
    box-shadow: 0 0 0 0.15rem rgba(255,255,255,0.12);
}
.dark-mode .accordion-item[data-triage-tier="strong"] {
    border-left-color: #28a745;
}
.dark-mode .accordion-item[data-triage-tier="name_match"] {
    border-left-color: #6aa8de;
}
.dark-mode .accordion-item[data-triage-tier="relative"] {
    border-left-color: #e0a800;
}

#delete-all-tlo-results-btn {
    white-space: nowrap;
}

/* Sticky accordion headers for TLO and idiCORE. Offset by the case bar so they
   pin below it rather than sliding underneath it. */
.accordion-item .accordion-header {
    position: sticky;
    top: var(--case-bar-height, 0px);
    z-index: 1019;
    background-color: var(--bs-accordion-btn-bg, #fff);
}

.accordion-item .accordion-button {
    background-color: var(--bs-accordion-btn-bg, #fff);
}

.accordion-item .accordion-button:not(.collapsed) {
    background-color: var(--bs-accordion-active-bg, #e7f1ff);
}

/* Vehicle card collapse chevron rotation */
.card-header[aria-expanded="false"] .bi-chevron-down {
    transform: rotate(-90deg);
}

.card-header[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(0deg);
}

.delete-idicore-result-btn:hover {
    opacity: 1 !important;
}

/* Match selection controls - uses common .source-match-checkbox from _selected_matches.html */
#idicore-selection-toolbar {
    display: none;
}

/* Search section styling */
.idicore-search-section {
    border-left: 3px solid #dee2e6;
    padding-left: 12px;
    margin-bottom: 1rem;
}

#idicore-current-section {
    border-left-color: #0d6efd;
}

.idicore-previous-section {
    border-left-color: #6c757d;
}

.dismiss-previous-btn {
    padding: 0.15rem 0.4rem;
    line-height: 1;
    font-size: 0.85rem;
}

#delete-all-clear-results-btn {
    white-space: nowrap;
}

/* Floating label styles for unified search */
.floating-sm {
    position: relative;
}
.floating-sm .form-control {
    height: calc(2.3rem + 2px);
    min-height: calc(2.3rem + 2px);
    padding: 1.5rem 0.5rem 0.25rem 0.5rem;
    font-size: 0.875rem;
}
.floating-sm label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0.62rem 0.5rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity .1s ease-in-out, transform .1s ease-in-out, font-size .1s ease-in-out;
    font-size: 0.88rem;
    color: #6c757d;
    opacity: .9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.floating-sm .form-control::placeholder {
    color: transparent;
}
.floating-sm .form-control:focus::placeholder,
.floating-sm .form-control:not(:placeholder-shown)::placeholder {
    color: #adb5bd;
}
.floating-sm .form-control:focus ~ label,
.floating-sm .form-control:not(:placeholder-shown) ~ label {
    opacity: .75;
    font-size: 0.80rem;
    transform: scale(.85) translateY(-0.32rem) translateX(0.15rem);
}
html, body {
    margin: 0;
    padding: 0;
}

body {
    background-color: #fff;
}
html.dark-mode {
    /* — handled below in the consolidated dark-mode section — */
}
samp {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 1em; }
.container {
    width: 96%;
    max-width: 1920px;
    margin: 15px auto;
    padding: 15px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h1, h2, h3 {
    color: #333;
    text-align: center;
    margin-bottom: 0.75rem;
}
h2, h3 {
    font-weight: 500;
}
table {
    border-radius: 10px;
    border-collapse: collapse;
    width: 100%;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

th, td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
    font-size: 0.95rem;
}

th {
    background-color: #f2f2f2;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e0e0e0;
    text-align: center;
}

.table tr {
    transition: background 0.2s;
}

.table tbody tr:hover {
    background-color: #e9f5ff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.table thead {   
    border-radius: 5px 5px 5px 5px;
    overflow: hidden;
}

/* Table headers that stick inside their own scrolling wrapper (a
   .table-responsive with a max-height), not to the viewport. Must stay at
   top: 0 — offsetting these by --case-bar-height would push the header down
   inside its box and let rows scroll into the gap above it. */
.pos-sticky {
    position: sticky;
    top: 0;
    z-index: 2;
}

.table-responsive {
    border-radius: 2px;
}

#recordHistorySection {
    border-radius: 10px;
}

.record-history-sticky {
    position: relative;
    z-index: 5;
    background: var(--bs-body-bg);
}

.record-history-compact-meta {
    display: none;
}

.record-history-minimize-btn {
    display: none;
}

.record-history-sticky.record-history-is-fixed {
    position: fixed;
    z-index: 1030;
    margin-top: 0 !important;
    overflow-x: hidden;
}

.record-history-sticky.record-history-is-fixed .record-history-minimize-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
}

.record-history-sticky.record-history-is-fixed.record-history-compact {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--bs-box-shadow-sm);
    background: var(--bs-body-bg);
    padding: 0.75rem !important;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .record-history-title {
    font-size: 1rem;
    margin-bottom: 0.5rem !important;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .record-history-compact-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.35rem;
    margin-bottom: 0.4rem !important;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .record-history-compact-meta > div {
    margin-bottom: 0;
}

.record-history-sticky.record-history-is-fixed.record-history-minimized .table-responsive {
    display: none;
}

.record-history-sticky.record-history-is-fixed.record-history-minimized .record-history-compact-meta {
    display: flex;
}

.record-history-sticky.record-history-is-fixed.record-history-minimized {
    padding: 0.25rem 0.5rem 0rem 0.5rem !important;
}

.record-history-sticky.record-history-is-fixed.record-history-minimized .record-history-header {
    margin-bottom: 0 !important;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .table-responsive {
    max-height: 56vh;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .table {
    table-layout: fixed;
    margin-bottom: 0;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .table th,
.record-history-sticky.record-history-is-fixed.record-history-compact .table td {
    font-size: 0.78rem;
    padding: 0.3rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .rh-col-actions,
.record-history-sticky.record-history-is-fixed.record-history-compact .rh-col-id,
.record-history-sticky.record-history-is-fixed.record-history-compact .rh-col-source,
.record-history-sticky.record-history-is-fixed.record-history-compact .rh-col-type {
    display: none;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .rh-col-subtype {
    width: 28%;
    max-width: 28%;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .rh-col-date {
    width: 22%;
    max-width: 22%;
}

.record-history-sticky.record-history-is-fixed.record-history-compact .rh-col-record {
    width: 50%;
    max-width: 50%;
}

/* Docked mode: the minimized Record History summary rendered inline inside the
   sticky case-context bar. Overrides the fixed-position treatment above, so it
   must not carry .record-history-is-fixed. Height is capped below the pill row
   so docking never changes the bar's height. */
.case-context-dock {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    min-width: 0;
}

.case-context-dock:empty {
    display: none;
}

.record-history-sticky.record-history-docked {
    position: static;
    z-index: auto;
    max-width: 26rem;
    margin: 0 !important;
    padding: .1rem .4rem !important;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
}

.record-history-sticky.record-history-docked .table-responsive,
.record-history-sticky.record-history-docked .modal {
    display: none;
}

.record-history-sticky.record-history-docked .record-history-header {
    gap: .4rem;
    margin-bottom: 0 !important;
}

.record-history-sticky.record-history-docked .record-history-title {
    margin-bottom: 0 !important;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* On the narrower end of the docked range the wording is redundant with the
   clock icon, so keep the icon and drop the label. */
@media (max-width: 1499.98px) {
    .record-history-sticky.record-history-docked .record-history-title {
        font-size: 0;
    }
    .record-history-sticky.record-history-docked .record-history-title i {
        font-size: .9rem;
    }
}

.record-history-sticky.record-history-docked .record-history-compact-meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    margin-bottom: 0 !important;
    font-size: .74rem;
    white-space: nowrap;
}

.record-history-sticky.record-history-docked .record-history-compact-meta > div {
    overflow: hidden;
    margin: 0 !important;
    text-overflow: ellipsis;
}

.record-history-sticky.record-history-docked .record-history-minimize-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    font-size: .7rem;
}

.record-history-sticky .table-responsive {
    max-height: none;
    overflow-y: visible;
}

.record-history-sticky.record-history-is-fixed:not(.record-history-compact) .table-responsive {
    max-height: 75vh;
    overflow-y: auto;
}

.record-history-sticky .table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bs-table-bg);
}

/* Profile photo dropzone overlay */
.dropzone-overlay {
    width: 100%;
    height: 50px;
    border: 2px dashed rgba(0, 0, 0, 0.3);
    border-radius: 0.375rem;
    align-items: center;
    justify-content: center;
    color: #333;
    background: rgba(255, 255, 255, 0.6);
    z-index: 10;
    display: flex;
}
.dropzone-overlay.highlight { display: flex; }
.dropzone-overlay.uploading::after {
    content: "Uploading...";
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.9rem;
    color: #0d6efd;
}
.dropzone-overlay::before {
    font-size: small;
    content: "Drop or paste image to update";
    color: #333;
    padding: 6px 10px;
    border-radius: 6px;
}

.tooltip-icon {
    border: 0;
    padding: 0 .15rem;
    background: transparent;
    cursor: pointer;
    margin-left: 6px;
    color: #0d6efd;
    font-size: 1.1em;
    vertical-align: middle;
    display: inline-block;
}
.custom-tooltip {
    display: none;
    position: absolute;
    z-index: 1000;
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 220px;
    max-width: 350px;
    font-size: 0.95em;
}
.tooltip-container {
    position: relative;
    display: inline-block;
    margin-top: 0;
    margin-bottom: 0;
}
.alert-match {
    background-color: #d4edda;
    color: #0d6efd;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}
.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}
.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.table td select {
    font-size: 0.85rem;
    border-radius: 5px;
    padding: 2px 5px;
}

.table td[style*="background-color: #e9f5ff"] {
    background-color: #e9f5ff !important;
}

/* Style for negative change */
.negative-change {
    color: red;
}
/* Style for positive change */
.positive-change {
    color: green;
}
.button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 20px 0;
    font-size: 16px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease;
}

.intel_note {
    width: 50%;
}

/* Optimized spacing for forms and sections */
form .bg-light {
    padding: 0.75rem !important;
}

section, .section {
    margin-bottom: 1.5rem;
}

hr.my-5 {
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
}

.stop-button {
    background-color: #ff4c4c;
}
.stop-button:hover {
    background-color: #d43f3f;
}
.close-position-button {
    background-color: #ff4c4c;
    padding: 5px 10px; /* Smaller padding */
    font-size: 12px; /* Smaller font size */
    border-radius: 4px; /* Optional: Round the corners */
    border: none; /* Optional: Remove border */
    cursor: pointer;
    width: 50px;
    justify-self: center;
}
.close-position-button:hover {
    background-color: #d43f3f;
}
.start-button {
    background-color: #4caf50;
}
.start-button:hover {
    background-color: #45a049;
}
.stock-table {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.stock-table th {
    background-color: #2e2c2c;
    color: white;
}
.stock-table tr:nth-child(even) {
    background-color: #f2f2f2;
}
.watchlist-table {
    border: 1px solid #ddd;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.watchlist-table th {
    background-color: #2e2c2c;
    color: white;
}
.watchlist-table tr:nth-child(even) {
    height: 6px;
    background-color: #f2f2f2;
}
.watchlist-table td, .watchlist-table th {
    padding: 0px;
    font-size: 0.95em;
    text-align: center;
}
.remove-button {
    display: block;
    width: 55px;
    padding: 2px;
    margin: 6px 0;
    font-size: 12px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease;
    background-color: #ff4c4c;
    justify-self: center;
}
.add-button {
    display: block;
    width: 55px;
    padding: 2px;
    margin: 6px 0;
    font-size: 12px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease;
    background-color: #4caf50;
    justify-self: center;
}
.statistics {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}
.stat-box {
    background-color: #f2f2f2;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 30%;
    margin-right: 3px;
    margin-left: 3px;
}
.stat-box h4 {
    margin: 0 0 10px;
    color: #525f7f;
}
.stat-box-data {
    display: block;
    font-size: 1.5rem;
}
.small-data {
    font-size: 1rem;
    padding-right: 10px;
    padding-left: 10px;
}
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: white;
    color: #1e1e2f;
}
.navbar .logo {
    font-size: 1.5rem;
    font-weight: bold;
}
.navbar .menu {
    position: relative;
}
.navbar .menu .menu-icon {
    cursor: pointer;
    font-size: 1.5rem;
}
.navbar .menu .dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #fff;
    color: #333;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    overflow: hidden;
    z-index: 1;
}
.navbar .menu .dropdown a {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
}
.navbar .menu .dropdown a:hover {
    background-color: #f2f2f2;
}
.navbar .menu .dropdown.show {
    display: block;
}
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}
.login-card {
    background: #fff;
    padding: 32px 24px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    min-width: 320px;
}
.login-card h2 {
    text-align: center;
    color: #333;
    margin-bottom: 24px;
}
.login-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-card button {
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}
.login-card button:hover {
    background: #45a049;
}

/* Static drop zone in the Case Files section. Replaces the old floating
   #floatingDropZone; the drag-anywhere overlay below covers the reach it had. */
.case-files-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    padding: 1.1rem .75rem;
    border: 2px dashed var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    text-align: center;
    cursor: pointer;
    transition: border-color .12s ease-out, background .12s ease-out;
}

.case-files-dropzone:hover,
.case-files-dropzone:focus-visible {
    border-color: #0d6efd;
    background: rgba(13, 110, 253, .06);
    color: var(--bs-body-color);
}

.case-files-dropzone.is-dragover {
    border-color: #0d6efd;
    border-style: solid;
    background: rgba(13, 110, 253, .12);
    color: var(--bs-body-color);
}

.case-files-dropzone-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.case-files-dropzone-primary {
    font-weight: 600;
    font-size: .9rem;
}

.case-files-dropzone-hint {
    font-size: .78rem;
    opacity: .8;
}

/* Drag-anywhere hint. pointer-events:none keeps it purely visual so the drop
   lands on the element underneath — that is what preserves the profile photo
   tile's own drop target while this is showing. */
.case-files-drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 1045;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, .12);
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.case-files-drag-overlay.is-active {
    display: flex;
}

.case-files-drag-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: 1.75rem 2.5rem;
    border: 2px dashed #0d6efd;
    border-radius: .75rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}

.case-files-drag-overlay-inner i {
    font-size: 2rem;
    line-height: 1;
    color: #0d6efd;
}

.case-files-drag-overlay-inner span {
    color: var(--bs-secondary-color);
    font-size: .85rem;
}

.scroll-to-top-btn {
    position: fixed;
    right: 12px;
    bottom: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(108, 117, 125, 0.45);
    border-radius: 50%;
    background: rgba(248, 249, 250, 0.88);
    color: #6c757d;
    font-size: 1rem;
    line-height: 1;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.scroll-to-top-btn:hover,
.scroll-to-top-btn:focus-visible {
    background: #f8f9fa;
    border-color: #6c757d;
    color: #495057;
}
.dark-mode .scroll-to-top-btn {
    background: rgba(33, 37, 41, 0.88);
    border-color: rgba(173, 181, 189, 0.45);
    color: #adb5bd;
}
.dark-mode .scroll-to-top-btn:hover,
.dark-mode .scroll-to-top-btn:focus-visible {
    background: var(--dm-bg-elevated);
    border-color: #adb5bd;
    color: #dee2e6;
}
.dark-mode .case-files-dropzone:hover,
.dark-mode .case-files-dropzone:focus-visible,
.dark-mode .case-files-dropzone.is-dragover {
    border-color: var(--dm-accent);
}
.dark-mode .case-files-drag-overlay-inner {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-accent);
}
.dark-mode .case-files-drag-overlay-inner i {
    color: var(--dm-accent);
}

#dropZone {
    position: relative;
    z-index: 100;
    background: #f8f9fa;
    cursor: pointer;
    min-height: 100px;
}

.edit-photo-btn {
    position: absolute;
    bottom: 10px;     /* bottom-right is the standard spot */
    right: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    padding: 8px 10px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: background 0.2s ease, transform 0.2s ease;
}

.edit-photo-btn i {
    font-size: 18px;
    color: #333;
}

/* Hover effect (optional, but looks great) */
.edit-photo-btn:hover {
    background: rgba(240,240,240,0.95);
    transform: scale(1.08);
}

.highlight {
    background-color: #d5e7df !important;
}

.form-floating > .form-control,
.form-floating > .form-select {
    height: calc(3.5rem + 2px);
    padding: 1rem .75rem .25rem;
}

.form-floating > label {
    color: #6c757d;
    font-weight: 500;
    font-size: 0.9rem;
}

form .form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
}

form select.form-select,
form input.form-control {
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
}
/* ==========================================================================
   DARK MODE — Variable-driven theme for "private intelligence" aesthetic
   Bootstrap 5.3 data-bs-theme="dark" handles: buttons, dropdowns, modals,
   cards, forms, navbars, accordions, tables, alerts, badges automatically.
   We layer on top with custom surface / accent tokens.
   ========================================================================== */

html.dark-mode {
    /* ── Surface palette (layered depth) ── */
    --dm-bg-base:       #0d1017;
    --dm-bg-surface:    #151921;
    --dm-bg-elevated:   #1c2231;
    --dm-bg-hover:      #252d40;
    --dm-bg-active:     #2f3952;

    /* ── Borders ── */
    --dm-border:        #232b3e;
    --dm-border-light:  #323c56;

    /* ── Typography ── */
    --dm-text-primary:  #dfe3ed;
    --dm-text-secondary:#8d95ab;
    --dm-text-muted:    #586074;
    --dm-text-inverse:  #151921;

    /* ── Accent ── */
    --dm-accent:        #5b9aff;
    --dm-accent-muted:  rgba(91,154,255,0.12);
    --dm-amber:         #d4a853;
    --dm-amber-muted:   rgba(212,168,83,0.12);
}

/* ── Root / body ── */
html.dark-mode {
    background-color: var(--dm-bg-base) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode body {
    background-color: var(--dm-bg-base) !important;
    color: var(--dm-text-primary) !important;
}

/* ── Main container ── */
.dark-mode .container {
    background-color: var(--dm-bg-surface) !important;
    color: var(--dm-text-primary) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    border: 1px solid var(--dm-border);
}

/* ── Typography ── */
.dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode h4, .dark-mode h5, .dark-mode h6 {
    color: var(--dm-text-primary) !important;
}
.dark-mode p, .dark-mode span, .dark-mode label, .dark-mode li {
    color: var(--dm-text-primary);
}
.dark-mode .text-muted {
    color: var(--dm-text-secondary) !important;
}
.dark-mode .text-body-secondary {
    color: var(--dm-text-secondary) !important;
}
.dark-mode a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item) {
    color: var(--dm-accent);
}
.dark-mode a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover {
    color: #82b5ff;
}

/* ── Placeholders ── */
.dark-mode input::placeholder,
.dark-mode textarea::placeholder {
    color: var(--dm-text-muted) !important;
    opacity: 1;
}

/* Keep floating-label placeholders hidden so they don't overlap labels. */
.dark-mode .form-floating > .form-control::placeholder,
.dark-mode .form-floating > .form-control-plaintext::placeholder,
.dark-mode .form-floating > .form-select::placeholder {
    color: transparent !important;
}

/* ── Date picker ── */
/* Render native date/time controls (calendar icon, spin buttons, and the picker
   popup) in a dark scheme app-wide so the indicator stays clearly visible on
   dark inputs instead of being a near-black icon on a dark field. */
.dark-mode input[type="date"],
.dark-mode input[type="datetime-local"],
.dark-mode input[type="time"],
.dark-mode input[type="month"],
.dark-mode input[type="week"] {
    color-scheme: dark;
}
.dark-mode input[type="date"]::-webkit-calendar-picker-indicator,
.dark-mode input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.dark-mode input[type="time"]::-webkit-calendar-picker-indicator,
.dark-mode input[type="month"]::-webkit-calendar-picker-indicator,
.dark-mode input[type="week"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 1;
}

/* Light-themed islands (data-bs-theme="light" cards/modals) keep the native
   light control so the icon stays a dark glyph visible on their light field. */
.dark-mode [data-bs-theme="light"] input[type="date"],
.dark-mode [data-bs-theme="light"] input[type="datetime-local"],
.dark-mode [data-bs-theme="light"] input[type="time"],
.dark-mode [data-bs-theme="light"] input[type="month"],
.dark-mode [data-bs-theme="light"] input[type="week"] {
    color-scheme: light;
}

/* ── Navbar ── */
.dark-mode .navbar {
    background-color: var(--dm-bg-surface) !important;
    border-bottom: 1px solid var(--dm-border);
    box-shadow: 0 1px 8px rgba(0,0,0,0.35);
}

/* ── Tables ── */
.dark-mode table {
    background-color: var(--dm-bg-surface) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode th {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border) !important;
}
.dark-mode th a {
    color: var(--dm-text-primary) !important;
}
.dark-mode td {
    background-color: var(--dm-bg-surface) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border) !important;
}
.dark-mode .table-light {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode tbody tr:hover td {
    background-color: var(--dm-bg-hover) !important;
}

/* ── Forms (supplement Bootstrap dark) ── */
.dark-mode .form-control,
.dark-mode .form-select {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border-light) !important;
}
.dark-mode .form-control:focus,
.dark-mode .form-select:focus {
    border-color: var(--dm-accent) !important;
    box-shadow: 0 0 0 0.2rem var(--dm-accent-muted) !important;
}
.dark-mode .form-label {
    color: var(--dm-text-secondary) !important;
}
.dark-mode .form-check-label {
    color: var(--dm-text-primary) !important;
}
.dark-mode .form-text {
    color: var(--dm-text-muted) !important;
}

/* ── Cards ── */
.dark-mode .card {
    background-color: var(--dm-bg-elevated) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode .card-header {
    background-color: var(--dm-bg-surface) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode .card-body {
    color: var(--dm-text-primary) !important;
}
.dark-mode .card-footer {
    background-color: var(--dm-bg-surface) !important;
    border-color: var(--dm-border) !important;
}

/* ── Modals ── */
.app-decision-dialog {
    width: min(26rem, calc(100vw - 2rem));
    max-width: none;
    padding: 0;
    border: 1px solid var(--app-shell-border, #dfe3e8);
    border-radius: .75rem;
    background: var(--app-shell-surface, #fff);
    color: var(--bs-body-color, #212529);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, .3);
}
.app-decision-dialog:not([open]) {
    display: none;
}
.app-decision-dialog::backdrop {
    background: rgba(0, 0, 0, .55);
}
.app-decision-fallback-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, .55);
}
.app-decision-fallback-backdrop[hidden] {
    display: none !important;
}
.app-decision-dialog.app-decision-fallback {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 10001;
    max-height: calc(100vh - 2rem);
    margin: 0;
    overflow: auto;
    transform: translate(-50%, -50%);
}
.app-decision-dialog .modal-content {
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: inherit;
    background: transparent;
}
.app-decision-dialog .modal-header,
.app-decision-dialog .modal-footer {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
}
.app-decision-dialog .modal-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--app-shell-border, #dfe3e8);
}
.app-decision-dialog .modal-title {
    margin: 0;
}
.app-decision-dialog .modal-body {
    padding: 1.25rem;
    max-height: min(50dvh, 30rem);
    overflow-y: auto;
}
#appMessageDialogBody {
    white-space: pre-line;
}
.app-decision-dialog .modal-footer {
    justify-content: flex-end;
    flex-wrap: wrap;
    border-top: 1px solid var(--app-shell-border, #dfe3e8);
}
.app-decision-dialog [hidden] {
    display: none !important;
}
.app-decision-close {
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.dark-mode .app-decision-dialog {
    border-color: var(--dm-border-light);
    background: var(--dm-bg-elevated);
    color: var(--dm-text-primary);
}
.dark-mode .modal-content:not(#exportViewModal .modal-content) {
    background-color: var(--dm-bg-elevated) !important;
    border-color: var(--dm-border-light) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode .modal-header:not(#exportViewModal .modal-header) {
    border-color: var(--dm-border) !important;
}
.dark-mode .modal-footer:not(#exportViewModal .modal-footer) {
    border-color: var(--dm-border) !important;
}
.dark-mode .modal-title:not(#exportViewModal .modal-title) {
    color: var(--dm-text-primary) !important;
}
.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Keep QA confirmation header readable against bg-warning in dark mode. */
.dark-mode #qaConfirmModal .modal-header,
.dark-mode #qaConfirmModal .modal-title,
.dark-mode #qaConfirmModal .modal-title i {
    color: #323c56 !important;
}

.dark-mode #qaConfirmModal .btn-close {
    filter: none !important;
    opacity: 0.75;
}

.dark-mode #qaConfirmModal .btn-close:hover {
    opacity: 1;
}

/* ── Accordions ── */
.dark-mode .accordion-item {
    background-color: var(--dm-bg-surface) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode .accordion-button {
    background-color: var(--dm-bg-surface) !important;
    color: var(--dm-text-primary) !important;
    box-shadow: none;
}
.dark-mode .accordion-button:not(.collapsed) {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-accent) !important;
}
.dark-mode .accordion-button::after {
    /* data-bs-theme="dark" already swaps the icon; no extra filter needed */
}
.dark-mode .accordion-body {
    background-color: var(--dm-bg-base) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode .accordion-item .accordion-header {
    background-color: var(--dm-bg-surface);
}
.dark-mode .accordion-item .accordion-button {
    background-color: var(--dm-bg-surface);
}
.dark-mode .accordion-item .accordion-button:not(.collapsed) {
    background-color: var(--dm-bg-elevated);
}

/* ── Dropdowns ── */
.dark-mode .dropdown-menu {
    background-color: var(--dm-bg-elevated) !important;
    border-color: var(--dm-border-light) !important;
}
.dark-mode .dropdown-item {
    color: var(--dm-text-primary) !important;
}
.dark-mode .dropdown-item:hover,
.dark-mode .dropdown-item:focus {
    background-color: var(--dm-bg-hover) !important;
    color: #fff !important;
}
.dark-mode .dropdown-header {
    color: var(--dm-text-secondary) !important;
}
.dark-mode .dropdown-divider {
    border-color: var(--dm-border) !important;
}

/* ── Alerts ── */
.dark-mode .alert-success {
    background-color: rgba(25,135,84,0.15) !important;
    border-color: rgba(25,135,84,0.3) !important;
    color: #6ce0a0 !important;
}
.dark-mode .alert-danger {
    background-color: rgba(220,53,69,0.15) !important;
    border-color: rgba(220,53,69,0.3) !important;
    color: #f0929c !important;
}
.dark-mode .alert-warning {
    background-color: rgba(255,193,7,0.12) !important;
    border-color: rgba(255,193,7,0.25) !important;
    color: #ffe083 !important;
}
.dark-mode .alert-info {
    background-color: rgba(13,202,240,0.12) !important;
    border-color: rgba(13,202,240,0.25) !important;
    color: #76e3f5 !important;
}

/* ── Badges (ensure readability) ── */
.dark-mode .badge.bg-light {
    background-color: var(--dm-bg-hover) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode .badge.bg-secondary {
    background-color: var(--dm-bg-active) !important;
}

/* ── List groups ── */
.dark-mode .list-group-item {
    background-color: var(--dm-bg-surface) !important;
    border-color: var(--dm-border) !important;
    color: var(--dm-text-primary) !important;
}

/* ── OSINT candidate list ── */
#osintResults .osint-candidate-main,
#osintResults .osint-candidate-body {
    min-width: 0;
}
#osintResults .osint-source-link {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ── Case-record OSINT actions/results ── */
.osint-action-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .45rem;
}

/* 44px is the touch-target floor the case-record browser gate enforces at
   390px, and it matches every sibling control rule in this file. Shrink the
   button's visual weight with padding, font-size, or width if it looks heavy —
   not by lowering the hit area below the accessible minimum. */
.osint-action-group .btn,
.btn.record-profile-rail-lenso {
    min-height: 32px;
}

/* aria-disabled controls remain keyboard-focusable so the adjacent reason or
   title can be discovered. Make the guarded state visible without using
   pointer-events:none, which would hide the explanation from keyboard users. */
.osint-action-group .btn[aria-disabled="true"],
.record-profile-rail-lenso[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .68;
    filter: saturate(.55);
}

.osint-action-group .btn[aria-disabled="true"]:focus-visible,
.record-profile-rail-lenso[aria-disabled="true"]:focus-visible {
    opacity: .88;
    outline: 3px solid rgba(13, 110, 253, .45);
    outline-offset: 2px;
}

.record-profile-rail-primary .record-profile-rail-lenso {
    grid-column: 1 / -1;
    width: 100%;
    white-space: normal;
}

.osint-candidate-thumbnail {
    width: 4rem;
    height: 4rem;
    flex: 0 0 4rem;
    margin-right: .55rem;
    border-radius: .35rem;
    object-fit: cover;
}

.osint-candidate-body {
    overflow-wrap: anywhere;
}

.osint-source-only,
.osint-vendor-relevance,
.osint-not-addable {
    display: block;
    margin-top: .3rem;
    line-height: 1.35;
}

.osint-candidate-actions {
    max-width: 42%;
    white-space: normal;
    text-align: right;
}

.osint-candidate-actions .btn {
    min-height: 44px;
}

@media (max-width: 575.98px) {
    .osint-action-group {
        width: 100%;
        justify-content: stretch;
    }

    .osint-action-group .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    #osintResults .osint-candidate-row {
        display: block !important;
    }

    #osintResults .osint-candidate-main {
        width: 100%;
    }

    #osintResults .osint-candidate-actions {
        max-width: none;
        margin-top: .55rem;
        margin-left: 0 !important;
        text-align: left;
    }

    #osintResults .osint-candidate-actions .btn {
        width: 100%;
    }
}

/* The application may start in dark mode. Keep provider-result text and
   controls readable there as well as in the default Bootstrap theme. */
.dark-mode #osintResults .osint-candidate-row,
.dark-mode #osintResults .osint-candidate-body {
    color: var(--dm-text-primary) !important;
}

.dark-mode #osintResults .osint-candidate-row strong {
    color: var(--dm-text-primary) !important;
}

.dark-mode #osintResults .osint-candidate-row .badge.bg-secondary {
    background-color: var(--dm-bg-active) !important;
    color: var(--dm-text-primary) !important;
}

.dark-mode #osintResults .osint-candidate-row .badge.bg-light.text-dark {
    background-color: var(--dm-bg-hover) !important;
    color: var(--dm-text-primary) !important;
}

.dark-mode #osintResults .osint-candidate-row .badge.bg-info.text-darker {
    background-color: #0f7188 !important;
    color: #fff !important;
}

.dark-mode #osintResults .osint-source-link a {
    color: #8ec5ff !important;
}

.dark-mode #osintResults .osint-source-only,
.dark-mode #osintResults .osint-not-addable {
    color: #c1cada !important;
}

.dark-mode #osintResults .osint-add-btn {
    border-color: #8ec5ff !important;
    color: #8ec5ff !important;
}

/* ── Borders / dividers ── */
.dark-mode hr {
    border-color: var(--dm-border) !important;
    opacity: 1;
}
.dark-mode .border,
.dark-mode .border-bottom,
.dark-mode .border-top {
    border-color: var(--dm-border) !important;
}

/* ── Shadows ── */
.dark-mode .shadow-sm {
    box-shadow: 0 2px 8px rgba(0,0,0,0.35) !important;
}
.dark-mode .shadow {
    box-shadow: 0 4px 16px rgba(0,0,0,0.45) !important;
}
.dark-mode .shadow-lg {
    box-shadow: 0 8px 30px rgba(0,0,0,0.55) !important;
}

/* ── BS utility class overrides (remove the old broken .rounded/.shadow-sm/.p-3 rule) ── */
/* We intentionally do NOT set background on .rounded, .shadow-sm, or .p-3 globally */

/* ── Selected match cards ── */
.dark-mode .selected-match-card {
    background-color: var(--dm-bg-elevated);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}

.dark-mode .record-selected-analysis-purpose,
.dark-mode .record-selected-purpose-option {
    border-color: var(--dm-border);
    background: var(--dm-bg-elevated);
}

.dark-mode .record-selected-related-context {
    border-color: var(--dm-border);
}

.dark-mode .record-selected-analysis-purpose-label,
.dark-mode .record-selected-related-context .form-label,
.dark-mode .record-selected-relevance-basis legend {
    color: var(--dm-text-primary);
}

.dark-mode .record-selected-analysis-purpose-help,
.dark-mode .record-selected-purpose-option small {
    color: var(--dm-text-secondary);
}

.dark-mode .record-selected-analysis-guidance {
    border-color: var(--dm-border);
    border-left-color: var(--dm-accent);
    background: color-mix(in srgb, var(--dm-bg-active) 62%, var(--dm-bg-surface));
}

.dark-mode .record-selected-analysis-guidance-label {
    color: var(--dm-text-primary);
}

.dark-mode .record-selected-analysis-guidance-help,
.dark-mode .record-selected-analysis-guidance-footer,
.dark-mode .record-selected-analysis-optional {
    color: var(--dm-text-secondary);
}

/* ── Inline editing ── */
.dark-mode tr.editing {
    background-color: var(--dm-bg-hover) !important;
}
.dark-mode .editable-cell select.cell-edit,
.dark-mode .editable-cell input.cell-edit,
.dark-mode .editable-cell textarea.cell-edit {
    background-color: var(--dm-bg-elevated);
    color: var(--dm-text-primary);
    border-color: var(--dm-accent);
}

/* ── Login page card ── */
.dark-mode .card.shadow-lg {
    box-shadow: 0 8px 30px rgba(0,0,0,0.55) !important;
}

/* ── Theme toggle button ── */
.dm-theme-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #ced4da;
    background-color: #fff;
    color: #2e2f31;
    font-size: 1rem;
    transition: all 0.2s ease;
}
.dm-theme-toggle:hover {
    background-color: #e9ecef;
}
.dark-mode .dm-theme-toggle {
    border-color: var(--dm-border-light);
    background-color: var(--dm-bg-elevated);
    color: var(--dm-amber);
}
.dark-mode .dm-theme-toggle:hover {
    background-color: var(--dm-bg-hover);
    border-color: var(--dm-amber);
}

/* ── Backward-compat utility classes (used in templates) ── */
.dark-mode .p-text,
.dark-mode .dm-white-text {
    color: var(--dm-text-primary) !important;
}
.dark-mode .dm-black-text,
.dark-mode .dark-title {
    color: var(--dm-text-primary) !important;
}
.dark-mode .dm-white-bg,
.dark-mode .dark-gray-container {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary) !important;
}
.dark-gray-container {
    border-radius: 12px;
    padding: 1rem;
}
.dark-mode .error-title {
    color: #f0929c !important;
}

/* ── Scrollbar ── */
.dark-mode ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.dark-mode ::-webkit-scrollbar-track {
    background: var(--dm-bg-base);
}
.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--dm-border-light);
    border-radius: 4px;
}
.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--dm-text-muted);
}

/* Status color classes (stable across themes) */
.status-open { color: #dc3545 !important; }
.status-returned { color: #dc3545 !important; }
.status-quality { color: #0d6efd !important; }
.status-ready { color: #0d6efd !important; }
.status-sent { color: #198754 !important; }
.status-other { color: #856404 !important; }
.dark-mode .status-other { color: var(--dm-amber) !important; }

/* QA Report Markdown Styling */

#qaReportText h1 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 0.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.35rem;
    text-align: center;
}

#qaReportText h2 {
    color: #333;
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    text-align: left;
}

#qaReportText h3 {
    color: #333;
    font-size: 1.0rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.4rem;
    text-align: left;
}

#qaReportText hr {
    border: 0;
    height: 2px;
    background: linear-gradient(to right, #204783, transparent);
    margin: 0.75rem 0;
}

#qaReportText table {
    width: 100%;
    margin: 0.5rem 0;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#qaReportText table thead tr {
    background-color: #333;
    color: white;
    text-align: left;
    font-weight: 600;
}

#qaReportText table th {
    background-color: #2e2f31 !important;
    text-align: center;
}

#qaReportText table th,
#qaReportText table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
}

#qaReportText table tbody tr {
    border-bottom: 1px solid #dddddd;
}

#qaReportText table tbody tr:nth-of-type(even) {
    background-color: #f8f9fa;
}

#qaReportText strong {
    color: #2e2f31;
    font-weight: 600;
}

#qaReportText p {
    margin-bottom: 1.0rem;
    margin-top: 0.25rem;
    line-height: 1.5;
}

#qaReportText ul, #qaReportText ol {
    margin-left: 1.5rem;
    margin-top: 0.25rem;
    margin-bottom: 1.5rem;
}

#qaReportText li {
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

#qaReportText code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

#qaReportText blockquote {
    border-left: 4px solid #2e2f31;
    padding-left: 1rem;
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    color: #7f8c8d;
    font-style: italic;
}

.dark-mode #qaReportText h1,
.dark-mode #qaReportText h2,
.dark-mode #qaReportText h3,
.dark-mode #qaReportText h4 {
    color: var(--dm-text-primary) !important;
}
.dark-mode #qaReportText {
    color: var(--dm-text-primary);
}
.dark-mode #qaReportText strong {
    color: var(--dm-text-primary);
}
.dark-mode #qaReportText p,
.dark-mode #qaReportText li {
    color: var(--dm-text-primary);
}
.dark-mode #qaReportText code {
    background-color: var(--dm-bg-hover);
    color: #f0929c;
}
.dark-mode #qaReportText blockquote {
    border-left-color: var(--dm-border-light);
    color: var(--dm-text-secondary);
}
.dark-mode #qaReportText table {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.dark-mode #qaReportText table thead tr {
    background-color: var(--dm-bg-active);
}
.dark-mode #qaReportText table th {
    background-color: var(--dm-bg-active) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border) !important;
}
.dark-mode #qaReportText table td {
    border-color: var(--dm-border) !important;
}
.dark-mode #qaReportText table tbody tr:nth-of-type(even) {
    background-color: var(--dm-bg-elevated);
}
.dark-mode #qaReportText hr {
    background: linear-gradient(to right, var(--dm-accent), transparent);
}

/* Chat Message Markdown Styling */
.ai-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    margin-bottom: 1rem;
}

.ai-message--user {
    align-items: flex-end;
}

.ai-message--assistant {
    width: 100%;
}

.ai-message__content {
    min-width: 0;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-align: left;
    overflow-wrap: anywhere;
}

.ai-message__content--assistant {
    width: min(100%, 68ch);
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #212529;
    font-size: 0.94rem;
    line-height: 1.58;
    overflow-x: auto;
}

.ai-message__content--user {
    max-width: min(80%, 62ch);
    background-color: #0d6efd;
    color: #fff;
    white-space: pre-wrap;
}

.ai-message__metadata,
.ai-message__reasoning {
    width: min(100%, 68ch);
    margin-top: 0.25rem;
    text-align: left;
}

#chatMessagesContainer .ai-message__content--assistant h1 {
    color: #2c3e50;
    font-size: 1.05rem;
    font-weight: 650;
    line-height: 1.3;
    margin-top: 1rem;
    margin-bottom: 0.45rem;
    text-align: left;
}

#chatMessagesContainer .ai-message__content--assistant h2 {
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.3;
    margin-top: 0.9rem;
    margin-bottom: 0.4rem;
    text-align: left;
}

#chatMessagesContainer .ai-message__content--assistant h3,
#chatMessagesContainer .ai-message__content--assistant h4,
#chatMessagesContainer .ai-message__content--assistant h5,
#chatMessagesContainer .ai-message__content--assistant h6 {
    color: #34495e;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 0.8rem;
    margin-bottom: 0.35rem;
    text-align: left;
}

#chatMessagesContainer .ai-message__content--assistant > :first-child {
    margin-top: 0;
}

#chatMessagesContainer .ai-message__content--assistant > :last-child {
    margin-bottom: 0;
}

#chatMessagesContainer .ai-message__content--assistant hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, #204783, transparent);
    margin: 0.5rem 0;
}

#chatMessagesContainer .ai-message__content--assistant table {
    width: 100%;
    margin: 0.5rem 0;
    border-collapse: collapse;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.9em;
}

#chatMessagesContainer .ai-message__content--assistant table thead tr {
    background-color: #2e2f31;
    color: white;
    text-align: left;
    font-weight: 600;
}

#chatMessagesContainer table th {
    background-color: #2e2f31 !important;
    text-align: center;
}

#chatMessagesContainer .ai-message__content--assistant table th,
#chatMessagesContainer .ai-message__content--assistant table td {
    padding: 6px 10px;
    border: 1px solid #ddd;
}

#chatMessagesContainer .ai-message__content--assistant table tbody tr:nth-of-type(even) {
    background-color: #f8f9fa;
}

#chatMessagesContainer .ai-message__content--assistant strong {
    color: #2c3e50;
    font-weight: 600;
}

#chatMessagesContainer .ai-message__content--assistant p {
    margin: 0 0 0.7rem;
    line-height: 1.58;
}

#chatMessagesContainer .ai-message__content--assistant ul,
#chatMessagesContainer .ai-message__content--assistant ol {
    margin: 0.25rem 0 0.75rem;
    padding-left: 1.35rem;
}

#chatMessagesContainer .ai-message__content--assistant blockquote {
    margin: 0.7rem 0;
    padding: 0.15rem 0 0.15rem 0.75rem;
    border-left: 3px solid #a9b9cc;
    color: #4b5563;
}

#chatMessagesContainer .ai-message__content--assistant pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 0.65rem;
    border-radius: 0.4rem;
    background: #f5f7fa;
    font-size: 0.84rem;
}

/* Floating AI Chat Widget Styles */
.ai-chat-widget {
    position: relative;
    z-index: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ai-chat-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e2f31 0%, #0d6efd 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ai-chat-toggle:active {
    transform: scale(0.95);
}

.ai-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

.ai-chat-window {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-100%);
    width: 800px;
    max-width: calc(100vw - 10px);
    height: 600px;
    max-height: calc(100vh - 10px);
    min-width: 400px;
    min-height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    /* Native CSS `resize: both` is wrong here: the widget grows upward from a
       bottom-anchored toggle via translateY(-100%), so the bottom-right corner
       drag feels inverted (pulling down made the widget grow UP). We use a
       custom top-right drag handle instead — see .ai-chat-resize-handle. */
}

.ai-chat-window.ai-chat-window-expanded {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    bottom: 20px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    transform: none;
    resize: none;
    animation: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(calc(-100% + 20px));
    }
    to {
        opacity: 1;
        transform: translateY(-100%);
    }
}

.ai-chat-header {
    background: linear-gradient(135deg, #2e2f31 0%, #0d6efd 100%);
    color: white;
    padding: 8px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.ai-chat-header .btn-icon {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.ai-chat-header .btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

#aiChatExpand {
    cursor: pointer;
}

.ai-chat-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.ai-tab-btn {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    color: #6c757d;
    transition: all 0.2s;
}

.ai-tab-btn:hover {
    color: #495057;
    background: rgba(0, 0, 0, 0.02);
}

.ai-tab-btn.active {
    color: #2e2f31;
    border-bottom-color: #2e2f31;
    background: white;
}

.ai-chat-content {
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.ai-tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.ai-tab-content.active {
    display: flex;
}

/* AI Chat History Sidebar */
.ai-chat-body {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
}

.ai-history-sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: 0 solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease, min-width 0.2s ease, border-right 0.2s ease;
    background: #f8f9fa;
    flex-shrink: 0;
}

.ai-history-sidebar.ai-history-sidebar-open {
    width: 195px;
    min-width: 155px;
    border-right: 1px solid #dee2e6;
}

.ai-history-sidebar-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.ai-history-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.ai-history-group-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 10px 2px;
}

.ai-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 5px 8px;
    font-size: 0.78rem;
    border-bottom: 1px solid #f0f0f0;
    color: #343a40;
    gap: 4px;
}

.ai-history-item:hover {
    background: #e8f0fe;
}

.ai-history-item.active {
    background: #dbeafe;
    font-weight: 600;
}

.ai-history-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ai-history-delete-btn {
    background: transparent;
    border: none;
    color: #adb5bd;
    padding: 0 2px;
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.ai-history-delete-btn:hover {
    color: #dc3545;
}

.ai-chat-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
}

/* QA review FAB + menu */
.qa-review-fab-container {
    position: relative;
    z-index: 2;
}

.qa-review-fab-container .dropup {
    display: flex;
    justify-content: center;
}

.qa-review-fab {
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.35);
    font-weight: 600;
    padding: 0.55rem 0.95rem;
}

.qa-review-fab:focus,
.qa-review-fab:active {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.qa-review-fab.qa-fab-accurate {
    background-color: #198754;
    border-color: #198754;
    box-shadow: 0 8px 24px rgba(25, 135, 84, 0.35);
}

.qa-review-fab.qa-fab-minor {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
    box-shadow: 0 8px 24px rgba(255, 193, 7, 0.4);
}

.qa-review-fab.qa-fab-major {
    background-color: #dc3545;
    border-color: #dc3545;
    box-shadow: 0 8px 24px rgba(220, 53, 69, 0.35);
}

.qa-review-dropdown {
    min-width: 240px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.qa-review-dropdown .dropdown-item {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.qa-review-dropdown .dropdown-item:active {
    background-color: rgba(13, 110, 253, 0.1);
    color: #1f2937;
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.ai-chat-input {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #dee2e6;
}

.ai-chat-mode-picker {
    margin-bottom: 0.65rem;
}

.ai-chat-mode-label {
    display: block;
    margin-bottom: 0.3rem;
    color: #5f6873;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.ai-chat-mode-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ai-chat-mode-btn {
    flex: 1 1 9rem;
    min-height: 2rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid #c8d0da;
    border-radius: 0.45rem;
    background: #fff;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

.ai-chat-mode-btn:hover:not(:disabled) {
    border-color: #7b94b5;
    background: #f4f7fb;
}

.ai-chat-mode-btn.active,
.ai-chat-mode-btn[aria-pressed="true"] {
    border-color: #0d6efd;
    background: #eaf2ff;
    color: #0b4fae;
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.12);
}

.ai-chat-mode-btn:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.25);
    outline-offset: 1px;
}

.ai-chat-mode-help {
    min-height: 1.2rem;
    margin-top: 0.35rem;
    color: #667085;
    font-size: 0.76rem;
    line-height: 1.35;
}

.ai-chat-mode-context {
    margin-top: 0.5rem;
    border: 1px solid #dbe2ea;
    border-radius: 0.45rem;
    background: #f8fafc;
    overflow: hidden;
}

.ai-chat-mode-context__bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.45rem;
}

.ai-chat-mode-context__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0;
    border: 0;
    background: none;
    color: #475569;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ai-chat-mode-context__toggle i {
    font-size: 0.7rem;
}

.ai-chat-mode-context__state {
    color: #b45309;
    font-size: 0.68rem;
    font-weight: 600;
}

.ai-chat-mode-context__open {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: #0d6efd;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: underline;
}

.ai-chat-mode-context__body {
    max-height: 9rem;
    padding: 0.5rem 0.6rem;
    border-top: 1px solid #e3e9f0;
    background: #fff;
    overflow-y: auto;
    color: #334155;
    font-size: 0.76rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-chat-mode-context__body--empty {
    color: #7b8794;
    font-style: italic;
}

.ai-message__mode-label {
    margin: 0 0.25rem 0.25rem;
    color: #667085;
    font-size: 0.72rem;
    font-weight: 650;
}

.ai-narrative-proposal {
    width: min(100%, 68ch);
    margin-top: 0.55rem;
    overflow: hidden;
    border: 1px solid #b8c8da;
    border-radius: 0.6rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(23, 43, 77, 0.08);
}

.ai-narrative-proposal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #dbe3ec;
    background: #f6f9fc;
}

.ai-narrative-proposal__title {
    margin: 0;
    color: #24364b;
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}

.ai-narrative-proposal__preview {
    margin: 0;
}

.ai-narrative-proposal__preview > summary {
    padding: 0.55rem 0.8rem;
    color: #31577f;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.ai-narrative-proposal__preview-body {
    max-height: 21rem;
    overflow: auto;
    margin: 0 0.8rem;
    padding: 0.7rem 0;
    border-top: 1px solid #e5eaf0;
    color: #263342;
    font-size: 0.9rem;
    line-height: 1.55;
}

.ai-narrative-proposal__preview-body h1,
.ai-narrative-proposal__preview-body h2,
.ai-narrative-proposal__preview-body h3,
.ai-narrative-proposal__preview-body h4,
.ai-narrative-proposal__preview-body h5,
.ai-narrative-proposal__preview-body h6 {
    margin: 0.8rem 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}

.ai-narrative-proposal__preview-body p,
.ai-narrative-proposal__preview-body ul,
.ai-narrative-proposal__preview-body ol {
    margin: 0 0 0.65rem;
}

.ai-narrative-proposal__preview-body ul,
.ai-narrative-proposal__preview-body ol {
    padding-left: 1.3rem;
}

.ai-narrative-proposal__preview-body > :first-child {
    margin-top: 0;
}

.ai-narrative-proposal__preview-body > :last-child {
    margin-bottom: 0;
}

.ai-narrative-proposal__status {
    margin: 0;
    padding: 0.6rem 0.8rem;
    border-top: 1px solid #e5eaf0;
    color: #5c6673;
    font-size: 0.78rem;
    line-height: 1.4;
}

.ai-narrative-proposal__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
    padding: 0 0.8rem 0.75rem;
}

.ai-narrative-proposal--stale {
    border-color: #d8b04c;
}

.ai-narrative-proposal--stale .ai-narrative-proposal__header {
    background: #fff8e5;
}

.ai-chat-input textarea {
    resize: none;
    border-radius: 20px;
    border: 1px solid #ced4da;
    padding: 8px 16px;
    font-size: 14px;
}

.ai-chat-input textarea:focus {
    border-color: #2e2f31;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.ai-chat-input .btn-primary {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2e2f31 0%, #0d6efd 100%);
    border: none;
}

.ai-chat-input .btn-primary:hover {
    background: linear-gradient(135deg, #1f2021 0%, #2978ee 100%);
}

.ai-reasoning-box {
    background: #eef4ff;
    border-color: #c9dcff !important;
    color: #44516a !important;
}

.ai-reasoning-box summary {
    color: #2f4f8f;
    font-weight: 600;
    cursor: pointer;
}

/* Top-right resize handle — drag up to grow height, drag right to grow width.
   This matches the widget's geometry (bottom-anchored, grows upward from the
   toggle button) so the drag direction feels natural. */
.ai-chat-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    cursor: nesw-resize;
    z-index: 10;
    background:
        linear-gradient(225deg, transparent 0%, transparent 45%,
            rgba(255, 255, 255, 0.55) 45%,
            rgba(255, 255, 255, 0.55) 60%,
            transparent 60%, transparent 70%,
            rgba(255, 255, 255, 0.55) 70%,
            rgba(255, 255, 255, 0.55) 85%,
            transparent 85%);
    border-radius: 0 12px 0 0;
}

.ai-chat-resize-handle:hover {
    background:
        linear-gradient(225deg, transparent 0%, transparent 45%,
            rgba(255, 255, 255, 0.85) 45%,
            rgba(255, 255, 255, 0.85) 60%,
            transparent 60%, transparent 70%,
            rgba(255, 255, 255, 0.85) 70%,
            rgba(255, 255, 255, 0.85) 85%,
            transparent 85%);
}

.ai-chat-window.ai-chat-window-expanded .ai-chat-resize-handle {
    display: none;
}

/* Settings tab scrollable content */
#settingsTab {
    overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
    }

    .qa-review-fab-container {
        position: relative;
    }

    .qa-review-fab {
        font-size: 0.9rem;
        padding: 0.45rem 0.75rem;
    }
}

/* Analyst dashboard refresh */
.analyst-dashboard-page {
    padding-bottom: 1.5rem;
}

.dashboard-hero {
    border-radius: 1rem;
    background: linear-gradient(135deg, #f7faff 0%, #eef3ff 48%, #f4f6fb 100%);
}

.dashboard-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.74rem;
    font-weight: 700;
    color: #5f6e90;
    margin-bottom: 0.35rem;
}

.dashboard-hero-meta .badge {
    background-color: #e8eefc;
    color: #2a3f73;
    border: 1px solid #d2def6;
    font-weight: 500;
}

.dashboard-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.dashboard-summary-item {
    background: #ffffff;
    border: 1px solid #dce4f4;
    border-radius: 0.65rem;
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 64px;
}

.dashboard-summary-item .summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #667085;
    line-height: 1.1;
}

.dashboard-summary-item .summary-value {
    margin-top: 0.16rem;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    color: #1f2937;
}

.dashboard-summary-item.summary-assigned {
    background: #f8fafd;
    border-color: #e4e9f4;
}

.dashboard-summary-item.summary-ready {
    background: #f8fafd;
    border: 1.5px solid #198754;
}

.dashboard-summary-item.summary-returned {
    background: #f8fafd;
    border: 1.5px solid #dc3545;
}

.dashboard-summary-item.summary-research {
    background: #f8fafd;
    border: 1.5px solid #f59e0b;
}

.dashboard-summary-item.summary-qa-queue {
    background: #f8fafd;
    border-color: #e4e9f4;
}

.dashboard-summary-item.summary-feedback {
    background: #f8fafd;
    border-color: #e4e9f4;
}

.dashboard-summary-item.summary-no-new-evidence {
    background: #fff9f2;
    border: 1.5px solid #b45309;
}

.qa-outcomes-grid,
.weekly-snapshot-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.qa-outcome-item,
.weekly-snapshot-item {
    border-radius: 0.65rem;
    border: 1px solid #e4e9f4;
    background: #f8fafd;
    padding: 0.55rem 0.6rem;
}

.qa-outcome-item .kpi-value {
    margin-top: 0.15rem;
}

.qa-outcome-item.qa-outcome-good {
    border-left: 4px solid #198754;
}

.qa-outcome-item.qa-outcome-minor {
    border-left: 4px solid #f59e0b;
}

.qa-outcome-item.qa-outcome-major {
    border-left: 4px solid #dc3545;
}

.dashboard-streak-panel {
    border-radius: 0.9rem;
    background: linear-gradient(155deg, #1f2f62 0%, #2c4c96 52%, #4068bf 100%);
    color: #f4f8ff;
    padding: 1rem;
    box-shadow: 0 18px 36px rgba(31, 47, 98, 0.28);
}

.dashboard-streak-panel.is-earned {
    background: linear-gradient(155deg, #1f5c3b 0%, #2f7d50 52%, #45a76b 100%);
    box-shadow: 0 18px 36px rgba(31, 92, 59, 0.28);
}

.dashboard-streak-panel--compact {
    padding: 0.8rem 0.85rem;
}

.dashboard-streak-panel--compact .streak-days {
    font-size: clamp(1.7rem, 3.2vw, 2.2rem);
}

.dashboard-streak-panel--compact .streak-caption {
    font-size: 0.76rem;
}

.dashboard-streak-panel--compact .streak-metrics {
    gap: 0.4rem;
}

.dashboard-streak-panel--compact .streak-metrics > div {
    padding: 0.34rem 0.42rem;
}

.dashboard-streak-panel--compact .streak-metrics strong {
    font-size: 0.86rem;
}

.dashboard-streak-panel .streak-label {
    font-size: 0.86rem;
    font-weight: 600;
    opacity: 0.95;
}

.streak-days {
    line-height: 1;
    font-size: clamp(2rem, 4.8vw, 3rem);
    font-weight: 700;
}

.streak-days-suffix {
    font-size: 1.05rem;
    margin-left: 0.2rem;
    font-weight: 600;
    opacity: 0.9;
}

.streak-caption {
    margin-top: 0.25rem;
    font-size: 0.82rem;
    opacity: 0.9;
}

.streak-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.streak-metrics > div {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.55rem;
    padding: 0.45rem 0.55rem;
}

.streak-metrics span {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.84;
}

.streak-metrics strong {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.dashboard-filter-card,
.dashboard-feedback-card,
.dashboard-previous-badge,
.dashboard-weekly-health {
    border-radius: 0.9rem;
}

.dashboard-filter-card {
    border-top: 4px solid #2962d2;
}

.dashboard-kpi-card {
    background: #ffffff;
    border: 1px solid #e8ebf3;
    border-radius: 0.85rem;
    padding: 0.65rem 0.75rem;
    min-height: 82px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-kpi-card .kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #667085;
    margin-bottom: 0.2rem;
}

.dashboard-kpi-card .kpi-value {
    font-size: clamp(1.1rem, 1.6vw, 1.45rem);
    font-weight: 700;
    line-height: 1.1;
    color: #111827;
}

.dashboard-kpi-card.kpi-primary {
    border-left: 4px solid #2962d2;
}

.dashboard-kpi-card.kpi-success {
    border-left: 4px solid #198754;
}

.dashboard-kpi-card.kpi-warning {
    border-left: 4px solid #f59e0b;
}

.dashboard-kpi-card.kpi-info {
    border-left: 4px solid #0ea5e9;
}

.dashboard-kpi-card.kpi-neutral {
    border-left: 4px solid #6b7280;
}

.dashboard-kpi-card.kpi-danger {
    border-left: 4px solid #dc3545;
}

.dashboard-weekly-health {
    background: #ffffff;
    border: 1px solid #e8ebf3;
}

.dashboard-feedback-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7f9fc;
    border-bottom: 1px solid #dde4f0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #4b5563;
}

.dashboard-feedback-table tbody tr {
    border-bottom: 1px solid #edf1f7;
}

.dashboard-feedback-table tbody tr:hover {
    background: #f8fbff;
}

.dashboard-feedback-table .notes-cell {
    white-space: pre-wrap;
    min-width: 250px;
    max-width: 460px;
}

.dashboard-feedback-table .qa-row-major td:first-child {
    border-left: 4px solid #dc3545;
}

.dashboard-feedback-table .qa-row-minor td:first-child {
    border-left: 4px solid #f59e0b;
}

.dashboard-feedback-table .qa-row-accurate td:first-child {
    border-left: 4px solid #198754;
}

.dashboard-empty-state {
    color: #1f2937;
}

.dashboard-empty-state i {
    font-size: 2rem;
    color: #7c8ba3;
}

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

    .qa-outcomes-grid,
    .weekly-snapshot-grid {
        grid-template-columns: 1fr;
    }

    .streak-metrics {
        grid-template-columns: 1fr;
    }
}

/* Role-neutral My Work landing page. Keep operational headings aligned with
   their content instead of inheriting the legacy global centered heading rule. */
.work-dashboard-page h1,
.work-dashboard-page h2 {
    text-align: left;
}

#chatMessagesContainer .ai-message__content--assistant li {
    margin-bottom: 0.25rem;
    line-height: 1.45;
}

#chatMessagesContainer .ai-message__content--assistant code {
    background-color: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #e74c3c;
}
/* Inline editing styles for found records table */
.editable-cell .cell-edit {
    display: none;
    width: 100%;
}

.editable-cell select.cell-edit,
.editable-cell input.cell-edit,
.editable-cell textarea.cell-edit {
    font-size: 0.9rem;
    padding: 4px 6px;
    border: 1px solid #007bff;
    border-radius: 4px;
}

.editable-cell textarea.cell-edit {
    min-height: 60px;
    resize: vertical;
}

tr.editing {
    background-color: #f0f8ff !important;
}

tr.editing .editable-cell .cell-display {
    display: none;
}

tr.editing .editable-cell .cell-edit {
    display: block;
}

.save-record-btn,
.cancel-edit-btn {
    display: none;
}

.hidden {
    display: none !important;
}

/* ============================================================
   FOUND RECORDS TABLE — Responsive Design
   ============================================================ */

/* Tier 1: Line-clamp for long content cells (all screens) */
.fr-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fr-clamp.fr-expanded {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}
.fr-toggle {
    display: none;
    border: none;
    background: none;
    color: #0d6efd;
    font-size: 0.78rem;
    padding: 2px 0;
    cursor: pointer;
    font-weight: 600;
}
.fr-toggle.fr-visible {
    display: inline-block;
}
.fr-toggle:hover {
    text-decoration: underline;
}

/* Expand chevron — hidden on large screens, shown via media queries */
.fr-expand-btn {
    display: none;
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1;
    vertical-align: middle;
}
.fr-expand-btn:hover {
    color: #0d6efd;
}

/* Detail row for hidden column data */
.fr-detail-row {
    display: none !important;
}
.fr-detail-row.fr-open {
    display: table-row !important;
}
.fr-detail-row td {
    padding: 6px 12px !important;
    font-size: 0.85rem;
}
.fr-detail-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}
.fr-detail-label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-right: 4px;
}

/* Tier 2: Medium screens (< 1200px) — hide less-used columns */
@media (max-width: 1199.98px) {
    #foundRecordsTable .fr-col-actions,
    #foundRecordsTable .fr-col-source,
    #foundRecordsTable .fr-col-cl {
        display: none !important;
    }
    .fr-expand-btn {
        display: inline-block;
    }
    #foundRecordsTable th,
    #foundRecordsTable td {
        padding: 0.35rem 0.45rem;
    }
}

/* Tier 3: Small screens (< 768px) — Card layout */
@media (max-width: 767.98px) {
    #foundRecordsTableContainer .table-responsive {
        overflow-x: visible;
    }
    #foundRecordsTable {
        border: none !important;
    }
    #foundRecordsTable thead {
        display: none !important;
    }
    #foundRecordsTable tbody {
        display: block;
    }
    #foundRecordsTable tr.record-row {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 10px 12px;
    }
    #foundRecordsTable tr.record-row td {
        display: flex;
        align-items: flex-start;
        padding: 3px 0 !important;
        border: none !important;
        text-align: left !important;
        background: transparent !important;
    }
    #foundRecordsTable tr.record-row td .cell-display {
        flex: 1;
        min-width: 0;
    }
    #foundRecordsTable tr.record-row td .fr-clamp {
        word-break: break-word;
    }
    #foundRecordsTable tr.record-row td::before {
        content: attr(data-label);
        flex: 0 0 85px;
        font-weight: 600;
        font-size: 0.72rem;
        text-transform: uppercase;
        color: #6c757d;
        padding-top: 2px;
        letter-spacing: 0.4px;
    }
    #foundRecordsTable tr.record-row td[data-label=""]::before {
        display: none;
    }
    /* On mobile cards, show Source and CL inline, hide only Actions */
    #foundRecordsTable .fr-col-source,
    #foundRecordsTable .fr-col-cl {
        display: flex !important;
    }
    #foundRecordsTable .fr-col-actions {
        display: none !important;
    }
    .fr-expand-btn {
        display: inline-block;
    }
    /* Detail rows on mobile */
    #foundRecordsTable .fr-detail-row.fr-open {
        display: block !important;
        background: #f8f9fa;
        border: 1px dashed #dee2e6;
        border-radius: 8px;
        margin-top: -8px;
        margin-bottom: 12px;
        padding: 8px 12px;
    }
    #foundRecordsTable .fr-detail-row.fr-open td {
        display: block;
        border: none !important;
        padding: 4px 0 !important;
    }
}

/* Dark mode — found records responsive overrides */
.dark-mode .fr-toggle {
    color: var(--dm-accent);
}
.dark-mode .fr-expand-btn {
    color: var(--dm-text-secondary);
}
.dark-mode .fr-expand-btn:hover {
    color: var(--dm-accent);
}
.dark-mode .fr-detail-row.fr-open td {
    background-color: var(--dm-bg-elevated) !important;
}
.dark-mode .fr-detail-label {
    color: var(--dm-text-secondary);
}
@media (max-width: 767.98px) {
    .dark-mode #foundRecordsTable tr.record-row {
        border-color: var(--dm-border);
    }
    .dark-mode #foundRecordsTable tr.record-row td {
        background: transparent !important;
    }
    .dark-mode #foundRecordsTable tr.record-row td::before {
        color: var(--dm-text-secondary);
    }
    .dark-mode #foundRecordsTable .fr-detail-row.fr-open {
        background: var(--dm-bg-elevated);
        border-color: var(--dm-border);
    }
    /* Mobile hover: keep dark surface so text stays readable */
    #foundRecordsTable tr.record-row:hover {
        background-color: #f0f1f3;
    }
    #foundRecordsTable tr.record-row:hover td {
        background-color: transparent !important;
        color: #212529 !important;
    }
    .dark-mode #foundRecordsTable tr.record-row:hover {
        background-color: var(--dm-bg-hover) !important;
    }
    .dark-mode #foundRecordsTable tr.record-row:hover td {
        background-color: transparent !important;
        color: var(--dm-text-primary) !important;
    }
    .dark-mode #foundRecordsTable tr.record-row:hover td::before {
        color: var(--dm-text-secondary) !important;
    }
}

/* ============================================================
   RESPONSIVE — Pending (Automated Recommendations) Table
   ============================================================ */
#pendingRecordsTable .record-content {
    max-width: 100%;
    white-space: normal;
}

/* Medium screens – hide Sources column, compact padding */
@media (max-width: 1199.98px) {
    #pendingRecordsTable .pr-col-sources {
        display: none;
    }
    #pendingRecordsTable td,
    #pendingRecordsTable th {
        padding: .35rem .45rem;
        font-size: .88rem;
    }
}

/* Mobile – card layout */
@media (max-width: 767.98px) {
    #pendingRecordsTable thead {
        display: none;
    }
    #pendingRecordsTable tbody tr {
        display: block;
        margin-bottom: .75rem;
        border: 1px solid #dee2e6;
        border-radius: .5rem;
        overflow: hidden;
    }
    #pendingRecordsTable td {
        display: block;
        padding: .5rem .75rem;
        text-align: left !important;
    }
    #pendingRecordsTable td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: .78rem;
        color: #6c757d;
        margin-bottom: .15rem;
    }
    #pendingRecordsTable td[data-label=""]::before {
        display: none;
    }
    /* Show Sources column in card view */
    #pendingRecordsTable .pr-col-sources {
        display: block;
    }
}

/* Dark-mode overrides for pending records table */
.dark-mode #pendingRecordsTable {
    --bs-table-bg: var(--dm-bg-elevated);
    --bs-table-color: var(--dm-text-primary);
    --bs-table-hover-bg: var(--dm-bg-hover);
    --bs-table-hover-color: var(--dm-text-primary);
    border-color: var(--dm-border) !important;
}
.dark-mode #pendingRecordsTable thead th {
    background-color: var(--dm-bg-active) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border) !important;
}
.dark-mode #pendingRecordsTable td {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border) !important;
}
@media (max-width: 767.98px) {
    .dark-mode #pendingRecordsTable tbody tr {
        border-color: var(--dm-border);
        background-color: var(--dm-bg-elevated);
    }
    .dark-mode #pendingRecordsTable td[data-label]::before {
        color: var(--dm-text-secondary) !important;
    }
}

/* ============================================================
   RESPONSIVE — Internal Analyst Comments Table
   ============================================================ */
#internalCommentsTable .fr-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
#internalCommentsTable .fr-clamp.fr-expanded {
    -webkit-line-clamp: unset;
    display: block;
}

/* Medium screens – compact padding */
@media (max-width: 1199.98px) {
    #internalCommentsTable td,
    #internalCommentsTable th {
        padding: .35rem .45rem;
        font-size: .88rem;
    }
}

/* Mobile – card layout */
@media (max-width: 767.98px) {
    #internalCommentsTable thead {
        display: none;
    }
    #internalCommentsTable tbody tr {
        display: block;
        margin-bottom: .75rem;
        border: 1px solid #dee2e6;
        border-radius: .5rem;
        overflow: hidden;
    }
    #internalCommentsTable td {
        display: block;
        padding: .5rem .75rem;
        text-align: left !important;
    }
    #internalCommentsTable td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: .78rem;
        color: #6c757d;
        margin-bottom: .15rem;
    }
    #internalCommentsTable td[data-label=""]::before {
        display: none;
    }
    /* Remove line clamp at mobile — full text visible in card */
    #internalCommentsTable .fr-clamp {
        -webkit-line-clamp: unset;
        display: block;
    }
}

/* Dark-mode overrides for internal comments table */
.dark-mode #internalCommentsTable {
    --bs-table-bg: var(--dm-bg-elevated);
    --bs-table-color: var(--dm-text-primary);
    --bs-table-hover-bg: var(--dm-bg-hover);
    --bs-table-hover-color: var(--dm-text-primary);
    border-color: var(--dm-border) !important;
}
.dark-mode #internalCommentsTable thead th {
    background-color: var(--dm-bg-active) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border) !important;
}
.dark-mode #internalCommentsTable td {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary) !important;
    border-color: var(--dm-border) !important;
}
@media (max-width: 767.98px) {
    .dark-mode #internalCommentsTable tbody tr {
        border-color: var(--dm-border);
        background-color: var(--dm-bg-elevated);
    }
    .dark-mode #internalCommentsTable td[data-label]::before {
        color: var(--dm-text-secondary) !important;
    }
}

/* Login page styles */
.card {
    transition: transform 0.2s ease-in-out;
}
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}
/* ============================================================
   DARK MODE — AI Chat Widget
   ============================================================ */
.dark-mode .ai-chat-window {
    background: var(--dm-bg-surface);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.dark-mode .ai-chat-header {
    background: linear-gradient(135deg, #0d1017 0%, #1a3a6b 100%);
}
.dark-mode .ai-chat-tabs {
    background: var(--dm-bg-base);
    border-bottom-color: var(--dm-border);
}
.dark-mode .ai-tab-btn {
    color: var(--dm-text-secondary);
}
.dark-mode .ai-tab-btn:hover {
    color: var(--dm-text-primary);
    background: rgba(255, 255, 255, 0.03);
}
.dark-mode .ai-tab-btn.active {
    color: var(--dm-accent);
    border-bottom-color: var(--dm-accent);
    background: var(--dm-bg-surface);
}
.dark-mode .ai-messages {
    background: var(--dm-bg-base);
}
.dark-mode .ai-chat-input {
    background: var(--dm-bg-surface);
    border-top-color: var(--dm-border);
}
.dark-mode .ai-chat-input textarea {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}
.dark-mode .ai-chat-input textarea::placeholder {
    color: var(--dm-text-muted);
}
.dark-mode .ai-chat-input textarea:focus {
    border-color: var(--dm-accent);
    box-shadow: 0 0 0 0.2rem rgba(91, 154, 255, 0.2);
}
.dark-mode .ai-chat-input .btn-primary {
    background: linear-gradient(135deg, #1a3a6b 0%, var(--dm-accent) 100%);
}
.dark-mode .ai-chat-input .btn-primary:hover {
    background: linear-gradient(135deg, #0d2851 0%, #4a89ee 100%);
}
.dark-mode .ai-history-sidebar {
    background: var(--dm-bg-base);
    border-right-color: var(--dm-border);
}
.dark-mode .ai-history-sidebar-header {
    border-bottom-color: var(--dm-border);
}
.dark-mode .ai-history-group-label {
    color: var(--dm-text-muted);
}
.dark-mode .ai-history-item {
    color: var(--dm-text-primary);
    border-bottom-color: var(--dm-border);
}
.dark-mode .ai-history-item:hover {
    background: var(--dm-bg-hover);
}
.dark-mode .ai-history-item.active {
    background: var(--dm-accent-muted);
}
.dark-mode .ai-history-delete-btn {
    color: var(--dm-text-muted);
}
.dark-mode .ai-history-delete-btn:hover {
    color: #ff6b7a;
}
.dark-mode .ai-reasoning-box {
    background: rgba(91, 154, 255, 0.08);
    border-color: var(--dm-border-light) !important;
    color: var(--dm-text-secondary) !important;
}
.dark-mode .ai-reasoning-box summary {
    color: var(--dm-accent);
}
.dark-mode .ai-chat-resize-handle {
    background:
        linear-gradient(225deg, transparent 0%, transparent 45%,
                                 rgba(255, 255, 255, 0.25) 45%,
                                 rgba(255, 255, 255, 0.25) 60%,
                                 transparent 60%, transparent 70%,
                                 rgba(255, 255, 255, 0.25) 70%,
                                 rgba(255, 255, 255, 0.25) 85%,
                                 transparent 85%);
}
.dark-mode .ai-chat-resize-handle:hover {
    background:
        linear-gradient(225deg, transparent 0%, transparent 45%,
            rgba(255, 255, 255, 0.55) 45%,
            rgba(255, 255, 255, 0.55) 60%,
            transparent 60%, transparent 70%,
            rgba(255, 255, 255, 0.55) 70%,
            rgba(255, 255, 255, 0.55) 85%,
            transparent 85%);
}
/* Chat toggle and QA FAB dark mode */
.dark-mode .ai-chat-toggle {
    background: linear-gradient(135deg, #1a3a6b 0%, var(--dm-accent) 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.dark-mode .ai-chat-toggle:hover {
    box-shadow: 0 6px 24px rgba(91, 154, 255, 0.3);
}
.dark-mode .qa-review-dropdown {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
}
.dark-mode .qa-review-dropdown .dropdown-item {
    color: var(--dm-text-primary);
}
.dark-mode .qa-review-dropdown .dropdown-item:hover {
    background: var(--dm-bg-hover);
}

/* ============================================================
   DARK MODE — Chat Messages Container
   ============================================================ */
.dark-mode #chatMessagesContainer .ai-message__content--assistant {
    background-color: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary);
    border-color: var(--dm-border);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant h1,
.dark-mode #chatMessagesContainer .ai-message__content--assistant h2,
.dark-mode #chatMessagesContainer .ai-message__content--assistant h3,
.dark-mode #chatMessagesContainer .ai-message__content--assistant h4,
.dark-mode #chatMessagesContainer .ai-message__content--assistant h5,
.dark-mode #chatMessagesContainer .ai-message__content--assistant h6 {
    color: var(--dm-text-primary);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant strong {
    color: var(--dm-text-primary);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant p {
    color: var(--dm-text-primary);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant li {
    color: var(--dm-text-primary);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant hr {
    background: linear-gradient(to right, var(--dm-accent), transparent);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant table {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant table thead tr {
    background-color: var(--dm-bg-active);
    color: var(--dm-text-primary);
}
.dark-mode #chatMessagesContainer table th {
    background-color: var(--dm-bg-active) !important;
    color: var(--dm-text-primary) !important;
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant table th,
.dark-mode #chatMessagesContainer .ai-message__content--assistant table td {
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant table tbody tr:nth-of-type(even) {
    background-color: var(--dm-bg-surface);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant code {
    background-color: var(--dm-bg-hover);
    color: #f0929c;
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant blockquote {
    border-left-color: var(--dm-border-light);
    color: var(--dm-text-secondary);
}
.dark-mode #chatMessagesContainer .ai-message__content--assistant pre {
    background: var(--dm-bg-surface);
    color: var(--dm-text-primary);
}
.dark-mode .ai-chat-mode-label,
.dark-mode .ai-chat-mode-help,
.dark-mode .ai-message__mode-label {
    color: var(--dm-text-secondary);
}
.dark-mode .ai-chat-mode-btn {
    border-color: var(--dm-border);
    background: var(--dm-bg-surface);
    color: var(--dm-text-secondary);
}
.dark-mode .ai-chat-mode-btn:hover:not(:disabled) {
    border-color: var(--dm-border-light);
    background: var(--dm-bg-hover);
}
.dark-mode .ai-chat-mode-btn.active,
.dark-mode .ai-chat-mode-btn[aria-pressed="true"] {
    border-color: var(--dm-accent);
    background: var(--dm-accent-muted);
    color: var(--dm-accent);
}
.dark-mode .ai-chat-mode-context {
    border-color: var(--dm-border);
    background: var(--dm-bg-surface);
}
.dark-mode .ai-chat-mode-context__toggle {
    color: var(--dm-text-secondary);
}
.dark-mode .ai-chat-mode-context__open {
    color: var(--dm-accent);
}
.dark-mode .ai-chat-mode-context__body {
    border-top-color: var(--dm-border);
    background: var(--dm-bg-elevated);
    color: var(--dm-text-primary);
}
.dark-mode .ai-chat-mode-context__body--empty {
    color: var(--dm-text-secondary);
}
.dark-mode .ai-narrative-proposal {
    border-color: var(--dm-border-light);
    background: var(--dm-bg-elevated);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}
.dark-mode .ai-narrative-proposal__header {
    border-bottom-color: var(--dm-border);
    background: var(--dm-bg-surface);
}
.dark-mode .ai-narrative-proposal__title,
.dark-mode .ai-narrative-proposal__preview-body {
    color: var(--dm-text-primary);
}
.dark-mode .ai-narrative-proposal__preview > summary {
    color: var(--dm-accent);
}
.dark-mode .ai-narrative-proposal__preview-body,
.dark-mode .ai-narrative-proposal__status {
    border-color: var(--dm-border);
}
.dark-mode .ai-narrative-proposal__status {
    color: var(--dm-text-secondary);
}
.dark-mode .ai-narrative-proposal--stale {
    border-color: #c99a2e;
}
.dark-mode .ai-narrative-proposal--stale .ai-narrative-proposal__header {
    background: rgba(201, 154, 46, 0.12);
}

/* ============================================================
   DARK MODE — Analyst Dashboard
   ============================================================ */
.dark-mode .dashboard-hero {
    background: linear-gradient(135deg, var(--dm-bg-elevated) 0%, rgba(91, 154, 255, 0.06) 48%, var(--dm-bg-surface) 100%);
}
.dark-mode .dashboard-kicker {
    color: var(--dm-text-muted);
}
.dark-mode .dashboard-hero-meta .badge {
    background-color: var(--dm-accent-muted);
    color: var(--dm-accent);
    border-color: var(--dm-border);
}
.dark-mode .dashboard-summary-item {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
}
.dark-mode .dashboard-summary-item .summary-label {
    color: var(--dm-text-secondary);
}
.dark-mode .dashboard-summary-item .summary-value {
    color: var(--dm-text-primary);
}
.dark-mode .dashboard-summary-item.summary-assigned {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
}
.dark-mode .dashboard-summary-item.summary-ready {
    background: rgba(25, 135, 84, 0.08);
    border-color: #198754;
}
.dark-mode .dashboard-summary-item.summary-returned {
    background: rgba(220, 53, 69, 0.08);
    border-color: #dc3545;
}
.dark-mode .dashboard-summary-item.summary-research {
    background: rgba(245, 158, 11, 0.08);
    border-color: #f59e0b;
}
.dark-mode .dashboard-summary-item.summary-qa-queue {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
}
.dark-mode .dashboard-summary-item.summary-feedback {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
}
.dark-mode .dashboard-summary-item.summary-no-new-evidence {
    background: rgba(180, 83, 9, 0.08);
    border-color: #b45309;
}
.dark-mode .qa-outcome-item,
.dark-mode .weekly-snapshot-item {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
}
.dark-mode .qa-outcome-item .kpi-value,
.dark-mode .weekly-snapshot-item .kpi-value {
    color: var(--dm-text-primary);
}
.dark-mode .dashboard-kpi-card {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.dark-mode .dashboard-kpi-card .kpi-label {
    color: var(--dm-text-secondary);
}
.dark-mode .dashboard-kpi-card .kpi-value {
    color: var(--dm-text-primary);
}
.dark-mode .dashboard-weekly-health {
    background: var(--dm-bg-surface);
    border-color: var(--dm-border);
}
.dark-mode .dashboard-filter-card {
    border-top-color: var(--dm-accent);
}
.dark-mode .dashboard-feedback-table thead th {
    background: var(--dm-bg-active);
    border-bottom-color: var(--dm-border);
    color: var(--dm-text-secondary);
}
.dark-mode .dashboard-feedback-table tbody tr {
    border-bottom-color: var(--dm-border);
}
.dark-mode .dashboard-feedback-table tbody tr:hover {
    background: var(--dm-bg-hover);
}
.dark-mode .dashboard-empty-state {
    color: var(--dm-text-secondary);
}
.dark-mode .dashboard-empty-state i {
    color: var(--dm-text-muted);
}
.dark-mode .dashboard-feedback-card,
.dark-mode .dashboard-previous-badge,
.dark-mode .dashboard-weekly-health {
    background: var(--dm-bg-surface);
    border-color: var(--dm-border);
}

/* ============================================================
   DARK MODE — Inline Editing
   ============================================================ */
.dark-mode tr.editing {
    background-color: var(--dm-bg-hover) !important;
}
.dark-mode .editable-cell select.cell-edit,
.dark-mode .editable-cell input.cell-edit,
.dark-mode .editable-cell textarea.cell-edit {
    background-color: var(--dm-bg-elevated);
    color: var(--dm-text-primary);
    border-color: var(--dm-accent);
}

/* ============================================================
   DARK MODE — Miscellaneous Overrides
   ============================================================ */
.dark-mode .text-muted {
    color: var(--dm-text-secondary) !important;
}
.dark-mode .text-dark {
    color: var(--dm-text-primary) !important;
}
.text-darker {
    color: var(--dm-text-inverse) !important;
}
.dark-mode .bg-white {
    background-color: var(--dm-bg-surface) !important;
}
.dark-mode .bg-light {
    background-color: var(--dm-bg-elevated) !important;
}
.dark-mode .border {
    border-color: var(--dm-border) !important;
}
.dark-mode .border-bottom {
    border-bottom-color: var(--dm-border) !important;
}
.dark-mode .border-top {
    border-top-color: var(--dm-border) !important;
}
.dark-mode .shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
.dark-mode .shadow {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}
.dark-mode a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: var(--dm-accent);
}
.dark-mode a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: #82b4ff;
}
/* ============================================================
   QA Report tab — action-first review layout
   ============================================================ */

#qaReportContainer[hidden],
#qaReportContent[hidden] {
    display: none !important;
}

#qaTab.ai-tab-content {
    /* The report content owns the single vertical scroll surface. */
    display: none;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    padding: 0;
}

#qaTab.ai-tab-content.active {
    display: flex;
    flex: 1 1 auto;
}

.qa-tab-layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    min-width: 0;
}

.qa-tab-header {
    flex: 0 0 auto;
    background: #fff;
}

.qa-tab-empty {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.qa-tab-content-grid {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 0.75rem 0.1rem 0.25rem;
}

#qaReportContent.qa-tab-content-grid {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding-bottom: 4rem;
    scroll-padding-bottom: 4rem;
    container-name: qa-report;
    container-type: inline-size;
    --qa-card-bg: var(--bs-body-bg, #fff);
    --qa-card-border: var(--bs-border-color, #dee2e6);
    --qa-sidecar-divider: var(--bs-border-color, rgba(108, 117, 125, 0.25));
}

.qa-conclusion {
    --qa-conclusion-accent: var(--bs-secondary, #6c757d);
    flex: 0 0 auto;
    min-width: 0;
    margin-right: 0.15rem !important;
    margin-bottom: 0.75rem !important;
    margin-left: 0.15rem !important;
    padding: 0.55rem 0.65rem;
    border: 1px solid color-mix(in srgb, var(--qa-conclusion-accent) 38%, var(--qa-card-border));
    border-left: 0.25rem solid var(--qa-conclusion-accent);
    border-radius: 0.55rem;
    background: color-mix(in srgb, var(--qa-conclusion-accent) 9%, var(--qa-card-bg));
}

.qa-conclusion[data-qa-conclusion="clean"] {
    --qa-conclusion-accent: var(--bs-success, #198754);
}

.qa-conclusion[data-qa-conclusion="minor"] {
    --qa-conclusion-accent: var(--bs-primary, #0d6efd);
}

.qa-conclusion[data-qa-conclusion="rework"] {
    --qa-conclusion-accent: var(--bs-warning, #ffc107);
}

.qa-conclusion[data-qa-conclusion="needs-rework"] {
    --qa-conclusion-accent: var(--bs-danger, #dc3545);
}

.qa-conclusion-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
}

.qa-conclusion-header h6 {
    font-size: 0.9rem;
    font-weight: 700;
}

.qa-conclusion-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.3rem;
}

.qa-conclusion-badges .badge {
    font-size: 0.7rem;
    line-height: 1.2;
}

.qa-conclusion-category {
    border: 1px solid color-mix(in srgb, var(--qa-conclusion-accent) 82%, #000);
    background: var(--qa-conclusion-accent);
    color: #fff;
}

.qa-conclusion[data-qa-conclusion="rework"] .qa-conclusion-category {
    color: #212529;
}

.qa-coverage-badge {
    border: 1px solid var(--qa-card-border);
    background: color-mix(in srgb, var(--bs-secondary, #6c757d) 12%, var(--qa-card-bg));
    color: var(--bs-emphasis-color, #212529);
}

.qa-conclusion[data-qa-coverage="complete"] .qa-coverage-badge {
    border-color: color-mix(in srgb, var(--bs-success, #198754) 55%, var(--qa-card-border));
    background: color-mix(in srgb, var(--bs-success, #198754) 12%, var(--qa-card-bg));
}

.qa-conclusion[data-qa-coverage="partial"] .qa-coverage-badge {
    border-color: color-mix(in srgb, var(--bs-warning, #ffc107) 60%, var(--qa-card-border));
    background: color-mix(in srgb, var(--bs-warning, #ffc107) 13%, var(--qa-card-bg));
}

.qa-recheck-panel {
    flex: 0 0 auto;
    min-width: 0;
    margin-right: 0.15rem !important;
    margin-left: 0.15rem !important;
    padding: 0.65rem;
    border: 1px solid var(--qa-card-border);
    border-radius: 0.55rem;
    background: color-mix(in srgb, var(--bs-primary, #0d6efd) 4%, var(--qa-card-bg));
}

.qa-recheck-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    margin-bottom: 0.55rem;
}

.qa-recheck-header h6 {
    font-size: 0.9rem;
    font-weight: 700;
}

.qa-recheck-summary,
.qa-recheck-panel p {
    overflow-wrap: anywhere;
}

.qa-recheck-panel [aria-busy="true"] {
    cursor: progress;
}

.qa-conclusion[data-qa-coverage="outdated"] .qa-coverage-badge {
    border-color: color-mix(in srgb, var(--bs-danger, #dc3545) 55%, var(--qa-card-border));
    background: color-mix(in srgb, var(--bs-danger, #dc3545) 12%, var(--qa-card-bg));
}

.qa-conclusion-risk {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.qa-conclusion-risk-label {
    margin-right: 0.2rem;
    font-weight: 700;
}

.qa-suggestions-block {
    flex: 0 0 auto;
    min-width: 0;
    margin-right: 0.15rem !important;
    margin-bottom: 0.75rem !important;
    margin-left: 0.15rem !important;
    padding: 0.35rem 0.1rem 0.45rem;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.qa-report-block {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.qa-report-text {
    min-width: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* The original markdown rules use #qaReportText. Keep those rules for the
   report's established colors, while explicitly bringing their spacing into
   this compact disclosure's type scale. */
#qaReportText h1,
#qaReportText h2,
#qaReportText h3,
#qaReportText h4,
#qaReportText h5,
#qaReportText h6 {
    margin: 0.6rem 0 0.25rem;
    padding-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.25;
    text-align: left;
}

#qaReportText h1 {
    font-size: 1rem;
}

#qaReportText h2 {
    font-size: 0.95rem;
}

#qaReportText p,
#qaReportText ul,
#qaReportText ol,
#qaReportText pre,
#qaReportText blockquote,
#qaReportText table {
    margin: 0 0 0.45rem;
}

#qaReportText p {
    line-height: 1.45;
}

#qaReportText ul,
#qaReportText ol {
    padding-left: 1.1rem;
}

#qaReportText li {
    margin-bottom: 0.15rem;
    line-height: 1.4;
}

#qaReportText li > p {
    margin: 0;
}

#qaReportText code {
    padding: 0 0.2rem;
    font-size: 0.8rem;
}

.qa-pattern-summary {
    flex: 0 0 auto;
    min-width: 0;
    margin-right: 0.15rem !important;
    margin-bottom: 0.75rem !important;
    margin-left: 0.15rem !important;
    padding: 0;
    border: 1px solid var(--qa-card-border);
    border-radius: 0.55rem;
    background: var(--qa-card-bg);
}

.qa-pattern-summary-toggle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    padding: 0.55rem 0.65rem;
    cursor: pointer;
    list-style: none;
    color: var(--bs-emphasis-color, #212529);
    font-size: 0.9rem;
    font-weight: 650;
}

.qa-pattern-summary-toggle::-webkit-details-marker {
    display: none;
}

.qa-pattern-summary-toggle::before {
    width: 0;
    height: 0;
    border-top: 0.28rem solid transparent;
    border-bottom: 0.28rem solid transparent;
    border-left: 0.38rem solid currentColor;
    content: '';
    transition: transform 120ms ease;
}

.qa-pattern-summary[open] > .qa-pattern-summary-toggle::before {
    transform: rotate(90deg);
}

.qa-pattern-summary-toggle #qaPatternSummaryCounts {
    margin-left: auto;
    text-align: right;
}

.qa-pattern-summary-body {
    padding: 0.55rem 0.65rem 0.65rem;
    border-top: 1px solid var(--qa-sidecar-divider);
}

.qa-section-heading {
    min-width: 0;
}

.qa-section-heading h6,
.qa-report-details summary {
    font-size: 0.9rem;
    font-weight: 650;
}

.qa-stale-advisory {
    flex: 0 0 auto;
    margin-bottom: 0.5rem !important;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(255, 193, 7, 0.6);
    border-radius: 0.5rem;
    background: rgba(255, 193, 7, 0.12);
    color: var(--bs-emphasis-color, #664d03);
}

.qa-finding-review-help {
    max-width: 42rem;
    line-height: 1.35;
}

.qa-report-details {
    flex: 0 0 auto;
    min-width: 0;
    padding: 0.65rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.6rem;
    background: var(--bs-body-bg, #fff);
}

.qa-report-details > summary,
.qa-resolved-suggestions > summary {
    cursor: pointer;
    color: var(--bs-emphasis-color, #212529);
}

.qa-report-details > summary:focus-visible,
.qa-pattern-summary > summary:focus-visible,
.qa-finding-summary:focus-visible,
.qa-pattern-coverage-note > summary:focus-visible,
.qa-resolved-suggestions > summary:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 76%, transparent);
    outline-offset: 3px;
}

.qa-pattern-findings {
    display: grid;
    gap: 0.35rem;
}

.qa-pattern-finding {
    display: block;
    position: relative;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--qa-card-border);
    border-radius: 0.45rem;
    background: var(--qa-card-bg);
    font-size: 0.875rem;
    line-height: 1.4;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.qa-finding-disclosure {
    min-width: 0;
}

.qa-finding-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    list-style: none;
}

.qa-finding-summary::-webkit-details-marker,
.qa-pattern-coverage-summary::-webkit-details-marker {
    display: none;
}

.qa-finding-summary::after,
.qa-pattern-coverage-summary::after {
    width: 0;
    height: 0;
    border-top: 0.28rem solid transparent;
    border-bottom: 0.28rem solid transparent;
    border-left: 0.38rem solid currentColor;
    content: '';
    transition: transform 120ms ease;
}

.qa-finding-disclosure[open] > .qa-finding-summary::after,
.qa-pattern-coverage-note[open] > .qa-pattern-coverage-summary::after {
    transform: rotate(90deg);
}

.qa-pattern-finding--has-summary-action .qa-finding-summary {
    padding-right: 11rem;
}

.qa-finding-summary .badge {
    font-size: 0.67rem;
    line-height: 1;
}

.qa-finding-summary-title {
    min-width: 0;
    overflow: hidden;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qa-finding-details {
    padding: 0.5rem 0.6rem 0.6rem;
    border-top: 1px solid var(--qa-sidecar-divider);
}

.qa-finding-body {
    min-width: 0;
}

.qa-finding-detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.45rem;
    margin-bottom: 0.35rem;
}

.qa-finding-message {
    color: var(--bs-secondary-color, #6c757d);
}

.qa-pattern-finding p {
    overflow-wrap: anywhere;
}

.qa-pattern-finding[data-qa-severity="CRITICAL"] {
    border-left: 0.25rem solid var(--bs-danger, #dc3545) !important;
}

.qa-pattern-finding[data-qa-severity="MAJOR"] {
    border-left: 0.25rem solid var(--bs-warning, #ffc107) !important;
}

.qa-pattern-finding[data-qa-severity="MINOR"] {
    border-left: 0.25rem solid var(--bs-secondary, #6c757d) !important;
}

/* Tighten margins produced by marked.js — default browser/Bootstrap spacing is
   far too generous for a narrow chat-widget column. These rules only apply
   inside the report panel so they don't affect markdown rendered elsewhere. */
.qa-report-text p,
.qa-report-text ul,
.qa-report-text ol,
.qa-report-text pre,
.qa-report-text blockquote,
.qa-report-text table {
    margin: 0 0 0.45rem 0;
}
.qa-report-text ul,
.qa-report-text ol {
    padding-left: 1.1rem;
}
.qa-report-text li {
    margin-bottom: 0.15rem;
}
.qa-report-text li > p {
    margin: 0;
}
.qa-report-text h1,
.qa-report-text h2,
.qa-report-text h3,
.qa-report-text h4,
.qa-report-text h5,
.qa-report-text h6 {
    margin: 0.6rem 0 0.25rem;
    font-weight: 600;
    line-height: 1.25;
}
.qa-report-text h1 { font-size: 1rem; }
.qa-report-text h2 { font-size: 0.95rem; }
.qa-report-text h3,
.qa-report-text h4,
.qa-report-text h5,
.qa-report-text h6 { font-size: 0.9rem; }
.qa-report-text > *:first-child { margin-top: 0; }
.qa-report-text > *:last-child  { margin-bottom: 0; }
.qa-report-text code {
    font-size: 0.8rem;
    padding: 0 0.2rem;
}
.qa-report-text hr {
    margin: 0.5rem 0;
}

/* Suggestion cards keep the record preview and action footer easy to scan. */
.qa-suggestion-card {
    min-width: 0;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--qa-card-border);
    border-radius: 0.55rem;
    background: var(--qa-card-bg);
    font-size: 0.875rem;
    line-height: 1.35;
}

.qa-pattern-coverage-note {
    display: block;
    min-width: 0;
    border: 1px solid var(--qa-card-border);
    border-radius: 0.45rem;
    background: var(--qa-card-bg);
    line-height: 1.4;
    overflow: hidden;
}

.qa-pattern-coverage-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    color: var(--bs-secondary-color, #6c757d);
    font-weight: 650;
    list-style: none;
}

.qa-pattern-coverage-details {
    padding: 0.5rem 0.6rem 0.6rem;
    border-top: 1px solid var(--qa-sidecar-divider);
}

.qa-pattern-technical-details > summary {
    width: fit-content;
    cursor: pointer;
    font-weight: 600;
}

.qa-pattern-technical-details > code {
    display: block;
    margin-top: 0.35rem;
    overflow-wrap: anywhere;
    white-space: normal;
}
.qa-suggestion-card[data-qa-severity="CRITICAL"] {
    border-left: 0.2rem solid var(--bs-danger, #dc3545);
}
.qa-suggestion-card[data-qa-severity="MAJOR"] {
    border-left: 0.2rem solid var(--bs-warning, #ffc107);
}
.qa-suggestion-card[data-qa-severity="MINOR"] {
    border-left: 0.2rem solid var(--bs-secondary, #6c757d);
}
.qa-suggestion-card .qa-suggestion-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
}
.qa-suggestion-card .qa-suggestion-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.45rem;
    min-width: 0;
}
.qa-suggestion-card .qa-suggestion-meta .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}
.qa-suggestion-card .qa-suggestion-type {
    font-weight: 600;
}
.qa-suggestion-card .qa-suggestion-value {
    min-width: 0;
    font-family: var(--bs-font-monospace, monospace);
    color: var(--bs-danger-text, #b02a37);
    word-break: break-word;
}
.qa-suggestion-card .qa-suggestion-reason {
    margin-top: 0.3rem;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.8rem;
    line-height: 1.35;
}
.qa-suggestion-card .qa-suggestion-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding-left: 0.65rem;
    border-left: 1px solid var(--qa-sidecar-divider);
    flex-shrink: 0;
}
.qa-suggestion-card .qa-suggestion-actions .bi {
    font-size: 0.7rem;
}
.qa-suggestion-card[aria-busy="true"],
.qa-pattern-finding[aria-busy="true"] {
    cursor: progress;
}
.qa-suggestion-help,
.qa-suggestion-error,
.qa-finding-action-error {
    font-size: 0.75rem;
}
.qa-suggestion-error,
.qa-finding-action-error {
    margin-top: 0.35rem;
    color: var(--bs-danger, #dc3545);
}
.qa-finding-review {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    margin-top: 0.4rem;
    padding-top: 0.3rem;
    border-top: 1px solid var(--qa-sidecar-divider);
}
.qa-finding-review > .small,
.qa-finding-review > .qa-finding-storage-advisory,
.qa-finding-action-error {
    min-width: 0;
    overflow-wrap: anywhere;
}
.qa-finding-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.qa-finding-actions .btn {
    min-width: 44px;
    min-height: 44px;
}
.qa-finding-summary-actions {
    position: absolute;
    z-index: 1;
    top: 0.28rem;
    right: 1.35rem;
    width: auto;
    flex-wrap: nowrap;
}
.qa-finding-summary-actions .btn {
    min-width: 0;
    min-height: 2rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.15;
    white-space: nowrap;
}
.qa-finding-review .qa-finding-reviewed {
    font-size: 0.7rem;
}
.qa-finding-summary-actions .qa-finding-reviewed {
    font-size: 0.7rem;
}

@container qa-report (max-width: 36rem) {
    .qa-suggestion-card .qa-suggestion-head {
        grid-template-columns: minmax(0, 1fr);
    }

    .qa-suggestion-card .qa-suggestion-actions {
        width: 100%;
        padding-top: 0.45rem;
        padding-left: 0;
        border-top: 1px solid var(--qa-sidecar-divider);
        border-left: 0;
    }
}

@container qa-report (min-width: 42rem) {
    .qa-pattern-finding.qa-pattern-finding--has-review > .qa-finding-disclosure > .qa-finding-details {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem);
        column-gap: 1rem;
        align-items: start;
    }

    .qa-pattern-finding.qa-pattern-finding--has-review > .qa-finding-disclosure > .qa-finding-details > .qa-finding-body,
    .qa-pattern-finding.qa-pattern-finding--has-review > .qa-finding-disclosure > .qa-finding-details > .qa-finding-review {
        min-width: 0;
    }

    .qa-pattern-finding.qa-pattern-finding--has-review > .qa-finding-disclosure > .qa-finding-details > .qa-finding-review {
        margin-top: 0;
        padding-top: 0;
        padding-left: 0.75rem;
        border-top: 0;
        border-left: 1px solid var(--qa-sidecar-divider);
    }

    .qa-pattern-finding.qa-pattern-finding--has-review > .qa-finding-disclosure > .qa-finding-details > .qa-finding-review > .small,
    .qa-pattern-finding.qa-pattern-finding--has-review > .qa-finding-disclosure > .qa-finding-details > .qa-finding-review > .qa-finding-storage-advisory,
    .qa-pattern-finding.qa-pattern-finding--has-review > .qa-finding-disclosure > .qa-finding-details > .qa-finding-review > .qa-finding-action-error {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

/* History dropdown — compact button replacing the old form-select */
#qaReportHistoryMenu {
    max-height: 320px;
    overflow-y: auto;
    min-width: 260px;
}

#qaReportHistoryMenu .qa-history-item {
    white-space: normal;
    line-height: 1.2;
}

#qaReportHistoryCount:empty {
    display: none;
}

.qa-resolved-suggestions {
    padding-top: 0.6rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.qa-resolved-suggestions > summary {
    font-size: 0.8rem;
    font-weight: 600;
}

/* Dark mode tweaks for the new blocks */
.dark-mode .qa-tab-header {
    background: var(--dm-bg-elevated);
    border-color: var(--dm-border);
}

.dark-mode #qaReportContent.qa-tab-content-grid {
    --qa-card-bg: var(--dm-bg-elevated);
    --qa-card-border: var(--dm-border-light);
    --qa-sidecar-divider: var(--dm-border);
}

.dark-mode .qa-report-details {
    background: var(--dm-bg-surface);
    border-color: var(--dm-border);
}

.dark-mode .qa-pattern-finding {
    background: var(--qa-card-bg);
    border-color: var(--qa-card-border);
}

.dark-mode .qa-pattern-coverage-note {
    background: var(--qa-card-bg);
    border-color: var(--qa-card-border);
}

.dark-mode .qa-stale-advisory {
    border-color: rgba(255, 193, 7, 0.65);
    background: rgba(255, 193, 7, 0.16);
    color: #ffe69c;
}

.dark-mode .qa-report-text {
    background: var(--dm-bg-elevated) !important;
    color: var(--dm-text-primary);
    border-color: var(--dm-border) !important;
}

.dark-mode .qa-suggestion-card {
    background: var(--qa-card-bg);
    border-color: var(--qa-card-border);
    color: var(--dm-text-primary);
}
.dark-mode .qa-suggestion-card .qa-suggestion-value {
    color: #ff8a80;
}
.dark-mode .qa-suggestion-card .qa-suggestion-reason {
    color: color-mix(in srgb, var(--dm-text-primary) 68%, var(--dm-text-muted));
}

.dark-mode .qa-pattern-summary {
    background: var(--qa-card-bg);
    border-color: var(--qa-card-border);
}

.dark-mode .qa-coverage-badge {
    color: var(--dm-text-primary);
}
.dark-mode .qa-finding-review {
    border-color: var(--qa-sidecar-divider);
}
.dark-mode .qa-resolved-suggestions {
    border-color: var(--dm-border);
}
.dark-mode .qa-suggestion-error,
.dark-mode .qa-finding-action-error {
    color: #ff8a80;
}

.qa-tab-header :is(button, [href]):focus-visible,
.qa-report-details > summary:focus-visible,
.qa-pattern-summary > summary:focus-visible,
.qa-finding-summary:focus-visible,
.qa-pattern-coverage-note > summary:focus-visible,
.qa-resolved-suggestions > summary:focus-visible,
.qa-suggestion-card :is(button, [href]):focus-visible,
.qa-pattern-finding :is(button, [href]):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 76%, transparent);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .qa-tab-content-grid {
        padding-right: 0;
        padding-left: 0;
    }

    .qa-suggestions-block,
    .qa-conclusion,
    .qa-pattern-summary {
        margin-right: 0.1rem !important;
        margin-left: 0.1rem !important;
        margin-bottom: 0.6rem !important;
    }

    .qa-suggestions-block {
        padding: 0.3rem 0.05rem 0.35rem;
    }

    .qa-conclusion {
        padding: 0.5rem 0.55rem;
    }

    .qa-conclusion-badges {
        justify-content: flex-start;
    }

    .qa-pattern-summary-toggle #qaPatternSummaryCounts {
        flex-basis: 100%;
        margin-left: 1rem;
        text-align: left;
    }

    .qa-report-details {
        margin-right: 0.35rem !important;
        margin-left: 0.35rem !important;
        padding: 0.65rem;
    }

    .qa-finding-summary,
    .qa-pattern-coverage-summary {
        min-height: 2.75rem;
    }

    .qa-finding-actions {
        width: 100%;
        margin-left: 0;
    }

    .qa-suggestion-card .qa-suggestion-actions .btn,
    .qa-finding-actions .btn {
        flex: 1 1 0;
    }

    .qa-finding-summary-actions {
        width: auto;
    }

    .qa-finding-summary-actions .btn {
        flex: 0 0 auto;
    }

    .qa-suggestion-card .qa-suggestion-actions .btn {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #qaTab .qa-suggestion-card,
    #qaTab .qa-pattern-finding,
    #qaTab details {
        transition: none !important;
        animation: none !important;
    }
}

/* Shared compact context bar for case workspace pages.

   The shell is a direct child of <body> (see base.html), so position:sticky
   pins it for the whole page with no JS. base.js adds .is-stuck once it
   reaches the top and publishes its height as --case-bar-height, which the
   scroll-margin and sticky-offset rules below consume so nothing ends up
   parked underneath it. */
.case-context-sentinel {
    height: 1px;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.case-context-shell {
    position: sticky;
    top: 0;
    z-index: 1020;
    width: calc(100% - 2rem);
    margin: .45rem auto .55rem;
    padding: .45rem .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-body-bg);
    box-shadow: none !important;
    transition: box-shadow .12s ease-out;
}

/* Pinned: drop the card treatment for a full-bleed bar, and reclaim the width
   the page title and subject name were using for the nav pills and the docked
   Record History summary.

   Every property here is horizontal or decorative on purpose. The margins,
   vertical padding and top/bottom borders stay exactly as they are because the
   shell is in normal flow — changing its vertical box would jump the whole page
   at the moment it sticks. (The top margin costs nothing visually: sticky pins
   the border box at top:0, and margins above it simply aren't painted.) */
.case-context-shell.is-stuck {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
    border-width: 1px 0;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .14) !important;
}

/* Clipped rather than display:none so the page heading stays in the
   accessibility tree while the bar is compressed. */
.case-context-shell.is-stuck .case-context h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.case-context-shell.is-stuck .case-context-divider,
.case-context-shell.is-stuck .case-context-subject {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .case-context-shell {
        transition: none;
    }
}

/* Anchor targets clear the pinned bar instead of landing under it. */
#caseOverview,
#recordTabs,
#recordHistorySection,
#foundRecordsTableContainer,
#priorCaseWork,
#documentsTable {
    scroll-margin-top: calc(var(--case-bar-height, 0px) + .75rem);
}

.case-context {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: .35rem;
    max-width: 100%;
}

.case-context-identity {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    white-space: nowrap;
}

.case-context-number {
    color: var(--bs-secondary-color);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.case-context-divider {
    width: 1px;
    height: 1.25rem;
    background: var(--bs-border-color);
}

.case-context h1 {
    margin: 0;
    color: inherit;
    font-size: 1.15rem;
    line-height: 1.2;
    text-align: left;
}

.case-context-subject {
    max-width: 22rem;
    overflow: hidden;
    color: var(--bs-secondary-color);
    font-size: .82rem;
    text-overflow: ellipsis;
}

.case-context-tabs {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    min-width: 0;
    margin-left: 0;
}

.case-context-action {
    flex: 0 0 auto;
}

.case-context .case-navigation {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    margin-bottom: 0 !important;
}

.case-context .case-navigation .nav {
    scrollbar-width: thin;
}

.case-context .case-navigation .nav-link {
    padding: .32rem .52rem;
    font-size: .8rem;
}

.case-context .case-navigation .nav-link i {
    margin-right: .1rem;
}

.record-workspace {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
}

/* ========================================================================
   Phase 3: unified case workspace
   ======================================================================== */

.case-context-shell {
    position: sticky;
    top: 70px;
    z-index: 1020;
    background: color-mix(in srgb, var(--app-shell-surface, var(--bs-body-bg)) 94%, transparent);
    backdrop-filter: blur(14px);
}

#exportViewModal .modal-dialog {
    width: auto;
    max-width: min(1320px, calc(100vw - 2rem));
    margin-right: auto;
    margin-left: auto;
}

#exportViewModal .modal-content {
    max-height: calc(100vh - 2rem);
}

#exportViewModal .modal-body {
    overflow: auto;
}

.record-workspace .case-workspace-section {
    width: min(100%, 1600px);
    margin: 0 auto 1rem;
    padding: 1.15rem;
    scroll-margin-top: 10.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .8rem;
    background: var(--bs-body-bg);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .055);
}

.record-workspace .case-workspace-summary {
    margin-top: .35rem;
}

.case-workspace-brief {
    margin-bottom: .75rem;
    padding: .7rem .85rem;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 24%, var(--bs-border-color));
    border-radius: .75rem;
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 52%, var(--bs-body-bg));
}

.case-workspace-brief-heading,
.case-workspace-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.case-workspace-brief-heading h2,
.case-workspace-section-heading h2,
.case-subsection-heading h2,
.case-subsection-heading h3 {
    margin: .15rem 0 .3rem;
    color: var(--bs-body-color);
    text-align: left;
}

.case-workspace-brief-heading h2 {
    font-size: clamp(1.15rem, 1.7vw, 1.45rem);
    font-weight: 700;
}

.case-workspace-section-heading {
    padding-bottom: .2rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.case-workspace-section-heading h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.case-workspace-section-heading p {
    max-width: 64rem;
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .88rem;
}

.case-workspace-brief-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1rem;
    color: var(--bs-secondary-color);
    font-size: .82rem;
}

.case-workspace-brief-meta span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.case-workspace-state-stack {
    display: flex;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .4rem;
}

.case-state-pill {
    display: inline-flex;
    align-items: center;
    max-width: 24rem;
    padding: .32rem .65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: .76rem;
    font-weight: 700;
    text-align: right;
}

.case-state-pill-primary {
    border-color: color-mix(in srgb, var(--bs-primary) 42%, var(--bs-border-color));
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.case-workspace-inner-panel {
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--bs-body-bg);
}

.case-subsection-heading {
    scroll-margin-top: 10.5rem;
}

.case-lead-source {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    color: var(--bs-secondary-color);
    font-size: .72rem;
}

.case-workspace-research #recordTabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.case-workspace-research #recordTabs .nav-link {
    white-space: nowrap;
}

.case-delivery-readiness {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(0, 2fr);
    gap: .8rem;
}

.case-delivery-status,
.case-delivery-checklist {
    margin: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--bs-tertiary-bg);
}

.case-delivery-status {
    padding: 1rem;
}

.case-delivery-status span,
.case-delivery-status small {
    display: block;
    color: var(--bs-secondary-color);
}

.case-delivery-status span {
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.case-delivery-status strong {
    display: block;
    margin: .35rem 0;
    font-size: 1.08rem;
}

.case-delivery-status small {
    font-size: .76rem;
}

.case-delivery-checklist {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 0;
    list-style: none;
}

.case-delivery-checklist li {
    display: grid;
    align-content: start;
    gap: .2rem;
    min-width: 0;
    padding: .8rem;
    border-right: 1px solid var(--bs-border-color);
}

.case-delivery-checklist li:last-child {
    border-right: 0;
}

.case-delivery-checklist i {
    color: var(--bs-secondary-color);
}

.case-delivery-checklist .is-ready i {
    color: var(--bs-success);
}

.case-delivery-checklist span {
    color: var(--bs-secondary-color);
    font-size: .7rem;
}

.case-delivery-checklist strong {
    overflow-wrap: anywhere;
    font-size: .78rem;
}

.case-workspace-guardrail {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin-top: .8rem;
    padding: .75rem .85rem;
    border-left: 4px solid var(--bs-warning);
    border-radius: .35rem;
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
    font-size: .8rem;
}

.case-workspace-guardrail i {
    flex: 0 0 auto;
    margin-top: .05rem;
}

.case-workspace-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 7rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: .6rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
}

.case-navigation .nav-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 70%, transparent);
    outline-offset: 2px;
}

.dark-mode .case-workspace-brief,
.dark-mode .record-workspace .case-workspace-section,
.dark-mode .case-workspace-inner-panel {
    background: var(--dm-bg-surface) !important;
    border-color: var(--dm-border-light) !important;
}

.dark-mode .case-workspace-brief {
    background: color-mix(in srgb, var(--dm-accent-muted) 46%, var(--dm-bg-surface)) !important;
}

@media (max-width: 1399.98px) {
    .case-delivery-checklist {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .case-delivery-checklist li:nth-child(3) {
        border-right: 0;
    }

    .case-delivery-checklist li:nth-child(n+4) {
        border-top: 1px solid var(--bs-border-color);
    }
}

@media (max-width: 991.98px) {
    .case-context-shell {
        top: 70px;
    }

    .case-workspace-brief-heading,
    .case-workspace-section-heading {
        flex-direction: column;
    }

    .case-workspace-state-stack {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .case-delivery-readiness {
        grid-template-columns: 1fr 1fr;
    }

    .case-delivery-status {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767.98px) {
    .record-workspace {
        padding-right: .5rem !important;
        padding-left: .5rem !important;
    }

    .record-workspace .case-workspace-section {
        padding: .8rem;
        scroll-margin-top: 12rem;
        border-radius: .6rem;
    }

    .case-delivery-readiness {
        grid-template-columns: 1fr 1fr;
    }

    .case-delivery-checklist {
        grid-template-columns: 1fr 1fr;
    }

    .case-delivery-checklist li,
    .case-delivery-checklist li:nth-child(3) {
        border-right: 1px solid var(--bs-border-color);
        border-top: 1px solid var(--bs-border-color);
    }

    .case-delivery-checklist li:nth-child(1),
    .case-delivery-checklist li:nth-child(2) {
        border-top: 0;
    }

    .case-delivery-checklist li:nth-child(even),
    .case-delivery-checklist li:last-child {
        border-right: 0;
    }
}

@media (max-width: 575.98px) {
    .case-context-shell {
        position: static;
    }

    .case-delivery-checklist {
        grid-template-columns: 1fr;
    }

    .case-delivery-checklist li,
    .case-delivery-checklist li:nth-child(3) {
        border-right: 0;
        border-top: 1px solid var(--bs-border-color);
    }

    .case-delivery-checklist li:first-child {
        border-top: 0;
    }

    .case-state-pill {
        max-width: 100%;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .case-navigation .nav-link {
        scroll-behavior: auto;
        transition: none;
    }
}

/* Phase 5: invite-only external organization onboarding. */
.external-access-page,
.external-admin-page {
    --external-panel: color-mix(in srgb, var(--bs-body-bg) 95%, var(--bs-primary) 5%);
    --external-border: color-mix(in srgb, var(--bs-border-color) 86%, var(--bs-primary) 14%);
    padding-bottom: 3rem;
}

.external-access-hero,
.external-admin-header,
.client-workspace-header,
.external-access-section-heading,
.external-admin-section-heading,
.external-admin-record-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.external-access-hero,
.external-admin-header {
    margin-bottom: 1rem;
}

.external-access-hero h1,
.external-admin-header h1,
.client-workspace-header h1 {
    margin: .15rem 0 .3rem;
    font-size: clamp(1.6rem, 2.5vw, 2.2rem);
    font-weight: 780;
    letter-spacing: -.035em;
}

.external-access-hero p,
.external-admin-header p {
    max-width: 780px;
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .9rem;
}

.external-access-eyebrow {
    color: var(--bs-primary);
    font-size: .68rem;
    font-weight: 780;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.external-access-layout {
    display: grid;
    grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.external-access-summary-card,
.external-access-readiness-card,
.external-access-panel,
.external-admin-section,
.external-admin-form-card,
.external-admin-record,
.external-admin-table-wrap {
    border: 1px solid var(--external-border);
    border-radius: .9rem;
    background: var(--external-panel);
    box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .035);
}

.external-access-summary-card {
    position: sticky;
    top: 1rem;
    padding: 1.1rem;
}

.external-access-organization-mark {
    display: grid;
    width: 3rem;
    height: 3rem;
    place-items: center;
    margin-bottom: .8rem;
    border-radius: .8rem;
    background: color-mix(in srgb, var(--bs-primary) 15%, var(--bs-body-bg));
    color: var(--bs-primary);
    font-size: 1.2rem;
    font-weight: 800;
}

.external-access-summary-card h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 760;
}

.external-access-summary-card > p {
    color: var(--bs-secondary-color);
    font-size: .75rem;
}

.external-access-summary-card dl {
    display: grid;
    gap: .55rem;
    margin: 1rem 0;
}

.external-access-summary-card dl div {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding-top: .55rem;
    border-top: 1px solid var(--external-border);
    font-size: .72rem;
}

.external-access-summary-card dt {
    color: var(--bs-secondary-color);
}

.external-access-summary-card dd {
    margin: 0;
    text-align: right;
    font-weight: 650;
}

.external-access-boundary-note {
    display: flex;
    gap: .55rem;
    padding: .7rem;
    border-radius: .65rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: .68rem;
    line-height: 1.4;
}

.external-access-boundary-note p {
    margin: 0;
}

.external-access-main-column {
    display: grid;
    gap: 1rem;
}

.external-access-readiness-card,
.external-access-panel {
    padding: 1rem;
}

.external-access-section-heading h2,
.external-admin-section-heading h2 {
    margin: .15rem 0 0;
    font-size: 1rem;
    font-weight: 760;
}

.external-access-checklist {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .55rem;
    margin: 1rem 0;
}

.external-access-check-item {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    min-height: 3.4rem;
    padding: .65rem;
    border: 1px solid var(--external-border);
    border-radius: .65rem;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
}

.external-access-check-item.is-complete {
    border-color: color-mix(in srgb, var(--bs-success) 38%, var(--external-border));
}

.external-access-check-item.is-complete > i {
    color: var(--bs-success);
}

.external-access-check-item span {
    display: grid;
}

.external-access-check-item strong {
    color: var(--bs-body-color);
    font-size: .73rem;
}

.external-access-check-item small {
    font-size: .64rem;
}

.external-access-count {
    display: inline-grid;
    min-width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: .6rem;
    background: var(--bs-tertiary-bg);
    font-size: .72rem;
    font-weight: 750;
}

.external-access-policy-list,
.external-access-purpose-list {
    display: grid;
    gap: .45rem;
    margin-top: .8rem;
}

.external-access-policy-row,
.external-access-purpose-list article {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: center;
    padding: .7rem;
    border: 1px solid var(--external-border);
    border-radius: .65rem;
    color: inherit;
    text-decoration: none;
    background: var(--bs-body-bg);
}

.external-access-policy-row:hover {
    border-color: var(--bs-primary);
}

.external-access-policy-row span:not(.badge),
.external-access-purpose-list article > div {
    display: grid;
}

.external-access-policy-row strong,
.external-access-purpose-list strong {
    font-size: .76rem;
}

.external-access-policy-row small,
.external-access-purpose-list small {
    color: var(--bs-secondary-color);
    font-size: .66rem;
}

.external-access-acceptance-form,
.external-access-purpose-request {
    margin-top: .8rem;
    padding: .8rem;
    border-radius: .7rem;
    background: var(--bs-tertiary-bg);
}

.external-access-acceptance-form {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    font-size: .75rem;
}

.external-access-purpose-request summary,
.external-admin-record summary {
    cursor: pointer;
    color: var(--bs-primary);
    font-size: .75rem;
    font-weight: 700;
}

.external-access-purpose-request form,
.external-admin-record details form {
    margin-top: .8rem;
}

.external-access-inline-empty,
.external-access-empty {
    display: flex;
    gap: .8rem;
    align-items: flex-start;
    padding: 1rem;
    border: 1px dashed var(--external-border);
    border-radius: .8rem;
    background: var(--bs-tertiary-bg);
}

.external-access-inline-empty {
    margin-top: .8rem;
}

.external-access-inline-empty p,
.external-access-empty p {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .78rem;
}

.external-access-empty h2 {
    margin: 0 0 .35rem;
    font-size: 1rem;
}

.client-access-banner {
    display: flex;
    gap: .8rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    border-radius: .75rem;
    color: #fff;
    background: #1e293b;
}

.client-access-banner > i {
    font-size: 1.2rem;
}

.client-access-banner > div {
    flex: 1;
}

.client-access-banner strong {
    font-size: .82rem;
}

.client-access-banner p {
    margin: .1rem 0 0;
    color: rgba(255, 255, 255, .75);
    font-size: .7rem;
}

.client-purpose-context {
    padding: .75rem;
    border: 1px solid var(--external-border);
    border-radius: .7rem;
    background: var(--bs-tertiary-bg);
}

.external-admin-release-gate {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
}

.external-admin-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .65rem;
    margin: 1rem 0;
}

.external-admin-metrics article {
    display: flex;
    gap: .7rem;
    align-items: center;
    padding: .8rem;
    border: 1px solid var(--external-border);
    border-radius: .75rem;
    background: var(--external-panel);
}

.external-admin-metrics i {
    color: var(--bs-primary);
    font-size: 1.1rem;
}

.external-admin-metrics span {
    display: grid;
}

.external-admin-metrics strong {
    font-size: 1rem;
}

.external-admin-metrics small {
    color: var(--bs-secondary-color);
    font-size: .64rem;
}

.external-admin-tabs {
    position: sticky;
    top: .5rem;
    z-index: 4;
    gap: .35rem;
    margin: 0 0 1rem;
    padding: .45rem;
    border: 1px solid var(--external-border);
    border-radius: .75rem;
    background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
    backdrop-filter: blur(10px);
}

.external-admin-tabs .nav-link {
    padding: .42rem .7rem;
    font-size: .7rem;
}

.external-admin-section {
    margin-bottom: 1rem;
    padding: 1rem;
    scroll-margin-top: 5rem;
}

.external-admin-section-heading {
    margin-bottom: .8rem;
}

.external-admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 350px);
    gap: .85rem;
    align-items: start;
}

.external-admin-list {
    display: grid;
    gap: .6rem;
}

.external-admin-list-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.external-admin-record,
.external-admin-form-card {
    padding: .8rem;
}

.external-admin-record-heading strong {
    display: block;
    font-size: .78rem;
}

.external-admin-record-heading small,
.external-admin-table-wrap td small {
    display: block;
    color: var(--bs-secondary-color);
    font-size: .63rem;
}

.external-admin-record-facts {
    display: flex;
    gap: .8rem;
    flex-wrap: wrap;
    margin: .7rem 0;
    color: var(--bs-secondary-color);
    font-size: .65rem;
}

.external-admin-inline-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .55rem;
}

.external-admin-inline-form label,
.external-admin-form-card form > label,
.external-admin-two-column label {
    display: grid;
    gap: .22rem;
    color: var(--bs-secondary-color);
    font-size: .65rem;
    font-weight: 650;
}

.external-admin-full {
    grid-column: 1 / -1;
}

.external-admin-form-card {
    position: sticky;
    top: 4.6rem;
}

.external-admin-form-card h3 {
    margin: 0;
    font-size: .85rem;
}

.external-admin-form-card > p {
    color: var(--bs-secondary-color);
    font-size: .65rem;
}

.external-admin-form-card form {
    display: grid;
    gap: .65rem;
}

.external-admin-form-card fieldset {
    padding: .55rem;
    border: 1px solid var(--external-border);
    border-radius: .55rem;
}

.external-admin-form-card legend {
    float: none;
    width: auto;
    margin: 0;
    padding: 0 .25rem;
    font-size: .64rem;
    font-weight: 700;
}

.external-admin-form-card .form-check {
    font-size: .68rem;
}

.external-admin-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
}

.external-admin-table-wrap {
    overflow-x: auto;
    padding: .35rem;
}

.external-admin-table-wrap table {
    min-width: 680px;
    margin: 0;
    font-size: .7rem;
}

.external-admin-capabilities span {
    display: inline-block;
    margin: .1rem;
    padding: .16rem .35rem;
    border-radius: .35rem;
    background: var(--bs-tertiary-bg);
    font-size: .58rem;
}

.external-admin-empty {
    margin: 0;
    padding: 1rem;
    color: var(--bs-secondary-color);
    text-align: center;
    font-size: .72rem;
}

@media (max-width: 1199.98px) {
    .external-admin-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .external-admin-list-wide {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .external-access-layout,
    .external-admin-grid {
        grid-template-columns: 1fr;
    }

    .external-access-summary-card,
    .external-admin-form-card {
        position: static;
    }

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

@media (max-width: 767.98px) {
    .external-access-hero,
    .external-admin-header,
    .client-workspace-header,
    .external-access-acceptance-form,
    .client-access-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .external-access-checklist,
    .external-admin-metrics,
    .external-admin-inline-form,
    .external-admin-two-column {
        grid-template-columns: 1fr;
    }

    .external-admin-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}

@media (max-width: 991.98px) {
    .case-context {
        align-items: flex-start;
    }

    .case-context-tabs {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .case-context-shell {
        width: calc(100% - 1rem);
        padding-right: .5rem;
        padding-left: .5rem;
    }

    .case-context-identity {
        flex-wrap: wrap;
        white-space: normal;
    }

    .case-context-subject {
        flex-basis: 100%;
        max-width: 100%;
    }
}

/* ========================================================================
   Case management platform shell and project workspaces
   ======================================================================== */

:root {
    --app-sidebar-width: 244px;
    --app-sidebar-collapsed-width: 72px;
    --app-topbar-height: 56px;
    --app-sidebar-bg: #0f172a;
    --app-sidebar-border: rgba(148, 163, 184, .18);
    --app-sidebar-text: #cbd5e1;
    --app-sidebar-muted: #7f8da4;
    --app-sidebar-active: #1e40af;
    --app-shell-surface: var(--bs-body-bg, #fff);
    --app-shell-subtle: var(--bs-tertiary-bg, #f4f6f9);
    --app-shell-border: var(--bs-border-color, #dfe3e8);
    --app-focus-ring: #60a5fa;
}

.skip-to-content {
    position: fixed;
    top: .5rem;
    left: .5rem;
    z-index: 1200;
    transform: translateY(-160%);
    padding: .65rem 1rem;
    border-radius: .5rem;
    background: #fff;
    color: #111827;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .24);
    font-weight: 700;
}

.skip-to-content:focus {
    transform: translateY(0);
}

.development-banner {
    /* Keep the floated deploy metadata inside the banner so a following
       formatting context cannot be squeezed beside it on narrow screens. */
    display: flow-root;
    position: relative;
    /* Stay above the application chrome, but below Bootstrap's backdrop
       (1050) and modal (1055) so local/dev banners never cover dialogs. */
    z-index: 1045;
}

.app-shell-body {
    min-width: 0;
    background: var(--app-shell-subtle);
}

.non-internal-shell-body {
    display: flex;
    flex-direction: column;
    min-width: 320px;
    min-height: 100vh;
}

.non-internal-shell-body > main {
    flex: 1 0 auto;
}

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

.app-sidebar {
    position: sticky;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--app-sidebar-width);
    height: 100vh;
    overflow: hidden;
    color: var(--app-sidebar-text);
    background: var(--app-sidebar-bg);
    border-right: 1px solid var(--app-sidebar-border);
    transition: width .2s ease, transform .2s ease;
}

.app-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--app-topbar-height);
    min-height: var(--app-topbar-height);
    padding: .45rem 1.1rem;
    border-bottom: 1px solid var(--app-sidebar-border);
}

.app-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .7rem;
    color: #fff;
    text-decoration: none;
    font-size: 1.08rem;
    font-weight: 750;
    letter-spacing: -.02em;
}

.app-brand:hover,
.app-brand:focus {
    color: #fff;
}

.app-brand-logo {
    display: block;
    flex: 0 1 auto;
    width: auto;
    height: 24px;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
}

/* The pin mark stands in for the wordmark once the rail is too narrow for it. */
.app-brand-logo-mark {
    display: none;
    height: 32px;
}

/* The logo is a full wordmark, so the text is only a fallback for a missing
   image file (revealed by the img onerror handler in base.html). */
.app-brand-text {
    display: none;
}

.app-brand-text,
.app-nav-label,
.app-nav-badge {
    white-space: nowrap;
    transition: opacity .15s ease;
}

.btn.app-sidebar-close {
    display: none;
    color: var(--app-sidebar-text);
}

.app-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .55rem .55rem 1rem;
    scrollbar-width: thin;
}

.app-nav-group {
    margin-top: .75rem;
}

.app-nav-group:first-child {
    margin-top: .2rem;
}

.app-nav-group-unlabeled,
.app-nav-menu-group {
    margin-top: .12rem;
}

.app-nav-group-divider {
    margin-top: .62rem;
    padding-top: .62rem;
    border-top: 1px solid var(--app-sidebar-border);
}

.app-nav-group-label {
    margin: 0 0 .3rem;
    padding: 0 .65rem;
    color: var(--app-sidebar-muted) !important;
    text-align: left;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .11em;
    line-height: 1.8;
    text-transform: uppercase;
}

.app-nav-item + .app-nav-item {
    margin-top: .12rem;
}

.app-nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    gap: .72rem;
    padding: .58rem .7rem;
    border: 1px solid transparent;
    border-radius: .55rem;
    color: var(--app-sidebar-text);
    background: transparent;
    text-align: left;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
}

.app-nav-link:hover,
.app-nav-link:focus-visible {
    color: #fff;
    background: rgba(148, 163, 184, .12);
}

.app-nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--app-sidebar-active), #1d4ed8);
    box-shadow: 0 5px 16px rgba(30, 64, 175, .24);
}

.app-nav-icon {
    width: 1.25rem;
    flex: 0 0 1.25rem;
    text-align: center;
    font-size: 1.02rem;
}

.app-nav-button {
    cursor: pointer;
}

.app-nav-count-badge {
    margin-left: auto;
}

.app-nav-menu {
    position: relative;
}

.app-nav-menu-chevron {
    margin-left: auto;
    color: var(--app-sidebar-muted);
    font-size: .72rem;
    transition: transform .16s ease, color .16s ease;
}

.app-nav-menu-trigger[aria-expanded="true"] .app-nav-menu-chevron {
    color: #fff;
    transform: rotate(90deg);
}

.app-nav-flyout {
    position: fixed;
    z-index: 1060;
    width: min(270px, calc(100vw - 1.5rem));
    padding: .5rem;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: .75rem;
    color: var(--app-sidebar-text);
    background: #111c31;
    box-shadow: 0 18px 44px rgba(2, 6, 23, .36);
}

.app-nav-flyout-title {
    padding: .28rem .58rem .42rem;
    color: #94a3b8;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.app-nav-submenu-list li + li {
    margin-top: .12rem;
}

.app-nav-submenu-link {
    display: flex;
    align-items: center;
    min-height: 40px;
    gap: .65rem;
    padding: .52rem .58rem;
    border: 1px solid transparent;
    border-radius: .5rem;
    color: var(--app-sidebar-text);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 600;
}

.app-nav-submenu-link:hover,
.app-nav-submenu-link:focus-visible {
    color: #fff;
    background: rgba(148, 163, 184, .13);
}

.app-nav-submenu-link:focus-visible {
    outline: 3px solid var(--app-focus-ring);
    outline-offset: 1px;
}

.app-nav-submenu-link.active {
    color: #fff;
    background: rgba(37, 99, 235, .28);
    border-color: rgba(96, 165, 250, .45);
}

.app-nav-submenu-icon {
    width: 1.15rem;
    flex: 0 0 1.15rem;
    color: #93c5fd;
    text-align: center;
    font-size: .95rem;
}

.app-sidebar-footer {
    padding: .65rem .55rem;
    border-top: 1px solid var(--app-sidebar-border);
}

/* ========================================================================
   CASE PAGE PHASE 5 — LOCATION + VALIDATED CASE-FILE RAIL
   ======================================================================== */

.record-case-pane-evidence {
    container: record-evidence / inline-size;
}

.record-case-pane-evidence #evidenceWorkspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .85rem;
}

#validatedRecordsHome,
#validatedRecordsSection {
    min-width: 0;
}

.record-case-pane-evidence #evidenceWorkspace > hr {
    margin: .15rem 0 !important;
}

.record-validated-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    min-width: 0;
}

.record-validated-heading > div {
    min-width: 0;
}

.record-validated-heading h3,
.record-case-files-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.record-validated-heading h3 {
    white-space: nowrap;
}

.record-validated-heading p,
.record-case-files-heading p {
    margin: 0;
    font-size: .76rem;
    line-height: 1.35;
}

.record-validated-heading-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    max-width: 100%;
    gap: .35rem;
}

.record-validated-add-action {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: .28rem;
    min-height: 1.8rem;
    padding: .24rem .5rem;
    font-size: .68rem;
    font-weight: 750;
    white-space: nowrap;
}

.record-validated-expand-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.8rem;
    min-height: 1.8rem;
    padding: .24rem;
    font-size: .68rem;
    font-weight: 750;
    white-space: nowrap;
}

.record-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: .28rem;
    min-height: 1.8rem;
    padding: .24rem .5rem;
    font-size: .68rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}

.record-action-button-icon {
    width: 1.8rem;
    padding-inline: 0;
}

.location-analysis-card {
    min-width: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: .8rem;
    background: var(--bs-body-bg);
    overflow: hidden;
}

.location-analysis-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .75rem .55rem;
}

.location-analysis-heading > div {
    min-width: 0;
}

.location-analysis-heading > button {
    flex-shrink: 0;
}

.location-analysis-heading h3 {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
    font-size: .96rem;
}

.location-analysis-heading p {
    margin: .15rem 0 0;
    color: var(--bs-secondary-color);
    font-size: .72rem;
}

.location-map-shell {
    position: relative;
    min-height: 15rem;
    margin: 0;
    border: 1px solid var(--bs-border-color);
    overflow: hidden;
    background: color-mix(in srgb, var(--bs-tertiary-bg) 88%, var(--bs-primary) 12%);
}

.location-map-placeholder {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(32deg, transparent 44%, color-mix(in srgb, var(--bs-primary) 17%, transparent) 45% 48%, transparent 49%),
        linear-gradient(118deg, transparent 30%, color-mix(in srgb, var(--bs-primary) 12%, transparent) 31% 34%, transparent 35%),
        repeating-linear-gradient(0deg, transparent 0 2.7rem, color-mix(in srgb, var(--bs-border-color) 55%, transparent) 2.75rem 2.85rem),
        repeating-linear-gradient(90deg, transparent 0 4.4rem, color-mix(in srgb, var(--bs-border-color) 45%, transparent) 4.45rem 4.55rem),
        var(--bs-tertiary-bg);
}

.location-map-placeholder-hit {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .65rem;
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: 0;
    color: var(--bs-body-color);
    text-align: left;
    background: linear-gradient(90deg, color-mix(in srgb, var(--bs-body-bg) 94%, transparent), color-mix(in srgb, var(--bs-body-bg) 72%, transparent));
}

.location-map-placeholder-hit:hover {
    background: linear-gradient(90deg, color-mix(in srgb, var(--bs-primary-bg-subtle) 94%, transparent), color-mix(in srgb, var(--bs-body-bg) 68%, transparent));
}

.location-map-placeholder-pin {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    box-shadow: 0 .3rem 1rem rgba(15, 23, 42, .16);
}

.location-map-placeholder-copy {
    display: grid;
    gap: .15rem;
    min-width: 0;
}

.location-map-placeholder-copy strong,
.location-map-placeholder-copy small {
    overflow-wrap: anywhere;
}

.location-map-placeholder-copy small {
    color: var(--bs-secondary-color);
    font-size: .72rem;
}

.location-map-placeholder-action {
    color: var(--bs-primary);
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
}

.location-map-canvas {
    width: 100%;
    height: 15rem;
}

.location-map-state {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: 1rem;
    color: var(--bs-secondary-color);
    text-align: center;
    background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
}

.location-map-state[hidden] {
    display: none !important;
}

.location-map-unavailable {
    flex-wrap: wrap;
}

.location-map-state-modal {
    inset: 1rem;
}

.location-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem .65rem;
    padding: .5rem .75rem .65rem;
    color: var(--bs-secondary-color);
    font-size: .64rem;
}

.location-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.location-map-legend span > i {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--pin-color);
}

.location-map-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    border: 0;
    color: #172033;
    background: transparent;
}

.location-map-marker-dot {
    width: 1rem;
    height: 1rem;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--location-marker-color);
    box-shadow: 0 1px 5px rgba(0, 0, 0, .42);
}

.location-map-marker-label {
    max-width: 10rem;
    margin-top: .15rem;
    padding: .1rem .3rem;
    border: 1px solid rgba(15, 23, 42, .14);
    border-radius: .25rem;
    overflow: hidden;
    font-size: .62rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .2);
}

.location-map-popup {
    max-width: 17rem;
    color: #29303d;
    font-size: .76rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.location-map-popup-kicker {
    margin-bottom: .2rem;
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.location-distances {
    padding: .15rem .75rem .4rem;
    font-size: .78rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.location-distances h4 {
    margin: 0;
    font-size: .85rem;
    font-weight: 700;
}

.location-distance-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    margin-bottom: .2rem;
}

.location-distance-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    flex: 0 0 auto;
    padding: .2rem .25rem;
    border: 0;
    border-radius: .2rem;
    background: transparent;
    color: inherit;
    font-size: .72rem;
    cursor: pointer;
}

.location-distance-toggle::after {
    content: '';
    width: .4rem;
    height: .4rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(.1rem) rotate(225deg);
}

.location-distance-toggle[aria-expanded="false"]::after {
    transform: translateY(-.1rem) rotate(45deg);
}

.location-distance-toggle:hover {
    background: color-mix(in srgb, currentColor 8%, transparent);
}

.location-distance-toggle:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

.location-distances [role="status"][hidden] {
    display: none !important;
}

.location-distance-empty {
    margin: .25rem 0;
}

.location-distance-note {
    font-size: .72rem;
    opacity: .85;
}

.location-distance-group + .location-distance-group {
    margin-top: .5rem;
}

.location-distance-home {
    padding: .3rem .4rem;
    border-left: 3px solid #28a745;
    background: color-mix(in srgb, #28a745 8%, transparent);
}

.location-distance-label {
    display: block;
    margin-bottom: .15rem;
    font-size: .7rem;
    font-weight: 600;
    opacity: .85;
}

.location-distance-table {
    width: 100%;
    margin-top: .35rem;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: .3rem;
    overflow: hidden;
    color: inherit;
    box-shadow: none;
}

.location-distance-column {
    width: 6.25rem;
}

.location-distance-table th,
.location-distance-table td {
    padding: .4rem .5rem;
    border: 0;
    background: transparent;
    font: inherit;
    letter-spacing: normal;
    vertical-align: top;
}

.location-distance-table thead th {
    font-size: .7rem;
    font-weight: 600;
    text-align: left;
    background: color-mix(in srgb, currentColor 6%, transparent);
    border-bottom: 1px solid var(--bs-border-color);
}

.location-distance-table thead th:last-child,
.location-distance-table .location-distance-result {
    text-align: right;
    border-left: 1px solid var(--bs-border-color);
}

.location-distance-table tbody tr + tr > * {
    border-top: 1px solid var(--bs-border-color);
}

.location-distance-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, currentColor 3%, transparent);
}

.location-distance-address {
    font-weight: 400;
    text-align: left;
}

.dark-mode .location-distance-table tbody tr > :is(th, td) {
    background-color: transparent !important;
}

.location-distance-address > .location-distance-note {
    display: block;
}

.location-distance-value {
    font-size: .8rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.location-distance-value.is-unavailable {
    white-space: normal;
    font-size: .7rem;
    font-weight: 600;
}

.location-distances-expanded {
    flex: 0 1 auto;
    max-height: 35vh;
    overflow-y: auto;
    padding-top: .65rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.location-distance-comparison + .location-distance-comparison {
    margin-top: .5rem;
}

.location-popup-distance:not(:empty) {
    margin-top: .3rem;
    padding-top: .3rem;
    border-top: 1px dashed #cbd5e1;
}

.location-map-popup dl {
    display: grid;
    gap: .15rem;
    margin: .45rem 0 0;
    padding-top: .4rem;
    border-top: 1px solid #e5e7eb;
}

.location-map-popup dl > div {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: .35rem;
}

.location-map-popup dt,
.location-map-popup dd {
    margin: 0;
}

.location-popup-street-view {
    margin-top: .4rem;
}

/* Keep the constrained inline map popup compact. The fullscreen map retains
   the roomier base popup styles above. */
#addressMap .mapboxgl-popup {
    max-width: min(13.25rem, calc(100% - .75rem)) !important;
}

#addressMap .mapboxgl-popup-content {
    padding: .45rem .5rem .5rem;
}

#addressMap .location-map-popup {
    max-width: none;
    font-size: .68rem;
    line-height: 1.28;
}

#addressMap .location-map-popup-kicker {
    margin-bottom: .1rem;
    font-size: .6rem;
}

#addressMap .location-map-popup dl {
    gap: .08rem;
    margin-top: .3rem;
    padding-top: .3rem;
}

#addressMap .location-map-popup dl > div {
    grid-template-columns: 3.75rem minmax(0, 1fr);
    gap: .25rem;
}

#addressMap .location-popup-street-view {
    margin-top: .28rem;
}

.location-street-view-empty {
    display: grid;
    place-items: center;
    height: 100%;
    padding: 1rem;
    color: #667085;
    text-align: center;
    background: #f1f3f5;
}

.location-street-view-empty > div {
    display: grid;
    gap: .55rem;
}

.location-street-view-empty i {
    font-size: 2rem;
}

.found-records-rail {
    min-width: 0;
}

.record-validated-expanded-modal .modal-dialog {
    max-width: min(1400px, calc(100vw - 1.5rem));
}

.record-validated-expanded-modal .modal-content {
    max-height: calc(100dvh - 1.5rem);
}

.record-validated-expanded-modal .modal-header {
    position: relative;
    justify-content: center;
    padding-right: 3.5rem;
    padding-left: 3.5rem;
}

.record-validated-expanded-modal-heading {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
}

.record-validated-expanded-modal .modal-header .btn-close {
    position: absolute;
    top: 50%;
    right: 1rem;
    margin: 0;
    transform: translateY(-50%);
}

.record-validated-expanded-modal-body,
.record-validated-expanded-modal-mount {
    min-width: 0;
}

.record-validated-expanded-modal-body {
    min-height: min(42rem, 72dvh);
}

.record-validated-expanded-modal .found-record-filter-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.record-validated-expanded-modal .found-record-card-list {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: .75rem;
}

.record-validated-expanded-modal .found-record-card {
    padding: .85rem 1rem 1rem;
}

.record-validated-expanded-modal .found-record-card-header {
    align-items: center;
}

.record-validated-expanded-modal .found-record-value {
    padding-top: 0;
    font-size: 1.04rem;
}

.record-validated-expanded-modal .found-record-card-meta {
    margin-top: .55rem;
    margin-bottom: .65rem;
    font-size: .72rem;
}

.record-validated-expanded-modal .found-record-chip,
.record-validated-expanded-modal .found-record-state-chip,
.record-validated-expanded-modal .found-record-provider-chip {
    font-size: .68rem;
}

.record-validated-expanded-modal .found-record-details > summary {
    display: none;
}

.record-validated-expanded-modal .found-record-details-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "notes"
        "provider";
    align-items: start;
    gap: .65rem;
    padding-top: .75rem;
}

.record-validated-expanded-modal .found-record-detail-label {
    font-size: .72rem;
}

.record-validated-expanded-modal .found-record-detail-list {
    display: none;
}

.record-validated-expanded-modal .found-record-intel-notes {
    grid-area: notes;
    min-height: 0;
    padding: .2rem 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: .86rem;
    line-height: 1.5;
}

.record-validated-expanded-modal .twilio-lookup-block {
    grid-area: provider;
    margin-top: 0 !important;
    padding: .8rem !important;
}

.record-validated-expanded-modal .fr-clamp {
    display: block;
    overflow: visible;
    -webkit-box-orient: initial;
    -webkit-line-clamp: unset;
}

.record-validated-expanded-modal .fr-toggle {
    display: none !important;
}

.record-validated-expanded-modal :is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 72%, transparent);
    outline-offset: 2px;
}

.found-record-filter-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .35rem;
    margin-bottom: .55rem;
}

.found-record-filter {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .25rem;
    min-width: 0;
    min-height: 2.15rem;
    padding: .35rem .42rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
}

.found-record-filter:hover:not(:disabled),
.found-record-filter.active {
    border-color: color-mix(in srgb, var(--bs-primary) 65%, var(--bs-border-color));
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

.found-record-filter:disabled {
    cursor: not-allowed;
    opacity: .42;
    filter: grayscale(1);
}

.found-record-filter > i {
    font-size: .9rem;
}

.found-record-filter-label {
    min-width: 0;
    overflow: hidden;
    font-size: .64rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.found-record-filter-count {
    min-width: 1.15rem;
    padding: .06rem .22rem;
    border-radius: 999px;
    color: var(--bs-body-color);
    font-size: .61rem;
    line-height: 1.25;
    text-align: center;
    background: var(--bs-tertiary-bg);
}

.found-address-filter-strip {
    display: flex;
    gap: .3rem;
    margin: 0 0 .6rem;
    padding-bottom: .2rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.found-address-filter-strip[hidden] {
    display: none !important;
}

.found-address-filter {
    flex: 0 0 auto;
    padding: .25rem .5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    color: var(--bs-secondary-color);
    font-size: .66rem;
    font-weight: 700;
    background: var(--bs-body-bg);
}

.found-address-filter.active {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

.found-address-filter:disabled {
    opacity: .45;
    filter: grayscale(1);
}

.found-record-card-list {
    display: grid;
    gap: .55rem;
}

.found-record-card {
    min-width: 0;
    padding: .65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    background: var(--bs-body-bg);
    box-shadow: 0 .2rem .7rem rgba(15, 23, 42, .055);
    transition: border-color .16s ease, box-shadow .16s ease, opacity .2s ease;
}

.found-record-card[hidden] {
    display: none !important;
}

.found-record-card:hover {
    border-color: color-mix(in srgb, var(--bs-primary) 35%, var(--bs-border-color));
}

.found-record-card.is-map-selected {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-primary) 22%, transparent);
}

.found-record-card-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: .55rem;
    min-width: 0;
}

.found-record-type-icon {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 35%, var(--bs-border-color));
    border-radius: .5rem;
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

button.found-record-type-icon {
    padding: 0;
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

button.found-record-type-icon:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary-text-emphasis);
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 72%, var(--bs-primary) 28%);
}

.found-record-value {
    min-width: 0;
    padding-top: .1rem;
    font-size: .88rem;
    font-weight: 750;
    line-height: 1.32;
    overflow-wrap: anywhere;
}

.found-record-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .25rem;
    max-width: none;
}

.found-record-card-actions .btn {
    display: inline-grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border-radius: .45rem;
}

.found-record-card-actions .dropdown-toggle::after {
    display: none;
}

.found-record-card-actions .dropdown-menu {
    min-width: 12rem;
    font-size: .78rem;
}

.found-record-edit-actions {
    align-items: center;
    gap: .25rem;
}

.found-record-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .3rem .4rem;
    min-width: 0;
    margin: .5rem 0 .35rem 2.55rem;
    color: var(--bs-secondary-color);
    font-size: .68rem;
}

.found-record-card-meta > * {
    min-width: 0;
}

.found-record-source-display {
    display: inline-flex;
    align-items: center;
    gap: .22rem;
    max-width: 14rem;
    color: var(--bs-secondary-color);
    font-weight: 650;
}

.found-record-source-display > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.found-record-status-edit-label,
.found-record-confidence-edit-label {
    display: none;
    margin-bottom: .2rem;
    color: var(--bs-body-color);
    font-size: .66rem;
    font-weight: 750;
    line-height: 1.25;
}

.found-record-confidence-edit-label span {
    color: var(--bs-secondary-color);
    font-weight: 650;
}

.found-record-confidence-display > i {
    font-size: .82rem;
    vertical-align: -.06em;
}

.found-record-confidence-display.found-record-confidence-high > i {
    color: #198754 !important;
}

.found-record-confidence-display.found-record-confidence-medium > i {
    color: #d97706 !important;
}

.found-record-confidence-display.found-record-confidence-low > i {
    color: #dc3545 !important;
}

.found-record-confidence-display.found-record-confidence-unknown > i {
    color: #6c757d !important;
}

.dark-mode .found-record-confidence-display.found-record-confidence-high > i {
    color: #4ade80 !important;
}

.dark-mode .found-record-confidence-display.found-record-confidence-medium > i {
    color: #fbbf24 !important;
}

.dark-mode .found-record-confidence-display.found-record-confidence-low > i {
    color: #fb7185 !important;
}

.dark-mode .found-record-confidence-display.found-record-confidence-unknown > i {
    color: #94a3b8 !important;
}

.found-record-chip,
.found-record-state-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: .12rem .35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    overflow: hidden;
    color: var(--bs-body-color);
    font-size: .63rem;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--bs-tertiary-bg);
}

.found-record-provider-chip {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .12rem .35rem;
    border: 1px solid color-mix(in srgb, var(--bs-info) 45%, var(--bs-border-color));
    border-radius: 999px;
    color: var(--bs-info-text-emphasis);
    font-size: .63rem;
    font-weight: 700;
    line-height: 1.2;
    background: var(--bs-info-bg-subtle);
}

.found-record-chip-subtype {
    color: var(--bs-primary);
}

.found-record-details {
    margin-left: 2.55rem;
    border-top: 1px solid var(--bs-border-color);
}

.found-record-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .42rem 0 0;
    color: var(--bs-secondary-color);
    cursor: pointer;
    font-size: .67rem;
    font-weight: 700;
    list-style: none;
}

.found-record-details > summary::-webkit-details-marker {
    display: none;
}

.found-record-details[open] > summary i {
    transform: rotate(180deg);
}

.found-record-details-body {
    display: grid;
    gap: .55rem;
    padding: .55rem 0 .15rem;
    min-width: 0;
}

.found-record-detail-list {
    display: grid;
    gap: .35rem;
    margin: 0;
}

.found-record-detail-list > div {
    display: grid;
    grid-template-columns: minmax(5rem, .35fr) minmax(0, 1fr);
    gap: .5rem;
    min-width: 0;
}

.found-record-detail-list dt,
.found-record-detail-label {
    color: var(--bs-secondary-color);
    font-size: .64rem;
    font-weight: 750;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.found-record-detail-list dd {
    min-width: 0;
    margin: 0;
    font-size: .72rem;
    overflow-wrap: anywhere;
}

.found-record-intel-notes {
    display: grid;
    gap: .25rem;
    min-width: 0;
    font-size: .73rem;
    line-height: 1.42;
    overflow-wrap: anywhere;
}

.found-record-structured-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    margin-top: .35rem;
}

.found-record-grid-span {
    grid-column: 1 / -1;
}

.found-record-card.editing {
    border-color: color-mix(in srgb, var(--bs-primary) 65%, var(--bs-border-color));
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 28%, var(--bs-body-bg));
}

.found-record-card.editing .editable-cell .cell-display {
    display: none !important;
}

.found-record-card.editing .editable-cell .cell-edit {
    display: block;
}

.found-record-card.editing .found-record-status-edit-label,
.found-record-card.editing .found-record-confidence-edit-label {
    display: block;
}

.found-record-card.editing .found-record-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.found-record-card.editing .found-record-details {
    margin-top: .5rem;
}

.found-record-card :is(input, select, textarea) {
    min-width: 0;
    max-width: 100%;
}

.found-record-card .twilio-lookup-block {
    min-width: 0;
    overflow-wrap: anywhere;
}

.found-record-card .twilio-lookup-details > summary {
    cursor: pointer;
}

.found-records-empty,
.found-records-filter-empty {
    min-height: 7rem;
}

.found-records-empty {
    grid-column: 1 / -1;
    flex-direction: column;
    gap: .3rem;
    padding: 1rem;
    text-align: center;
}

.found-records-empty-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.found-records-empty-copy {
    max-width: 34rem;
}

.record-case-files-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .65rem;
    margin-bottom: .65rem;
}

.case-files-summary {
    display: grid;
    gap: .4rem;
}

.case-files-summary-count {
    color: var(--bs-secondary-color);
    font-size: .7rem;
    font-weight: 700;
}

.case-files-summary-list {
    display: grid;
    gap: .25rem;
    max-height: 12rem;
    overflow-y: auto;
    scrollbar-width: thin;
}

.case-files-summary-list.case-files-summary-list--menu-open {
    overflow: visible;
}

.case-file-summary-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    padding: .35rem .4rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .45rem;
    font-size: .7rem;
    background: var(--bs-tertiary-bg);
}

.case-file-summary-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-file-summary-actions {
    min-width: 0;
}

.case-file-summary-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.case-file-summary-menu-trigger::after {
    display: none;
}

.case-file-summary-menu {
    min-width: 10rem;
    font-size: .78rem;
}

.case-files-summary-empty {
    padding: .65rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: .45rem;
    color: var(--bs-secondary-color);
    font-size: .7rem;
    text-align: center;
}

.record-files-modal .modal-content {
    max-height: min(90vh, 58rem);
}

.record-files-modal #documentsTableContainer {
    margin-bottom: 0 !important;
}

.record-files-modal #documentsTableContainer .table-responsive {
    max-height: 53vh;
}

.record-files-modal #documentsTableContainer table {
    min-width: 56rem;
}

.case-file-table-actions-cell {
    white-space: nowrap;
}

.case-file-table-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    white-space: nowrap;
}

.case-file-table-actions > form {
    display: inline-flex !important;
    flex: 0 0 auto;
}

.case-file-manage-target > td {
    background: color-mix(in srgb, var(--bs-primary) 10%, transparent);
}

.dark-mode .location-analysis-card,
.dark-mode .found-record-card,
.dark-mode .found-record-filter,
.dark-mode .found-address-filter {
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
    background: var(--dm-bg-surface);
}

.dark-mode .location-map-placeholder {
    background:
        linear-gradient(32deg, transparent 44%, rgba(33, 150, 243, .13) 45% 48%, transparent 49%),
        linear-gradient(118deg, transparent 30%, rgba(33, 150, 243, .1) 31% 34%, transparent 35%),
        repeating-linear-gradient(0deg, transparent 0 2.7rem, rgba(148, 163, 184, .1) 2.75rem 2.85rem),
        repeating-linear-gradient(90deg, transparent 0 4.4rem, rgba(148, 163, 184, .08) 4.45rem 4.55rem),
        var(--dm-bg-elevated);
}

.dark-mode .location-map-placeholder-hit {
    color: var(--dm-text-primary);
    background: linear-gradient(90deg, rgba(20, 28, 43, .94), rgba(20, 28, 43, .7));
}

.dark-mode .location-map-state {
    color: var(--dm-text-secondary);
    background: rgba(20, 28, 43, .94);
}

.dark-mode .found-record-card.is-map-selected {
    border-color: var(--dm-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dm-accent) 28%, transparent);
}

.dark-mode .found-record-card.editing {
    background: color-mix(in srgb, var(--dm-accent) 10%, var(--dm-bg-surface));
}

.dark-mode .found-record-chip,
.dark-mode .found-record-state-chip,
.dark-mode .found-record-provider-chip,
.dark-mode .case-file-summary-row {
    border-color: var(--dm-border);
    color: var(--dm-text-primary);
    background: var(--dm-bg-elevated);
}

.dark-mode .found-record-card .twilio-lookup-block {
    border-color: var(--dm-border) !important;
    color: var(--dm-text-primary);
    background: var(--dm-bg-elevated) !important;
}

.dark-mode .found-record-delete-action {
    color: var(--bs-danger-text-emphasis) !important;
}

.dark-mode .found-record-delete-action:is(:hover, :focus) {
    background: color-mix(in srgb, var(--bs-danger-bg-subtle) 72%, var(--dm-bg-elevated));
}

@container record-evidence (max-width: 29rem) {
    .found-record-filter-strip {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .found-record-filter {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: .1rem;
        padding: .3rem .2rem;
    }

    .found-record-filter-label {
        display: none;
    }

    .found-record-filter-count {
        position: absolute;
        top: .16rem;
        right: .16rem;
        min-width: .9rem;
        padding: 0 .14rem;
    }

    .location-map-placeholder-action {
        display: none;
    }
}

@container record-evidence (max-width: 23rem) {
    .found-record-card-meta,
    .found-record-details {
        margin-left: 0;
    }

    .found-record-detail-list > div {
        grid-template-columns: minmax(0, 1fr);
        gap: .1rem;
    }
}

@media (max-width: 991.98px) {
    .record-validated-expanded-modal .found-record-filter-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

}

@media (max-width: 767.98px) {
    .record-validated-expanded-modal .found-record-card-meta,
    .record-validated-expanded-modal .found-record-details {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .record-validated-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .record-validated-heading-actions {
        width: 100%;
    }

    .record-validated-heading-actions .btn {
        flex: 1 1 0;
        justify-content: center;
    }

    .record-validated-heading-actions .record-validated-expand-action {
        flex: 0 0 2.75rem;
    }

    .record-validated-expanded-modal .modal-dialog {
        margin: .4rem;
    }

    .found-record-filter-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .location-map-placeholder-hit {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .location-map-placeholder-action {
        display: none;
    }

    .found-record-card.editing .found-record-card-meta,
    .found-record-structured-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .found-record-grid-span {
        grid-column: auto;
    }
}

.app-sidebar-collapse-button {
    margin-bottom: .2rem;
}

.app-frame {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--app-topbar-height);
    min-height: var(--app-topbar-height);
    padding: .35rem 1.25rem;
    border-bottom: 1px solid var(--app-shell-border);
    background: color-mix(in srgb, var(--app-shell-surface) 92%, transparent);
    backdrop-filter: blur(14px);
}

.app-topbar-start,
.app-topbar-actions {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .55rem;
}

.app-icon-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--app-shell-border);
    color: var(--bs-body-color);
    background: var(--app-shell-surface);
}

.app-icon-button:focus-visible,
.app-user-menu-button:focus-visible,
.app-sidebar-collapse-button:focus-visible {
    outline: 3px solid var(--app-focus-ring);
    outline-offset: 2px;
    box-shadow: none;
}

.btn.app-mobile-menu-button {
    display: none;
}

.app-project-context {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: .55rem;
    min-width: 190px;
    max-width: min(32vw, 420px);
    padding: .35rem .65rem;
    border: 1px solid transparent;
    border-radius: .55rem;
    color: var(--bs-body-color);
    background: transparent;
    font: inherit;
    text-align: left;
    text-decoration: none;
}

.app-project-context:hover,
.app-project-context:focus-visible {
    color: var(--bs-body-color);
    background: var(--app-shell-subtle);
}

.app-project-context-label {
    grid-column: 1;
    color: var(--bs-secondary-color);
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .05em;
    line-height: 1.2;
    text-transform: uppercase;
}

.app-project-context strong {
    grid-column: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9rem;
}

.app-project-context i {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.app-project-context.dropdown-toggle::after {
    display: none;
}

.app-project-menu {
    width: max-content;
    min-width: min(320px, calc(100vw - 2rem));
    max-width: min(420px, calc(100vw - 2rem));
    max-height: min(70vh, 30rem);
    overflow-y: auto;
}

.app-project-switch-form {
    margin: 0;
}

.app-project-option {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .55rem;
}

.app-project-option i {
    flex: 0 0 auto;
}

.app-project-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-project-option-current {
    color: var(--bs-primary);
    font-weight: 700;
}

.app-user-menu-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--app-shell-border);
    color: var(--bs-body-color);
    background: var(--app-shell-surface);
}

.app-user-menu-icon {
    display: inline-block;
    font-size: 1.25rem;
    line-height: 1;
}

.app-user-menu-button.dropdown-toggle::after {
    display: none;
}

.app-user-menu-button:hover {
    color: var(--bs-body-color);
    background: var(--app-shell-subtle);
}

.app-account-summary {
    display: grid;
    gap: .2rem;
}

.app-account-summary span {
    color: var(--bs-secondary-color);
    font-size: .75rem;
}

.app-feedback-button {
    text-decoration: none;
}

.app-notification-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    padding: .1rem .32rem;
    border: 2px solid var(--app-shell-surface);
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: .65rem;
    font-weight: 800;
    line-height: 1.2;
}

.app-main {
    flex: 1 0 auto;
    min-width: 0;
    padding-bottom: 2rem;
}

.app-main > .container,
.app-main > .container-fluid {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.25rem 1.4rem;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.app-toast-region {
    position: fixed;
    top: calc(var(--app-toast-top, .75rem) + env(safe-area-inset-top, 0px));
    right: max(clamp(.75rem, 1.4vw, 1.25rem), env(safe-area-inset-right, 0px));
    z-index: 1025;
    display: grid;
    gap: .6rem;
    width: min(26rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - var(--app-toast-top, .75rem) - env(safe-area-inset-top, 0px) - .75rem);
    overflow-y: auto;
    padding: .1rem;
    pointer-events: none;
    scrollbar-width: thin;
}

.app-toast {
    --app-toast-accent: var(--bs-info);
    position: relative;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) 1.75rem;
    align-items: start;
    gap: .65rem;
    min-width: 0;
    overflow: hidden;
    padding: .72rem .62rem .72rem .72rem;
    border: 1px solid color-mix(in srgb, var(--app-toast-accent) 42%, var(--bs-border-color));
    border-left: 3px solid var(--app-toast-accent);
    border-radius: .72rem;
    background: color-mix(in srgb, var(--bs-body-bg) 94%, var(--app-toast-accent) 6%);
    color: var(--bs-body-color);
    box-shadow: 0 .8rem 2rem rgba(15, 23, 42, .22), 0 .18rem .5rem rgba(15, 23, 42, .16);
    backdrop-filter: blur(16px);
    pointer-events: auto;
}

.app-toast-success {
    --app-toast-accent: var(--bs-success);
}

.app-toast-danger {
    --app-toast-accent: var(--bs-danger);
}

.app-toast-warning {
    --app-toast-accent: var(--bs-warning);
}

.app-toast-info {
    --app-toast-accent: var(--bs-info);
}

.app-toast-icon {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: .55rem;
    background: color-mix(in srgb, var(--app-toast-accent) 16%, transparent);
    color: var(--app-toast-accent);
    font-size: 1rem;
}

.app-toast-copy {
    min-width: 0;
}

.app-toast-title {
    display: block;
    margin: 0 0 .12rem;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .035em;
    line-height: 1.2;
    text-transform: uppercase;
}

.app-toast-message {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .86rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.app-toast-dismiss {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    margin: -.18rem -.12rem 0 0;
    padding: 0;
    border: 0;
    border-radius: .45rem;
    background: transparent;
    color: var(--bs-secondary-color);
}

.app-toast-dismiss:hover {
    background: color-mix(in srgb, var(--bs-secondary-bg) 78%, transparent);
    color: var(--bs-body-color);
}

.app-toast-dismiss:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 72%, transparent);
    outline-offset: 1px;
}

.app-toast-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--app-toast-accent);
    transform-origin: left center;
}

.app-toast[data-app-toast-bound="true"]:not(.is-persistent) .app-toast-progress {
    animation: app-toast-countdown var(--app-toast-duration, 5500ms) linear forwards;
}

.app-toast.is-paused .app-toast-progress {
    animation-play-state: paused;
}

.app-toast.is-persistent .app-toast-progress {
    display: none;
}

.app-toast.is-entering {
    animation: app-toast-enter .2s ease-out both;
}

.app-toast.is-leaving {
    animation: app-toast-leave .18s ease-in both;
}

.dark-mode .app-toast {
    background: color-mix(in srgb, var(--dm-bg-elevated, #1c2231) 94%, var(--app-toast-accent) 6%);
    box-shadow: 0 .9rem 2.2rem rgba(0, 0, 0, .4), 0 .2rem .6rem rgba(0, 0, 0, .28);
}

@keyframes app-toast-enter {
    from {
        opacity: 0;
        transform: translate3d(1rem, -.2rem, 0) scale(.98);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes app-toast-leave {
    to {
        opacity: 0;
        transform: translate3d(.75rem, 0, 0) scale(.98);
    }
}

@keyframes app-toast-countdown {
    to {
        transform: scaleX(0);
    }
}

@media (max-width: 575.98px) {
    .app-toast-region {
        right: max(.5rem, env(safe-area-inset-right, 0px));
        left: max(.5rem, env(safe-area-inset-left, 0px));
        width: auto;
        max-height: calc(100dvh - var(--app-toast-top, .5rem) - env(safe-area-inset-top, 0px) - .5rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-toast,
    .app-toast-progress {
        animation: none !important;
        transition: none !important;
    }
}

.app-sidebar-backdrop {
    display: none;
}

.app-legal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .38rem .65rem;
    flex: 0 0 auto;
    padding: .3rem .75rem .4rem;
    color: var(--bs-secondary-color);
    text-align: center;
    font-size: .69rem;
    line-height: 1.2;
}

.app-legal-footer nav {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
}

.app-legal-copyright {
    margin: 0;
}

.app-legal-footer a {
    color: inherit !important;
    text-decoration: none;
}

.app-legal-footer a:hover,
.app-legal-footer a:focus-visible {
    color: var(--bs-body-color) !important;
    text-decoration: underline;
    text-underline-offset: .14em;
}

.dark-mode .app-legal-footer,
.dark-mode .app-legal-footer span {
    color: var(--dm-text-secondary);
}

/* Authenticated legal notices ------------------------------------------- */
.policy-container {
    max-width: 920px;
}

.app-main > .policy-container {
    max-width: 920px;
    margin-inline: auto;
}

.policy-page {
    padding: clamp(.25rem, 1vw, .75rem) clamp(.1rem, 1vw, .65rem) 1.5rem;
}

.policy-page-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.policy-page-header h1,
.policy-page h2 {
    text-align: left;
}

.policy-kicker {
    margin-bottom: .35rem;
    color: var(--bs-secondary-color);
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.policy-page-header h1 {
    margin-bottom: .4rem;
    font-size: clamp(1.75rem, 4vw, 2.35rem);
}

.policy-meta {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .84rem;
}

.policy-review-note {
    margin: 1rem 0 1.35rem;
    padding: .75rem .9rem;
    border: 1px solid color-mix(in srgb, var(--bs-warning) 38%, var(--bs-border-color));
    border-left: 4px solid var(--bs-warning);
    border-radius: .4rem;
    background: color-mix(in srgb, var(--bs-warning-bg-subtle) 72%, transparent);
    font-size: .88rem;
}

.policy-review-note p:last-child {
    margin-bottom: 0;
}

.policy-page section {
    margin-top: 1.35rem;
}

.policy-page h2 {
    margin-bottom: .55rem;
    font-size: 1.08rem;
    font-weight: 700;
}

.policy-page p,
.policy-page li {
    font-size: .94rem;
    line-height: 1.65;
}

.policy-page ul {
    padding-left: 1.25rem;
}

.policy-page li + li {
    margin-top: .3rem;
}

.policy-page .policy-contact {
    padding: .85rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
}

.dark-mode .policy-review-note {
    background: color-mix(in srgb, var(--bs-warning) 10%, var(--dm-bg-surface));
}

.sidebar-collapsed .app-shell {
    grid-template-columns: var(--app-sidebar-collapsed-width) minmax(0, 1fr);
}

.sidebar-collapsed .app-sidebar {
    width: var(--app-sidebar-collapsed-width);
}

.sidebar-collapsed .app-brand {
    justify-content: center;
}

.sidebar-collapsed .app-brand-logo-wordmark {
    display: none;
}

.sidebar-collapsed .app-brand-logo-mark {
    display: block;
}

.sidebar-collapsed .app-brand-text,
.sidebar-collapsed .app-nav-label,
.sidebar-collapsed .app-nav-badge,
.sidebar-collapsed .app-nav-group-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.sidebar-collapsed .app-nav-link {
    justify-content: center;
    padding-inline: .5rem;
}

.sidebar-collapsed .app-nav-menu-chevron {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.sidebar-collapsed .app-nav-link {
    position: relative;
}

.sidebar-collapsed .app-nav-count-badge {
    position: absolute;
    top: .16rem;
    right: .16rem;
    min-width: 1.1rem;
    margin: 0;
    padding: .12rem .28rem;
    font-size: .58rem;
}

/* Shared platform page primitives. */
.platform-page {
    width: min(100%, 1760px);
    margin: 0 auto;
}

.platform-page h1,
.platform-page h2,
.platform-page h3 {
    color: var(--bs-body-color);
    text-align: left;
}

.platform-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1.15rem;
}

.platform-eyebrow {
    margin-bottom: .22rem;
    color: var(--bs-primary);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.platform-page-title {
    margin: 0 0 .25rem;
    font-size: clamp(1.55rem, 2.4vw, 2.15rem);
    font-weight: 750;
    letter-spacing: -.035em;
}

.platform-page-subtitle {
    color: var(--bs-secondary-color);
    font-size: .92rem;
}

.platform-breadcrumb {
    margin-bottom: .85rem;
    font-size: .82rem;
}

.platform-panel,
.batch-reconciliation-card,
.project-card,
.portfolio-stat,
.attention-card {
    border: 1px solid var(--app-shell-border);
    background: var(--app-shell-surface);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .045);
}

.platform-panel {
    overflow: hidden;
    border-radius: .85rem;
}

.platform-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--app-shell-border);
}

.platform-panel-header h2 {
    margin: 0;
    font-size: 1.03rem;
    font-weight: 700;
}

.platform-panel-empty,
.platform-empty-state {
    padding: 2.5rem 1.25rem;
    color: var(--bs-secondary-color);
    text-align: center;
}

.platform-empty-state {
    border: 1px dashed var(--app-shell-border);
    border-radius: .9rem;
    background: var(--app-shell-surface);
}

.platform-empty-state i {
    font-size: 2.1rem;
}

.platform-empty-state h2 {
    margin-top: .8rem;
    text-align: center;
    font-size: 1.15rem;
}

/* QA delivery pre-export review. */
#preExportReviewSearch {
    min-width: min(100%, 18rem);
    flex: 1 1 24rem;
}

.pre-export-review-filter-guide {
    padding: .65rem .75rem;
    border: 1px solid var(--app-shell-border);
    border-radius: .55rem;
    background: var(--app-shell-surface-subtle, var(--bs-tertiary-bg));
}

.pre-export-review-filter-guide > summary {
    width: fit-content;
    cursor: pointer;
    font-size: .84rem;
    font-weight: 650;
}

#preExportReviewFilterChoices {
    max-height: 13rem;
    overflow: auto;
}

.pre-export-review-filter-choice {
    max-width: 100%;
    white-space: normal;
    text-align: left;
}

#preExportReviewModal .modal-body {
    overflow-y: auto;
}

#preExportReviewModal .pre-export-review-table-wrap {
    max-height: 45vh;
    overflow: auto;
}

#preExportReviewModal .pre-export-review-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

#preExportReviewModal .modal-dialog.modal-fullscreen .modal-body {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
}

#preExportReviewModal .modal-dialog.modal-fullscreen #preExportReviewIssues {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

#preExportReviewModal .modal-dialog.modal-fullscreen .pre-export-review-table-wrap {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
}

/* Read-only, full-screen profile-picture scan for the Ready snapshot. */
.profile-photo-review-modal .modal-content {
    color: #f8fafc;
    background: #0b0f17;
}

.profile-photo-review-modal .modal-header {
    padding: 1rem clamp(1rem, 3vw, 2.5rem);
    border-color: rgba(255, 255, 255, .12);
    background: rgba(11, 15, 23, .96);
}

.profile-photo-review-modal .modal-body {
    padding: clamp(1rem, 3vw, 2.5rem);
    overflow-y: auto;
}

.profile-photo-review-eyebrow {
    color: #a7f3d0;
    font-weight: 750;
    letter-spacing: .1em;
}

.profile-photo-review-description {
    max-width: 70rem;
    margin-bottom: 1.5rem;
    color: #cbd5e1;
}

.profile-photo-review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr));
    align-items: start;
    gap: clamp(.85rem, 1.6vw, 1.35rem);
}

.profile-photo-review-card {
    min-width: 0;
    padding: .75rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: .8rem;
    background: #171d28;
    box-shadow: 0 .75rem 1.8rem rgba(0, 0, 0, .22);
}

.profile-photo-review-name {
    min-height: 2.5em;
    margin: 0 0 .65rem;
    overflow: hidden;
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.profile-photo-review-frame {
    position: relative;
    display: grid;
    aspect-ratio: 4 / 5;
    place-items: center;
    overflow: hidden;
    border-radius: .55rem;
    background: #252d3b;
}

.profile-photo-review-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    object-fit: contain;
}

.profile-photo-review-image.is-loaded {
    opacity: 1;
}

.profile-photo-review-loading,
.profile-photo-review-unavailable {
    display: grid;
    gap: .35rem;
    padding: .8rem;
    place-items: center;
    color: #94a3b8;
    text-align: center;
    font-size: .82rem;
}

.profile-photo-review-unavailable i,
.profile-photo-review-empty > i {
    font-size: 2rem;
}

.profile-photo-review-case-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .7rem;
    color: #93c5fd;
    font-size: .85rem;
    font-weight: 650;
    text-decoration: none;
}

.profile-photo-review-case-link:hover,
.profile-photo-review-case-link:focus-visible {
    color: #dbeafe;
    text-decoration: underline;
}

.profile-photo-review-empty {
    display: grid;
    min-height: 45vh;
    place-content: center;
    justify-items: center;
    color: #cbd5e1;
    text-align: center;
}

.profile-photo-review-empty h3 {
    margin: .75rem 0 .35rem;
    color: #fff;
    font-size: 1.15rem;
}

/* Projects portfolio and managed-batch detail. */
.project-portfolio-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.portfolio-stat {
    display: grid;
    gap: .28rem;
    padding: .8rem .9rem;
    border-radius: .7rem;
}

.portfolio-stat-label {
    color: var(--bs-secondary-color);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.portfolio-stat strong {
    font-size: 1.35rem;
    line-height: 1;
}

.portfolio-stat-attention strong {
    color: var(--bs-warning-text-emphasis);
}

.project-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 410px), 1fr));
    gap: 1rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border-radius: .9rem;
}

.project-card-current {
    border-color: color-mix(in srgb, var(--bs-primary) 58%, var(--app-shell-border));
    box-shadow: 0 8px 28px rgba(var(--bs-primary-rgb), .12);
}

.project-card-header,
.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1rem;
}

.project-card-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--app-shell-border);
}

.project-card-title {
    font-size: 1.02rem;
    font-weight: 750;
}

.project-card-title a {
    color: var(--bs-body-color) !important;
    text-decoration: none;
}

.project-card-title a:hover {
    color: var(--bs-primary) !important;
}

.project-card-meta,
.project-updated,
.project-progress-caption {
    color: var(--bs-secondary-color);
    font-size: .75rem;
}

.project-card-meta {
    margin-top: .28rem;
}

.project-progress-block {
    padding: .9rem 1rem .7rem;
}

.project-progress {
    height: .6rem;
    overflow: hidden;
    border-radius: 999px;
}

.project-progress-lg {
    height: .8rem;
    margin-top: 1rem;
}

.project-progress-caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .35rem .75rem;
    margin-top: .48rem;
}

.project-reconciliation-warning {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    margin-top: .65rem;
    padding: .55rem .65rem;
    border: 1px solid color-mix(in srgb, var(--bs-warning) 55%, var(--app-shell-border));
    border-radius: .55rem;
    background: color-mix(in srgb, var(--bs-warning-bg-subtle) 82%, transparent);
    color: var(--bs-warning-text-emphasis);
    font-size: .8rem;
    line-height: 1.35;
}

.project-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: 0 1rem .85rem;
    gap: .45rem;
}

.project-metric-grid div {
    padding: .55rem .62rem;
    border-radius: .55rem;
    background: var(--app-shell-subtle);
}

.project-metric-grid dt {
    color: var(--bs-secondary-color);
    font-size: .68rem;
    font-weight: 650;
}

.project-metric-grid dd {
    margin: .12rem 0 0;
    font-size: 1.03rem;
    font-weight: 750;
}

.project-card-footer {
    margin-top: auto;
    border-top: 1px solid var(--app-shell-border);
    background: var(--app-shell-subtle);
}

.batch-reconciliation-card {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr);
    gap: 1.25rem;
    padding: 1.1rem;
    border-radius: .9rem;
}

.batch-reconciliation-main h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 750;
}

.batch-progress-percent {
    font-size: 1.8rem;
    letter-spacing: -.04em;
}

.batch-reconciliation-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    gap: .55rem;
}

.batch-reconciliation-stats div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: .7rem .8rem;
    border-radius: .65rem;
    background: var(--app-shell-subtle);
}

.batch-reconciliation-stats dt {
    color: var(--bs-secondary-color);
    font-size: .7rem;
    text-transform: uppercase;
}

.batch-reconciliation-stats dd {
    margin: .15rem 0 0;
    font-size: 1.25rem;
    font-weight: 750;
}

.project-attention-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .7rem;
    margin-top: .9rem;
}

.attention-card {
    display: grid;
    gap: .2rem;
    padding: .75rem .82rem;
    border-radius: .7rem;
    color: var(--bs-body-color) !important;
    text-decoration: none;
}

.attention-card:hover {
    border-color: var(--bs-primary);
    transform: translateY(-1px);
}

.attention-card strong {
    font-size: 1.3rem;
}

.attention-card > span:last-child,
.attention-label {
    color: var(--bs-secondary-color);
    font-size: .7rem;
}

.attention-label {
    font-weight: 750;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.attention-card-warning strong {
    color: var(--bs-warning-text-emphasis);
}

.attention-card-danger strong {
    color: var(--bs-danger);
}

.project-workload-table,
.project-workload-table th,
.project-workload-table td {
    border-right: 0;
    border-left: 0;
    box-shadow: none;
}

.project-status-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .62rem 1.1rem;
    border-bottom: 1px solid var(--app-shell-border);
    font-size: .86rem;
}

.project-status-list li:last-child {
    border-bottom: 0;
}

.project-operation-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
    padding: 1rem;
}

.project-operation-links > a {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    min-width: 0;
    padding: .8rem;
    border: 1px solid var(--app-shell-border);
    border-radius: .65rem;
    color: var(--bs-body-color) !important;
    text-decoration: none;
}

.project-operation-links > a:hover:not([aria-disabled="true"]) {
    border-color: var(--bs-primary);
    background: var(--app-shell-subtle);
}

.project-operation-links > a[aria-disabled="true"] {
    opacity: .58;
    cursor: not-allowed;
    pointer-events: none;
}

.attention-card[aria-disabled="true"] {
    cursor: default;
    pointer-events: none;
}

.project-operation-links i {
    color: var(--bs-primary);
    font-size: 1.15rem;
}

.project-operation-links span {
    display: grid;
    min-width: 0;
    gap: .15rem;
}

.project-operation-links small {
    color: var(--bs-secondary-color);
    line-height: 1.35;
}

.dark-mode .app-main > .container,
.dark-mode .app-main > .container-fluid {
    background: transparent;
}

@media (max-width: 1199.98px) {
    .app-shell {
        grid-template-columns: var(--app-sidebar-collapsed-width) minmax(0, 1fr);
    }

    .app-sidebar {
        width: var(--app-sidebar-collapsed-width);
    }

    .app-brand {
        justify-content: center;
    }

    .app-brand-logo-wordmark {
        display: none;
    }

    .app-brand-logo-mark {
        display: block;
    }

    .app-brand-text,
    .app-nav-label,
    .app-nav-badge,
    .app-nav-group-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .app-nav-link {
        justify-content: center;
        padding-inline: .5rem;
    }

    .app-nav-menu-chevron {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .app-nav-link {
        position: relative;
    }

    .app-nav-count-badge {
        position: absolute;
        top: .16rem;
        right: .16rem;
        min-width: 1.1rem;
        margin: 0;
        padding: .12rem .28rem;
        font-size: .58rem;
    }

    .app-sidebar-collapse-button {
        display: none;
    }

    .project-portfolio-summary,
    .project-attention-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        width: min(var(--app-sidebar-width), 86vw);
        transform: translateX(-105%);
        box-shadow: 16px 0 40px rgba(0, 0, 0, .28);
    }

    .sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .btn.app-sidebar-close,
    .btn.app-mobile-menu-button {
        display: inline-grid;
    }

    .app-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1035;
        border: 0;
        background: rgba(2, 6, 23, .58);
    }

    .sidebar-open .app-sidebar-backdrop {
        display: block;
    }

    .app-brand-text,
    .app-nav-label,
    .app-nav-badge,
    .app-nav-group-label,
    .sidebar-collapsed .app-brand-text,
    .sidebar-collapsed .app-nav-label,
    .sidebar-collapsed .app-nav-badge,
    .sidebar-collapsed .app-nav-group-label {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
    }

    .app-brand,
    .app-nav-link,
    .sidebar-collapsed .app-brand,
    .sidebar-collapsed .app-nav-link {
        justify-content: flex-start;
    }

    .app-nav-menu-chevron,
    .sidebar-collapsed .app-nav-menu-chevron {
        position: static;
        width: auto;
        height: auto;
        margin-left: auto;
        overflow: visible;
        clip: auto;
    }

    .app-nav-count-badge,
    .sidebar-collapsed .app-nav-count-badge {
        position: static;
        min-width: 0;
        margin-left: auto;
        padding: var(--bs-badge-padding-y) var(--bs-badge-padding-x);
        font-size: var(--bs-badge-font-size);
    }

    .app-nav-flyout {
        position: static;
        width: auto;
        margin: .2rem .25rem .35rem;
        padding: .35rem;
        border-color: rgba(148, 163, 184, .16);
        border-radius: .6rem;
        background: rgba(15, 23, 42, .72);
        box-shadow: none;
    }

    .app-nav-flyout-title {
        padding-inline: .5rem;
    }

    /* Drawer opens at full width, so the wordmark fits again. */
    .app-brand-logo-wordmark,
    .sidebar-collapsed .app-brand-logo-wordmark {
        display: block;
    }

    .app-brand-logo-mark,
    .sidebar-collapsed .app-brand-logo-mark {
        display: none;
    }

    .app-topbar {
        padding-inline: .85rem;
    }

    .batch-reconciliation-card {
        grid-template-columns: 1fr;
    }

    .project-portfolio-summary,
    .project-attention-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .app-main > .container,
    .app-main > .container-fluid {
        padding: 1rem .75rem;
    }

    .app-project-context {
        min-width: 0;
        max-width: 44vw;
    }

    .app-project-context-label {
        display: none;
    }

    .app-project-context strong {
        font-size: .8rem;
    }

    .platform-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .project-portfolio-summary,
    .project-attention-grid,
    .project-operation-links {
        grid-template-columns: 1fr 1fr;
    }

    .project-card-grid {
        grid-template-columns: minmax(0, 1fr);
    }

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

@media (max-width: 479.98px) {
    .app-topbar-actions {
        gap: .25rem;
    }

    .app-project-context {
        max-width: 36vw;
        padding-inline: .35rem;
    }

    .app-create-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .project-portfolio-summary,
    .project-attention-grid,
    .project-operation-links,
    .batch-reconciliation-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 359.98px) {
    .app-project-context {
        max-width: 30vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-sidebar,
    .app-brand-text,
    .app-nav-label,
    .attention-card {
        transition: none !important;
    }
}

/* Cases Workbench -------------------------------------------------------- */
.cases-workbench-header {
    align-items: center;
    margin-bottom: .75rem;
}

.cases-workbench-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
}

/* Shared workflow status pills used by the case queue and work dashboards. */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.status-pill-danger {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.12);
    border-color: rgba(220, 53, 69, 0.3);
}

.status-pill-warning {
    color: #b8860b;
    background: rgba(255, 193, 7, 0.16);
    border-color: rgba(255, 193, 7, 0.35);
}

.dark-mode .status-pill-warning {
    color: #d4a853;
}

.status-pill-info {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.12);
    border-color: rgba(13, 110, 253, 0.3);
}

.status-pill-success {
    color: #198754;
    background: rgba(25, 135, 84, 0.12);
    border-color: rgba(25, 135, 84, 0.3);
}

.dark-mode .status-pill-success {
    color: #6ce0a0;
}

.status-pill-neutral {
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

/* Review difficulty is intentionally a compact label, separate from workflow
   status. Color supports scanning but the T-number and text carry meaning. */
.review-tier-pill {
    display: inline-flex;
    align-items: center;
    padding: .24rem .55rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}

.review-tier-quick {
    color: #146c43;
    background: rgba(25, 135, 84, .12);
    border-color: rgba(25, 135, 84, .3);
}

.review-tier-standard {
    color: #0a58ca;
    background: rgba(13, 110, 253, .11);
    border-color: rgba(13, 110, 253, .28);
}

.review-tier-detailed {
    color: #997404;
    background: rgba(255, 193, 7, .16);
    border-color: rgba(255, 193, 7, .38);
}

.review-tier-research {
    color: #b02a37;
    background: rgba(220, 53, 69, .12);
    border-color: rgba(220, 53, 69, .3);
}

.review-tier-unranked {
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
}

.review-tier-overview-1 { border-left-color: #198754; }
.review-tier-overview-2 { border-left-color: #0d6efd; }
.review-tier-overview-3 { border-left-color: #d39e00; }
.review-tier-overview-4 { border-left-color: #dc3545; }

.cases-workbench .queue-tiles {
    display: flex;
    gap: .38rem;
    overflow-x: auto;
    padding: 0 .05rem .22rem;
    scrollbar-width: thin;
}

.cases-workbench .queue-tile {
    flex: 0 0 auto;
    min-width: 142px;
    gap: .42rem;
    padding: .32rem .5rem;
    background: var(--app-shell-surface);
}

.cases-workbench .queue-tile > div {
    display: flex;
    align-items: baseline;
    gap: .42rem;
}

.cases-workbench .queue-tile-icon {
    width: 26px;
    height: 26px;
    font-size: .78rem;
}

.cases-workbench .queue-tile-count {
    font-size: .92rem;
}

.case-status-overview {
    border: 1px solid var(--app-shell-border);
    border-radius: .55rem;
    background: var(--app-shell-surface);
}

.case-status-overview > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .42rem .68rem;
    cursor: pointer;
    font-size: .76rem;
    font-weight: 700;
    list-style-position: inside;
}

.case-status-overview .status-mini-cards {
    padding: 0 .55rem .55rem;
}

@media (min-width: 1200px) {
    .case-status-overview[open] {
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr);
        align-items: center;
        gap: .55rem;
        padding: .3rem .5rem;
    }

    .case-status-overview[open] > summary {
        display: grid;
        justify-items: start;
        gap: .05rem;
        min-width: 132px;
        padding: 0;
    }

    .case-status-overview[open] .status-mini-cards {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        gap: .35rem;
        margin-top: 0 !important;
        padding: 0;
    }

    .case-status-overview[open] .status-mini-card {
        min-width: 0;
        padding: .28rem .5rem;
    }

    .case-status-overview[open] .status-mini-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .case-status-overview[open] .status-mini-count {
        font-size: .9rem;
    }
}

.case-filter-panel {
    background: var(--app-shell-surface) !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
}

.case-filter-panel .form-label {
    line-height: 1.1;
}

.case-filter-drawer {
    padding-top: .65rem;
    margin-top: .65rem;
    border-top: 1px solid var(--app-shell-border);
}

.cases-workbench #activeFilterChips {
    padding: .35rem .45rem;
    margin-bottom: .45rem !important;
}

.cases-workbench .table-responsive {
    overflow: auto;
    border: 1px solid var(--app-shell-border);
    border-radius: .7rem;
    background: var(--app-shell-surface);
}

.cases-workbench .cases-table {
    min-width: 1040px;
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
}

.cases-workbench .cases-table th,
.cases-workbench .cases-table td {
    padding: .56rem .65rem;
    border-right: 0;
    border-left: 0;
    vertical-align: middle;
}

.cases-workbench .cases-table thead th {
    top: 0;
    padding-block: .48rem;
    color: var(--bs-secondary-color);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.cases-workbench .case-row-link {
    cursor: pointer;
}

.cases-workbench .case-row-link:focus-visible {
    outline: 3px solid var(--app-focus-ring, #60a5fa);
    outline-offset: -3px;
}

.cases-workbench .case-row-link [data-case-row-ignore],
.cases-workbench .case-row-link [data-case-row-ignore] * {
    cursor: default;
}

.case-id-value {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .82rem;
    font-weight: 700;
}

.case-subject-link {
    display: inline-block;
    max-width: 270px;
    overflow: hidden;
    color: var(--bs-body-color) !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 720;
    text-decoration: none;
}

.case-subject-link:hover {
    color: var(--bs-primary) !important;
    text-decoration: underline;
}

.case-country-cell {
    color: var(--bs-secondary-color);
}

.case-analyst-cell {
    min-width: 145px;
}

.cases-workbench .pagination {
    margin-block: .55rem !important;
}

.cases-workbench .pagination .page-link {
    padding: .3rem .55rem;
    font-size: .78rem;
}

@media (max-width: 991.98px) {
    .cases-workbench-header {
        align-items: flex-start;
    }

    .cases-workbench-actions {
        justify-content: flex-start;
    }

    .case-filter-panel > .row:first-of-type > [class*="col-"] {
        flex: 1 1 160px;
        width: auto;
    }
}

@media (max-width: 767.98px) {
    .cases-workbench .cases-table {
        min-width: 620px;
    }

    .cases-workbench .cases-table th[data-column="country_of_birth"],
    .cases-workbench .cases-table td.case-country-cell,
    .cases-workbench .cases-table [data-column="violent_offender"] {
        display: none;
    }

    .cases-workbench .status-pill {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 575.98px) {
    .cases-workbench .cases-table {
        min-width: 520px;
    }

    .cases-workbench .queue-tile {
        min-width: 138px;
    }
}

/* Phase 4: role-aware contextual creation and reusable project templates. */
.app-create-menu {
    width: min(350px, calc(100vw - 1.5rem));
    padding: .45rem;
}

.app-create-menu .dropdown-header {
    padding: .35rem .55rem .45rem;
    color: var(--bs-secondary-color);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.app-create-menu-item {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: .65rem;
    align-items: center;
    padding: .62rem .55rem;
    border-radius: .5rem;
}

.app-create-menu-item > i {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 24%, var(--app-shell-border));
    border-radius: .55rem;
    color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary) 8%, transparent);
}

.app-create-menu-item span {
    display: grid;
    min-width: 0;
}

.app-create-menu-item strong {
    font-size: .84rem;
}

.app-create-menu-item small {
    overflow: hidden;
    color: var(--bs-secondary-color);
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.creation-page {
    --creation-panel: color-mix(in srgb, var(--bs-body-bg) 92%, var(--bs-tertiary-bg));
    max-width: 1440px;
    margin-inline: auto;
}

.creation-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 1.25rem;
    align-items: start;
}

.creation-main,
.creation-aside {
    display: grid;
    gap: 1rem;
}

.creation-aside {
    position: sticky;
    top: calc(var(--app-topbar-height, 64px) + 1rem);
}

.creation-section,
.creation-guidance-card,
.creation-boundary-note,
.creation-context-strip {
    border: 1px solid var(--app-shell-border);
    border-radius: .85rem;
    background: var(--creation-panel);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .055);
}

.creation-section {
    padding: 1.15rem;
}

.creation-section-header {
    display: flex;
    gap: .8rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.creation-step {
    display: grid;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--bs-primary);
    font-size: .78rem;
    font-weight: 800;
}

.creation-section-header h2,
.creation-guidance-card h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 780;
}

.creation-section-header p,
.creation-guidance-card p {
    margin: .18rem 0 0;
    color: var(--bs-secondary-color);
    font-size: .8rem;
}

.creation-template-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.creation-template-option {
    position: relative;
}

.creation-template-card {
    display: grid;
    grid-template-columns: 2.4rem minmax(0, 1fr) 1.1rem;
    gap: .7rem;
    align-items: center;
    height: 100%;
    padding: .9rem;
    border: 1px solid var(--app-shell-border);
    border-radius: .7rem;
    background: var(--bs-body-bg);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.creation-template-card:hover {
    border-color: color-mix(in srgb, var(--bs-primary) 55%, var(--app-shell-border));
    transform: translateY(-1px);
}

.creation-template-card > i:first-child {
    display: grid;
    width: 2.4rem;
    height: 2.4rem;
    place-items: center;
    border-radius: .65rem;
    color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary) 10%, transparent);
    font-size: 1.1rem;
}

.creation-template-card span {
    display: grid;
    gap: .15rem;
}

.creation-template-card strong {
    font-size: .88rem;
}

.creation-template-card small {
    color: var(--bs-secondary-color);
    font-size: .72rem;
    line-height: 1.35;
}

.creation-template-check {
    color: var(--bs-primary);
    opacity: 0;
}

.project-template-input:checked + .creation-template-card {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-primary) 16%, transparent);
}

.project-template-input:checked + .creation-template-card .creation-template-check {
    opacity: 1;
}

.project-template-input:focus-visible + .creation-template-card {
    outline: 3px solid color-mix(in srgb, var(--bs-primary) 40%, transparent);
    outline-offset: 2px;
}

.creation-member-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    max-height: 260px;
    overflow-y: auto;
    padding: .65rem;
    border: 1px solid var(--app-shell-border);
    border-radius: .65rem;
    background: var(--bs-body-bg);
}

.creation-member-row {
    margin: 0;
    padding: .5rem .55rem .5rem 2rem;
    border-radius: .5rem;
}

.creation-member-row:hover {
    background: var(--bs-tertiary-bg);
}

.creation-member-row label {
    display: grid;
    cursor: pointer;
}

.creation-member-row label strong {
    font-size: .8rem;
}

.creation-member-row label span {
    color: var(--bs-secondary-color);
    font-size: .68rem;
}

.creation-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    padding-bottom: 1.5rem;
}

.creation-guidance-card,
.creation-boundary-note {
    padding: 1rem;
}

.creation-guidance-card dl {
    display: grid;
    gap: .55rem;
    margin: 1rem 0 0;
}

.creation-guidance-card dl div {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: .5rem;
    padding-top: .55rem;
    border-top: 1px solid var(--app-shell-border);
    font-size: .72rem;
}

.creation-guidance-card dt {
    color: var(--bs-secondary-color);
}

.creation-guidance-card dd {
    margin: 0;
    font-weight: 650;
}

.creation-managed-batch-card > i {
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: .75rem;
    place-items: center;
    border-radius: .65rem;
    color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary) 10%, transparent);
    font-size: 1.15rem;
}

.creation-managed-batch-card .btn {
    margin-top: .85rem;
}

.creation-boundary-note {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    border-color: color-mix(in srgb, var(--bs-info) 45%, var(--app-shell-border));
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 55%, var(--creation-panel));
}

.creation-boundary-note i {
    color: var(--bs-info-text-emphasis);
}

.creation-boundary-note p {
    margin: 0;
    color: var(--bs-info-text-emphasis);
    font-size: .75rem;
    line-height: 1.45;
}

/* Advanced Search form density. The criteria form is a wide, low-value-per-row
   grid, so default Bootstrap control sizing pushed the submit button below the
   fold on laptop screens. Shared by the new-search and refine-search forms. */
.advanced-search-compact .form-label {
    margin-bottom: .15rem;
    font-size: .78rem;
    font-weight: 600;
}

.advanced-search-compact legend.form-label {
    float: none;
    width: auto;
}

.advanced-search-compact .form-control {
    min-height: auto;
    padding: .3rem .55rem;
    font-size: .875rem;
}

.advanced-search-compact .form-select {
    min-height: auto;
    padding: .3rem 2rem .3rem .55rem;
    font-size: .875rem;
}

.advanced-search-compact .form-text {
    margin-top: .1rem;
    font-size: .72rem;
    line-height: 1.3;
}

.advanced-search-compact .form-check-label {
    font-size: .85rem;
}

.creation-inline-template,
.creation-context-strip,
.context-locked-project {
    display: flex;
    gap: .75rem;
    align-items: center;
}

.creation-inline-template {
    margin-top: .7rem;
    color: var(--bs-secondary-color);
}

.creation-inline-template > i {
    color: var(--bs-primary);
}

.creation-inline-template span,
.creation-context-strip span,
.context-locked-project span {
    display: grid;
}

.creation-inline-template small,
.creation-context-strip small,
.context-locked-project small {
    color: var(--bs-secondary-color);
    font-size: .68rem;
}

.creation-inline-template strong,
.creation-context-strip strong,
.context-locked-project strong {
    font-size: .8rem;
}

.creation-context-strip {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
}

.creation-context-strip > i,
.context-locked-project > i {
    color: var(--bs-primary);
}

.creation-context-strip p {
    margin: 0 0 0 auto;
    color: var(--bs-secondary-color);
    font-size: .75rem;
}

.context-locked-project {
    padding: .8rem;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 35%, var(--app-shell-border));
    border-radius: .65rem;
    background: color-mix(in srgb, var(--bs-primary) 6%, var(--bs-body-bg));
}

.context-locked-project a {
    margin-left: auto;
    font-size: .75rem;
}

.project-context-copy {
    max-width: 820px;
    color: var(--bs-secondary-color);
    font-size: .78rem;
}

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

    .creation-aside {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .creation-boundary-note {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767.98px) {
    .creation-template-grid,
    .creation-member-list,
    .creation-aside {
        grid-template-columns: 1fr;
    }

    .creation-context-strip {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .creation-context-strip p {
        flex-basis: 100%;
        margin-left: 0;
    }

    .context-locked-project {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .context-locked-project a {
        flex-basis: 100%;
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .creation-template-card {
        transition: none;
    }

    .creation-template-card:hover {
        transform: none;
    }
}
.client-search-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

/* Case management platform Phase 6: customer commercial readiness. */
.commercial-hero {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.commercial-hero h1 {
    margin: .15rem 0 .2rem;
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    font-weight: 780;
    text-align: left;
}

.commercial-admin-page .external-admin-header h1,
.commercial-admin-page .external-admin-section-heading h2 {
    text-align: left;
}

.commercial-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .82rem;
}

.commercial-boundary-banner {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: .9rem 1rem;
    border: 1px solid color-mix(in srgb, var(--bs-warning) 35%, var(--external-border));
    border-radius: .8rem;
    background: color-mix(in srgb, var(--bs-warning) 8%, var(--bs-body-bg));
}

.commercial-boundary-banner > i {
    color: var(--bs-warning-text-emphasis);
    font-size: 1.05rem;
}

.commercial-boundary-banner strong {
    font-size: .78rem;
}

.commercial-boundary-banner p {
    margin: .15rem 0 0;
    color: var(--bs-secondary-color);
    font-size: .7rem;
    line-height: 1.5;
}

.commercial-overview-grid,
.commercial-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.commercial-panel {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--external-border);
    border-radius: .9rem;
    background: var(--external-panel);
    box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .035);
}

.commercial-section-heading {
    display: flex;
    gap: .8rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: .85rem;
}

.commercial-section-heading h2 {
    margin: .12rem 0 0;
    font-size: .95rem;
    font-weight: 760;
}

.commercial-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}

.commercial-check-item {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    min-height: 3.3rem;
    padding: .65rem;
    border: 1px solid var(--external-border);
    border-radius: .65rem;
    background: var(--bs-body-bg);
}

.commercial-check-item > i {
    color: var(--bs-secondary-color);
}

.commercial-check-item.is-complete {
    border-color: color-mix(in srgb, var(--bs-success) 38%, var(--external-border));
}

.commercial-check-item.is-complete > i {
    color: var(--bs-success);
}

.commercial-check-item span {
    display: grid;
}

.commercial-check-item strong {
    font-size: .72rem;
}

.commercial-check-item small {
    color: var(--bs-secondary-color);
    font-size: .63rem;
}

.commercial-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem 1rem;
    margin: 0;
}

.commercial-facts div {
    display: grid;
    gap: .15rem;
    padding-top: .55rem;
    border-top: 1px solid var(--external-border);
}

.commercial-facts dt {
    color: var(--bs-secondary-color);
    font-size: .62rem;
    font-weight: 650;
}

.commercial-facts dd {
    margin: 0;
    font-size: .72rem;
    font-weight: 650;
}

.commercial-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
    margin-bottom: 1rem;
}

.commercial-metrics article {
    display: flex;
    gap: .7rem;
    align-items: center;
    padding: .8rem;
    border: 1px solid var(--external-border);
    border-radius: .75rem;
    background: var(--external-panel);
}

.commercial-metrics i {
    color: var(--bs-primary);
    font-size: 1.05rem;
}

.commercial-metrics span {
    display: grid;
}

.commercial-metrics strong {
    font-size: .95rem;
}

.commercial-metrics small {
    color: var(--bs-secondary-color);
    font-size: .62rem;
}

.commercial-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.commercial-record-card {
    padding: .8rem;
    border: 1px solid var(--external-border);
    border-radius: .7rem;
    background: var(--bs-body-bg);
}

.commercial-record-heading,
.commercial-list-row {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    justify-content: space-between;
}

.commercial-record-heading > div,
.commercial-list-row > span {
    display: grid;
}

.commercial-record-heading strong,
.commercial-list-row strong {
    font-size: .74rem;
}

.commercial-record-heading small,
.commercial-list-row small {
    color: var(--bs-secondary-color);
    font-size: .62rem;
}

.commercial-record-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    margin: .7rem 0 0;
}

.commercial-record-card dl div {
    display: grid;
}

.commercial-record-card dt {
    color: var(--bs-secondary-color);
    font-size: .59rem;
}

.commercial-record-card dd {
    margin: 0;
    font-size: .68rem;
}

.commercial-table {
    margin: 0;
    font-size: .69rem;
}

.commercial-table th {
    color: var(--bs-secondary-color);
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.commercial-table td strong,
.commercial-table td small {
    display: block;
}

.commercial-table td small {
    color: var(--bs-secondary-color);
    font-size: .59rem;
}

.commercial-empty-copy {
    margin: 0;
    padding: .9rem;
    border: 1px dashed var(--external-border);
    border-radius: .7rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    font-size: .72rem;
}

.commercial-stack {
    display: grid;
    gap: .45rem;
}

.commercial-list-row {
    padding: .65rem;
    border: 1px solid var(--external-border);
    border-radius: .65rem;
    background: var(--bs-body-bg);
}

.commercial-privacy-note {
    color: var(--bs-secondary-color);
    font-size: .63rem;
}

.commercial-privacy-note i {
    margin-right: .25rem;
    color: var(--bs-success);
}

.commercial-evidence-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.commercial-evidence-grid article {
    display: grid;
    gap: .12rem;
    padding: .8rem;
    border: 1px solid var(--external-border);
    border-radius: .7rem;
    background: var(--bs-body-bg);
}

.commercial-evidence-grid strong {
    color: var(--bs-primary);
    font-size: 1.1rem;
}

.commercial-evidence-grid span {
    font-size: .7rem;
    font-weight: 700;
}

.commercial-evidence-grid small {
    color: var(--bs-secondary-color);
    font-size: .6rem;
    line-height: 1.4;
}

@media (max-width: 991.98px) {
    .commercial-overview-grid,
    .commercial-two-column {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 767.98px) {
    .commercial-hero,
    .commercial-section-heading,
    .commercial-record-heading,
    .commercial-list-row {
        align-items: stretch;
        flex-direction: column;
    }

    .commercial-checklist,
    .commercial-facts,
    .commercial-metrics,
    .commercial-card-grid,
    .commercial-record-card dl,
    .commercial-evidence-grid {
        grid-template-columns: 1fr;
    }

    .commercial-list-row .text-end {
        text-align: start !important;
    }
}

/* Case management platform Phase 7A: read-only pilot readiness. */
.pilot-readiness-page {
    --pilot-border: color-mix(in srgb, var(--bs-border-color) 82%, transparent);
    --pilot-panel: color-mix(in srgb, var(--bs-body-bg) 96%, var(--bs-primary) 4%);
    display: grid;
    gap: 1rem;
    width: 100%;
    max-width: 1760px;
    margin: 0 auto;
}

.pilot-readiness-hero,
.pilot-readiness-section-heading {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.pilot-readiness-hero h1,
.pilot-readiness-section-heading h2 {
    margin: .15rem 0 .2rem;
    text-align: left;
    font-weight: 780;
}

.pilot-readiness-hero h1 {
    font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.pilot-readiness-section-heading h2 {
    font-size: 1rem;
}

.pilot-readiness-hero p,
.pilot-readiness-section-heading p {
    max-width: 900px;
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .76rem;
    line-height: 1.5;
}

.pilot-readiness-boundary {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    margin: 0;
}

.pilot-readiness-boundary > i {
    margin-top: .1rem;
    font-size: 1.1rem;
}

.pilot-readiness-boundary p {
    margin: .15rem 0 0;
    font-size: .72rem;
    line-height: 1.45;
}

.pilot-readiness-nav {
    gap: .25rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: .35rem;
    border: 1px solid var(--pilot-border);
    border-radius: .75rem;
    background: var(--pilot-panel);
}

.pilot-readiness-nav .nav-link {
    flex: 0 0 auto;
    padding: .35rem .7rem;
    font-size: .7rem;
    font-weight: 700;
}

.pilot-readiness-section {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--pilot-border);
    border-radius: .9rem;
    background: var(--pilot-panel);
    box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .035);
    scroll-margin-top: 5rem;
}

.pilot-readiness-control-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-top: .9rem;
}

.pilot-readiness-control-card {
    padding: .8rem;
    border: 1px solid color-mix(in srgb, var(--bs-success) 25%, var(--pilot-border));
    border-radius: .7rem;
    background: color-mix(in srgb, var(--bs-success) 5%, var(--bs-body-bg));
}

.pilot-readiness-control-card.is-open {
    border-color: color-mix(in srgb, var(--bs-danger) 45%, var(--pilot-border));
    background: color-mix(in srgb, var(--bs-danger) 7%, var(--bs-body-bg));
}

.pilot-readiness-state {
    display: inline-flex;
    gap: .35rem;
    align-items: center;
    color: var(--bs-success-text-emphasis);
    font-size: .62rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.pilot-readiness-control-card.is-open .pilot-readiness-state {
    color: var(--bs-danger-text-emphasis);
}

.pilot-readiness-control-card h3,
.pilot-readiness-evidence-list h3 {
    margin: .45rem 0 .2rem;
    font-size: .82rem;
}

.pilot-readiness-control-card p,
.pilot-readiness-evidence-list p,
.pilot-readiness-card-list p {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .67rem;
    line-height: 1.45;
}

.pilot-readiness-evidence-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-top: .9rem;
}

.pilot-readiness-evidence-list article {
    display: grid;
    gap: .7rem;
    padding: .85rem;
    border: 1px solid var(--pilot-border);
    border-radius: .7rem;
    background: var(--bs-body-bg);
}

.pilot-readiness-evidence-list article > div {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
}

.pilot-readiness-domain-number {
    display: grid;
    flex: 0 0 1.65rem;
    width: 1.65rem;
    height: 1.65rem;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--bs-primary) 12%, var(--bs-body-bg));
    color: var(--bs-primary);
    font-size: .7rem;
    font-weight: 800;
}

.pilot-readiness-evidence-list h3 {
    margin-top: 0;
}

.pilot-readiness-evidence-list dl {
    display: flex;
    gap: .5rem;
    justify-content: space-between;
    margin: 0;
}

.pilot-readiness-evidence-list dl div {
    display: grid;
    gap: .12rem;
}

.pilot-readiness-evidence-list dt {
    color: var(--bs-secondary-color);
    font-size: .58rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.pilot-readiness-evidence-list dd {
    margin: 0;
    font-size: .66rem;
    font-weight: 650;
}

.pilot-readiness-table-wrap {
    overflow-x: auto;
    margin-top: .8rem;
}

.pilot-readiness-table {
    min-width: 940px;
    margin-bottom: 0;
    font-size: .68rem;
}

.pilot-readiness-table th,
.pilot-readiness-table td {
    padding: .55rem;
    vertical-align: top;
}

.pilot-readiness-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.pilot-readiness-card-list {
    display: grid;
    gap: .6rem;
    margin-top: .8rem;
}

.pilot-readiness-card-list article {
    display: grid;
    grid-template-columns: minmax(140px, .55fr) 1fr auto;
    gap: .75rem;
    align-items: center;
    padding: .7rem;
    border: 1px solid var(--pilot-border);
    border-radius: .65rem;
    background: var(--bs-body-bg);
}

.pilot-readiness-card-list article > div {
    display: flex;
    gap: .55rem;
    align-items: center;
}

.pilot-readiness-card-list i {
    color: var(--bs-primary);
    font-size: 1rem;
}

.pilot-readiness-card-list span span,
.pilot-readiness-card-list strong,
.pilot-readiness-card-list small {
    display: block;
}

.pilot-readiness-card-list strong {
    font-size: .78rem;
}

.pilot-readiness-card-list small {
    color: var(--bs-secondary-color);
    font-size: .6rem;
}

.pilot-readiness-footnote {
    display: flex;
    gap: .4rem;
    margin: .75rem 0 0;
    color: var(--bs-secondary-color);
    font-size: .62rem;
}

.pilot-readiness-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .65rem;
    margin-top: .85rem;
}

.pilot-readiness-metrics article {
    display: grid;
    gap: .1rem;
    padding: .7rem;
    border: 1px solid var(--pilot-border);
    border-radius: .65rem;
    background: var(--bs-body-bg);
}

.pilot-readiness-metrics strong {
    color: var(--bs-primary);
    font-size: 1rem;
}

.pilot-readiness-metrics span {
    color: var(--bs-secondary-color);
    font-size: .6rem;
    font-weight: 650;
}

.pilot-readiness-footer {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    padding: .85rem 1rem;
    border: 1px dashed var(--pilot-border);
    border-radius: .8rem;
    color: var(--bs-secondary-color);
}

.pilot-readiness-footer i {
    color: var(--bs-primary);
}

.pilot-readiness-footer p {
    margin: 0;
    font-size: .68rem;
    line-height: 1.5;
}

@media (max-width: 1199.98px) {
    .pilot-readiness-control-grid,
    .pilot-readiness-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pilot-readiness-two-column {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .pilot-readiness-hero,
    .pilot-readiness-section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .pilot-readiness-control-grid,
    .pilot-readiness-evidence-list,
    .pilot-readiness-metrics {
        grid-template-columns: 1fr;
    }

    .pilot-readiness-card-list article {
        grid-template-columns: 1fr;
        align-items: start;
    }
}

/* Public LocateIQ landing page ------------------------------------------- */
.landing-body {
    --landing-navy: #020f1f;
    --landing-navy-soft: #061a33;
    --landing-panel: #091d3d;
    --landing-blue: #1187f5;
    --landing-blue-bright: #47adff;
    --landing-text: #f6f9ff;
    --landing-muted: #b5c5d9;
    --landing-border: rgba(71, 173, 255, .35);
    background: var(--landing-navy);
    color: var(--landing-text);
}

.landing-body .public-navbar {
    position: relative;
    z-index: 20;
    margin-bottom: 0 !important;
    border-bottom: 1px solid rgba(71, 173, 255, .18);
    background: rgba(2, 15, 31, .96) !important;
}

.landing-body .public-navbar .container-fluid {
    max-width: 1500px;
    margin-inline: auto;
}

.landing-body .public-navbar .nav-link {
    color: rgba(246, 249, 255, .78);
}

.landing-body .public-navbar .nav-link:hover,
.landing-body .public-navbar .nav-link:focus-visible {
    color: #fff;
}

.landing-body > main {
    background: var(--landing-navy);
}

.landing-body .app-legal-footer {
    padding: 1.1rem 1rem 1.25rem;
    border-top: 1px solid rgba(71, 173, 255, .14);
    background: #010b17;
    color: #8ea4bd;
}

.landing-page {
    overflow: hidden;
    background:
        radial-gradient(circle at 82% 7%, rgba(17, 135, 245, .12), transparent 23rem),
        var(--landing-navy);
    color: var(--landing-text);
}

.landing-page a:focus-visible {
    outline: 3px solid #8fd0ff;
    outline-offset: 4px;
}

.landing-shell {
    width: min(1500px, calc(100% - 3rem));
    margin-inline: auto;
}

.landing-hero {
    position: relative;
    box-sizing: border-box;
    min-height: min(820px, calc(100vh - 68px));
    display: flex;
    align-items: center;
    padding: 3.5rem 0 4rem;
}

.landing-hero::before,
.landing-hero::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.landing-hero::before {
    inset: 0;
    opacity: .2;
    background-image: radial-gradient(circle, rgba(71, 173, 255, .5) 1px, transparent 1.5px);
    background-position: calc(100% - 2rem) 2rem;
    background-size: 22px 22px;
    mask-image: linear-gradient(115deg, transparent 42%, #000 100%);
}

.landing-hero::after {
    width: 24rem;
    height: 24rem;
    top: 12%;
    right: -12rem;
    border: 1px solid rgba(71, 173, 255, .22);
    border-radius: 50%;
}

.landing-hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr);
    align-items: center;
    gap: clamp(3rem, 7vw, 7rem);
}

.landing-closing-logo {
    display: block;
    width: min(330px, 72vw);
    height: auto;
    object-fit: contain;
}

.landing-eyebrow {
    margin: 0 0 1rem;
    color: var(--landing-blue-bright);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.landing-hero h1 {
    max-width: 780px;
    margin: 0;
    color: var(--landing-text);
    text-align: left;
    font-size: clamp(3.2rem, 5vw, 4.7rem);
    font-weight: 760;
    letter-spacing: -.055em;
    line-height: .98;
}

.landing-hero h1 span {
    color: var(--landing-blue-bright);
}

.landing-hero-lead {
    max-width: 720px;
    margin: 1.5rem 0 0;
    color: var(--landing-muted);
    font-size: clamp(1.05rem, 1.6vw, 1.28rem);
    line-height: 1.6;
}

.landing-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    margin-top: 1.5rem;
}

.landing-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3.25rem;
    padding: .8rem 1.35rem;
    border: 1px solid transparent;
    border-radius: .5rem;
    font-weight: 750;
    text-decoration: none;
    transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}

.landing-button:hover {
    transform: translateY(-2px);
}

.landing-body .landing-button-primary {
    background: var(--landing-blue);
    color: #fff !important;
}

.landing-body .landing-button-primary:hover,
.landing-body .landing-button-primary:focus-visible {
    background: #0876db;
    color: #fff !important;
}

.landing-body .landing-button-secondary {
    border-color: rgba(246, 249, 255, .3);
    background: rgba(255, 255, 255, .03);
    color: var(--landing-text) !important;
}

.landing-body .landing-button-secondary:hover,
.landing-body .landing-button-secondary:focus-visible {
    border-color: var(--landing-blue-bright);
    background: rgba(17, 135, 245, .09);
    color: #fff !important;
}

.landing-fusion-visual {
    display: grid;
    justify-items: center;
    gap: 1.5rem;
}

.landing-fusion-visual > p {
    margin: 0;
    color: var(--landing-muted);
    font-size: 1rem;
    letter-spacing: .01em;
}

.landing-fusion-visual > p strong {
    color: var(--landing-text);
}

.landing-orbit {
    position: relative;
    width: min(430px, 82vw);
    aspect-ratio: 1;
    border: 1px solid var(--landing-border);
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(17, 135, 245, .17), transparent 41%),
        rgba(8, 28, 58, .62);
    box-shadow: inset 0 0 70px rgba(17, 135, 245, .08), 0 30px 80px rgba(0, 0, 0, .3);
}

.landing-orbit::before,
.landing-orbit::after {
    position: absolute;
    content: "";
    border: 1px dashed rgba(181, 197, 217, .28);
    border-radius: 50%;
}

.landing-orbit::before {
    inset: 16%;
}

.landing-orbit::after {
    inset: 34%;
}

.landing-orbit-center,
.landing-orbit-node {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    border-radius: 50%;
}

.landing-orbit-center {
    inset: 35%;
    border: 1px solid rgba(255, 255, 255, .72);
    background: linear-gradient(145deg, #168df7, #0a4d9f);
    box-shadow: 0 0 40px rgba(17, 135, 245, .35);
}

.landing-orbit-center img {
    width: 43%;
    max-height: 62%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.landing-orbit-node {
    width: 4rem;
    height: 4rem;
    border: 1px solid rgba(71, 173, 255, .75);
    background: #071a35;
    color: var(--landing-blue-bright);
    font-size: 1.55rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .24);
}

.landing-orbit-node-location { top: -1.2rem; left: calc(50% - 2rem); }
.landing-orbit-node-phone { top: 20%; right: -1.1rem; }
.landing-orbit-node-email { bottom: 20%; right: -1.1rem; }
.landing-orbit-node-people { bottom: -1.2rem; left: calc(50% - 2rem); }
.landing-orbit-node-building { bottom: 20%; left: -1.1rem; }
.landing-orbit-node-vehicle { top: 20%; left: -1.1rem; }

.landing-problem,
.landing-functions,
.landing-accountability,
.landing-review,
.landing-mission,
.landing-closing {
    padding: clamp(5rem, 9vw, 8rem) 0;
}

.landing-problem {
    border-block: 1px solid rgba(71, 173, 255, .14);
    background: #041326;
}

.landing-statement-grid,
.landing-review-grid {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: clamp(2rem, 6vw, 6rem);
}

.landing-section-number {
    margin: -.2em 0 0;
    color: rgba(71, 173, 255, .16);
    font-size: clamp(4.25rem, 8vw, 6rem);
    font-weight: 800;
    letter-spacing: -.08em;
    line-height: 1;
}

.landing-problem h2,
.landing-functions h2,
.landing-accountability h2,
.landing-review h2,
.landing-mission h2,
.landing-closing h2 {
    margin: 0;
    color: var(--landing-text);
    text-align: left;
    font-size: clamp(2.25rem, 4.3vw, 4.2rem);
    font-weight: 750;
    letter-spacing: -.04em;
    line-height: 1.08;
}

.landing-problem h2 {
    max-width: 950px;
}

.landing-problem h2 + p,
.landing-review h2 + p,
.landing-accountability-intro > p:last-child,
.landing-section-intro > p:last-child,
.landing-mission-copy p {
    color: var(--landing-muted);
    font-size: 1.05rem;
    line-height: 1.75;
}

.landing-problem h2 + p,
.landing-review h2 + p {
    max-width: 900px;
    margin: 1.6rem 0 0;
}

.landing-functions {
    background:
        linear-gradient(180deg, rgba(9, 29, 61, .72), rgba(2, 15, 31, .98)),
        var(--landing-navy);
}

.landing-functions-grid {
    display: grid;
    grid-template-columns: minmax(280px, .78fr) minmax(0, 1.22fr);
    align-items: start;
    gap: clamp(3rem, 8vw, 8rem);
}

.landing-section-intro {
    position: sticky;
    top: 2rem;
}

.landing-section-intro > p:last-child {
    margin: 1.5rem 0 0;
}

.landing-function-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.landing-function-list li {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: 1.25rem;
    padding: 1.65rem 0 1.8rem;
    border-top: 1px solid rgba(71, 173, 255, .24);
}

.landing-function-list li:last-child {
    border-bottom: 1px solid rgba(71, 173, 255, .24);
}

.landing-function-list > li > span {
    color: var(--landing-blue-bright);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.landing-function-list h3 {
    margin: -.2rem 0 .55rem;
    color: var(--landing-text);
    font-size: 1.4rem;
    font-weight: 720;
}

.landing-function-list p {
    margin: 0;
    color: var(--landing-muted);
    line-height: 1.7;
}

.landing-accountability {
    border-block: 1px solid rgba(71, 173, 255, .14);
    background: #031225;
}

.landing-accountability-grid {
    display: grid;
    grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr);
    align-items: start;
    gap: clamp(3rem, 8vw, 8rem);
}

.landing-accountability-intro > p:last-child {
    margin: 1.5rem 0 0;
}

.landing-trust-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none !important;
}

.landing-trust-list > li {
    list-style: none !important;
}

.landing-trust-list > li::marker {
    content: "";
}

.landing-trust-list li {
    min-height: 13rem;
    padding: 1.5rem;
    border: 1px solid var(--landing-border);
    border-radius: 1.2rem;
    background: rgba(9, 29, 61, .58);
}

.landing-trust-list i {
    display: grid;
    width: 2.9rem;
    height: 2.9rem;
    place-items: center;
    border-radius: .8rem;
    background: rgba(17, 135, 245, .14);
    color: var(--landing-blue-bright);
    font-size: 1.35rem;
}

.landing-trust-list h3 {
    margin: 1.25rem 0 .55rem;
    color: var(--landing-text);
    font-size: 1.2rem;
    font-weight: 750;
}

.landing-trust-list p {
    margin: 0;
    color: var(--landing-muted);
    line-height: 1.65;
}

.landing-review {
    background: linear-gradient(120deg, #096ecc, #0e88f4 62%, #0663bb);
}

.landing-review .landing-section-number,
.landing-review .landing-eyebrow {
    color: rgba(255, 255, 255, .7);
}

.landing-review h2 + p {
    color: rgba(255, 255, 255, .86);
}

.landing-mission {
    background: #020f1f;
}

.landing-mission-inner {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(340px, 1.1fr);
    align-items: start;
    gap: clamp(3rem, 8vw, 8rem);
}

.landing-mission-copy p:first-child {
    margin-top: 0;
}

.landing-mission-links {
    display: grid;
    gap: .85rem;
    margin-top: 2rem;
}

.landing-mission-links a {
    width: fit-content;
    color: var(--landing-blue-bright);
    font-weight: 750;
    text-decoration: none;
}

.landing-mission-links a:hover {
    color: #fff;
}

.landing-closing {
    border-top: 1px solid rgba(71, 173, 255, .16);
    background:
        radial-gradient(circle at 80% 50%, rgba(17, 135, 245, .19), transparent 28rem),
        #04152a;
}

.landing-closing .landing-shell {
    display: grid;
    justify-items: start;
}

.landing-closing-logo {
    margin-bottom: 2.4rem;
}

.landing-closing h2 {
    max-width: 980px;
}

.landing-closing p {
    margin: 1.4rem 0 2.2rem;
    color: var(--landing-muted);
    font-size: 1.25rem;
}

/* Public briefing request ------------------------------------------------ */
.briefing-page {
    min-height: calc(100vh - 68px);
    padding: clamp(3.5rem, 7vw, 6rem) 0;
    background:
        radial-gradient(circle at 14% 18%, rgba(17, 135, 245, .2), transparent 25rem),
        radial-gradient(circle at 88% 76%, rgba(71, 173, 255, .1), transparent 28rem),
        #020f1f;
}

.briefing-shell {
    display: grid;
    grid-template-columns: minmax(280px, .72fr) minmax(520px, 1.28fr);
    align-items: start;
    gap: clamp(3rem, 6vw, 6rem);
}

.briefing-intro {
    position: sticky;
    top: 3rem;
}

.briefing-back-link {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: 3rem;
    color: var(--landing-muted);
    font-weight: 700;
    text-decoration: none;
}

.briefing-back-link:hover,
.briefing-back-link:focus-visible {
    color: #fff;
}

.briefing-intro h1 {
    max-width: 580px;
    margin: 0;
    color: var(--landing-text);
    text-align: left;
    font-size: clamp(2.9rem, 4vw, 4rem);
    font-weight: 760;
    letter-spacing: -.055em;
    line-height: 1;
}

.briefing-lead {
    max-width: 560px;
    margin: 1.6rem 0 0;
    color: var(--landing-muted);
    font-size: 1.12rem;
    line-height: 1.75;
}

.briefing-expectations {
    display: grid;
    gap: 1.1rem;
    margin: 2.4rem 0 0;
    padding: 0;
    list-style: none;
}

.briefing-expectations li {
    display: grid;
    grid-template-columns: 2.7rem minmax(0, 1fr);
    align-items: start;
    gap: 1rem;
    color: var(--landing-muted);
    line-height: 1.6;
}

.briefing-expectations i {
    display: grid;
    width: 2.7rem;
    height: 2.7rem;
    place-items: center;
    border: 1px solid rgba(71, 173, 255, .28);
    border-radius: .75rem;
    background: rgba(17, 135, 245, .1);
    color: var(--landing-blue-bright);
}

.briefing-expectations strong {
    color: var(--landing-text);
}

.briefing-audience-note {
    margin: 2.5rem 0 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(71, 173, 255, .2);
    color: #8fa5bd;
    font-size: .92rem;
    line-height: 1.65;
}

.briefing-form-card {
    width: 100%;
    max-width: 820px;
    padding: clamp(1.5rem, 4vw, 3rem);
    border: 1px solid rgba(71, 173, 255, .34);
    border-radius: 1.35rem;
    background: rgba(7, 27, 55, .92);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .35);
    backdrop-filter: blur(18px);
}

.briefing-form-heading h2,
.briefing-success h2 {
    margin: 0;
    color: var(--landing-text);
    font-size: clamp(2rem, 3.2vw, 3rem);
    font-weight: 750;
    letter-spacing: -.035em;
    line-height: 1.12;
}

.briefing-form-heading > p:last-child,
.briefing-success > p:not(.landing-eyebrow) {
    margin: 1rem 0 0;
    color: var(--landing-muted);
    line-height: 1.65;
}

.briefing-form-alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid rgba(255, 176, 71, .5);
    border-radius: .75rem;
    background: rgba(255, 153, 0, .1);
    color: #ffe2b8;
}

.briefing-form {
    margin-top: 2rem;
}

.briefing-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
}

.briefing-field {
    display: grid;
    align-content: start;
    gap: .5rem;
}

.briefing-field-wide {
    grid-column: 1 / -1;
}

.briefing-field label {
    color: #eaf3ff;
    font-size: .93rem;
    font-weight: 720;
}

.briefing-field input,
.briefing-field select,
.briefing-field textarea {
    width: 100%;
    min-height: 3.2rem;
    padding: .8rem .9rem;
    border: 1px solid rgba(181, 197, 217, .32);
    border-radius: .65rem;
    background: rgba(1, 13, 29, .78);
    color: var(--landing-text);
    font: inherit;
    box-shadow: none;
}

.briefing-field textarea {
    min-height: 9.5rem;
    resize: vertical;
}

.briefing-field input:focus,
.briefing-field select:focus,
.briefing-field textarea:focus {
    border-color: var(--landing-blue-bright);
    outline: 3px solid rgba(71, 173, 255, .18);
}

.briefing-field [aria-invalid="true"] {
    border-color: #ff8e8e;
}

.briefing-field-help,
.briefing-field-error {
    margin: 0;
    font-size: .82rem;
    line-height: 1.45;
}

.briefing-field-help {
    color: #8fa5bd;
}

.briefing-field-error {
    color: #ffb5b5;
}

.briefing-consent {
    display: grid;
    grid-template-columns: 1.15rem minmax(0, 1fr);
    align-items: start;
    gap: .75rem;
    margin-top: 1.4rem;
    color: var(--landing-muted);
    font-size: .9rem;
    line-height: 1.55;
}

.briefing-consent input {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: .2rem;
    accent-color: var(--landing-blue);
}

.briefing-consent a {
    color: var(--landing-blue-bright);
}

.briefing-submit {
    gap: .7rem;
    width: 100%;
    margin-top: 1.6rem;
    cursor: pointer;
}

.briefing-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.briefing-success {
    display: grid;
    justify-items: start;
    align-content: center;
    min-height: 30rem;
}

.briefing-success-icon {
    display: grid;
    width: 4rem;
    height: 4rem;
    margin-bottom: 2rem;
    place-items: center;
    border: 1px solid rgba(71, 173, 255, .5);
    border-radius: 50%;
    background: rgba(17, 135, 245, .16);
    color: var(--landing-blue-bright);
    font-size: 2rem;
}

.briefing-success .landing-button {
    margin-top: 2rem;
}

@media (max-width: 1099.98px) {
    .briefing-shell {
        grid-template-columns: minmax(280px, .72fr) minmax(480px, 1.28fr);
        gap: 3rem;
    }
}

@media (max-width: 991.98px) {
    .briefing-shell {
        grid-template-columns: 1fr;
    }

    .briefing-intro {
        position: static;
    }

    .briefing-form-card {
        max-width: 760px;
    }
}

@media (max-width: 575.98px) {
    .briefing-page {
        padding-block: 3rem;
    }

    .briefing-back-link {
        margin-bottom: 2rem;
    }

    .briefing-intro h1 {
        font-size: clamp(2.45rem, 12vw, 3.5rem);
    }

    .briefing-form-grid {
        grid-template-columns: 1fr;
    }

    .briefing-field-wide {
        grid-column: auto;
    }
}

@media (max-width: 991.98px) {
    .landing-hero {
        min-height: auto;
    }

    .landing-hero-grid,
    .landing-functions-grid,
    .landing-accountability-grid,
    .landing-mission-inner {
        grid-template-columns: 1fr;
    }

    .landing-fusion-visual {
        margin-top: 1rem;
    }

    .landing-section-intro {
        position: static;
    }

}

@media (max-width: 767.98px) {
    .landing-shell {
        width: min(100% - 2rem, 1500px);
    }

    .landing-hero {
        padding-block: 3.5rem 4.5rem;
    }

    .landing-hero h1 {
        font-size: clamp(2.8rem, 14vw, 4.2rem);
    }

    .landing-hero-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .landing-button {
        width: 100%;
    }

    .landing-orbit-node {
        width: 3.2rem;
        height: 3.2rem;
        font-size: 1.25rem;
    }

    .landing-orbit-node-location { top: -1rem; left: calc(50% - 1.6rem); }
    .landing-orbit-node-phone { top: 20%; right: -.8rem; }
    .landing-orbit-node-email { bottom: 20%; right: -.8rem; }
    .landing-orbit-node-people { bottom: -1rem; left: calc(50% - 1.6rem); }
    .landing-orbit-node-building { bottom: 20%; left: -.8rem; }
    .landing-orbit-node-vehicle { top: 20%; left: -.8rem; }

    .landing-statement-grid,
    .landing-review-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .landing-section-number {
        font-size: 4rem;
    }

    .landing-trust-list {
        grid-template-columns: 1fr;
    }

    .landing-trust-list li {
        min-height: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing-button {
        transition: none;
    }
}

.case-link-search-notice {
    width: min(28rem, calc(100vw - 2rem));
    border-left: .3rem solid var(--bs-primary);
}

.case-link-search-notice .btn-outline-secondary {
    background: var(--bs-body-bg);
}

@media (max-width: 575.98px) {
    .case-link-search-notice {
        top: .5rem !important;
        right: .5rem !important;
        left: .5rem !important;
        width: auto;
        margin: 0 !important;
    }
}

/* ========================================================================
   Case page phase 2: command header and responsive three-pane foundation

   Pane and grid containers deliberately do not establish clipping, transforms,
   filters, or containment contexts. Several legacy Bootstrap dialogs still
   originate inside the record regions and must remain viewport-positioned.
   ======================================================================== */

:root {
    --record-case-shell-max-width: 1920px;
    --record-case-topbar-height: var(--app-topbar-height, 56px);
    --record-case-header-height: var(--case-bar-height, 0px);
    --record-case-sidebar-width: var(--app-sidebar-collapsed-width, 72px);
    --record-case-page-gutter: clamp(.65rem, 1vw, 1.1rem);
    --record-case-pane-gap: clamp(.75rem, 1vw, 1.15rem);
    --record-case-profile-rail: minmax(18rem, .85fr);
    --record-case-action-column: minmax(34rem, 2fr);
    --record-case-evidence-rail: minmax(21rem, 1fr);
    --record-case-sticky-offset: calc(
        var(--record-case-topbar-height) +
        var(--record-case-header-height) +
        var(--record-case-page-gutter)
    );
}

/* The case command bar sits immediately below the compact application topbar. */
.case-context-shell:has(.record-case-context) {
    top: var(--record-case-topbar-height);
    max-width: var(--record-case-shell-max-width);
    margin-top: .3rem;
    margin-bottom: .4rem;
    padding: .38rem .75rem;
}

.record-case-context {
    gap: .38rem;
    min-width: 0;
}

.record-case-command {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(28rem, auto);
    grid-template-areas: "identity actions";
    align-items: center;
    gap: .5rem .8rem;
    min-width: 0;
}

.record-case-identity {
    grid-area: identity;
    display: flex;
    align-items: center;
    min-width: 0;
}

.record-case-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    width: fit-content;
    color: var(--bs-secondary-color);
    flex: 0 0 auto;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

.record-case-title-divider {
    flex: 0 0 auto;
    color: var(--bs-border-color);
    font-size: .8rem;
    line-height: 1;
}

.record-case-breadcrumb:hover {
    color: var(--bs-primary);
    text-decoration: underline;
    text-underline-offset: .18em;
}

.record-case-title-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: .28rem .5rem;
    min-width: 0;
}

.record-case-subject-row {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: .2rem .55rem;
    min-width: 0;
    text-align: center;
    justify-self: center;
}

.record-case-subject-row h1 {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(100%, 48rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.4rem;
}

.record-case-dob {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    flex: 0 0 auto;
    white-space: nowrap;
    color: var(--bs-secondary-color);
    font-size: .78rem;
    font-weight: 600;
}

.record-case-subject-divider {
    color: var(--bs-border-color);
}

.record-case-badges {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: .3rem;
    min-width: 0;
}

.record-case-badges .badge {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
}

.record-case-statuses {
    grid-area: actions;
    display: grid;
    grid-template-columns:
        minmax(13.5rem, 17rem)
        minmax(13.5rem, 21rem);
    align-items: center;
    justify-content: end;
    gap: .5rem;
    min-width: 0;
}

.record-case-collaboration-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.record-case-status-control {
    display: grid;
    grid-template-columns: max-content minmax(8.5rem, 1fr);
    align-items: center;
    gap: .25rem .42rem;
    min-width: 0;
    margin: 0;
}

.record-case-status-control .form-label {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .045em;
    line-height: 1.25;
    text-transform: uppercase;
    white-space: nowrap;
}

.record-case-status-control .form-select {
    width: 100%;
    min-width: 0;
    min-height: 2.1rem;
    padding-top: .28rem;
    padding-bottom: .28rem;
    font-size: .82rem;
}

.record-case-status-message {
    grid-column: 1 / -1;
    color: var(--bs-secondary-color);
    font-size: .68rem;
    line-height: 1.25;
}

.record-case-context .case-context-tabs {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: .5rem;
}

.record-case-context .case-navigation {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
}

.record-case-context .case-navigation .nav-link {
    padding: .28rem .48rem;
    font-size: .78rem;
}

.record-case-outcome-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: .35rem;
    min-width: 0;
}

.record-case-outcome-region {
    min-width: 0;
}

.record-case-outcome-actions .record-case-status-control {
    width: 100%;
}

.record-case-assignment {
    position: absolute;
    top: 50%;
    right: 0;
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    gap: .26rem;
    width: auto;
    max-width: 16rem;
    min-width: 0;
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .66rem;
    line-height: 1.2;
    transform: translateY(-50%);
}

.record-case-assignment-dot {
    flex: 0 0 auto;
    width: .42rem;
    height: .42rem;
    border-radius: 50%;
    background: var(--bs-primary);
    box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle);
}

.record-case-assignment-divider {
    color: var(--bs-border-color);
}

.record-case-assignment strong {
    overflow: hidden;
    color: var(--bs-primary-text-emphasis);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-case-assignment-unassigned {
    color: var(--bs-secondary-color);
}

.record-case-assignment-unassigned .record-case-assignment-dot {
    background: var(--bs-warning);
    box-shadow: 0 0 0 2px var(--bs-warning-bg-subtle);
}

.record-case-assignment-unassigned strong {
    color: var(--bs-warning-text-emphasis);
}

.record-case-assignment-self .record-case-assignment-dot {
    background: var(--bs-success);
    box-shadow: 0 0 0 2px var(--bs-success-bg-subtle);
}

.record-case-assignment-self strong {
    color: var(--bs-success-text-emphasis);
}

.record-case-assignment-other .record-case-assignment-dot {
    background: var(--bs-primary);
    box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle);
}

.record-case-assignment-other strong {
    color: var(--bs-primary-text-emphasis);
}

.record-case-more {
    align-self: end;
    flex: 0 0 auto;
}

.record-case-more-toggle {
    display: inline-grid;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    place-items: center;
}

.record-case-more-toggle .bi {
    font-size: 1.05rem;
    line-height: 1;
}

.record-case-more .dropdown-menu {
    min-width: 13rem;
}

/* Keep the subject visible when the shared shell switches to its compact state. */
.case-context-shell.is-stuck .record-case-context h1 {
    position: static;
    display: block;
    width: auto;
    height: auto;
    min-width: 0;
    overflow: hidden;
    clip-path: none;
    font-size: 1.2rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-context-shell.is-stuck .record-case-command {
    align-items: center;
}

.case-context-shell.is-stuck .record-case-title-row {
    flex-wrap: nowrap;
}

.case-context-shell.is-stuck .record-case-breadcrumb {
    display: inline-flex;
}

.record-case-workbench {
    width: 100%;
    max-width: var(--record-case-shell-max-width);
    min-width: 0;
    margin-inline: auto;
}

.record-case-grid {
    display: grid;
    align-items: start;
    gap: var(--record-case-pane-gap);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.record-case-pane {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: var(--record-case-pane-gap);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.record-case-pane-profile {
    display: block;
}

.record-case-pane-profile > * + * {
    margin-top: var(--record-case-pane-gap) !important;
}

[data-record-history-home]:empty {
    display: none;
}

.record-case-pane > .case-workspace-section,
.record-case-pane > .container.case-workspace-section {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
}

.record-case-pane .tab-content,
.record-case-pane .tab-pane,
.record-case-pane form,
.record-case-pane fieldset {
    max-width: 100%;
    min-width: 0;
}

/* Wide legacy result tables scroll within their own region, not the page. */
.record-case-pane .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.record-case-pane table {
    margin-bottom: 0;
}

.record-case-pane-evidence #documentsTable table {
    min-width: 38rem;
}

@media (min-width: 768px) {
    .record-case-pane-evidence #foundRecordsTableContainer table {
        min-width: 68rem;
    }
}

.record-case-context :is(a, button, select):focus-visible,
.record-case-workbench :is(a, button, input, select, textarea):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 72%, transparent);
    outline-offset: 2px;
}

.dark-mode .record-case-status-message,
.dark-mode .record-case-breadcrumb,
.dark-mode .record-case-status-control .form-label {
    color: var(--dm-text-muted, #adb5bd);
}

@media (min-width: 1500px) {
    .record-case-grid {
        grid-template-columns:
            var(--record-case-profile-rail)
            var(--record-case-action-column)
            var(--record-case-evidence-rail);
    }

    .record-case-pane-profile {
        grid-column: 1;
    }

    .record-case-pane-actions {
        grid-column: 2;
    }

    .record-case-pane-evidence {
        grid-column: 3;
    }
}

@media (min-width: 1200px) and (max-width: 1499.98px) {
    .record-case-grid {
        grid-template-columns: var(--record-case-profile-rail) var(--record-case-action-column);
    }

    .record-case-pane-profile {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .record-case-pane-actions {
        grid-column: 2;
        grid-row: 1;
    }

    .record-case-pane-evidence {
        grid-column: 2;
        grid-row: 2;
    }

    .record-case-pane-evidence .case-workspace-section {
        max-width: none;
    }
}

@media (max-width: 1499.98px) {
    .record-case-command {
        grid-template-columns: minmax(0, 1fr) minmax(28rem, 1fr);
    }

    .record-case-statuses {
        grid-template-columns:
            minmax(12rem, .9fr)
            minmax(12rem, 1.1fr);
    }
}

@media (max-width: 1199.98px) {
    .case-context-shell:has(.record-case-context) {
        position: relative;
        top: auto;
    }

    .record-case-command,
    .record-case-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-case-command {
        grid-template-areas:
            "identity"
            "actions";
    }

    .record-case-pane-profile,
    .record-case-pane-actions,
    .record-case-pane-evidence {
        grid-column: 1;
    }

    .record-case-statuses {
        justify-content: stretch;
    }

    .record-case-assignment {
        position: static;
        margin-left: .15rem;
        transform: none;
    }

    .record-case-title-row {
        flex-wrap: wrap;
    }

    .case-context-shell.is-stuck .record-case-title-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .record-case-statuses {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-case-status-control {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-case-context .case-context-tabs {
        align-items: stretch;
        grid-template-columns: minmax(0, 1fr);
    }

    .record-case-context .case-navigation {
        grid-column: 1;
        grid-row: 2;
    }

    .record-case-subject-row {
        grid-column: 1;
        grid-row: 1;
    }

}

@media (max-width: 575.98px) {
    .record-case-title-divider {
        display: none;
    }

    .record-case-subject-row {
        align-items: center;
        flex-direction: column;
        gap: .15rem;
    }

    .record-case-subject-row h1 {
        max-width: 100%;
        white-space: normal;
    }

    .record-case-subject-divider {
        display: none;
    }

    .record-case-assignment {
        margin-left: 0;
    }

    .record-case-badges {
        flex-basis: auto;
        width: 100%;
    }
}

/* ========================================================================
   Case page phase 3: compact left context rail
   ======================================================================== */

.record-profile-rail,
#recordHistorySection,
.prior-work-card-panel,
.record-narrative-panel,
.record-profile-rail-workspace,
.record-history-card-list,
.prior-work-card-list,
.record-narrative-tab-content,
.record-narrative-pane {
    min-width: 0;
}

.record-profile-rail {
    padding: .8rem !important;
}

.record-profile-rail-heading,
.record-profile-rail-section-heading,
.record-narrative-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.record-profile-rail-heading {
    margin-bottom: .65rem;
}

.record-profile-rail-heading h2,
.record-profile-rail-section-heading h3,
.record-narrative-header h2,
.record-narrative-pane-title,
.record-history-title {
    margin: 0;
    color: var(--bs-body-color);
    text-align: left;
}

.record-profile-rail-heading h2,
.record-narrative-header h2,
.record-history-title {
    font-size: 1rem;
    font-weight: 750;
}

.record-profile-rail-section-heading h3,
.record-narrative-pane-title {
    font-size: .9rem;
    font-weight: 750;
}

.record-profile-rail-eyebrow {
    margin: 0 0 .12rem;
    color: var(--bs-secondary-color);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .065em;
    line-height: 1.2;
    text-transform: uppercase;
}

.record-profile-rail-readonly {
    margin-bottom: .7rem;
    padding: .55rem .65rem;
    font-size: .75rem;
}

.record-profile-rail-workspace {
    display: grid;
    gap: .65rem;
}

.record-profile-rail-card {
    min-width: 0;
    margin: 0;
    padding: .7rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    background: var(--bs-tertiary-bg);
}

.record-profile-rail-photo {
    container-name: record-profile-summary;
    container-type: inline-size;
}

.record-profile-rail-primary {
    display: grid;
    grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
    align-items: start;
    gap: .65rem;
    min-width: 0;
}

.record-profile-rail-photo-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .45rem;
    width: 100%;
    max-width: 12rem;
    min-width: 0;
}

.record-profile-rail-photo-frame {
    position: relative;
    width: 100%;
    min-width: 0;
}

.record-profile-rail-photo-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    margin: 0;
    object-fit: cover;
}

.record-profile-rail-photo-edit {
    top: auto;
    right: .35rem;
    bottom: .35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
}

.record-profile-rail-photo-edit i {
    font-size: .85rem;
}

.record-profile-rail-help,
.record-narrative-header p,
.record-history-card-section-header p {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .72rem;
    line-height: 1.4;
}

.record-profile-rail-photo-stack .record-profile-rail-compare {
    width: 100%;
    white-space: normal;
}

.record-profile-rail-core-list {
    display: grid;
    align-content: start;
    gap: .34rem;
    min-width: 0;
    margin: 0;
    padding-top: .08rem;
}

.record-profile-rail-core-row {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: .38rem;
    min-width: 0;
}

.record-profile-rail-core-row dt {
    color: var(--bs-secondary-color);
    font-size: .61rem;
    font-weight: 800;
    letter-spacing: .045em;
    line-height: 1.3;
    text-transform: uppercase;
}

.record-profile-rail-core-row dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--bs-body-color);
    font-size: .7rem;
    font-weight: 650;
    line-height: 1.35;
}

/* Keep long alias lists compact until the analyst asks to read the rest. */
[data-record-profile-aliases].is-collapsed {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.record-profile-aliases-toggle {
    margin-top: .2rem;
    padding: .15rem 0;
    border: 0;
    background: transparent;
    color: var(--bs-link-color);
    font: inherit;
    text-align: left;
    text-decoration: underline;
    cursor: pointer;
}

.record-profile-aliases-toggle[hidden] {
    display: none;
}

/* Reduce the portrait before it squeezes dates and names into fragments. */
@container record-profile-summary (max-width: 26rem) {
    .record-profile-rail-primary {
        grid-template-columns: minmax(5.25rem, 36%) minmax(0, 1fr);
    }
}

@container record-profile-summary (max-width: 13.5rem) {
    .record-profile-rail-primary {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-profile-rail-photo-stack {
        max-width: 12rem;
    }
}

/* Relationships retain a conventional table where the workspace is wide, then
   become scan-friendly evidence cards before fixed columns can crush names. */
.relationships-panel {
    container-name: relationships-panel;
    container-type: inline-size;
    min-width: 0;
}

.relationships-heading {
    display: grid;
    gap: .75rem;
}

.relationship-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.relationship-filters .btn {
    border-radius: .375rem !important;
}

.relationship-result-groups {
    display: grid;
    gap: .75rem;
}

.relationship-result-group {
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    border-radius: .55rem;
    background: var(--bs-body-bg);
}

.relationship-result-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .8rem;
    cursor: pointer;
    background: var(--bs-tertiary-bg);
}

.relationship-result-summary > span:first-child {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
    min-width: 0;
}

.relationship-result-summary-actions {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex: 0 0 auto;
}

.relationship-group-delete-btn {
    white-space: nowrap;
}

.relationship-result-token {
    color: var(--bs-secondary-color);
    font-family: var(--bs-font-monospace);
    font-size: .72rem;
    overflow-wrap: anywhere;
}

.relationship-result-group[open] > .relationship-result-summary {
    border-bottom: 1px solid var(--bs-border-color);
}

.relationship-result-group .relationships-table-shell {
    max-height: 24rem;
    border-radius: 0;
}

.relationships-table-shell {
    max-height: 32.5rem;
    overflow: auto;
    border-radius: .5rem;
}

.relationships-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    margin-bottom: 0;
}

.relationships-table th:nth-child(1) { width: 24%; }
.relationships-table th:nth-child(2) { width: 18%; }
.relationships-table th:nth-child(3) { width: 23%; }
.relationships-table th:nth-child(4) { width: 18%; }
.relationships-table th:nth-child(5) { width: 17%; }

.relationship-details-list {
    display: grid;
    gap: .22rem;
    margin: 0;
}

.relationship-details-list > div {
    display: grid;
    grid-template-columns: 2.8rem minmax(0, 1fr);
    gap: .4rem;
    align-items: baseline;
    min-width: 0;
}

.relationship-details-list dt {
    color: var(--bs-secondary-color);
    font-size: .65rem;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.relationship-details-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.relationship-source-details-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    gap: .3rem;
    white-space: normal;
}

.relationship-source-details-modal .modal-body {
    display: grid;
    gap: 1rem;
}

.relationship-source-caution {
    margin: 0;
}

.relationship-evidence-section,
.relationship-source-detail-section,
.relationship-address-history {
    min-width: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: .6rem;
    background: var(--bs-body-bg);
}

.relationship-evidence-section,
.relationship-source-detail-section {
    padding: .85rem;
}

.relationship-evidence-heading,
.relationship-address-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.relationship-address-list {
    display: grid;
    gap: .55rem;
    margin-top: .75rem;
}

.relationship-address-card {
    min-width: 0;
    padding: .7rem .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
    overflow-wrap: anywhere;
}

.relationship-address-card.has-date-overlap {
    border-color: color-mix(in srgb, var(--bs-success) 55%, var(--bs-border-color));
    background: color-mix(in srgb, var(--bs-success-bg-subtle) 45%, var(--bs-body-bg));
}

.relationship-timeline-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    margin: .6rem 0 0;
}

.relationship-timeline-grid > div {
    min-width: 0;
}

.relationship-timeline-grid dt {
    color: var(--bs-secondary-color);
    font-size: .68rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.relationship-timeline-grid dd {
    margin: .1rem 0 0;
    overflow-wrap: anywhere;
}

.relationship-source-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: .75rem;
}

.relationship-source-detail-section h3 {
    margin-bottom: .65rem;
}

.relationship-source-detail-list {
    display: grid;
    gap: .45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.relationship-source-detail-list li {
    display: grid;
    gap: .05rem;
    min-width: 0;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--bs-border-color);
    overflow-wrap: anywhere;
}

.relationship-source-detail-list li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.relationship-source-detail-list span {
    color: var(--bs-secondary-color);
    font-size: .78rem;
}

.relationship-contact-list {
    max-height: 13rem;
    padding-right: .25rem;
    overflow-y: auto;
}

.relationship-address-history {
    padding: .75rem .85rem;
}

.relationship-address-history > summary {
    cursor: pointer;
    font-weight: 600;
}

.tlo-relationship-people {
    max-height: 34rem;
    overflow-y: auto;
}

.tlo-relationship-person {
    border-bottom: 1px solid var(--bs-border-color);
}

.tlo-relationship-person:last-child {
    border-bottom: 0;
}

.tlo-relationship-person > summary {
    display: grid;
    grid-template-columns: minmax(10rem, .8fr) minmax(14rem, 1.2fr);
    align-items: center;
    gap: .75rem;
    padding: .65rem .75rem;
    cursor: pointer;
    list-style: none;
}

.tlo-relationship-person > summary::-webkit-details-marker {
    display: none;
}

.tlo-relationship-person-name {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

.tlo-relationship-person-chevron {
    flex: 0 0 auto;
    width: .5rem;
    height: .5rem;
    margin-right: .1rem;
    border-right: .12rem solid currentColor;
    border-bottom: .12rem solid currentColor;
    color: var(--bs-primary);
    transform: rotate(-45deg);
    transition: transform .15s ease;
}

.tlo-relationship-person[open] > summary .tlo-relationship-person-chevron {
    transform: rotate(45deg);
}

.tlo-relationship-person > summary:hover {
    background: var(--bs-tertiary-bg);
}

.tlo-relationship-person > summary:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
    background: var(--bs-tertiary-bg);
}

.tlo-relationship-person-body {
    display: grid;
    gap: .75rem;
    padding: .75rem;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
}

.relationship-row-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

.relationship-code-detail {
    margin-top: .35rem;
    font-size: .72rem;
    line-height: 1.2;
}

.relationship-row-actions .relationship-search-btn {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
}

.relationship-actions-menu {
    flex: 0 0 auto;
}

.relationship-actions-menu-toggle {
    width: 2rem;
    min-width: 2rem;
    padding-inline: .25rem;
}

.relationship-actions-menu-toggle::after {
    display: none;
}

.relationship-actions-menu .dropdown-menu {
    min-width: 13.5rem;
    text-align: left;
}

.relationship-actions-menu .dropdown-menu.show {
    position: fixed !important;
    inset: auto !important;
    top: var(--relationship-menu-top, 0) !important;
    left: var(--relationship-menu-left, 0) !important;
    z-index: 1060;
    transform: none !important;
}

@container relationships-panel (max-width: 46rem) {
    .relationships-table-shell {
        overflow-x: hidden;
        border-radius: 0;
    }

    .relationships-table {
        display: block;
        min-width: 0;
        table-layout: auto;
        border: 0;
    }

    .relationships-table thead {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    .relationships-table tbody {
        display: grid;
        gap: .7rem;
    }

    .relationships-table tr[data-relationship-row] {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(10rem, .8fr);
        grid-template-areas:
            "name relationship"
            "details details"
            "delivery actions";
        overflow: hidden;
        border: 1px solid var(--bs-border-color);
        border-radius: .55rem;
        background: var(--bs-body-bg);
    }

    .relationships-table tr[data-relationship-row] > td {
        display: block;
        min-width: 0;
        padding: .65rem .75rem;
        border: 0;
        text-align: left !important;
    }

    .relationships-table tr[data-relationship-row] > td::before {
        display: block;
        margin-bottom: .3rem;
        color: var(--bs-secondary-color);
        content: attr(data-label);
        font-size: .68rem;
        font-weight: 700;
        letter-spacing: .045em;
        line-height: 1;
        text-transform: uppercase;
    }

    .relationship-cell-name { grid-area: name; }
    .relationship-cell-type { grid-area: relationship; }
    .relationship-cell-details { grid-area: details; }
    .relationship-cell-delivery { grid-area: delivery; }
    .relationship-cell-actions { grid-area: actions; }

    .relationship-cell-name,
    .relationship-cell-type {
        background: var(--bs-tertiary-bg);
    }

    .relationship-cell-delivery,
    .relationship-cell-actions {
        border-top: 1px solid var(--bs-border-color) !important;
    }

    .relationship-cell-delivery::before,
    .relationship-cell-actions::before {
        text-align: center;
    }

    .relationship-delivery-controls {
        display: flex !important;
        flex-wrap: nowrap;
        gap: .4rem !important;
    }

    .relationship-delivery-controls > * {
        flex: 1 1 0;
        min-width: 0;
    }
}

@container relationships-panel (max-width: 30rem) {
    .relationships-table tr[data-relationship-row] {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "name"
            "relationship"
            "details"
            "delivery"
            "actions";
    }

    .relationship-delivery-controls {
        flex-wrap: wrap;
    }

    .relationship-delivery-controls > * {
        flex-basis: 8.5rem;
    }

    .relationship-evidence-heading,
    .relationship-address-card-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .relationship-timeline-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 30rem) {
    .tlo-relationship-person > summary {
        grid-template-columns: minmax(0, 1fr);
        gap: .2rem;
    }
}

.record-profile-modal-dropzone-control {
    display: block;
    width: 100%;
    border: 0;
    border-radius: .65rem;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.record-profile-modal-dropzone-control:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 72%, transparent);
    outline-offset: 3px;
}

.record-profile-modal-dropzone-control.is-disabled {
    cursor: wait;
    opacity: .68;
}

.record-profile-modal-dropzone {
    position: relative;
    flex-direction: column;
    gap: .35rem;
    min-height: 6rem;
    border-color: color-mix(in srgb, var(--bs-primary) 48%, var(--bs-border-color));
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 45%, var(--bs-body-bg));
    color: var(--bs-body-color);
    transition: border-color .15s ease, background-color .15s ease;
}

.record-profile-modal-dropzone::before {
    content: none;
}

.record-profile-modal-dropzone i {
    color: var(--bs-primary);
    font-size: 1.5rem;
}

.record-profile-modal-dropzone.highlight {
    border-color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 76%, var(--bs-body-bg));
}

.record-profile-modal-dropzone.uploading {
    opacity: .72;
}

.record-profile-modal-dropzone.uploading::after {
    position: static;
    margin-top: .2rem;
}

.record-profile-upload-status {
    min-height: 1.25rem;
    margin-top: .35rem;
}

.record-profile-rail-section-heading {
    margin-bottom: .55rem;
}

.record-profile-rail-verification {
    padding: .55rem .6rem;
}

.record-profile-rail-verification .record-profile-rail-section-heading {
    margin-bottom: .4rem;
}

.record-profile-rail-verification-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .55rem;
}

.record-profile-rail-field {
    min-width: 0;
}

.record-profile-rail-field .form-label {
    margin-bottom: .2rem;
    color: var(--bs-secondary-color);
    font-size: .68rem;
    font-weight: 750;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.record-profile-rail-select {
    min-width: 0;
    font-weight: 650;
}

.record-profile-rail-select-verified,
.record-profile-rail-select-clear {
    border-color: color-mix(in srgb, var(--bs-success) 58%, var(--bs-border-color));
    background-color: color-mix(in srgb, var(--bs-success-bg-subtle) 68%, var(--bs-body-bg));
    color: var(--bs-success-text-emphasis);
}

.record-profile-rail-select-unverified,
.record-profile-rail-select-danger {
    border-color: color-mix(in srgb, var(--bs-danger) 58%, var(--bs-border-color));
    background-color: color-mix(in srgb, var(--bs-danger-bg-subtle) 68%, var(--bs-body-bg));
    color: var(--bs-danger-text-emphasis);
}

.record-profile-rail-select-warning {
    border-color: color-mix(in srgb, var(--bs-warning) 70%, var(--bs-border-color));
    background-color: color-mix(in srgb, var(--bs-warning-bg-subtle) 70%, var(--bs-body-bg));
    color: var(--bs-warning-text-emphasis);
}

.record-profile-rail-select-unset {
    border-color: var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.record-profile-rail-disclosure {
    padding: 0;
    overflow: clip;
}

.record-profile-rail-disclosure-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    min-width: 0;
    padding: .7rem;
    cursor: pointer;
    list-style: none;
}

.record-profile-rail-disclosure-summary::-webkit-details-marker {
    display: none;
}

.record-profile-rail-disclosure-title {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    font-size: .8rem;
    font-weight: 750;
}

.record-profile-rail-disclosure-action {
    flex: 0 0 auto;
    color: var(--bs-primary);
    font-size: .68rem;
    font-weight: 750;
}

.record-profile-rail-disclosure[open] .record-profile-rail-disclosure-action {
    color: var(--bs-secondary-color);
}

.record-profile-rail-disclosure-trailing {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: .4rem;
}

.record-profile-rail-disclosure-chevron {
    color: var(--bs-secondary-color);
    font-size: .68rem;
    transition: transform .16s ease;
}

.record-profile-rail-disclosure[open] .record-profile-rail-disclosure-chevron {
    transform: rotate(180deg);
}

.record-profile-rail-disclosure-body {
    padding: .7rem;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.record-profile-rail-definition-list {
    display: grid;
    gap: .42rem;
    margin: 0;
}

.record-profile-rail-definition-row {
    display: grid;
    grid-template-columns: minmax(6rem, .82fr) minmax(0, 1fr);
    gap: .55rem;
    min-width: 0;
}

.record-profile-rail-definition-row dt {
    color: var(--bs-secondary-color);
    font-size: .64rem;
    font-weight: 750;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.record-profile-rail-definition-row dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: .72rem;
}

.record-profile-rail-sensitive {
    margin-top: .7rem;
    padding: .65rem;
    border: 1px solid color-mix(in srgb, var(--bs-warning) 48%, var(--bs-border-color));
    border-radius: .55rem;
    background: color-mix(in srgb, var(--bs-warning-bg-subtle) 46%, var(--bs-body-bg));
}

.record-profile-rail-sensitive-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .55rem;
}

.record-profile-rail-sensitive-heading h4 {
    margin: 0;
    font-size: .76rem;
}

.record-profile-rail-physical-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .38rem;
}

.record-profile-rail-physical .record-profile-rail-disclosure-body {
    padding: .55rem .6rem;
}

.record-profile-rail-physical .record-profile-rail-field .form-label {
    margin-bottom: .1rem;
    font-size: .58rem;
}

.record-profile-rail-physical .form-control {
    min-height: 1.75rem;
    padding: .2rem .38rem;
    font-size: .68rem;
    line-height: 1.2;
}

.record-profile-rail-physical-fields > :last-child {
    grid-column: span 2;
}

.record-profile-rail-physical .record-profile-rail-form-actions {
    margin-top: .5rem;
}

.record-profile-rail-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: .7rem;
}

.record-profile-rail-modal-photo {
    width: min(15rem, 100%);
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

#compareFaceModal .modal-dialog {
    max-width: 36rem;
}

.compare-photo-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2px minmax(0, 1fr);
    gap: .55rem 1rem;
    align-items: start;
}

.compare-photo-source {
    grid-column: 1;
}

.compare-photo-target {
    grid-column: 3;
}

.compare-photo-label {
    grid-row: 1;
    margin-bottom: 0;
    text-align: center;
}

.compare-photo-input {
    grid-row: 2;
    min-width: 0;
}

.compare-photo-actions {
    display: grid;
    grid-row: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    align-self: stretch;
    align-content: start;
}

.compare-photo-profile-action {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
}

.compare-photo-clear {
    grid-column: 2;
    min-width: 0;
}

.compare-photo-status {
    grid-row: 4;
    min-width: 0;
    margin-top: 0;
}

.compare-photo-preview-frame {
    display: flex;
    grid-row: 5;
    justify-content: center;
    min-width: 0;
}

.compare-photo-preview {
    display: none;
    width: min(100%, 13rem);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: .375rem;
}

.compare-photo-divider {
    grid-column: 2;
    grid-row: 1 / 6;
    align-self: center;
    width: 2px;
    height: 7.5rem;
    background: currentColor;
    opacity: .3;
}

@media (max-width: 575.98px) {
    #compareFaceModal .modal-dialog {
        margin: .5rem;
    }

    .compare-photo-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: .55rem;
    }

    .compare-photo-source,
    .compare-photo-target,
    .compare-photo-divider {
        grid-column: 1;
    }

    .compare-photo-source.compare-photo-label { grid-row: 1; }
    .compare-photo-source.compare-photo-input { grid-row: 2; }
    .compare-photo-source.compare-photo-actions { grid-row: 3; }
    .compare-photo-source.compare-photo-status { grid-row: 4; }
    .compare-photo-source.compare-photo-preview-frame { grid-row: 5; }

    .compare-photo-divider {
        grid-row: 6;
        width: 100%;
        height: 1px;
        margin-block: .5rem;
    }

    .compare-photo-target.compare-photo-label { grid-row: 7; }
    .compare-photo-target.compare-photo-input { grid-row: 8; }
    .compare-photo-target.compare-photo-actions { grid-row: 9; }
    .compare-photo-target.compare-photo-status { grid-row: 10; }
    .compare-photo-target.compare-photo-preview-frame { grid-row: 11; }
}

#recordHistorySection {
    padding: .8rem !important;
}

.record-history-card-section-header {
    display: grid;
    gap: .2rem;
}

.record-section-heading-line,
.record-section-title-row {
    display: flex;
    align-items: center;
    min-width: 0;
}

.record-section-heading-line {
    justify-content: space-between;
    gap: .6rem;
}

.record-section-title-row {
    gap: .25rem;
}

.record-section-title-row > :is(h2, h3, h4) {
    min-width: 0;
    margin-block: 0;
}

.record-section-tooltip-container {
    flex: 0 0 auto;
}

.record-section-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    margin-left: 0;
    border-radius: 50%;
    padding: 0;
    color: var(--bs-primary);
    font-size: .82rem;
}

.record-section-tooltip-trigger:hover {
    background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
}

.record-section-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1060;
    width: min(20rem, calc(100vw - 1.5rem));
    min-width: 0;
    max-width: calc(100vw - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    overflow: auto;
    text-align: left;
}

.record-evidence-scope-note {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    padding: .35rem .45rem;
    border-left: 2px solid var(--bs-info);
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 45%, transparent);
    color: var(--bs-secondary-color);
    font-size: .66rem;
    line-height: 1.35;
}

.record-evidence-scope-note i {
    flex: 0 0 auto;
    color: var(--bs-info-text-emphasis);
}

.intel-brief-note {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    padding: .35rem .45rem;
    border-left: 2px solid var(--bs-info);
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 45%, transparent);
    color: var(--bs-secondary-color);
    font-size: .66rem;
    line-height: 1.35;
}

.dark-mode .record-section-tooltip {
    border-color: var(--dm-border-light);
    background: var(--dm-bg-elevated);
    color: var(--dm-text-primary);
}

.record-history-compare-toggle {
    flex: 0 0 auto;
    white-space: nowrap;
}

.record-validated-compare-toggle {
    flex: 0 0 auto;
    white-space: nowrap;
}

.record-history-comparison-panel[hidden] {
    display: none !important;
}

.record-history-comparison-panel {
    position: fixed;
    top: var(--record-case-sticky-offset);
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
    left: var(--record-history-panel-left, calc(var(--app-sidebar-collapsed-width, 72px) + 1rem));
    z-index: 1025;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: var(--record-history-panel-width, 18rem);
    max-width: calc(100vw - var(--app-sidebar-collapsed-width, 72px) - 2rem);
    min-height: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 34%, var(--bs-border-color));
    border-radius: .8rem;
    background: var(--bs-body-bg);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .24);
}

.record-history-comparison-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-body-bg) 94%, var(--bs-primary) 6%);
}

.record-history-comparison-panel-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.record-history-comparison-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
}

.record-history-comparison-mount {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.record-history-comparison-mount #recordHistorySection {
    width: 100%;
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.record-validated-comparison-panel[hidden] {
    display: none !important;
}

.record-validated-comparison-panel {
    position: fixed;
    top: var(--record-case-sticky-offset);
    right: var(--record-validated-panel-right, 1rem);
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
    z-index: 1025;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: var(--record-validated-panel-width, 40rem);
    max-width: calc(100vw - var(--app-sidebar-collapsed-width, 72px) - 2rem);
    min-height: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 34%, var(--bs-border-color));
    border-radius: .8rem;
    background: var(--bs-body-bg);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .24);
}

.record-validated-comparison-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-body-bg) 94%, var(--bs-primary) 6%);
}

.record-validated-comparison-panel-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.record-validated-comparison-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
}

.record-validated-comparison-mount {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.record-validated-comparison-mount #validatedRecordsSection {
    width: 100%;
    margin: 0 !important;
    padding: .75rem;
}

.analyst-feedback-classification {
    border: 1px solid currentColor;
    font-weight: 650;
}

.analyst-feedback-classification-major {
    color: #842029;
    background: #f8d7da;
}

.analyst-feedback-classification-minor {
    color: #664d03;
    background: #fff3cd;
}

.analyst-feedback-classification-accurate {
    color: #0f5132;
    background: #d1e7dd;
}

.analyst-feedback-classification-neutral {
    color: #343a40;
    background: #e9ecef;
}

.dark-mode .analyst-feedback-classification-major {
    color: #ffb3bd;
    background: rgba(220, 53, 69, .22);
}

.dark-mode .analyst-feedback-classification-minor {
    color: #ffe08a;
    background: rgba(255, 193, 7, .2);
}

.dark-mode .analyst-feedback-classification-accurate {
    color: #9ee2bf;
    background: rgba(25, 135, 84, .24);
}

.dark-mode .analyst-feedback-classification-neutral {
    color: #e9ecef;
    background: rgba(108, 117, 125, .28);
}

.record-history-card-list {
    display: grid;
    gap: .6rem;
}

.record-history-card-item {
    display: grid;
    gap: .55rem;
    min-width: 0;
    padding: .7rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--bs-tertiary-bg);
}

.record-history-card-heading,
.record-history-card-record-line {
    display: flex;
    min-width: 0;
}

.record-history-card-heading {
    align-items: flex-start;
    justify-content: space-between;
    gap: .45rem;
}

.record-history-card-record-line {
    align-items: flex-start;
    flex: 1 1 auto;
    gap: .45rem;
}

.record-history-card-type-icon {
    display: grid;
    place-items: center;
    flex: 0 0 1.55rem;
    width: 1.55rem;
    height: 1.55rem;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 35%, var(--bs-border-color));
    border-radius: .42rem;
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    font-size: .72rem;
}

.record-history-card-record {
    min-width: 0;
    padding-top: .14rem;
    color: var(--bs-body-color);
    font-size: .86rem;
    font-weight: 750;
    line-height: 1.3;
}

.record-history-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: .3rem;
    min-width: 0;
}

.record-history-card-chip {
    display: inline-flex;
    align-items: center;
    gap: .22rem;
    min-width: 0;
    max-width: 100%;
    min-height: 1.28rem;
    padding: .12rem .38rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    font-size: .61rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.record-history-card-chip i {
    flex: 0 0 auto;
    color: var(--bs-secondary-color);
    font-size: .58rem;
}

.record-history-card-subtype,
.record-history-card-source {
    flex: 1 1 0;
    overflow: hidden;
}

.record-history-card-date {
    flex: 0 0 auto;
}

.record-history-card-chip-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-history-card-label,
.prior-work-card-record-meta dt {
    color: var(--bs-secondary-color);
    font-size: .61rem;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.prior-work-card-record-meta dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: .68rem;
}

.record-history-card-address {
    display: grid;
    gap: .45rem;
    padding-top: .5rem;
    border-top: 1px solid var(--bs-border-color);
}

.record-history-card-suggested {
    display: grid;
    gap: .16rem;
    min-width: 0;
    font-size: .7rem;
}

.record-history-card-validation {
    display: flex;
    justify-content: flex-start;
}

.record-history-card-socialnet {
    flex: 0 0 auto;
}

.prior-work-card-panel {
    overflow: hidden;
}

.prior-work-card-header {
    display: grid;
    gap: .4rem;
    padding: .7rem;
}

.prior-work-card-title-row,
.prior-work-card-case-header,
.prior-work-card-record-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    min-width: 0;
}

.prior-work-card-title-row {
    justify-content: flex-start;
}

.prior-work-card-boundary {
    line-height: 1.4;
}

.prior-work-card-list {
    display: grid;
    gap: .65rem;
    padding: .7rem;
}

.prior-work-card-case {
    display: grid;
    gap: .55rem;
    min-width: 0;
}

.prior-work-card-case + .prior-work-card-case {
    padding-top: .65rem;
    border-top: 1px solid var(--bs-border-color);
}

.prior-work-card-project {
    overflow-wrap: anywhere;
    font-size: .76rem;
    font-weight: 750;
}

.prior-work-card-status {
    flex: 0 1 auto;
    max-width: 50%;
    overflow-wrap: anywhere;
    white-space: normal;
}

.prior-work-card-record-list {
    display: grid;
    gap: .45rem;
}

.prior-work-card-record {
    display: grid;
    gap: .38rem;
    min-width: 0;
    padding: .55rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .55rem;
    background: var(--bs-tertiary-bg);
}

.prior-work-card-record-heading {
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.prior-work-card-record-type {
    font-size: .68rem;
    font-weight: 800;
}

.prior-work-card-record-subtype {
    color: var(--bs-secondary-color);
    font-size: .62rem;
}

.prior-work-card-record-value {
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.3;
}

.prior-work-card-record-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .35rem;
}

.prior-work-card-record-meta-item {
    min-width: 0;
}

.prior-work-card-record-meta dt,
.prior-work-card-record-meta dd {
    display: block;
}

.record-narrative-panel {
    padding: .8rem !important;
}

.record-narrative-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .65rem;
}

.record-narrative-expand-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0;
}

.record-narrative-workspace-content {
    min-width: 0;
    max-width: 100%;
}

.record-narrative-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .3rem;
    border: 0;
}

.record-narrative-tabs .nav-item {
    display: flex;
    min-width: 0;
}

.record-narrative-tabs .nav-link {
    width: 100%;
    min-width: 0;
    min-height: 2.65rem;
    padding: .4rem .35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    color: var(--bs-secondary-color);
    font-size: .66rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: normal;
}

.record-narrative-tabs .nav-link.active {
    border-color: color-mix(in srgb, var(--bs-primary) 52%, var(--bs-border-color));
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.record-narrative-tab-content {
    margin-top: .55rem;
    padding-top: .65rem;
    border-top: 1px solid var(--bs-border-color);
}

.record-narrative-comments-home,
.record-narrative-expanded-modal-mount {
    min-width: 0;
}

.record-case-pane-profile .record-narrative-pane .row {
    --bs-gutter-x: 0;
}

.record-case-pane-profile .record-narrative-pane .row > [class*="col-"] {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    padding-inline: 0;
}

.record-case-pane-profile .record-narrative-pane .text-end {
    text-align: left !important;
}

.record-case-pane-profile .record-narrative-pane :is(textarea, select) {
    max-width: 100%;
}

.record-case-pane-profile #internalCommentsTable,
.record-case-pane-profile #internalCommentsTable tbody {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
}

.record-case-pane-profile #internalCommentsTable thead {
    display: none;
}

.record-case-pane-profile #internalCommentsTable tbody {
    display: grid;
    gap: .5rem;
}

.record-case-pane-profile #internalCommentsTable tbody tr {
    display: block;
    min-width: 0;
    padding: .6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .55rem;
    background: var(--bs-tertiary-bg);
}

.record-case-pane-profile #internalCommentsTable tbody tr:hover {
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 32%, var(--bs-tertiary-bg));
    box-shadow: none;
}

.record-case-pane-profile #internalCommentsTable td {
    display: block;
    width: 100%;
    min-width: 0;
    padding: .25rem 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
}

.record-case-pane-profile #internalCommentsTable td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .12rem;
    color: var(--bs-secondary-color);
    font-size: .61rem;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.record-case-pane-profile #internalCommentsTable .fr-clamp {
    -webkit-line-clamp: 4;
    overflow-wrap: anywhere;
    font-size: .72rem;
    line-height: 1.4;
}

.record-comment-meta {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
    gap: .5rem;
    min-width: 0;
    margin: 0;
}

.record-comment-meta > div {
    min-width: 0;
}

.record-comment-meta dt {
    margin-bottom: .1rem;
    color: var(--bs-secondary-color);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.record-comment-meta dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: .68rem;
}

.record-comment-edit-action {
    display: inline-grid;
    place-items: center;
    width: 1.8rem;
    min-width: 1.8rem;
    height: 1.8rem;
    padding: 0;
}

.record-case-pane-profile #internalCommentsTable td.record-comment-actions-cell {
    display: flex;
    justify-content: flex-end;
    padding-top: .35rem !important;
}

.record-narrative-expanded-modal .record-comment-actions-cell {
    text-align: center;
}

.record-narrative-pane > .record-narrative-activity {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.record-narrative-pane-heading {
    margin-bottom: .65rem;
    padding-bottom: .55rem;
}

.record-narrative-expanded-modal .modal-dialog {
    max-width: min(1180px, calc(100vw - 1.5rem));
}

.record-narrative-expanded-modal .modal-content {
    max-height: calc(100vh - 1.5rem);
}

.record-narrative-expanded-modal-body {
    min-height: min(34rem, 68vh);
}

.record-narrative-expanded-modal .record-narrative-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.record-narrative-expanded-modal .record-narrative-tabs .nav-link {
    min-height: 2.85rem;
    font-size: .78rem;
}

.record-narrative-expanded-modal .record-narrative-editor-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .65rem;
    margin-inline: 0;
    --bs-gutter-x: 0;
}

.record-narrative-expanded-modal :is(.record-narrative-editor-field, .record-narrative-editor-actions) {
    width: 100%;
    max-width: none;
    padding-inline: 0;
}

.record-narrative-expanded-modal :is(#externalCustomerNote, #intelBriefText) {
    width: 100%;
    min-height: clamp(15rem, 44vh, 36rem) !important;
    min-height: clamp(15rem, 44dvh, 36rem) !important;
}

.record-narrative-expanded-modal .record-narrative-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    text-align: right !important;
}

.record-narrative-expanded-modal .record-narrative-editor-actions > :is(.record-action-button, [data-autosave-state]) {
    margin-top: 0 !important;
}

.record-narrative-expanded-modal .table-responsive {
    max-height: none !important;
    overflow-y: visible !important;
}

.record-narrative-expanded-modal :is(a, button, input, select, textarea):focus-visible,
.record-profile-rail summary:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 72%, transparent);
    outline-offset: 2px;
}

.dark-mode .record-profile-rail-card,
.dark-mode .record-history-card-item,
.dark-mode .prior-work-card-record,
.dark-mode .record-case-pane-profile #internalCommentsTable tbody tr {
    border-color: var(--dm-border);
    background: var(--dm-bg-elevated);
}

.dark-mode .record-profile-rail-disclosure-body,
.dark-mode .record-profile-rail-sensitive {
    border-color: var(--dm-border);
    background: var(--dm-bg-surface);
}

.dark-mode .record-profile-rail-select-unset {
    border-color: var(--dm-border);
    background: var(--dm-bg-elevated);
    color: var(--dm-text-primary);
}

.dark-mode .record-narrative-tabs .nav-link {
    border-color: var(--dm-border);
    background: var(--dm-bg-elevated);
    color: var(--dm-text-secondary);
}

.dark-mode .record-narrative-tabs .nav-link.active {
    border-color: var(--dm-accent);
    background: var(--dm-bg-active);
    color: var(--dm-text-primary);
}

.dark-mode .record-case-pane-profile #internalCommentsTable tbody tr:hover {
    background: var(--dm-bg-hover) !important;
}

@media (min-width: 768px) and (max-width: 1199.98px) {
    .record-profile-rail-physical-fields {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .record-history-card-list,
    .prior-work-card-record-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-narrative-tabs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .record-narrative-expanded-modal #internalCommentsTable {
        min-width: 46rem;
    }
}

@media (max-width: 575.98px) {
    .record-profile-rail-definition-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-profile-rail-physical-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-profile-rail-form-actions {
        justify-content: flex-start;
    }

    .record-narrative-expanded-modal .modal-dialog {
        margin: .4rem;
    }

    .record-narrative-expanded-modal .record-narrative-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1199.98px) {
    .record-history-comparison-panel,
    .record-validated-comparison-panel {
        top: auto;
        right: 1rem;
        bottom: calc(8rem + env(safe-area-inset-bottom));
        left: calc(var(--app-sidebar-collapsed-width, 72px) + 1rem);
        width: auto;
        max-width: none;
        max-height: min(
            52dvh,
            max(
                3rem,
                calc(100dvh - var(--record-case-topbar-height) - 4.5rem - 8rem - env(safe-area-inset-bottom) - .5rem)
            )
        );
    }
}

@media (max-width: 991.98px) {
    .record-history-comparison-panel,
    .record-validated-comparison-panel {
        right: .75rem;
        left: .75rem;
    }
}

@media (max-width: 575.98px) {
    .record-history-comparison-panel,
    .record-validated-comparison-panel {
        right: .5rem;
        left: .5rem;
        border-radius: .65rem;
    }

    .record-history-compare-toggle span,
    .record-validated-compare-toggle span {
        display: none;
    }
}

/* ========================================================================
   Case page phase 4: center analyst workspace
   ======================================================================== */

.record-case-pane-actions {
    container-name: record-actions;
    container-type: inline-size;
}

.record-analyst-workspace,
.record-person-search-shell,
.record-result-navigation,
.record-result-content,
.record-person-search-card,
.record-search-control-deck,
.record-recommendations-workspace,
.record-recommendations-list,
.record-add-drawer-surface,
.record-add-form {
    min-width: 0;
}

.record-analyst-workspace {
    /* clip, not hidden: the card still clips to its radius, but stays out of
       the scroll chain so sticky controls inside the tabs pin to the page. */
    overflow: clip;
    padding: 0 !important;
}

.record-analyst-header,
.record-recommendations-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.record-analyst-header {
    padding: 1rem 1rem .8rem;
}

.record-analyst-heading {
    min-width: 0;
}

.record-analyst-heading h2,
.record-person-search-header h2,
.record-recommendations-header h2 {
    margin: 0;
    color: var(--bs-body-color);
    text-align: left;
}

.record-analyst-heading h2,
.record-recommendations-header h2 {
    font-size: 1.08rem;
    font-weight: 800;
}

.record-person-search-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
}

.record-analyst-heading > p:last-child,
.record-person-search-header > div > p:last-child,
.record-recommendations-header > div > p:last-child {
    margin: .25rem 0 0;
    color: var(--bs-secondary-color);
    font-size: .76rem;
    line-height: 1.4;
}

#researchWorkspaceTitle {
    margin: 0 0 .18rem;
    color: var(--bs-secondary-color);
    font-size: .8rem;
    font-weight: 850;
    letter-spacing: .075em;
    line-height: 1.2;
    text-transform: uppercase;
}

.record-analyst-header-actions,
.record-recommendations-header-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
}

.record-analyst-readonly {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 2rem;
    padding: .3rem .55rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: .7rem;
    font-weight: 750;
    white-space: nowrap;
}

.record-analyst-evidence-boundary,
.record-recommendations-boundary,
.record-add-modal-guidance {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    color: var(--bs-secondary-color);
    font-size: .72rem;
    line-height: 1.45;
}

.record-analyst-evidence-boundary {
    margin: 0 1rem .8rem;
    padding: .6rem .7rem;
    border-left: 3px solid var(--bs-info);
    border-radius: .35rem;
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 72%, transparent);
}

#osintContainer > .record-analyst-evidence-boundary {
    margin: 0 0 .8rem;
}

.record-result-navigation {
    margin: 0 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem .75rem 0 0;
    background: var(--bs-tertiary-bg);
}

.record-result-navigation-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .7rem .4rem;
    color: var(--bs-secondary-color);
}

.record-result-navigation-copy {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .3rem .55rem;
    min-width: 0;
}

.record-result-navigation-title {
    color: var(--bs-body-color);
    font-size: .9rem;
    font-weight: 800;
}

.record-result-navigation-meta {
    font-size: .68rem;
    font-weight: 650;
}

.record-run-analysis-action {
    flex: 0 0 auto;
    white-space: nowrap;
}

#recordTabs {
    display: flex;
    flex-wrap: nowrap;
    gap: .35rem;
    max-width: 100%;
    padding: .25rem .45rem .55rem;
    overflow-x: auto;
    border: 0;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
}

#recordTabs .nav-item {
    flex: 0 0 auto;
}

#recordTabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 2.35rem;
    padding: .45rem .62rem;
    border: 1px solid transparent;
    border-radius: .55rem;
    color: var(--bs-secondary-color);
    font-size: .72rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}

#recordTabs .nav-link:hover {
    border-color: var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 35%, transparent);
    color: var(--bs-body-color);
}

#recordTabs .nav-link.active {
    border-color: color-mix(in srgb, var(--bs-primary) 50%, var(--bs-border-color));
    background: var(--bs-body-bg);
    color: var(--bs-primary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

#recordTabs .badge {
    margin-left: .08rem !important;
}

.record-result-content {
    margin: 0 1rem;
    padding: 1rem 0 .9rem;
}

.record-advanced-evidence {
    display: grid;
    gap: .75rem;
    min-width: 0;
}

.record-advanced-evidence-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    background: color-mix(in srgb, var(--bs-tertiary-bg) 78%, transparent);
}

.record-advanced-evidence-heading {
    min-width: 0;
}

.record-advanced-evidence-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-bottom: .22rem;
    color: var(--bs-primary);
    font-size: .61rem;
    font-weight: 850;
    letter-spacing: .055em;
    line-height: 1.2;
    text-transform: uppercase;
}

.record-advanced-evidence-heading h2 {
    margin: 0;
    color: var(--bs-body-color);
    font-size: 1rem;
    font-weight: 800;
    text-align: left;
}

.record-advanced-evidence-heading p {
    max-width: 48rem;
    margin: .28rem 0 0;
    color: var(--bs-secondary-color);
    font-size: .72rem;
    line-height: 1.45;
}

.record-advanced-evidence-summary {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .35rem;
}

.record-advanced-evidence-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 1.75rem;
    padding: .25rem .48rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-body-bg);
    color: var(--bs-secondary-color);
    font-size: .65rem;
    font-weight: 700;
    white-space: nowrap;
}

.record-advanced-evidence-chip-link {
    text-decoration: none;
    color: var(--bs-link-color);
    border-color: var(--bs-link-color);
}

.record-advanced-evidence-chip-link:hover,
.record-advanced-evidence-chip-link:focus-visible {
    background: var(--bs-tertiary-bg);
    color: var(--bs-link-hover-color);
}

.record-advanced-evidence-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: .5rem;
    margin: 0;
    padding: .7rem .8rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--bs-body-bg);
}

.record-advanced-evidence-metadata > div {
    min-width: 0;
}

.record-advanced-evidence-metadata dt {
    margin-bottom: .12rem;
    color: var(--bs-secondary-color);
    font-size: .58rem;
    font-weight: 850;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.record-advanced-evidence-metadata dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--bs-body-color);
    font-size: .72rem;
    font-weight: 650;
    line-height: 1.35;
}

.record-advanced-evidence-boundary {
    margin: 0;
}

.record-advanced-evidence-notice {
    padding: .55rem .65rem;
    border: 1px solid color-mix(in srgb, var(--bs-info) 35%, var(--bs-border-color));
    border-radius: .55rem;
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 58%, transparent);
    color: var(--bs-secondary-color);
    font-size: .68rem;
    line-height: 1.4;
}

.record-advanced-evidence-notice-neutral {
    border-color: var(--bs-border-color);
    background: var(--bs-tertiary-bg);
}

.record-advanced-evidence-results {
    display: grid;
    gap: .55rem;
}

.record-advanced-evidence-result {
    overflow: hidden;
    border: 1px solid var(--bs-border-color) !important;
    border-radius: .65rem !important;
    background: var(--bs-body-bg);
}

.record-advanced-evidence-result > .accordion-header {
    position: static;
    z-index: auto;
}

.record-advanced-evidence-result .accordion-button {
    display: flex;
    gap: .45rem;
    min-width: 0;
    padding: .62rem .72rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-size: .74rem;
    box-shadow: none;
}

.record-advanced-evidence-result .accordion-button:not(.collapsed) {
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 42%, var(--bs-tertiary-bg));
    color: var(--bs-body-color);
}

.record-advanced-evidence-role,
.record-advanced-evidence-provider {
    flex: 0 0 auto;
    border-radius: 999px;
    font-size: .58rem;
    font-weight: 850;
    letter-spacing: .035em;
    line-height: 1.2;
    text-transform: uppercase;
}

.record-advanced-evidence-role {
    padding: .22rem .38rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-secondary-color);
}

.record-advanced-evidence-role.is-primary {
    border-color: color-mix(in srgb, var(--bs-primary) 42%, var(--bs-border-color));
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.record-advanced-evidence-provider {
    color: var(--bs-primary);
}

.record-advanced-evidence-result-name {
    min-width: 0;
    overflow: hidden;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-advanced-evidence-result-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .32rem .75rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: .66rem;
}

.record-advanced-evidence-result-meta span {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
}

.record-advanced-evidence .advanced-provider-heading {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0;
    padding: .58rem .75rem;
    background: color-mix(in srgb, var(--bs-tertiary-bg) 72%, transparent);
}

.record-advanced-evidence .advanced-provider-title {
    margin: 0;
    color: var(--bs-body-color);
    font-size: .75rem;
    font-weight: 750;
}

.record-advanced-evidence .advanced-provider-hint {
    color: var(--bs-secondary-color);
    font-size: .65rem;
    font-weight: 500;
}

.record-advanced-evidence .advanced-provider-collapsible > summary {
    cursor: pointer;
    list-style-position: inside;
}

.record-advanced-evidence .advanced-provider-note {
    margin: 0;
    padding: .45rem .75rem;
    border-top: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: .67rem;
}

.record-advanced-evidence .advanced-provider-row {
    display: grid;
    grid-template-columns: minmax(10rem, .75fr) minmax(0, 1.6fr);
    gap: .6rem;
    padding: .45rem .75rem;
    border-top: 1px solid var(--bs-border-color);
    font-size: .7rem;
    line-height: 1.35;
}

.record-advanced-evidence .advanced-provider-primary {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--bs-body-color);
    font-weight: 700;
}

.record-advanced-evidence .advanced-provider-secondary {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--bs-secondary-color);
}

.record-advanced-evidence .advanced-provider-row-details {
    margin-top: .3rem;
}

.record-advanced-evidence .advanced-provider-row-details > summary {
    color: var(--bs-link-color);
    cursor: pointer;
    font-weight: 700;
}

.record-advanced-evidence .advanced-provider-detail-list {
    margin-top: .35rem;
    padding-left: .65rem;
    border-left: 2px solid var(--bs-border-color);
}

.record-advanced-evidence .advanced-provider-detail-item {
    display: grid;
    grid-template-columns: minmax(7rem, .45fr) minmax(0, 1fr);
    gap: .4rem;
    padding: .15rem 0;
}

.record-advanced-evidence .advanced-provider-detail-item dt {
    color: var(--bs-body-color);
    font-weight: 700;
}

.record-advanced-evidence .advanced-provider-detail-item dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.record-advanced-evidence-comprehensive {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .75rem;
    border-block: 1px solid var(--bs-border-color);
}

.record-advanced-evidence-comprehensive h4 {
    margin: 0;
    font-size: .76rem;
    font-weight: 800;
}

.record-advanced-evidence-comprehensive p {
    margin: .18rem 0 0;
    color: var(--bs-secondary-color);
    font-size: .66rem;
}

.record-advanced-evidence-empty {
    display: grid;
    justify-items: center;
    gap: .35rem;
    padding: 2rem 1rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: .65rem;
    color: var(--bs-secondary-color);
    text-align: center;
}

.record-advanced-evidence-empty i {
    font-size: 1.25rem;
}

.record-advanced-evidence-empty p {
    margin: 0;
    font-size: .72rem;
}

@media (max-width: 760px) {
    .record-advanced-evidence-header {
        display: grid;
    }

    .record-advanced-evidence-summary {
        justify-content: flex-start;
    }

    .record-advanced-evidence .advanced-provider-row,
    .record-advanced-evidence .advanced-provider-detail-item {
        grid-template-columns: 1fr;
        gap: .12rem;
    }

    .record-advanced-evidence .advanced-provider-hint {
        display: none;
    }
}

.record-provider-results {
    position: relative;
    min-width: 0;
}

.record-provider-findings-body {
    position: relative;
    min-width: 0;
}

.record-provider-previous-vehicles > summary {
    margin-bottom: 0;
    padding-block: .25rem;
    cursor: pointer;
}

.record-provider-previous-vehicles[open] > summary {
    margin-bottom: .5rem;
}

.record-provider-previous-vehicles:not([open]) > summary .previous-vehicles-hide,
.record-provider-previous-vehicles[open] > summary .previous-vehicles-show {
    display: none;
}

@media (pointer: coarse) {
    .record-provider-previous-vehicles > summary {
        min-height: 44px;
        align-content: center;
    }
}

.record-analyst-workspace .record-provider-results-scroll {
    /* Keep expanded matches and reports below the provider controls. */
    max-height: min(1500px, 80vh);
    max-height: min(1500px, 80dvh);
    overflow-y: auto;
    overscroll-behavior-y: auto;
    scrollbar-gutter: stable;
    min-width: 0;
}

.record-analyst-workspace .record-provider-results-scroll:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.record-analyst-workspace .record-provider-results-scroll .accordion-item > .accordion-header {
    /* Match headings now pin to the results area instead of the case bar. */
    top: 0;
}

.record-provider-results-header {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) max-content;
    align-items: end;
    gap: .6rem;
    min-width: 0;
    margin-bottom: .55rem;
    padding: .55rem .65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--bs-tertiary-bg);
}

.record-provider-history-control,
.record-provider-workflow-messages {
    min-width: 0;
}

.record-provider-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .18rem;
}

.record-provider-history-control label {
    display: block;
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .62rem;
    font-weight: 750;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.record-provider-current-count {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: var(--bs-secondary-color);
    font-size: .61rem;
    font-weight: 750;
    letter-spacing: .025em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.record-provider-current-count .badge {
    font-size: .62rem;
}

.record-provider-history-control .form-select {
    min-width: 0;
}

.record-provider-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .4rem;
}

.record-provider-header-actions .btn {
    white-space: nowrap;
}

.record-provider-workflow-strip {
    display: grid;
    grid-template-columns: auto minmax(11rem, auto) minmax(0, 1fr);
    align-items: center;
    gap: .55rem .7rem;
    min-width: 0;
    margin-bottom: .55rem;
    padding: .48rem .6rem;
    border: 1px solid color-mix(in srgb, var(--bs-info) 42%, var(--bs-border-color));
    border-radius: .58rem;
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 45%, var(--bs-body-bg));
}

.record-provider-workflow-state,
.record-provider-workflow-phases,
.record-provider-workflow-phase {
    display: inline-flex;
    align-items: center;
}

.record-provider-workflow-state {
    gap: .38rem;
}

.record-provider-workflow-label,
.record-provider-workflow-key {
    color: var(--bs-secondary-color);
    font-size: .61rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.record-provider-workflow-phases {
    flex-wrap: wrap;
    gap: .4rem;
    min-width: 0;
}

.record-provider-workflow-phase {
    gap: .28rem;
    min-width: 0;
    font-size: .68rem;
}

.record-provider-workflow-phase strong {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--bs-body-color);
    font-size: .7rem;
}

.record-provider-workflow-arrow {
    flex: 0 0 auto;
    color: var(--bs-secondary-color);
    font-size: .72rem;
}

.record-provider-workflow-messages {
    display: grid;
    gap: .08rem;
    color: var(--bs-secondary-color);
    font-size: .65rem;
    line-height: 1.32;
}

.record-provider-workflow-messages > :first-child {
    color: var(--bs-body-color);
    font-weight: 650;
}

.record-provider-result-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    min-width: 0;
}

.record-provider-triage-pills,
.record-provider-selection-toolbar {
    align-items: center;
    flex-wrap: wrap;
    gap: .38rem;
    min-width: 0;
    margin-bottom: .55rem;
    padding: .35rem .45rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .55rem;
    background: var(--bs-tertiary-bg);
}

.record-provider-triage-pills {
    flex: 1 1 17rem;
}

.record-provider-selection-toolbar {
    flex: 0 1 auto;
}

.record-provider-selection-toolbar .form-check {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    min-height: 1.9rem;
    padding-left: 1.35rem;
}

.record-provider-selection-toolbar .btn,
.record-provider-triage-pills .btn {
    white-space: nowrap;
}

.record-person-search-shell {
    margin: 0 1rem .85rem;
    padding: .7rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: color-mix(in srgb, var(--bs-tertiary-bg) 72%, transparent);
}

.record-person-search-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: .55rem;
}

.record-person-search-header-actions {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .45rem;
}

.record-search-form-toggle {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: .3rem;
}

.record-search-history {
    position: relative;
}

.record-search-history-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: .55rem;
    min-height: 2rem;
    padding: .3rem .55rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .4rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: .72rem;
    text-align: left;
}

.record-search-history-toggle:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.record-search-history-panel {
    position: absolute;
    top: calc(100% + .35rem);
    right: -128px;
    z-index: 1060;
    display: none;
    width: min(34rem, calc(100vw - 3rem));
    max-height: min(28rem, 70vh);
    padding: .6rem .7rem;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: .65rem;
    background: var(--bs-body-bg);
    box-shadow: 0 14px 32px rgba(15, 23, 42, .2);
}

.record-search-history-panel.is-open {
    display: block;
}

.record-search-history-pagination {
    gap: .75rem;
}

.record-person-search-card {
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.record-person-search-card-body {
    padding: 0;
}

.record-search-field-grid {
    --bs-gutter-x: .5rem;
    --bs-gutter-y: .45rem;
    margin-bottom: .45rem !important;
}

.record-search-field-with-help .form-control {
    padding-right: 2rem;
}

.record-search-field-tooltip-container {
    position: absolute;
    top: .25rem;
    right: .3rem;
    z-index: 2;
}

.record-search-field-tooltip-trigger {
    width: 1.6rem;
    min-width: 1.6rem;
    height: 1.6rem;
    font-size: .72rem;
}

.record-search-more-fields {
    line-height: 1.2;
}

.record-search-control-deck {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .65rem 1.35rem;
    margin-top: .55rem;
    padding-top: .55rem;
    border-top: 1px solid var(--bs-border-color);
}

.record-search-control-group {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.record-search-control-label {
    display: block;
    margin-bottom: .28rem;
    color: var(--bs-secondary-color);
    font-size: .61rem;
    font-weight: 850;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.record-search-option-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .3rem .7rem;
    min-width: 0;
}

.record-search-option-row .form-check-inline {
    margin-right: 0;
}

.record-search-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-left: auto;
}

.record-search-primary-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
}

.record-search-status {
    border-color: var(--bs-border-color) !important;
    background: var(--bs-tertiary-bg) !important;
}

.record-search-billing {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .18rem .32rem;
    min-height: 1.25rem;
    margin-top: .2rem;
    color: var(--bs-secondary-color);
    font-size: .67rem;
    line-height: 1.25;
}

.record-search-billing[hidden] {
    display: none !important;
}

.record-search-billing > .bi {
    font-size: .7rem;
    opacity: .72;
}

.record-search-billing-label {
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.record-search-billing-values {
    color: var(--bs-secondary-color);
}

.record-search-billing-separator {
    width: 1px;
    height: .7rem;
    margin: 0 .08rem;
    background: var(--bs-border-color);
}

.record-search-billing-action {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    min-height: 0;
    padding: 0 .1rem;
    border: 0;
    font-size: .65rem;
    line-height: 1.2;
    text-decoration: none;
}

.record-search-billing-action:hover {
    text-decoration: underline;
}

.record-recommendations-workspace {
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    border-radius: .85rem;
    background: var(--bs-body-bg);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.record-recommendations-header {
    padding: .9rem 1rem .8rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-info-bg-subtle) 44%, var(--bs-body-bg));
}

.record-recommendations-body {
    min-width: 0;
    padding: .9rem 1rem 1rem;
}

.record-recommendations-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    min-height: 7rem;
    color: var(--bs-secondary-color);
    text-align: center;
}

.record-recommendations-state p {
    margin: 0;
}

.record-recommendations-state-icon {
    font-size: 1.7rem;
}

.record-recommendations-boundary {
    margin-bottom: .75rem;
    padding: .6rem .7rem;
    border: 1px solid color-mix(in srgb, var(--bs-info) 30%, var(--bs-border-color));
    border-radius: .55rem;
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
}

.record-recommendations-list,
#pendingRecordsTable,
#pending-records-tbody {
    display: block;
    width: 100%;
    max-width: 100%;
}

#pendingRecordsTable {
    margin: 0;
    border: 0;
}

#pending-records-tbody {
    display: grid;
    gap: .65rem;
}

.record-recommendation-card {
    display: grid;
    grid-template-areas:
        "confidence sources type actions"
        "value value rationale rationale";
    grid-template-columns: minmax(5.5rem, auto) minmax(8rem, .9fr) minmax(8rem, .9fr) auto;
    gap: .55rem .75rem;
    min-width: 0;
    padding: .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    background: var(--bs-tertiary-bg);
    box-shadow: 0 3px 10px rgba(15, 23, 42, .04);
}

.record-recommendation-card:hover {
    border-color: color-mix(in srgb, var(--bs-primary) 36%, var(--bs-border-color));
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 20%, var(--bs-tertiary-bg));
}

.record-recommendation-card td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--bs-body-color);
    text-align: left !important;
    overflow-wrap: anywhere;
}

.record-recommendation-card td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .18rem;
    color: var(--bs-secondary-color);
    font-size: .58rem;
    font-weight: 850;
    letter-spacing: .055em;
    line-height: 1.2;
    text-transform: uppercase;
}

.record-recommendation-confidence { grid-area: confidence; }
.record-recommendation-sources { grid-area: sources; }
.record-recommendation-type { grid-area: type; }
.record-recommendation-value { grid-area: value; }
.record-recommendation-rationale { grid-area: rationale; }
.record-recommendation-actions { grid-area: actions; }

.record-recommendation-card .badge.fs-6 {
    font-size: .78rem !important;
}

.record-recommendation-card .record-content {
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: .83rem;
    font-weight: 750;
    line-height: 1.35;
}

.record-recommendation-card .fr-clamp {
    -webkit-line-clamp: 3;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.record-recommendation-action-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .35rem;
}

.record-recommendation-status {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    line-height: 1.35;
}

.record-add-drawer-surface {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 .5rem 2rem rgba(15, 23, 42, .18);
    border-color: var(--bs-border-color);
}

.record-add-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 40%, var(--bs-body-bg));
}

.record-add-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 1rem;
}

.record-add-modal-guidance {
    margin-bottom: .9rem;
    padding: .65rem .75rem;
    border-left: 3px solid var(--bs-success);
    border-radius: .4rem;
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
}

.record-add-form {
    padding: .9rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    background: var(--bs-tertiary-bg);
}

.record-add-modal .add-record-gated.col-md-10 {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
}

.record-add-modal .custom-tooltip {
    min-width: min(28rem, calc(100vw - 3rem)) !important;
    max-width: min(42rem, calc(100vw - 3rem)) !important;
}

.record-add-modal-actions {
    position: sticky;
    bottom: -1rem;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-inline: -.9rem;
    padding: .75rem .9rem;
    border-top: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-tertiary-bg) 94%, transparent);
    backdrop-filter: blur(8px);
}

.record-analyst-workspace :is(a, button, input, select, textarea):focus-visible,
.record-recommendations-workspace :is(a, button, input, select, textarea):focus-visible,
.record-add-modal :is(a, button, input, select, textarea):focus-visible,
#rejectReasonModal :is(button, textarea):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 72%, transparent);
    outline-offset: 2px;
}

.dark-mode .record-person-search-shell,
.dark-mode .record-result-navigation,
.dark-mode .record-search-history-panel,
.dark-mode .record-provider-results-header,
.dark-mode .record-provider-triage-pills,
.dark-mode .record-provider-selection-toolbar,
.dark-mode .record-recommendations-workspace,
.dark-mode .record-recommendation-card,
.dark-mode .record-add-form {
    border-color: var(--dm-border);
    background: var(--dm-bg-elevated);
}

.dark-mode #recordTabs .nav-link.active {
    border-color: var(--dm-accent);
    background: var(--dm-bg-active);
    color: var(--dm-text-primary);
}

.dark-mode .record-provider-workflow-strip {
    border-color: color-mix(in srgb, var(--dm-accent) 42%, var(--dm-border));
    background: color-mix(in srgb, var(--dm-bg-active) 58%, var(--dm-bg-surface));
}

.dark-mode .record-analyst-evidence-boundary,
.dark-mode .record-recommendations-header,
.dark-mode .record-add-modal-header {
    border-color: var(--dm-border);
    background: color-mix(in srgb, var(--dm-bg-surface) 90%, var(--dm-accent) 10%);
}

.dark-mode .record-recommendations-boundary {
    border-color: color-mix(in srgb, var(--dm-accent) 45%, var(--dm-border));
    background: color-mix(in srgb, var(--dm-bg-active) 75%, var(--dm-bg-surface));
    color: var(--dm-text-primary);
}

.dark-mode .record-recommendation-card:hover {
    border-color: var(--dm-accent);
    background: var(--dm-bg-hover) !important;
}

.dark-mode .record-add-drawer-surface,
.dark-mode #rejectReasonModal .modal-content {
    border-color: var(--dm-border);
    background: var(--dm-bg-surface);
    color: var(--dm-text-primary);
}

.dark-mode .record-add-modal-guidance {
    background: color-mix(in srgb, var(--dm-bg-active) 72%, var(--dm-bg-surface));
    color: var(--dm-text-primary);
}

.dark-mode .record-add-modal-actions {
    border-color: var(--dm-border);
    background: color-mix(in srgb, var(--dm-bg-elevated) 94%, transparent);
}

@container record-actions (max-width: 42rem) {
    .record-analyst-header,
    .record-person-search-header,
    .record-selected-matches-header,
    .record-recommendations-header {
        align-items: stretch;
        flex-direction: column;
    }

    .record-analyst-header-actions,
    .record-person-search-header-actions,
    .record-selected-matches-actions,
    .record-recommendations-header-actions {
        justify-content: flex-start;
    }

    #unified-search-form .row > [class*="col-md-"] {
        flex: 0 0 50%;
        width: 50%;
        max-width: 50%;
    }

    .record-search-control-deck {
        align-items: flex-start;
    }

    .record-search-actions {
        justify-content: flex-start;
        margin-left: 0;
    }

    .record-provider-workflow-strip {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .record-provider-workflow-messages {
        grid-column: 1 / -1;
    }

    .record-recommendation-card {
        grid-template-areas:
            "confidence sources"
            "type actions"
            "value value"
            "rationale rationale";
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-recommendation-action-group {
        justify-content: flex-start;
    }
}

@container record-actions (max-width: 42rem) {
    .record-provider-results-header {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-provider-header-actions {
        grid-column: auto;
        justify-content: flex-start;
    }
}

@container record-actions (max-width: 34rem) {
    .record-result-navigation-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .record-result-navigation-meta {
        display: none;
    }

    #unified-search-form .row > [class*="col-md-"] {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }

    .record-search-actions,
    .record-search-primary-actions,
    .record-run-analysis-action {
        width: 100%;
    }

    .record-search-primary-actions {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    }

    .record-person-search-header-actions,
    .record-selected-matches-actions,
    #search-history-container,
    .record-search-history,
    .record-search-history-toggle {
        width: 100%;
    }

    .record-selected-matches-actions .btn {
        flex: 1 1 auto;
    }

    .record-selected-analysis-guidance-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: .2rem;
    }

    .record-selected-analysis-purpose-options,
    .record-selected-related-context,
    .record-selected-relevance-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-selected-analysis-guidance-count {
        align-self: flex-end;
    }

    .record-search-option-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .record-provider-results-header,
    .record-provider-workflow-strip {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-provider-header-actions,
    .record-provider-workflow-messages {
        grid-column: auto;
        justify-content: flex-start;
    }

    .record-provider-triage-pills {
        flex: 1 1 100%;
        flex-wrap: nowrap;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
    }

    .record-provider-selection-toolbar {
        flex: 1 1 100%;
    }

    .record-provider-selection-toolbar .btn {
        flex: 1 1 auto;
    }

    .record-recommendation-card {
        grid-template-areas:
            "confidence"
            "sources"
            "type"
            "value"
            "rationale"
            "actions";
        grid-template-columns: minmax(0, 1fr);
    }

    .record-recommendation-action-group .btn {
        flex: 1 1 auto;
    }
}

@media (max-width: 575.98px) {
    .record-analyst-header,
    .record-recommendations-header,
    .record-recommendations-body {
        padding-inline: .75rem;
    }

    .record-analyst-evidence-boundary,
    .record-person-search-shell,
    .record-result-navigation,
    .record-result-content {
        margin-inline: .75rem;
    }

    .record-analyst-header-actions .btn,
    .record-recommendations-header-actions .btn {
        flex: 1 1 auto;
    }

    .record-add-modal .modal-body,
    .record-add-form {
        padding: .75rem;
    }

    .record-add-modal-actions {
        bottom: -.75rem;
        margin-inline: -.75rem;
        padding-inline: .75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .record-case-context *,
    .record-case-workbench *,
    .record-add-modal *,
    #rejectReasonModal * {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ========================================================================
   Case page phase 6: privileged surfaces and collision-safe assistant dock
   ======================================================================== */

.case-floating-tools {
    position: fixed;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: calc(var(--app-sidebar-width, 244px) + 1rem);
    z-index: 1040;
    display: flex;
    align-items: flex-end;
    gap: .65rem;
    max-width: calc(100vw - var(--app-sidebar-width, 244px) - 2rem);
    pointer-events: none;
}

.sidebar-collapsed .case-floating-tools {
    left: calc(var(--app-sidebar-collapsed-width, 72px) + 1rem);
    max-width: calc(100vw - var(--app-sidebar-collapsed-width, 72px) - 2rem);
}

.case-floating-tools > * {
    pointer-events: auto;
}

.case-floating-tools .ai-chat-window {
    max-width: calc(100vw - var(--app-sidebar-width, 244px) - 2rem);
    max-height: calc(100dvh - var(--app-topbar-height, 56px) - 2rem);
    min-height: min(400px, calc(100dvh - var(--app-topbar-height, 56px) - 2rem));
}

.sidebar-collapsed .case-floating-tools .ai-chat-window {
    max-width: calc(100vw - var(--app-sidebar-collapsed-width, 72px) - 2rem);
}

.case-floating-tools .ai-chat-window.ai-chat-window-expanded {
    max-width: none;
    max-height: none;
}

.case-floating-tools :is(button, [href]):focus-visible,
#casePrivilegedToolsModal :is(button, [href], [tabindex="0"]):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 76%, transparent);
    outline-offset: 2px;
}

.case-privileged-tools-dialog {
    width: calc(100vw - 2rem);
    max-width: min(1600px, calc(100vw - 2rem));
    height: calc(100dvh - 2rem);
    margin: 1rem auto;
}

.case-privileged-tools-dialog .modal-content {
    min-height: 0;
    max-height: calc(100dvh - 2rem);
}

.case-privileged-tools-dialog .modal-body {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.case-privileged-tools-kicker {
    display: block;
    margin-bottom: .15rem;
    color: var(--bs-secondary-color);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.case-privileged-tools-tabs {
    gap: .35rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.case-privileged-tools-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.case-privileged-tools-content,
.case-privileged-tools-content > .tab-pane {
    min-width: 0;
}

.case-privileged-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.case-cost-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .75rem;
}

.case-cost-summary-grid > div {
    display: grid;
    align-content: start;
    gap: .3rem;
    min-width: 0;
    padding: .9rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .7rem;
    background: var(--bs-tertiary-bg);
}

.case-cost-summary-grid span {
    color: var(--bs-secondary-color);
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.case-cost-summary-grid strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: clamp(1.15rem, 2vw, 1.6rem);
}

.dark-mode .case-privileged-tools-dialog .modal-content,
.dark-mode .case-cost-summary-grid > div {
    color: var(--dm-text-primary);
    background: var(--dm-bg-surface);
    border-color: var(--dm-border-light);
}

@media (max-width: 1199.98px) {
    .case-floating-tools,
    .sidebar-collapsed .case-floating-tools {
        left: calc(var(--app-sidebar-collapsed-width, 72px) + 1rem);
        max-width: calc(100vw - var(--app-sidebar-collapsed-width, 72px) - 2rem);
    }

    .case-floating-tools .ai-chat-window,
    .sidebar-collapsed .case-floating-tools .ai-chat-window {
        max-width: calc(100vw - var(--app-sidebar-collapsed-width, 72px) - 2rem);
    }

    .case-cost-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .case-floating-tools,
    .sidebar-collapsed .case-floating-tools {
        right: .75rem;
        bottom: max(.75rem, env(safe-area-inset-bottom));
        left: .75rem;
        justify-content: space-between;
        max-width: none;
    }

    .sidebar-open .case-floating-tools {
        visibility: hidden;
        pointer-events: none;
    }

    .case-floating-tools .ai-chat-window,
    .sidebar-collapsed .case-floating-tools .ai-chat-window {
        width: min(800px, calc(100vw - 1.5rem));
        max-width: calc(100vw - 1.5rem);
        height: min(600px, calc(100dvh - 7rem));
        max-height: calc(100dvh - 7rem);
        min-width: 0;
        min-height: 0;
    }

    .case-privileged-tools-dialog {
        width: 100%;
        max-width: none;
        height: 100dvh;
        margin: 0;
    }

    .case-privileged-tools-dialog .modal-content {
        min-height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
    }

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

@media (max-width: 575.98px) {
    .case-floating-tools {
        gap: .5rem;
    }

    .case-floating-tools .ai-chat-window,
    .sidebar-collapsed .case-floating-tools .ai-chat-window {
        position: fixed;
        inset: max(.75rem, env(safe-area-inset-top)) .75rem calc(4.75rem + env(safe-area-inset-bottom));
        width: auto;
        height: auto;
        max-width: none;
        max-height: none;
        transform: none;
        animation: none;
        border-radius: .8rem;
    }

    .case-floating-tools .ai-chat-window.ai-chat-window-expanded {
        inset: max(.5rem, env(safe-area-inset-top)) .5rem max(.5rem, env(safe-area-inset-bottom));
    }

    .case-floating-tools .ai-chat-body {
        position: relative;
    }

    .case-floating-tools .ai-history-sidebar.ai-history-sidebar-open {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 5;
        width: min(18rem, 82vw);
        min-width: 0;
        box-shadow: .75rem 0 1.5rem rgba(15, 23, 42, .2);
    }

    .qa-review-fab {
        max-width: calc(100vw - 5rem);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .case-privileged-tools-tabs,
    .case-privileged-panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .case-privileged-tools-tabs .nav-link,
    .case-privileged-panel-heading .btn {
        justify-content: center;
        width: 100%;
    }

    .case-cost-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .case-floating-tools *,
    #casePrivilegedToolsModal * {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ========================================================================
   Case page phase 7: compact navigation and interaction hardening
   ======================================================================== */

[data-record-section-nav] {
    display: none;
}

.record-case-workbench {
    container-name: record-case-workbench;
    container-type: inline-size;
}

.record-case-pane {
    scroll-margin-top: calc(var(--record-case-topbar-height) + 4.5rem);
}

[data-record-section-link]:focus-visible,
.ai-history-session-btn:focus-visible,
.tooltip-icon:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 72%, transparent);
    outline-offset: 2px;
}

#caseProfilePane:focus-visible,
#caseActionsPane:focus-visible,
#caseEvidencePane:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--app-focus-ring, #60a5fa) 58%, transparent);
    outline-offset: .25rem;
}

.ai-history-session-btn {
    min-width: 0;
    border: 0;
    padding: .2rem;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.ai-history-session-btn[aria-current="true"] {
    font-weight: 700;
}

@container record-case-workbench (min-width: 76rem) {
    .record-case-grid {
        grid-template-columns:
            var(--record-case-profile-rail)
            var(--record-case-action-column)
            var(--record-case-evidence-rail);
    }

    .record-case-grid > :is(.record-case-pane-profile) {
        grid-column: 1;
        grid-row: 1;
    }

    .record-case-grid > :is(.record-case-pane-actions) {
        grid-column: 2;
        grid-row: 1;
    }

    .record-case-grid > :is(.record-case-pane-evidence) {
        grid-column: 3;
        grid-row: 1;
    }

    .record-case-pane-evidence .case-workspace-section {
        max-width: none;
    }
}

@media (max-width: 1199.98px) {
    [data-record-section-nav] {
        position: sticky;
        top: calc(var(--app-topbar-height, 56px) + .5rem);
        z-index: 1015;
        display: flex;
        align-items: center;
        gap: .4rem;
        max-width: 100%;
        margin: 0 0 var(--record-case-pane-gap);
        padding: .45rem;
        overflow-x: auto;
        border: 1px solid var(--bs-border-color);
        border-radius: .7rem;
        background: color-mix(in srgb, var(--bs-body-bg) 94%, var(--bs-primary) 6%);
        box-shadow: 0 8px 18px rgba(15, 23, 42, .1);
        scrollbar-width: thin;
    }

    .record-case-section-nav-label {
        flex: 0 0 auto;
        padding-inline: .25rem;
        color: var(--bs-secondary-color);
        font-size: .7rem;
        font-weight: 800;
        letter-spacing: .045em;
        text-transform: uppercase;
    }

    [data-record-section-link] {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        min-height: 2.4rem;
        padding: .45rem .7rem;
        border: 1px solid var(--bs-border-color);
        border-radius: .55rem;
        background: var(--bs-body-bg);
        color: var(--bs-body-color);
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.15;
        text-decoration: none;
        white-space: nowrap;
    }

    [data-record-section-link][aria-current="location"] {
        border-color: color-mix(in srgb, var(--bs-primary) 70%, var(--bs-border-color));
        background: color-mix(in srgb, var(--bs-primary) 14%, var(--bs-body-bg));
        color: var(--bs-primary-text-emphasis);
    }

    .record-workspace .scroll-to-top-btn {
        bottom: calc(4.5rem + env(safe-area-inset-bottom));
    }
}

@media screen and (max-width: 575.98px) {
    .record-add-modal .custom-tooltip {
        right: auto;
        left: 0;
        width: min(18rem, calc(100vw - 3rem));
        min-width: min(18rem, calc(100vw - 3rem)) !important;
        max-width: calc(100vw - 3rem);
        max-height: min(25rem, 60dvh);
        overflow: auto;
    }
}

@media (max-width: 991.98px) and (pointer: coarse) {
    .app-mobile-menu-button,
    [data-record-section-link],
    .record-case-status-control .form-select,
    .record-case-context :is(.btn, .dropdown-toggle),
    .found-record-filter,
    .found-address-filter,
    .found-record-card-actions :is(button, a),
    .record-profile-rail-compare,
    .record-profile-rail-lenso,
    .record-profile-rail-photo-edit,
    .record-history-compare-toggle,
    .record-history-comparison-close,
    .record-validated-compare-toggle,
    .record-validated-comparison-close,
    .record-provider-header-actions .btn,
    .record-provider-result-tools .btn,
    .record-provider-history-control .form-select,
    .record-section-tooltip-trigger,
    .app-toast-dismiss,
    .qa-review-fab,
    .scroll-to-top-btn {
        min-width: 2.75rem;
        min-height: 2.75rem;
    }

    .app-toast {
        grid-template-columns: 2rem minmax(0, 1fr) 2.75rem;
    }

    .record-search-field-with-help .form-control {
        padding-right: 3.15rem;
    }

    .record-search-field-tooltip-container {
        top: .05rem;
        right: .05rem;
    }

    .record-search-field-tooltip-trigger {
        width: 2.75rem;
        height: 2.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-record-section-nav],
    [data-record-section-link],
    .record-case-pane,
    .ai-history-session-btn,
    .tooltip-icon {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

/* Keep large case files compact and offer an in-page view across both work columns. */
.record-case-wide-pane[hidden] {
    display: none !important;
}

.record-history-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.record-history-card-section-header .record-section-heading-line {
    flex-wrap: wrap;
}

.record-wide-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    white-space: nowrap;
}

.record-case-pane :is(.record-history-card-list, .found-record-card-list) {
    max-height: min(57rem, 97.5dvh);
    padding: .15rem .3rem .3rem .1rem;
    overflow: auto;
    /* Continue scrolling the case page at the top or bottom of a record list. */
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
    align-items: start;
    align-content: start;
}

:is(.record-history-card-list, .found-record-card-list):focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.found-record-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-block: .4rem .2rem;
    color: var(--bs-secondary-color);
    font-size: .7rem;
}

.found-record-filter-toolbar .btn {
    padding: .15rem .25rem;
    font-size: inherit;
}

.found-record-filter-status {
    margin: 0 0 .45rem;
    color: var(--bs-secondary-color);
    font-size: .67rem;
}

.dark-mode .found-record-filter.active {
    border-color: var(--bs-primary);
    color: var(--bs-primary-text-emphasis);
    background: color-mix(in srgb, var(--bs-primary) 16%, var(--bs-body-bg));
}

.record-case-wide-pane > #validatedRecordsSection {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .75rem;
    background: var(--bs-body-bg);
}

.record-case-wide-pane > * {
    display: flex;
    flex-direction: column;
    /* The record list itself sets the scroll limit in wide and column views. */
    max-height: none;
    min-width: 0;
    min-height: 0;
    scroll-margin-top: var(--record-case-sticky-offset);
}

.record-case-wide-pane .found-records-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    container: record-evidence / inline-size;
}

.record-case-wide-pane :is(.found-record-card-list, .record-history-card-list) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.record-case-wide-pane .found-record-card-list:has(> .found-record-group) {
    grid-template-columns: minmax(0, 1fr);
}

.found-record-group {
    min-width: 0;
    margin: 0;
}

.found-record-group[hidden] {
    display: none !important;
}

.found-record-group-heading {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: .15rem 0 .55rem;
    padding-top: .6rem;
    border-top: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    font-size: .85rem;
    font-weight: 750;
}

.found-record-group-count {
    color: var(--bs-secondary-color);
    font-size: .7rem;
    font-weight: 500;
}

.found-record-group-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    align-items: start;
    gap: .55rem;
    min-width: 0;
}

.record-case-grid > .record-case-pane-profile {
    grid-row: 1;
}

.record-case-work-area {
    display: grid;
    grid-template-columns: subgrid;
    align-content: start;
    gap: var(--record-case-pane-gap);
    min-width: 0;
}

.record-case-work-tabs {
    display: flex;
    gap: .3rem;
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--bs-border-color);
}

.record-case-work-tabs [role="tab"] {
    padding: .65rem .9rem;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: .85rem;
    font-weight: 650;
}

.record-case-work-tabs [aria-selected="true"] {
    border-bottom-color: var(--bs-primary);
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
}

.record-case-work-tabs [role="tab"]:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.record-case-workspace-panel,
.record-case-review-panel {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    align-content: start;
    gap: var(--record-case-pane-gap);
    min-width: 0;
}

.record-case-work-area > [role="tabpanel"][hidden] {
    display: none !important;
}

.record-case-workspace-panel > :is(.record-case-pane-actions) {
    grid-column: 1;
    grid-row: 1;
}

.record-case-workspace-panel > .record-case-pane-evidence {
    grid-column: 1;
    grid-row: 2;
}

.record-case-workspace-panel[data-wide-records] > .record-case-wide-pane {
    grid-column: 1 / -1;
    grid-row: 1;
}

.record-case-workspace-panel[data-wide-records] > :is(.record-case-pane-actions) {
    grid-row: 2;
}

.record-case-workspace-panel[data-wide-records] > .record-case-pane-evidence {
    grid-row: 3;
}

@media (min-width: 1200px) {
    .record-case-work-area {
        grid-column: 2 / -1;
        grid-row: 1;
    }
}

@media (min-width: 1500px) {
    .record-case-workspace-panel {
        grid-template-columns: subgrid;
    }

    .record-case-workspace-panel > .record-case-pane-evidence {
        grid-column: 2;
        grid-row: 1;
    }

    .record-case-workspace-panel[data-wide-records] > .record-case-pane-evidence {
        grid-row: 2;
    }
}

@container record-case-workbench (min-width: 76rem) {
    .record-case-workspace-panel {
        grid-template-columns: subgrid;
    }

    .record-case-workspace-panel > .record-case-pane-evidence {
        grid-column: 2;
        grid-row: 1;
    }

    .record-case-workspace-panel[data-wide-records] > .record-case-pane-evidence {
        grid-row: 2;
    }
}

.record-case-review-intro {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .8rem;
}

.record-case-review-panel #validatedRecordsSection {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.record-case-review-panel :is(.record-wide-toggle, .record-validated-compare-toggle) {
    display: none;
}

.record-case-review-panel .found-records-rail {
    container: record-evidence / inline-size;
}

.record-case-review-panel .found-record-card-list {
    max-height: none;
    overflow: visible;
    grid-template-columns: minmax(0, 1fr);
}

.record-case-review-panel .found-record-group-cards {
    display: none;
}

.record-case-review-panel .found-record-filter-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .3rem;
}

.record-case-review-panel .found-record-filter {
    min-height: 1.9rem;
    padding: .25rem .4rem;
    border-radius: .3rem;
}

@container record-evidence (min-width: 46rem) {
    .record-case-review-panel .found-record-filter-strip {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.case-review-category-icon {
    color: var(--bs-primary);
    font-size: 1rem;
}

.case-review-table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.case-review-table-wrap:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.case-review-record-table {
    width: 100%;
    min-width: 47rem;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: .78rem;
    line-height: 1.45;
}

.case-review-record-table col:nth-child(1) { width: 29%; }
.case-review-record-table col:nth-child(2) { width: 14%; }
.case-review-record-table col:nth-child(3) { width: 15%; }
.case-review-record-table col:nth-child(4) { width: 10%; }
.case-review-record-table col:nth-child(5) { width: 9%; }
.case-review-record-table col:nth-child(6) { width: 9%; }
.case-review-record-table col:nth-child(7) { width: 9%; }
.case-review-record-table col:nth-child(8) { width: 5%; }

.case-review-record-table :is(th, td) {
    padding: .45rem .5rem;
    border-bottom: 1px solid var(--bs-border-color);
    vertical-align: top;
    text-align: left;
}

.case-review-record-table th {
    color: var(--bs-secondary-color);
    font-size: .67rem;
    font-weight: 650;
}

.case-review-record-table td {
    overflow-wrap: anywhere;
}

.case-review-record-table td:first-child {
    font-weight: 550;
}

.case-review-attribution {
    display: block;
    margin-top: .15rem;
    color: var(--bs-secondary-color);
    font-size: .7rem;
    font-weight: 500;
}

.case-review-record-table td:nth-child(3) {
    color: var(--bs-secondary-color);
}

.case-review-record-table td:nth-child(4) {
    white-space: nowrap;
}

.case-review-record-table tbody tr:hover {
    background: var(--bs-tertiary-bg);
}

.case-review-details {
    padding: 0;
    border: 0;
    font: inherit;
    align-items: flex-start;
    white-space: nowrap;
}

.case-review-row-menu {
    padding: .15rem .3rem;
    border: 0;
}

.case-review-actions-menu {
    z-index: 1085;
    font-size: .8rem;
}

.case-review-record-modal [hidden] {
    display: none !important;
}

.case-review-record-modal .found-record-card {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.case-review-record-modal :is(.found-record-type-icon, .found-record-card-actions, .found-record-details > summary) {
    display: none !important;
}

.case-review-record-modal .found-record-card-header {
    grid-template-columns: minmax(0, 1fr);
}

.case-review-record-modal .found-record-card-meta {
    margin: .75rem 0;
}

.case-review-record-modal .found-record-details {
    margin: 0;
    border: 0;
}

.case-review-record-modal .found-record-details-body {
    padding: 0;
}

.case-review-record-modal :is(.found-record-type-field, .found-record-subtype-field, .found-record-source-field, .found-record-date-field)::before {
    display: block;
    margin-bottom: .25rem;
    font-size: .75rem;
    font-weight: 600;
}

.case-review-record-modal .found-record-type-field::before { content: 'Record type'; }
.case-review-record-modal .found-record-subtype-field::before { content: 'Subtype'; }
.case-review-record-modal .found-record-source-field::before { content: 'Sources'; }
.case-review-record-modal .found-record-date-field::before { content: 'Record date'; }

.case-review-detail-value {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.case-review-detail-metadata {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .3rem .75rem;
    font-size: .85rem;
}

.case-review-detail-metadata dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.case-review-detail-notes {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .9rem;
}

.record-case-review-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .75rem;
}

.record-case-review-heading h2 {
    margin: 0;
    font-size: 1.1rem;
}

.record-case-review-narrative {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bs-border-color);
}

.case-review-narrative-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .9rem;
    line-height: 1.7;
}

.case-review-narrative-text.is-empty {
    color: var(--bs-secondary-color);
    font-style: italic;
}

.case-review-narrative-status {
    margin: .75rem 0 0;
}

.case-review-files-description,
.case-review-files-empty {
    margin: 0 0 1rem;
    color: var(--bs-secondary-color);
    font-size: .85rem;
}

.case-review-files-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.case-review-file-figure {
    min-width: 0;
    margin: 0;
    break-inside: avoid;
}

.case-review-file-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12rem;
    padding: .5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .35rem;
    background: var(--bs-tertiary-bg);
}

.case-review-file-image {
    max-width: 100%;
    max-height: 14rem;
    object-fit: contain;
}

.case-review-file-caption {
    margin-top: .5rem;
    font-size: .85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.case-review-pdf-attachments {
    margin-top: 1.25rem;
}

.case-review-pdf-attachments h3 {
    font-size: .95rem;
    text-align: left;
}

.case-review-attachment-list {
    padding-left: 1.25rem;
    margin-bottom: 0;
    font-size: .85rem;
    overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
    .case-review-files-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 575.98px) {
    .case-review-files-grid { grid-template-columns: minmax(0, 1fr); }
}

.record-scroll-frame {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.record-scroll-frame > [data-record-scroll-region] {
    flex: 1 1 auto;
    min-height: 0;
}

.record-scroll-more {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .45rem;
    width: 100%;
    padding: .35rem .65rem;
    border: 0;
    border-radius: 0 0 .35rem .35rem;
    background: rgb(8 66 152 / 78%);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
}

.record-scroll-more[hidden] {
    display: none;
}

.record-scroll-more:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -4px;
}

@media print {
    .record-case-work-tabs,
    .record-scroll-more,
    .record-case-review-narrative-actions,
    [data-case-review-manage-files] {
        display: none !important;
    }
}

@media (max-width: 1199.98px) {
    .record-validated-heading-actions .record-wide-toggle,
    .record-wide-toggle {
        display: none;
    }
}

@media print {
    .record-case-pane :is(.record-history-card-list, .found-record-card-list) {
        max-height: none;
        overflow: visible;
    }
}

/* Nonmodal record composer: keep provider results available while entering evidence. */
.record-workspace {
    --record-add-panel-width: 30rem;
}

.record-add-drawer {
    position: fixed;
    z-index: 1041;
    top: calc(var(--app-topbar-height, 56px) + .5rem);
    right: .75rem;
    bottom: max(.75rem, env(safe-area-inset-bottom));
    width: min(var(--record-add-panel-width), calc(100vw - 1.5rem));
    max-height: calc(100dvh - var(--app-topbar-height, 56px) - 1.25rem);
}

.record-add-drawer[hidden],
.record-add-resume[hidden] {
    display: none !important;
}

.record-add-drawer-tools {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 0 0 auto;
}

.record-add-drawer-tools .btn-close {
    margin: 0;
}

.record-add-drawer .modal-title {
    text-align: left;
}

.record-add-drawer .record-add-modal-guidance {
    font-size: .75rem;
    line-height: 1.45;
}

.record-add-drawer .row > [class*="col-md-"] {
    flex: 0 0 50%;
    width: 50%;
    max-width: 50%;
}

.record-add-drawer #addRecordForm > fieldset > .row > :first-child,
.record-add-drawer #addRecordFieldWrapper,
.record-add-drawer #addressFieldsContainer,
.record-add-drawer #vehicleFieldsContainer,
.record-add-drawer #addRecordIntelNotesWrapper,
.record-add-drawer .row > .col-md-12,
.record-add-drawer #addressFieldsContainer .col-md-5,
.record-add-drawer #addressFieldsContainer .col-md-3 {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
}

.record-add-resume {
    position: fixed;
    right: 1rem;
    bottom: max(5.5rem, calc(env(safe-area-inset-bottom) + 5rem));
    z-index: 1041;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .2);
}

@media (min-width: 1200px) {
    .record-workspace.record-add-open {
        padding-right: calc(var(--record-add-panel-width) + 1.5rem) !important;
    }

    .record-add-open .record-case-grid {
        grid-template-columns: clamp(12rem, 15vw, 17rem) minmax(0, 1fr);
    }

    .record-add-open .record-case-work-area {
        grid-column: 2;
        grid-row: 1;
    }

    .record-add-open .record-case-workspace-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .record-add-open .record-case-workspace-panel > .record-case-pane-evidence {
        grid-column: 1;
        grid-row: 2;
    }

    .record-add-open .record-case-workspace-panel[data-wide-records] > .record-case-pane-evidence {
        grid-row: 3;
    }
}

@media (max-width: 575.98px) {
    .record-add-drawer {
        top: calc(var(--app-topbar-height, 56px) + .25rem);
        right: .25rem;
        bottom: max(.25rem, env(safe-area-inset-bottom));
        width: calc(100vw - .5rem);
    }

    .record-add-modal-header {
        padding: .75rem;
    }
}

@media print {
    .record-add-drawer,
    .record-add-resume {
        display: none !important;
    }

    .record-workspace.record-add-open {
        padding-right: 1rem !important;
    }
}
