:root {
    --brand-green: #70AD47;
    --brand-green-rgb: 112, 173, 71;
    --brand-green-hover: #5a8c38;
    /* Pressed / active primary — muted sage (not Bootstrap blue) */
    --brand-sage: #8FAE6B;
    --brand-sage-rgb: 143, 174, 107;
    /* Informational / status success (not an action) */
    --brand-blue: #26478A;
    --brand-blue-rgb: 38, 71, 138;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow:
        0 0 0 0.1rem white,
        0 0 0 0.25rem #258cfb;
}

/* Column layout so the page footer (_Layout.cshtml) sits at the bottom of the
   viewport on short pages and after the content on tall ones, whatever height
   the footer wraps to. .page-body takes the spare height. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-bottom: 0;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

h4 {
    margin-bottom: 0.2rem;
}

/* ── Primary / forward action buttons (green = actionable) ── */
/* Override Bootstrap's --bs-btn-* vars so :active/:focus never flash blue. */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand-green);
    --bs-btn-border-color: var(--brand-green);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-green-hover);
    --bs-btn-hover-border-color: var(--brand-green-hover);
    --bs-btn-focus-shadow-rgb: var(--brand-green-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--brand-sage);
    --bs-btn-active-border-color: var(--brand-sage);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--brand-green);
    --bs-btn-disabled-border-color: var(--brand-green);
    color: #fff;
    background-color: var(--brand-green);
    border-color: var(--brand-green);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #fff;
    background-color: var(--brand-green-hover);
    border-color: var(--brand-green-hover);
}

.btn-primary:active,
.btn-primary.active,
.btn-primary:active:focus,
.show > .btn-primary.dropdown-toggle {
    color: #fff;
    background-color: var(--brand-sage);
    border-color: var(--brand-sage);
    box-shadow:
        0 0 0 0.1rem white,
        0 0 0 0.25rem rgba(var(--brand-sage-rgb), 0.5);
}

.btn-primary:focus-visible {
    box-shadow:
        0 0 0 0.1rem white,
        0 0 0 0.25rem rgba(var(--brand-green-rgb), 0.5);
}

/* Outlined primary actions (e.g. "Continue at Select Loan") */
.btn-outline-primary {
    --bs-btn-color: var(--brand-green);
    --bs-btn-border-color: var(--brand-green);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-green);
    --bs-btn-hover-border-color: var(--brand-green);
    --bs-btn-focus-shadow-rgb: var(--brand-green-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--brand-sage);
    --bs-btn-active-border-color: var(--brand-sage);
    --bs-btn-disabled-color: var(--brand-green);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--brand-green);
    color: var(--brand-green);
    border-color: var(--brand-green);
    background-color: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff;
    background-color: var(--brand-green);
    border-color: var(--brand-green);
}

.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary:active:focus {
    color: #fff;
    background-color: var(--brand-sage);
    border-color: var(--brand-sage);
}

/* ── SweetAlert2 global button styles ── */
.swal2-done-btn {
    background-color: #000 !important;
    color: #fff !important;
    padding: 10px 30px !important;
    border-radius: 6px !important;
    font-weight: 500;
    margin: 5px;
}
.swal2-done-btn:hover {
    background-color: #333 !important;
}
.swal2-cancel-btn {
    background-color: transparent !important;
    color: #343a40 !important;
    border: 1px solid #6c757d !important;
    padding: 10px 30px !important;
    border-radius: 6px !important;
    font-weight: 500;
    margin: 5px;
}
.swal2-cancel-btn:hover {
    background-color: #f8f9fa !important;
}
.swal2-danger-btn {
    background-color: #dc3545 !important;
    color: #fff !important;
    padding: 10px 30px !important;
    border-radius: 6px !important;
    font-weight: 500;
    margin: 5px;
}
.swal2-danger-btn:hover {
    background-color: #b02a37 !important;
}

