#detail .modal-body {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    color: #212529;
    padding: 0.85rem 1rem;
}

#detail .modal-dialog {
    max-width: 480px;
    width: calc(100% - 1.5rem);
    margin-left: auto;
    margin-right: auto;
}

#detail.detail-modal-has-qr .modal-dialog {
    max-width: 720px;
}

#detail.detail-modal-has-certification .modal-dialog {
    max-width: 680px;
}

#detail.detail-modal-has-hostel-detail .modal-dialog {
    max-width: 920px;
}

#detail.detail-modal-has-table .modal-dialog {
    max-width: 920px;
}

#detail.detail-modal-has-qr.detail-modal-has-certification .modal-dialog {
    max-width: 780px;
}

#detail.detail-modal-has-hostel-detail.detail-modal-has-certification .modal-dialog,
#detail.detail-modal-has-hostel-detail.detail-modal-has-qr .modal-dialog {
    max-width: 920px;
}

#detail.detail-modal-has-hostel-detail.detail-modal-has-qr.detail-modal-has-certification .modal-dialog {
    max-width: 960px;
}

#detail.detail-modal-has-certification .row > .col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

#detail.detail-modal-has-hostel-detail .row > .col-sm-6,
#detail.detail-modal-has-hostel-detail .detail-modal-cert-row > .col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

#detail.detail-modal-has-certification .worker-detail-certification .row > .col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

#detail.detail-modal-has-qr .worker-detail-profile .row > .col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

#detail.detail-modal-has-qr .worker-detail-profile .row > .col-md-5 {
    flex: 0 0 42%;
    max-width: 42%;
}

#detail.detail-modal-has-qr .worker-detail-profile .row > .col-md-4 {
    flex: 0 0 33%;
    max-width: 33%;
}

#detail.detail-modal-has-qr .worker-detail-cards > .col-lg-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

#detail.detail-modal-has-qr .worker-detail-modal .row:not(.worker-detail-cards) > .col-lg-3 {
    flex: 0 0 25%;
    max-width: 25%;
}

#detail.detail-modal-has-qr .worker-detail-modal .row:not(.worker-detail-cards) > .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

#detail.detail-modal-has-qr .worker-detail-avatar {
    width: 130px;
    height: 130px;
}

#detail.detail-modal-has-qr .worker-detail-qr img {
    width: 200px;
    height: 200px;
}

/* Layout inside modal follows modal width, not viewport breakpoints */
#detail .worker-detail-profile .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
}

#detail .worker-detail-cards > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
}

#detail .worker-detail-modal .row:not(.worker-detail-cards) > .col-lg-3,
#detail .worker-detail-modal .row:not(.worker-detail-cards) > .col-lg-4,
#detail .worker-detail-modal .row:not(.worker-detail-cards) > .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
}

#detail .modal-content {
    width: 100%;
}

:root {
    --detail-modal-label-color: #212529;
    --detail-modal-value-color: #212529;
    --detail-modal-empty-color: #212529;
    --detail-modal-label-size: 1rem;
    --detail-modal-value-size: 0.9375rem;
    --detail-modal-heading-size: 1.125rem;
    --detail-modal-label-weight: 700;
    --detail-modal-value-weight: 700;
    --detail-modal-line-height: 1.55;
    --detail-modal-row-gap: 0.75rem;
    --detail-modal-field-columns: minmax(11rem, 44%) minmax(0, 1fr);
    --detail-modal-field-gap: 0.65rem;
}

.worker-detail-modal {
    font-size: 1rem;
    color: #212529;
}

.worker-detail-profile.card {
    border: 1px solid #dee2e6;
    box-shadow: none;
}

.worker-detail-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 3px solid #dee2e6;
}

.worker-detail-qr img {
    width: 110px;
    height: 110px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
}

.worker-detail-field {
    display: grid;
    grid-template-columns: var(--detail-modal-field-columns);
    column-gap: var(--detail-modal-field-gap);
    row-gap: 0.25rem;
    align-items: baseline;
    margin-bottom: var(--detail-modal-row-gap);
    line-height: var(--detail-modal-line-height);
}

.worker-detail-label,
.detail-modal-label {
    grid-column: 1;
    display: block;
    font-size: var(--detail-modal-label-size);
    font-weight: var(--detail-modal-label-weight);
    letter-spacing: 0;
    text-transform: none;
    color: var(--detail-modal-label-color);
    margin-bottom: 0;
}

.worker-detail-value,
.detail-modal-value {
    grid-column: 2;
    display: block;
    min-width: 0;
    font-size: var(--detail-modal-value-size);
    font-weight: var(--detail-modal-value-weight);
    color: var(--detail-modal-value-color);
    line-height: var(--detail-modal-line-height);
    word-break: break-word;
}

.worker-detail-field:not(:has(.worker-detail-label)) .worker-detail-value {
    grid-column: 1 / -1;
}

#detail .worker-detail-modal > .worker-detail-field {
    grid-template-columns: minmax(11rem, 44%) minmax(0, 1fr);
}

#detail.detail-modal-has-hostel-detail .worker-detail-modal > .worker-detail-field,
#detail.detail-modal-has-hostel-detail .worker-detail-section .card-body > .worker-detail-field {
    grid-template-columns: minmax(14rem, 34%) minmax(0, 1fr);
}

#detail.detail-modal-has-certification .worker-detail-modal > .worker-detail-field,
#detail.detail-modal-has-certification .worker-detail-section .card-body > .worker-detail-field {
    grid-template-columns: minmax(12rem, 46%) minmax(0, 1fr);
}

#detail.detail-modal-has-hostel-detail .worker-detail-section .card-body > .detail-modal-cert-row > [class*="col-"] > .worker-detail-field,
#detail.detail-modal-has-hostel-detail .worker-detail-section .card-body > .detail-modal-pair-row > [class*="col-"] > .worker-detail-field {
    grid-template-columns: minmax(9rem, 56%) minmax(0, 1fr);
    column-gap: 0.55rem;
}

.worker-detail-section .card-body > .detail-modal-cert-row:last-child,
.worker-detail-section .card-body > .detail-modal-pair-row:last-child,
.worker-detail-section .card-body > .detail-modal-facilities-block:last-child,
.worker-detail-section .card-body > .detail-modal-html-only:last-child,
.worker-detail-section .card-body > .worker-detail-field:last-child {
    margin-bottom: 0;
}

.worker-detail-section .card-body > .detail-modal-room-divider:first-child {
    margin-top: 0;
}

.worker-detail-modal > .worker-detail-section:last-child,
.worker-detail-modal > .worker-detail-profile:last-child {
    margin-bottom: 0 !important;
}

#detail .detail-modal-pair-row > [class*="col-"] > .worker-detail-field,
#detail .detail-modal-cert-row > [class*="col-"] > .worker-detail-field,
#detail .worker-detail-certification [class*="col-"] > .worker-detail-field {
    grid-template-columns: minmax(6.25rem, 48%) minmax(0, 1fr);
    column-gap: 0.45rem;
    row-gap: 0.15rem;
    align-items: baseline;
    margin-bottom: 0.55rem;
}

#detail .detail-modal-pair-row > [class*="col-"] > .worker-detail-field:last-child,
#detail .detail-modal-cert-row > [class*="col-"] > .worker-detail-field:last-child,
#detail .worker-detail-certification [class*="col-"] > .worker-detail-field:last-child {
    margin-bottom: 0;
}

.detail-modal-pair-row,
.detail-modal-cert-row {
    margin-bottom: var(--detail-modal-row-gap);
}

.detail-modal-pair-row > [class*="col-"]:first-child,
.detail-modal-cert-row > [class*="col-"]:first-child {
    padding-right: 0.35rem;
}

.detail-modal-pair-row > [class*="col-"]:last-child,
.detail-modal-cert-row > [class*="col-"]:last-child {
    padding-left: 0.35rem;
}

.detail-modal-room-divider {
    margin: 0.85rem 0;
}

.detail-modal-facilities-block {
    margin-bottom: var(--detail-modal-row-gap);
}