/* ── CSP Utility Classes (replacing inline styles) ── */
.bg-app-gradient {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.navbar-logo {
    width: 180px;
    height: 40px;
}

.processing-overlay {
    z-index: 9999;
}

.processing-spinner {
    width: 3rem;
    height: 3rem;
}

.w-fit-content {
    width: fit-content;
}

.btn-padding-y-6-x-70 {
    padding: 6px 70px;
}

.btn-padding-y-6-x-24 {
    padding: 6px 24px;
}

/* ── Status Badge Classes ── */
/* Success = informational (blue), not an actionable green */
.badge-status-success {
    border: 1px solid rgba(var(--brand-blue-rgb), 0.35);
    background: rgba(var(--brand-blue-rgb), 0.1) !important;
    color: var(--brand-blue) !important;
}

.badge-status-failed {
    background: #FFE2E2 !important;
    border: 1px solid #FFA2A2;
    color: #C10007 !important;
}

.badge-status-pending {
    color: #BB4D00 !important;
    background: #FEF3C6 !important;
    border: 1px solid #FFD230;
}

.badge-status-na {
    color: #5c6370 !important;
    background: #f0f1f3 !important;
    border: 1px solid #ced0d4;
}

/* ── Miscellaneous CSP Utilities ── */
.pb-100 {
    padding-bottom: 100px;
}

.ml-38 {
    margin-left: 38px;
}

.inline-block-left {
    display: inline-block;
    text-align: left;
}

.avatar-35 {
    width: 35px;
    height: 35px;
}

.m-3px {
    margin: 3px !important;
}

.rounded-left-3px {
    border-bottom-left-radius: 3px !important;
    border-top-left-radius: 3px !important;
}

.text-wrap-inherit {
    white-space: inherit !important;
}

.fs-0875 {
    font-size: 0.875rem !important;
}

.w-80px {
    width: 80px !important;
}

.file-card-body {
    min-height: 140px;
    max-height: 240px;
    overflow-y: auto;
}

.select-none {
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* ── Select2 clear button vertical alignment ── */
.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    top: 50%;
    margin-right: 0 !important;
    transform: translateY(-50%);
    right: 1.75rem; /* ~20px - width of Select2's __arrow, keeps clear button left of it */
    font-size: 1rem;
    line-height: 1;
}

/* ── Cursor Utilities ── */
.cursor-pointer { cursor: pointer !important; }
.cursor-help    { cursor: help    !important; }

/* ── Typography Utilities ── */
.fs-xs { font-size: 0.7rem   !important; }
.ls-sm { letter-spacing: 0.5px !important; }

/* ── Spacing / Size Utilities ── */
.h-max-500  { max-height: 500px !important; }
.h-max-70vh { max-height: 70vh  !important; }

/* ── Refresh Spinner (Package Index) ── */
.refresh-spinner-bar  { height: 18px; }
.refresh-spinner-icon {
    width: 0.65rem;
    height: 0.65rem;
    border-width: 2px;
    opacity: 0;
    transition: opacity 0.4s;
}

/* ── Package List Table fixed header ── */
.table-fixed-header {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
}
.table-fixed-header thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f8f9fa;
    text-align: center;
    vertical-align: middle;
}

/* ── Empty state icon (ManualReview no-doc panels) ── */
.empty-state-icon { font-size: 3rem !important; }

/* ── Section badge (Extraction views) ── */
.section-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ── File Download Card (replaces scoped <style> removed from _FileDownloadCard.cshtml) ── */
.last-child-mb-0:last-child          { margin-bottom: 0 !important; }
.group:hover .group-hover-primary    { color: var(--bs-primary) !important; }
.file-download-icon:hover i          { color: var(--bs-primary) !important; }

/* ── Package Detail ── */
/* Show the full Invoice-to-Payment table on the page (no 70vh clip).
   Override .table-responsive overflow-x: auto so overflow-y stays visible —
   otherwise this wrapper becomes the sticky containing block and thead
   never sticks during page scroll. */