.worker-detail-field:has(.detail-modal-checkbox-list) {
    align-items: start;
}

.worker-detail-field:has(.detail-modal-checkbox-list) .worker-detail-label {
    padding-top: 0.15rem;
}

.detail-modal-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.detail-modal-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    min-height: 0;
    padding-left: 0;
}

.detail-modal-checkbox-item.form-check {
    padding-left: 0;
}

.detail-modal-checkbox-item .form-check-input {
    position: static;
    margin-top: 0.2rem;
    margin-left: 0;
    margin-right: 0;
    flex-shrink: 0;
    pointer-events: none;
    cursor: default;
    width: 1rem;
    height: 1rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    border: 1.5px solid #adb5bd;
    border-radius: 0.15rem;
    vertical-align: top;
    opacity: 1;
}

.detail-modal-checkbox-item .form-check-input:checked,
.detail-modal-checkbox-item .form-check-input:checked:disabled {
    background-color: #ffffff;
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2328a745' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.85rem 0.85rem;
}

.detail-modal-checkbox-item .form-check-input:disabled ~ .form-check-label {
    color: var(--detail-modal-value-color);
    opacity: 1;
}

.detail-modal-checkbox-item .form-check-label {
    color: var(--detail-modal-value-color);
    font-weight: var(--detail-modal-value-weight);
    font-size: var(--detail-modal-value-size);
    line-height: var(--detail-modal-line-height);
    cursor: default;
    flex: 1;
    min-width: 0;
}

.worker-detail-section .card-body > .worker-detail-field:has(.detail-modal-checkbox-list):last-child {
    margin-bottom: 0;
}

.detail-modal-facility-group-title {
    display: block;
    margin: 0 0 0.55rem;
    font-size: var(--detail-modal-label-size);
    font-weight: var(--detail-modal-label-weight);
    color: var(--detail-modal-label-color);
}

.detail-modal-facilities-block:last-child {
    margin-bottom: 0;
}

.detail-modal-facilities-block .form-check-label {
    color: var(--detail-modal-value-color);
    font-weight: var(--detail-modal-value-weight);
    font-size: var(--detail-modal-value-size);
}

.detail-modal-html-only {
    margin-bottom: var(--detail-modal-row-gap);
}

.worker-detail-field > .worker-detail-value ul,
.worker-detail-field > .worker-detail-value ol,
.worker-detail-field > .worker-detail-value .table,
.worker-detail-field > .worker-detail-value .worker-detail-table-wrap,
.worker-detail-field > .worker-detail-value .worker-detail-docs {
    display: block;
    width: 100%;
    margin-top: 0.15rem;
}

.worker-detail-value strong:not([style*="color"]) {
    font-weight: inherit;
    color: inherit;
}

.worker-detail-value.is-empty,
.detail-modal-value.is-empty {
    color: var(--detail-modal-empty-color);
    font-weight: var(--detail-modal-value-weight);
    font-style: italic;
}

.worker-detail-section.card {
    border: 1px solid #dee2e6;
    box-shadow: none;
}

.worker-detail-section .card-header.detail-modal-heading {
    background: #e8f4fd;
    border-bottom: 1px solid #d0e7f9;
    border-left: 4px solid #0d6efd;
    font-size: var(--detail-modal-heading-size);
    color: #111827;
    padding: 0.6rem 0.85rem 0.6rem 1rem;
}

.worker-detail-section .card-header.detail-modal-heading strong {
    font-weight: 700;
    color: #111827;
}

.worker-detail-section .card-body {
    padding: 0.85rem 1rem;
    color: #212529;
}

.worker-detail-cards .worker-detail-section {
    height: 100%;
}

.worker-detail-cards .card-body {
    min-height: 120px;
}

.worker-detail-docs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.worker-detail-docs .img-wrap img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.worker-detail-docs .worker-detail-value {
    color: #0d6efd;
    font-weight: 600;
}

.worker-detail-experience-item {
    padding: 0.85rem 0;
    border-bottom: 1px solid #dee2e6;
}

.worker-detail-experience-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.worker-detail-table-wrap {
    overflow-x: auto;
}

.worker-detail-table-wrap .table {
    margin-bottom: 0;
    font-size: 0.9375rem;
    color: #212529;
}

.worker-detail-table-wrap .table thead th {
    white-space: nowrap;
    background: #f1f3f5;
    border-top: none;
    color: #212529;
    font-weight: 700;
}

.worker-detail-table-wrap .table td,
.worker-detail-table-wrap .table th {
    color: #212529;
    vertical-align: middle;
}

.worker-detail-field .text-success,
.worker-detail-value.text-success {
    color: #198754 !important;
    font-weight: 700;
}

.worker-detail-field .text-danger,
.worker-detail-value.text-danger {
    color: #dc3545 !important;
    font-weight: 700;
}

.worker-detail-field .text-gray,
.worker-detail-value.text-gray {
    color: #495057 !important;
    font-weight: 600;
}

@media (max-width: 479.98px) {
    .worker-detail-field,
    #detail #content-detail p:has(> strong):not(:has(> strong:only-child)),
    #detail #content-detail p.activity-log-field {
        grid-template-columns: 1fr;
    }

    .worker-detail-label,
    .worker-detail-value,
    #detail #content-detail p strong,
    #detail #content-detail p .detail-modal-value,
    #detail #content-detail p .activity-log-value-list,
    #detail #content-detail .activity-log-field .activity-log-nested-item {
        grid-column: 1;
    }
}

@media (max-width: 767.98px) {
    .worker-detail-avatar {
        width: 110px;
        height: 110px;
        margin-bottom: 1rem;
    }

    .worker-detail-qr {
        margin-top: 1rem;
    }

    #detail.detail-modal-has-qr .worker-detail-profile .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #detail.detail-modal-has-qr .worker-detail-cards > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #detail.detail-modal-has-certification .row > .col-sm-6,
    #detail.detail-modal-has-certification .detail-modal-cert-row > .col-sm-6,
    #detail.detail-modal-has-certification .worker-detail-certification .row > .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #detail.detail-modal-has-hostel-detail .row > .col-sm-6,
    #detail.detail-modal-has-hostel-detail .detail-modal-cert-row > .col-sm-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Dark mode */
body.dark-mode #detail .modal-body {
    color: #f8f9fa !important;
}

body.dark-mode .worker-detail-modal {
    color: #f8f9fa !important;
}

body.dark-mode .worker-detail-profile.card,
body.dark-mode .worker-detail-section.card {
    background-color: #2c3238 !important;
    border-color: #495057 !important;
}

body.dark-mode .worker-detail-section .card-header.detail-modal-heading {
    background-color: #1a3a5c !important;
    border-bottom-color: #2d5a87 !important;
    border-left-color: #6ea8fe !important;
    color: #f8f9fa !important;
}

body.dark-mode .worker-detail-section .card-header.detail-modal-heading strong {
    color: #ffffff !important;
}

body.dark-mode .worker-detail-section .card-body,
body.dark-mode .worker-detail-profile .card-body {
    background-color: #2c3238 !important;
    color: #f8f9fa !important;
}

body.dark-mode .worker-detail-label,
body.dark-mode .detail-modal-label {
    color: #ffffff !important;
}

body.dark-mode .worker-detail-value,
body.dark-mode .detail-modal-value {
    color: #ffffff !important;
}

body.dark-mode .worker-detail-value.is-empty,
body.dark-mode .detail-modal-value.is-empty {
    color: #ffffff !important;
    font-weight: var(--detail-modal-value-weight) !important;
}

body.dark-mode .worker-detail-profile .worker-detail-label {
    color: #ffffff !important;
}

body.dark-mode .worker-detail-profile .worker-detail-value:not(.is-empty) {
    color: #ffffff !important;
}

body.dark-mode .worker-detail-avatar {
    border-color: #495057 !important;
}

body.dark-mode .worker-detail-qr img {
    border-color: #495057 !important;
    background-color: #ffffff;
}

body.dark-mode .worker-detail-docs .img-wrap img {
    border-color: #495057 !important;
}