#payment-invoice-matching-table .table-responsive {
    overflow: visible;
    max-width: 100%;
}
#payment-invoice-matching-table .table td {
    vertical-align: middle;
    overflow-wrap: break-word;
}
@media (max-width: 1200px) {
    #payment-invoice-matching-table .table-responsive {
        display: block;
        width: 100%;
        overflow: visible;
    }
}
#payment-invoice-matching-table .table td:last-child { white-space: nowrap; }
#payment-invoice-matching-table .text-break {
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Scrollable dropdown for many extra items */
.extra-items-dropdown {
    max-height: 300px;
    min-width: 250px;
    max-width: min(420px, 90vw);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.extra-items-dropdown .dropdown-item {
    white-space: normal;
    word-break: break-word;
}

/* ID link / button - underlined primary text */
#payment-invoice-matching-table a.id-link,
#payment-invoice-matching-table button.id-link {
    color: #0d6efd;
    text-decoration: underline;
}
#payment-invoice-matching-table a.id-link:hover,
#payment-invoice-matching-table button.id-link:hover { color: #0b5ed7; }
#payment-invoice-matching-table button.id-link:focus,
#payment-invoice-matching-table button.id-link:active,
#payment-invoice-matching-table button.id-link:focus-visible {
    outline: 2px solid #0d6efd !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
    border: none !important;
}

/* Detail table hover tint */
#payment-invoice-matching-table table.details-table tbody tr:hover td {
    background-color: rgba(13, 110, 253, 0.04);
}

/* Collapse icon rotation */
.id-link .bi-chevron-down {
    transition: transform 0.2s ease-in-out;
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 900 !important;
    -webkit-text-stroke: 0.5px;
}
.id-link[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }

/* ── Timeline (Package status history) ── */
.timeline {
    position: relative;
    padding-left: 30px;
    list-style: none;
}
.timeline::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 15px;
    width: 2px;
    background: #e9ecef;
}
.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}
.timeline-marker {
    position: absolute;
    left: -30px;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid #e9ecef;
    z-index: 1;
    font-size: 0.9rem;
}
.timeline-item.success .timeline-marker { border-color: #198754; color: #198754; }
.timeline-item.primary .timeline-marker { border-color: #0d6efd; color: #0d6efd; }
.timeline-item.warning .timeline-marker { border-color: #ffc107; color: #ffc107; }
.timeline-item.info    .timeline-marker { border-color: #0dcaf0; color: #0dcaf0; }
.timeline-content {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid #e9ecef;
}
.timeline-item.success .timeline-content { border-left-color: #198754; }
.timeline-item.primary .timeline-content { border-left-color: #0d6efd; }
.timeline-item.warning .timeline-content { border-left-color: #ffc107; }
.timeline-item.info    .timeline-content { border-left-color: #0dcaf0; }

/* ── Sticky Table Columns (Extraction tables) ── */
.details-table thead th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}
.extraction-table-wrapper {
    overflow-x: auto;
    position: relative;
}
.extraction-table thead th.col-sticky,
.extraction-table tbody td.col-sticky {
    position: sticky;
    background-color: #f8f9fa;
    z-index: 2;
}
.extraction-table thead th.col-sticky { z-index: 3; }
.extraction-table th.col-sticky-1,
.extraction-table td.col-sticky-1 {
    left: 0;
    min-width: 44px;
    box-shadow: 1px 0 0 #dee2e6;
}
.extraction-table th.col-sticky-2,
.extraction-table td.col-sticky-2 {
    left: 44px;
    min-width: 130px;
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.12);
}
.extraction-table tbody td.col-sticky              { background-color: #fff; }
.extraction-table tbody tr:hover td.col-sticky     { background-color: rgba(13,110,253,0.04); }

/* ── ManualReview - compact status-card icon ── */
.status-icon-sm { width: 28px !important; height: 28px !important; }

/* ── G702 manual review input warning border ── */
.g702-manual-review-input { border-color: var(--bs-warning) !important; }

/* ── Partial Invoice Requested Amount Highlighting ── */
.row-partial-invoice {
    background-color: rgba(255, 193, 7, 0.12) !important;
}
.badge-partial-invoice {
    font-size: 0.65rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* ── Text Wrapping Utilities ── */
.wrap-text {
    white-space: normal !important;
    overflow-wrap: break-word !important;
}

.notes-html p,
.notes-html div {
    margin: 0;
}

.notes-html ul,
.notes-html ol {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
}

.nowrap {
    white-space: nowrap !important;
}

/* ── Package type pill toggles (Index + ExtractionOnly upload) ── */
.pkg-toggle-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.pkg-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pkg-toggle-track {
    display: flex;
    align-items: center;
    width: 56px;
    height: 30px;
    background: #dee2e6;
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s ease;
    padding: 2px;
}

.pkg-toggle-input:checked + .pkg-toggle-track {
    background: #0d6efd;
}

.pkg-toggle-thumb {
    width: 26px;
    height: 26px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s ease;
    pointer-events: none;
}

.pkg-toggle-input:checked + .pkg-toggle-track .pkg-toggle-thumb {
    transform: translateX(26px);
}

.pkg-toggle-input:checked + .pkg-toggle-track.extraction-track {
    background: #198754;
}

.pkg-toggle-input:disabled + .pkg-toggle-track {
    cursor: default;
    opacity: 0.9;
}

#labelG702,
#labelExtraction {
    -webkit-user-select: none;
    user-select: none;
}

/* ── Admin package action modals (Package Index) ── */
.modal-backdrop.show {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    background-color: rgba(15, 23, 42, 0.45);
}

.admin-action-modal {
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.modal-is-sending {
    pointer-events: none;
    opacity: 0.72;
    transition: opacity 0.2s ease;
}

.admin-action-modal .modal-footer {
    /* Outside scrollable modal-body — errors stay visible without scrolling */
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #f1f5f9 !important;
}

.admin-action-modal .admin-modal-inline-error:not(.d-none) {
    width: 100%;
}

.borrower-request-meta {
    display: grid;
    grid-template-columns: 1fr;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    overflow: hidden;
}

.borrower-request-meta__cell {
    padding: 0.875rem 1rem;
    min-width: 0;
}

.borrower-request-meta__cell + .borrower-request-meta__cell {
    border-top: 1px solid #e2e8f0;
}

@media (min-width: 768px) {
    .borrower-request-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
    }

    .borrower-request-meta__cell + .borrower-request-meta__cell {
        border-top: 0;
        border-left: 1px solid #e2e8f0;
    }
}

#toastNotificationContainer {
    max-width: min(32rem, calc(100vw - 1.5rem));
    width: 100%;
    pointer-events: none;
}

#toastNotificationContainer .toast {
    pointer-events: auto;
    width: 100%;
}

@media (min-width: 992px) {
    #adminPackageActionModal .modal-dialog {
        max-width: 1200px;
        width: 94%;
    }
    #adminApproveModal .modal-dialog {
        max-width: 960px;
        width: 90%;
    }
}

.admin-action-modal .modal-header {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 1.25rem 1.5rem 0.875rem;
    border-bottom: 1px solid #f1f5f9;
}

.modal-header-badge {
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.modal-header-badge--warning {
    background: #fdf3d7;
    color: #7c2d12;
    border: 1px solid #fae6af;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.15);
}

.modal-header-badge--success {
    background: #e6f7f1;
    color: #134e4a;
    border: 1px solid #cdeee3;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.15);
}

.pkg-code-pill {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.15rem 0.5rem;
    letter-spacing: 0.02em;
}

.admin-modal-hero {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 1.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.admin-modal-loan-card .p-3 {
    border-color: #e2e8f0 !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
}

.modal-form-section {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 0.875rem;
    padding: 1.125rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.pkg-modal-context-bar {
    border-radius: 0.75rem;
}

.fs-075 { font-size: 0.75rem !important; }

/* Document Type Selection Grid */
.missing-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.missing-doc-batch-actions {
    display: flex;
    gap: 0.375rem;
}

.btn-batch-chip {
    font-size: 0.725rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-batch-chip:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

.missing-doc-grid {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.missing-doc-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 0.875rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.missing-doc-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

.missing-doc-card.is-selected {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}

.missing-doc-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.missing-doc-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.625rem;
    font-size: 1rem;
    flex-shrink: 0;
}

.missing-doc-icon-badge--inv {
    background: #e8f6fd;
    color: #0c4a6e;
}

.missing-doc-icon-badge--pay {
    background: #e8f7f2;
    color: #134e4a;
}

.missing-doc-icon-badge--sup {
    background: #f1ecfe;
    color: #3b0764;
}

.missing-doc-icon-badge--xls {
    background: #fdf5e3;
    color: #78350f;
}

.missing-doc-card .form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0;
    cursor: pointer;
}

.missing-doc-card .form-check-input:checked {
    background-color: #f59e0b;
    border-color: #f59e0b;
}

.missing-type-comment {
    margin-top: 0.75rem !important;
    border-radius: 0.5rem;
    border-color: #fcd34d;
    font-size: 0.825rem;
    background: #ffffff;
    transition: all 0.2s ease;
}

.missing-type-comment:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 0.25rem rgba(245, 158, 11, 0.2);
}

/* ── Mobile Responsive Optimizations for Admin Action Modals ── */
@media (max-width: 576px) {
    .admin-action-modal .modal-header {
        padding: 1rem 1rem 0.75rem;
    }

    .admin-action-modal .modal-body {
        padding: 0.875rem 1rem !important;
    }

    .modal-form-section {
        padding: 0.875rem 0.875rem;
    }

    .snippet-chip {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .missing-doc-card {
        padding: 0.625rem 0.75rem;
    }

    .admin-modal-loan-card .p-3 {
        padding: 0.75rem !important;
    }
}

/* Quick Comment Snippets */
.snippet-chips-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.625rem;
}

.snippet-chip {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 2rem;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.snippet-chip:hover {
    background: #e5e7eb;
    color: #111827;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.snippet-chip:active {
    transform: translateY(0);
}

/* ── Rich Text Editor (Request & Approve Modals) ── */
.rte-wrap {
    border: 1px solid #d1d5db;
    border-radius: 0.625rem;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.rte-wrap:focus-within {
    border-color: #f59e0b;
    box-shadow: 0 0 0 0.25rem rgba(245, 158, 11, 0.18);
    outline: none;
}

.rte-wrap.rte-wrap--approve:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 0.25rem rgba(16, 185, 129, 0.18);
}

.rte-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.625rem;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
}

.rte-toolbar__divider {
    width: 1px;
    height: 1.1rem;
    background: #e5e7eb;
    margin: 0 0.25rem;
    border: none;
    opacity: 1;
}

.rte-toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    color: #4b5563;
    font-size: 0.825rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    padding: 0;
}

.rte-toolbar__btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #111827;
}

.rte-toolbar__btn.is-active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.rte-toolbar__btn:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 1px;
}

.rte-editor {
    min-height: 110px;
    max-height: 260px;
    overflow-y: auto;
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #1f2937;
    outline: none;
    overflow-wrap: break-word;
}

.rte-editor:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}

.rte-editor ul,
.rte-editor ol {
    padding-left: 1.5rem;
    margin: 0.25rem 0;
}

.rte-editor li {
    margin-bottom: 0.125rem;
}

.rte-editor p {
    margin: 0;
}

.rte-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.3rem 0.75rem 0.35rem;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
}