body.dark-mode .worker-detail-docs .worker-detail-value,
body.dark-mode .worker-detail-docs a.fancybox .worker-detail-value,
body.dark-mode .worker-detail-modal a.fancybox,
body.dark-mode .worker-detail-modal a.fancybox .worker-detail-value {
    color: #6ea8fe !important;
}

body.dark-mode .worker-detail-experience-item {
    border-bottom-color: #495057 !important;
}

body.dark-mode .worker-detail-table-wrap .table {
    color: #f8f9fa !important;
    background-color: #2c3238 !important;
}

body.dark-mode .worker-detail-table-wrap .table thead th {
    background-color: #343a40 !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

body.dark-mode .worker-detail-table-wrap .table td,
body.dark-mode .worker-detail-table-wrap .table th {
    color: #f8f9fa !important;
    border-color: #495057 !important;
    background-color: #2c3238 !important;
}

body.dark-mode .worker-detail-table-wrap .table-bordered td,
body.dark-mode .worker-detail-table-wrap .table-bordered th {
    border-color: #495057 !important;
}

body.dark-mode .worker-detail-field .text-success,
body.dark-mode .worker-detail-value.text-success {
    color: #75b798 !important;
}

body.dark-mode .worker-detail-field .text-danger,
body.dark-mode .worker-detail-value.text-danger {
    color: #ea868f !important;
}

body.dark-mode .worker-detail-field .text-gray,
body.dark-mode .worker-detail-value.text-gray {
    color: #ced4da !important;
}

body.dark-mode .worker-detail-qr .btn-outline-primary {
    color: #6ea8fe !important;
    border-color: #6ea8fe !important;
}

body.dark-mode .worker-detail-qr .btn-outline-primary:hover {
    color: #ffffff !important;
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
}

/* Legacy detail markup (p/br/strong, alert-primary, tables, attachments) */
#detail #content-detail p {
    margin-bottom: var(--detail-modal-row-gap);
    line-height: var(--detail-modal-line-height);
}

#detail #content-detail p:has(> strong):not(:has(> strong:only-child)),
#detail #content-detail p.activity-log-field {
    display: grid;
    grid-template-columns: var(--detail-modal-field-columns);
    column-gap: var(--detail-modal-field-gap);
    row-gap: 0.25rem;
    align-items: baseline;
    font-size: var(--detail-modal-label-size);
    font-weight: var(--detail-modal-label-weight);
    color: var(--detail-modal-label-color);
}

#detail #content-detail p br {
    display: none;
}

#detail #content-detail p strong,
#detail #content-detail p .detail-modal-value,
#detail #content-detail p .activity-log-value-list {
    grid-column: 2;
    display: block;
    font-size: var(--detail-modal-value-size);
    font-weight: var(--detail-modal-value-weight);
    color: var(--detail-modal-value-color);
    margin-top: 0;
    line-height: var(--detail-modal-line-height);
    min-width: 0;
    word-break: break-word;
}

#detail #content-detail p strong.is-empty,
#detail #content-detail p .detail-modal-value.is-empty {
    color: var(--detail-modal-empty-color);
    font-weight: var(--detail-modal-value-weight);
    font-style: italic;
}

#detail #content-detail p strong[style*="color: red"],
#detail #content-detail p strong[style*="color:red"] {
    color: #dc3545 !important;
}

#detail #content-detail hr,
#detail #content-detail hr.detail-modal-divider {
    border-color: #dee2e6;
    margin: 1.25rem 0;
}

#detail #content-detail .detail-modal-section-title.detail-modal-heading {
    display: block;
    margin: 1.15rem 0 0.85rem;
    padding: 0.6rem 0.85rem 0.6rem 1rem;
    background: #e8f4fd;
    border: 1px solid #d0e7f9;
    border-left: 4px solid #0d6efd;
    border-radius: 0.25rem;
    font-size: var(--detail-modal-heading-size);
}

#detail #content-detail .detail-modal-section-title.detail-modal-heading:first-child,
#detail #content-detail > .worker-detail-modal > .detail-modal-section-title.detail-modal-heading:first-child {
    margin-top: 0;
}

#detail #content-detail .detail-modal-section-title.detail-modal-heading strong {
    display: block;
    color: #111827;
    font-weight: 700;
}

#detail #content-detail .alert.alert-primary {
    background: #e8f4fd;
    border: 1px solid #d0e7f9;
    border-left: 4px solid #0d6efd;
    color: #111827;
    font-weight: 700;
    font-size: var(--detail-modal-heading-size);
    padding: 0.6rem 0.85rem 0.6rem 1rem;
    margin: 1.15rem 0 0.85rem;
    border-radius: 0.25rem;
}

#detail #content-detail > b,
#detail #content-detail .row > div > b,
#detail #content-detail strong u {
    color: #111827;
}

#detail #content-detail .activity-log-field {
    margin-bottom: var(--detail-modal-row-gap);
    line-height: var(--detail-modal-line-height);
}

#detail #content-detail .activity-log-field strong,
#detail #content-detail .activity-log-field .detail-modal-value,
#detail #content-detail .activity-log-value-list {
    font-size: var(--detail-modal-value-size);
    font-weight: var(--detail-modal-value-weight);
    color: var(--detail-modal-value-color);
}

#detail #content-detail .activity-log-field .detail-modal-value.is-empty,
#detail #content-detail .activity-log-field strong.is-empty {
    color: var(--detail-modal-empty-color);
    font-weight: var(--detail-modal-value-weight);
    font-style: italic;
}

#detail #content-detail .activity-log-field .activity-log-value-list,
#detail #content-detail .activity-log-field .activity-log-nested-item {
    margin-top: 0.15rem;
}

#detail #content-detail .activity-log-field .activity-log-nested-item {
    grid-column: 2;
}

#detail #content-detail .activity-log-value-list li {
    margin-bottom: 0.35rem;
}

#detail #content-detail .activity-log-nested-item {
    margin-left: 0.75rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: #111827;
}

#detail #content-detail .activity-log-nested-item .text-muted {
    color: var(--detail-modal-label-color) !important;
    font-weight: var(--detail-modal-label-weight);
    font-size: var(--detail-modal-label-size);
}

#detail #content-detail .user-image {
    max-width: 180px;
    max-height: 180px;
    object-fit: cover;
}

#detail #content-detail .input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#detail #content-detail .input-group .img-wrap img,
#detail #content-detail .img-wrap img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

#detail #content-detail .table {
    font-size: 0.9375rem;
    color: #212529;
}

#detail #content-detail .table thead th {
    background: #f1f3f5;
    color: #212529;
    font-weight: 700;
}

#detail #content-detail .table td,
#detail #content-detail .table th {
    color: #212529;
    vertical-align: middle;
}

#detail #content-detail .form-check-label {
    color: #111827;
    font-weight: 600;
}

body.dark-mode #detail #content-detail p:has(> strong):not(:has(> strong:only-child)),
body.dark-mode #detail #content-detail p.activity-log-field {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail p strong,
body.dark-mode #detail #content-detail p .detail-modal-value,
body.dark-mode #detail #content-detail .activity-log-field .detail-modal-value,
body.dark-mode #detail #content-detail .activity-log-value-list {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail p strong.is-empty,
body.dark-mode #detail #content-detail p .detail-modal-value.is-empty {
    color: #ffffff !important;
    font-weight: var(--detail-modal-value-weight) !important;
}

body.dark-mode #detail #content-detail hr,
body.dark-mode #detail #content-detail hr.detail-modal-divider {
    border-color: #495057 !important;
}

body.dark-mode #detail #content-detail .detail-modal-section-title.detail-modal-heading {
    background: #1a3a5c !important;
    border-color: #2d5a87 !important;
    border-left-color: #6ea8fe !important;
}