.rte-counter {
    font-size: 0.725rem;
    font-weight: 500;
    color: #9ca3af;
    letter-spacing: 0.02em;
}

.rte-counter.is-near-limit { color: #f59e0b; }
.rte-counter.is-at-limit   { color: #ef4444; font-weight: 600; }

.action-btns {
    min-width: 7.5rem;
}

.action-btns-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.2rem;
}

.action-btns-row + .action-btns-row {
    margin-top: 0.25rem;
}

.action-btns .btn {
    margin: 0;
}


/* ── Status Badge Classes, additions (MAM-2299 status audit) ──
   One color per answer to "what should the asset manager do", shared by the list, detail, detail PDF,
   history modal and the upload pages' package table:
   badge-status-na       nothing to do (For Review By Borrower, Draft, Not Started, Not Required)
   badge-status-pending  wait, the system is working (Pending, Processing, Partially Uploaded, Queued, In Progress)
   badge-status-success  your turn (Success: reconciled and ready for review)
   badge-status-final    done (Approved Final)
   badge-status-failed   fix something (Failed, AI Service Unavailable) */
.badge-status-final {
    color: #2F6B1A !important;
    background: rgba(var(--brand-green-rgb), 0.16) !important;
    border: 1px solid rgba(var(--brand-green-rgb), 0.6);
}