body.dark-mode #detail #content-detail .detail-modal-section-title.detail-modal-heading strong {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail .alert.alert-primary {
    background: #1a3a5c !important;
    border-color: #2d5a87 !important;
    border-left-color: #6ea8fe !important;
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail > b,
body.dark-mode #detail #content-detail .row > div > b,
body.dark-mode #detail #content-detail strong u {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail .activity-log-field {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail .activity-log-field strong,
body.dark-mode #detail #content-detail .activity-log-field .detail-modal-value:not(.is-empty),
body.dark-mode #detail #content-detail .activity-log-value-list,
body.dark-mode #detail #content-detail .activity-log-nested-item {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail .activity-log-field .detail-modal-value.is-empty,
body.dark-mode #detail #content-detail .activity-log-field strong.is-empty {
    color: #ffffff !important;
    font-weight: var(--detail-modal-value-weight) !important;
}

body.dark-mode #detail #content-detail .activity-log-nested-item .text-muted {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail .table {
    color: #f8f9fa !important;
    background-color: #2c3238 !important;
}

body.dark-mode #detail #content-detail .table thead th {
    background-color: #343a40 !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

body.dark-mode #detail #content-detail .table td,
body.dark-mode #detail #content-detail .table th {
    color: #f8f9fa !important;
    border-color: #495057 !important;
    background-color: #2c3238 !important;
}

body.dark-mode #detail #content-detail .form-check-label {
    color: #ffffff !important;
}

body.dark-mode #detail #content-detail .detail-modal-checkbox-item .form-check-input {
    background-color: #ffffff;
    border-color: #adb5bd;
}

body.dark-mode #detail #content-detail .detail-modal-checkbox-item .form-check-input:checked,
body.dark-mode #detail #content-detail .detail-modal-checkbox-item .form-check-input:checked:disabled {
    background-color: #ffffff;
    border-color: #28a745;
}

body.dark-mode #detail #content-detail a {
    color: #6ea8fe;
}

/* Typography overrides — ensure modal styles are not overridden */
#detail .worker-detail-section .card-header.detail-modal-heading,
#detail #content-detail .detail-modal-section-title.detail-modal-heading,
#detail #content-detail .alert.alert-primary {
    font-size: var(--detail-modal-heading-size) !important;
}

#detail .worker-detail-section .card-header.detail-modal-heading strong,
#detail #content-detail .detail-modal-section-title.detail-modal-heading strong,
#detail #content-detail .alert.alert-primary {
    font-size: inherit !important;
}

#detail .worker-detail-label,
#detail .detail-modal-label,
#detail .detail-modal-facility-group-title,
#detail #content-detail p:has(> strong):not(:has(> strong:only-child)),
#detail #content-detail p.activity-log-field {
    font-size: var(--detail-modal-label-size) !important;
    font-weight: var(--detail-modal-label-weight) !important;
    color: var(--detail-modal-label-color) !important;
}

body.dark-mode #detail .worker-detail-label,
body.dark-mode #detail .detail-modal-label,
body.dark-mode #detail .detail-modal-facility-group-title,
body.dark-mode #detail #content-detail p:has(> strong):not(:has(> strong:only-child)),
body.dark-mode #detail #content-detail p.activity-log-field,
body.dark-mode #detail #content-detail .activity-log-field,
body.dark-mode #detail #content-detail .activity-log-nested-item .text-muted {
    color: #ffffff !important;
}

#detail .worker-detail-value.is-empty,
#detail .detail-modal-value.is-empty,
#detail #content-detail p strong.is-empty,
#detail #content-detail p .detail-modal-value.is-empty,
#detail #content-detail .activity-log-field .detail-modal-value.is-empty,
#detail #content-detail .activity-log-field strong.is-empty {
    color: var(--detail-modal-empty-color) !important;
    font-weight: var(--detail-modal-value-weight) !important;
    font-style: italic !important;
}

body.dark-mode #detail .worker-detail-value.is-empty,
body.dark-mode #detail .detail-modal-value.is-empty,
body.dark-mode #detail #content-detail p strong.is-empty,
body.dark-mode #detail #content-detail p .detail-modal-value.is-empty,
body.dark-mode #detail #content-detail .activity-log-field .detail-modal-value.is-empty,
body.dark-mode #detail #content-detail .activity-log-field strong.is-empty {
    color: #ffffff !important;
}

