/* CART MODAL (Upload Prescription) */
.modal-custom .custom-dropdown { width: 100%; margin-bottom: 1rem; }
.modal-custom .custom-dropdown-list { z-index: 10050; }
.modal-custom .custom-dropdown-trigger::after,
.modal-custom .custom-dropdown-trigger-wrap::after {
    color: #000;
}
.modal-custom .custom-dropdown-trigger:not(.is-placeholder),
.modal-custom .custom-dropdown-trigger-input:not(.is-placeholder) {
    background: #fff !important;
    color: #1e293b;
}
.modal-custom .custom-dropdown-trigger.is-placeholder:not(.open),
.modal-custom .custom-dropdown-trigger-input.is-placeholder:not(.open) {
    background: #f8fafc;
    color: #94a3b8;
}
.modal-custom .custom-dropdown-trigger:hover:not(.open):not(.is-placeholder),
.modal-custom .custom-dropdown-trigger-input:hover:not(.open):not(:focus) {
    border-color: #cbd5e1;
    background: #fff !important;
}
.modal-custom .custom-dropdown-trigger.is-placeholder:not(.open):hover,
.modal-custom .custom-dropdown-trigger-input.is-placeholder:not(.open):not(:focus):hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.modal-custom .custom-dropdown-trigger.open,
.modal-custom .custom-dropdown-trigger-input.open,
.modal-custom .custom-dropdown-trigger-input:focus:not(.is-placeholder) {
    border-color: #1a6b3c;
    background: #fff !important;
    outline: none;
    box-shadow: none;
}
.modal-custom {
    display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.45); z-index: 9999; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease; padding: 1rem; backdrop-filter: blur(4px);
}
.modal-custom.active { display: flex; opacity: 1; }
.modal-custom.modal-slide-closing { opacity: 0; transition: opacity 0.26s ease; }
#cartModal.cart-modal-camera-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
#cartModal.modal-slide-open.is-closing:not(.cart-modal-camera-hidden) {
    display: flex !important;
    pointer-events: none;
    animation: erxModalBackdropOut 0.26s ease-in both;
}
#cartModal.cart-modal-camera-reveal {
    display: flex !important;
    animation: erxModalBackdropIn 0.3s ease-out both;
}
@media (prefers-reduced-motion: reduce) {
    #cartModal.modal-slide-open.is-closing,
    #cartModal.cart-modal-camera-reveal,
    #cartModal .modal-content-custom.modal-fade-in,
    #cartModal .modal-content-custom.modal-fade-out {
        animation: none !important;
    }
}
.modal-custom .modal-content-custom {
    background: #fff; border-radius: 20px; width: 95%; max-width: 800px;
    max-height: 92vh; overflow: hidden; display: flex; flex-direction: column;
    font-family: 'Inter', sans-serif; box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    transform-origin: center center;
}
.modal-custom .modal-header {
    padding: 1rem 1.5rem; border-bottom: 1px solid #f1f5f9;
    display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.modal-custom .modal-header h3 { font-size: 1.1rem; font-weight: 700; color: #1a1a2e; margin: 0; display: flex; align-items: center; gap: 0.35rem; }
.modal-custom .modal-header h3 i { color: #1a6b3c; }
.modal-custom .close-btn { font-size: 1.5rem; font-weight: 700; color: #94a3b8; cursor: pointer; line-height: 1; transition: color 0.15s; }
.modal-custom .close-btn:hover { color: #dc2626; }
.modal-custom .modal-body { padding: 1rem 1.5rem; overflow-y: auto; overflow-x: visible; flex: 1; }
.modal-custom .instruction { color: #6b7280; font-size: 0.85rem; margin-bottom: 1rem; }
.modal-custom .instruction strong { font-weight: 600; color: inherit; }
.modal-custom .drop-zone {
    border: 2px dashed #cbd5e1; border-radius: 14px; padding: 1.5rem; text-align: center;
    cursor: pointer; transition: all 0.25s; background: #f8fafc; position: relative; overflow: visible;
}
.modal-custom .drop-zone:hover, .modal-custom .drop-zone.drag-over { border-color: #1a6b3c; background: #f0fdf4; }
.modal-custom .drop-zone .btn-browse {
    background: #1a6b3c; color: #fff; border: none; border-radius: 10px;
    padding: 0.55rem 1.5rem; font-weight: 600; font-size: 0.88rem; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.modal-custom .drop-zone .btn-browse:hover { background: #13522d; }
.file-preview {
    display: flex; align-items: center; gap: 0.75rem;
    margin-top: 0.75rem; padding: 0.6rem 1rem; background: #f0fdf4;
    border-radius: 10px; border: 1px solid #bbf7d0;
}
.file-preview-thumb {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #bbf7d0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cart-pdf-thumb {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #dc2626;
}
.cart-pdf-thumb span {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1;
}
.file-preview-thumb img.is-hidden {
    display: none !important;
}
.file-preview #cartFileName {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-custom .remove-file {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: #fff;
    border: 1.5px solid #fca5a5;
    color: #dc2626;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s;
    line-height: 1.25;
    font-family: inherit;
    text-transform: none;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}
.modal-custom .remove-file:hover {
    background: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
}
.cart-browse-anchor {
    position: relative;
    display: inline-block;
}
.cart-upload-modal-overlay {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10050;
    display: none;
    background: none;
    animation: cartFadeIn 0.2s ease-out;
}
.cart-upload-modal-overlay::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
}
.cart-upload-modal {
    background: #fff;
    border-radius: 16px;
    width: 220px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    animation: cartSlideDown 0.2s ease-out;
    border: 1px solid #e2e8f0;
}
@keyframes cartSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cartFadeIn { from { opacity: 0; } to { opacity: 1; } }
.cart-upload-modal-body {
    padding: 0.75rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.cart-upload-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: #444;
    text-align: left;
    width: 100%;
}
.cart-upload-option:hover {
    border-color: #1a6b3c;
    background: #f0fdf4;
}
.cart-upload-option i {
    font-size: 1.1rem;
    color: #1a6b3c;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.info-box { display: flex; align-items: flex-start; gap: 0.75rem; background: #f0fdf4; border-radius: 12px; padding: 0.85rem 1rem; margin-top: 1rem; margin-bottom: 1.25rem; }
.info-box i { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: #1a6b3c; color: #fff; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 0.72rem; font-weight: 700; }
.info-box strong { font-size: 0.85rem; color: #1a1a2e; display: block; }
.info-box p { font-size: 0.82rem; color: #4b5563; margin: 0.15rem 0 0; }
.modal-custom .label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #444;
    display: block;
    margin-bottom: 0.35rem;
}
.modal-custom textarea { width: 100%; min-height: 80px; max-height: 120px; padding: 0.75rem 1rem; border-radius: 10px; border: 1.5px solid #e2e8f0; font-size: 0.85rem; font-family: inherit; resize: vertical; box-sizing: border-box; }
.modal-custom textarea:focus { border-color: #1a6b3c; outline: none; box-shadow: 0 0 0 4px rgba(26,107,60,0.12); }
.modal-custom #cartCharCount { text-align: right; font-size: 0.78rem; color: #94a3b8; margin-top: 0.25rem; }
.modal-custom .modal-footer {
    padding: 0.85rem 1.5rem; border-top: 1px solid #f1f5f9;
    display: flex; justify-content: flex-end; align-items: center; flex-wrap: nowrap;
    gap: 0.5rem; flex-shrink: 0;
}
.cart-modal-footer-actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.cart-modal-footer-actions .btn {
    margin: 0;
    border-width: 1.5px;
    text-transform: none;
    -webkit-appearance: none;
    appearance: none;
}
.modal-custom .btn {
    padding: 0.65rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.25;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-transform: none;
    box-sizing: border-box;
}
.modal-custom .btn.cart-modal-btn-cancel {
    background: #fff;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    box-shadow: none;
}
.modal-custom .btn.cart-modal-btn-cancel:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}
.modal-custom .btn.upload {
    background: #1a6b3c;
    color: #fff;
    border: 1.5px solid transparent;
    box-shadow: none;
}
.modal-custom .btn.upload:hover { background: #13522d; box-shadow: none; }
.modal-custom .btn.upload.btn-loading { pointer-events: none; opacity: 0.92; }
.modal-custom .btn.upload .btn-spinner {
    display: none;
    font-size: 1rem;
    line-height: 1;
}
.modal-custom .btn.upload.btn-loading .btn-spinner { display: inline-flex; }
.modal-custom .btn.upload .btn-text-loading { display: none; }
.modal-custom .btn.upload.btn-loading .btn-text { display: none; }
.modal-custom .btn.upload.btn-loading .btn-text-loading { display: inline; }
.cart-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.cart-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: #f0fdf4;
    border-radius: 10px;
    border: 1px solid #bbf7d0;
}
.cart-file-item-name {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cart-file-item-type {
    font-size: 0.72rem;
    font-weight: 700;
    color: #1a6b3c;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cart-upload-content-hidden {
    display: none !important;
}

/* No black/gray press flash on tap */
.modal-custom button,
.modal-custom .close-btn,
.modal-custom .drop-zone,
.modal-custom .drop-zone .btn-browse,
.cart-upload-option,
.modal-custom .remove-file,
#cameraBox button,
#cameraBox .cam-close {
    -webkit-tap-highlight-color: transparent;
}
.modal-custom button:focus,
.modal-custom button:active,
.modal-custom button:focus-visible,
.modal-custom .close-btn:focus,
.modal-custom .close-btn:active,
.modal-custom .drop-zone .btn-browse:focus,
.modal-custom .drop-zone .btn-browse:active,
.modal-custom .drop-zone .btn-browse:focus-visible,
.cart-upload-option:focus,
.cart-upload-option:active,
.cart-upload-option:focus-visible,
.modal-custom .remove-file:focus,
.modal-custom .remove-file:active,
.modal-custom .remove-file:focus-visible,
#cameraBox .cam-btn:focus,
#cameraBox .cam-btn:active,
#cameraBox .cam-btn:focus-visible,
#cameraBox .cam-close:focus,
#cameraBox .cam-close:active,
#cameraBox .cam-close:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}
.modal-custom .btn.upload:active {
    background: #13522d;
}

/* Dark mode — loaded after light styles (cart modal is included at end of body) */
html[data-theme="dark"] .modal-custom .modal-content-custom {
    background: var(--dm-surface, #242428) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .modal-custom .modal-header,
html[data-theme="dark"] .modal-custom .modal-body,
html[data-theme="dark"] .modal-custom .modal-footer {
    background: var(--dm-surface, #242428) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .btn.cart-modal-btn-cancel {
    background: var(--dm-surface-elevated, #2e2e33) !important;
    color: var(--dm-text-secondary, #a1a1aa) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .btn.cart-modal-btn-cancel:hover {
    background: var(--dm-surface-raised, #2c2c30) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
    color: var(--dm-text, #f5f5f5) !important;
}

html[data-theme="dark"] .modal-custom .modal-header h3,
html[data-theme="dark"] .modal-custom .label,
html[data-theme="dark"] .modal-custom .info-box strong {
    color: var(--dm-text, #f5f5f5) !important;
}

html[data-theme="dark"] .modal-custom .instruction,
html[data-theme="dark"] .modal-custom .info-box p,
html[data-theme="dark"] .modal-custom #cartCharCount,
html[data-theme="dark"] .modal-custom .cart-file-item-name {
    color: var(--dm-text-secondary, #a1a1aa) !important;
}

html[data-theme="dark"] .modal-custom .drop-zone {
    background: var(--dm-bg, #1c1c1e) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .drop-zone:hover,
html[data-theme="dark"] .modal-custom .drop-zone.drag-over {
    border-color: var(--dm-primary, #1a6b3c) !important;
    background: var(--dm-primary-subtle, rgba(26, 107, 60, 0.18)) !important;
}

html[data-theme="dark"] .modal-custom .drop-zone-content > i {
    color: #4ade80 !important;
}

html[data-theme="dark"] .modal-custom .drop-zone-content > p {
    color: var(--dm-text-secondary, #a1a1aa) !important;
}

html[data-theme="dark"] .modal-custom .drop-zone-content > p:first-of-type {
    color: var(--dm-text, #f5f5f5) !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-trigger::after,
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger-wrap::after {
    color: #fff !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-trigger:not(.is-placeholder),
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger-input:not(.is-placeholder) {
    background: var(--dm-bg, #1c1c1e) !important;
    color: var(--dm-text, #f5f5f5) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-trigger.is-placeholder:not(.open),
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger-input.is-placeholder:not(.open) {
    background: var(--dm-surface-raised, #2c2c30) !important;
    color: var(--dm-text-secondary, #a1a1aa) !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-trigger:hover:not(.open):not(.is-placeholder),
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger-input:hover:not(.open):not(:focus),
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger.is-placeholder:not(.open):hover,
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger-input.is-placeholder:not(.open):not(:focus):hover {
    border-color: var(--dm-border, #3a3a3f) !important;
    background: var(--dm-surface-raised, #2c2c30) !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-trigger.open,
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger-input.open,
html[data-theme="dark"] .modal-custom .custom-dropdown-trigger-input:focus:not(.is-placeholder) {
    border-color: var(--dm-primary, #1a6b3c) !important;
    background: var(--dm-bg, #1c1c1e) !important;
    box-shadow: 0 0 0 3px rgba(26, 107, 60, 0.25) !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-list {
    background: var(--dm-surface, #242428) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-list .cd-item {
    color: var(--dm-text, #f5f5f5) !important;
    border-bottom-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .custom-dropdown-list .cd-item:hover,
html[data-theme="dark"] .modal-custom .custom-dropdown-list .cd-item.selected,
html[data-theme="dark"] .modal-custom .custom-dropdown-list .cd-item.active {
    background: var(--dm-primary-subtle, rgba(26, 107, 60, 0.18)) !important;
    color: #4ade80 !important;
}

html[data-theme="dark"] .modal-custom textarea {
    background: var(--dm-bg, #1c1c1e) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
    color: var(--dm-text, #f5f5f5) !important;
}

html[data-theme="dark"] .modal-custom textarea:focus {
    border-color: var(--dm-primary, #1a6b3c) !important;
    box-shadow: 0 0 0 3px rgba(26, 107, 60, 0.25) !important;
}

html[data-theme="dark"] .modal-custom textarea::placeholder {
    color: var(--dm-text-secondary, #a1a1aa) !important;
}

html[data-theme="dark"] .modal-custom .info-box,
html[data-theme="dark"] .modal-custom .file-preview,
html[data-theme="dark"] .modal-custom .cart-file-item {
    background: var(--dm-primary-subtle, rgba(26, 107, 60, 0.18)) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .file-preview-thumb,
html[data-theme="dark"] .modal-custom .cart-pdf-thumb {
    background: var(--dm-surface, #242428) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .cart-file-item-type {
    color: #4ade80 !important;
}

html[data-theme="dark"] .modal-custom .remove-file {
    background: var(--dm-surface, #242428) !important;
    border-color: rgba(248, 113, 113, 0.45) !important;
    color: #f87171 !important;
}

html[data-theme="dark"] .modal-custom .remove-file:hover {
    background: rgba(220, 38, 38, 0.15) !important;
    border-color: #ef4444 !important;
    color: #fca5a5 !important;
}

/* Browse Files popup */
html[data-theme="dark"] .modal-custom .cart-upload-modal-overlay::before {
    background: var(--dm-surface, #242428) !important;
    border-left-color: var(--dm-border, #3a3a3f) !important;
    border-top-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] .modal-custom .cart-upload-modal {
    background: var(--dm-surface, #242428) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .modal-custom .cart-upload-option {
    background: var(--dm-bg, #1c1c1e) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
    color: var(--dm-text, #f5f5f5) !important;
}

html[data-theme="dark"] .modal-custom .cart-upload-option:hover {
    background: var(--dm-primary-subtle, rgba(26, 107, 60, 0.18)) !important;
    border-color: var(--dm-primary, #1a6b3c) !important;
    color: #4ade80 !important;
}

html[data-theme="dark"] .modal-custom .cart-upload-option i {
    color: #4ade80 !important;
}

html[data-theme="dark"] #cameraBox {
    background: var(--dm-surface, #242428) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] #cameraBox .cam-header {
    background: var(--dm-surface, #242428) !important;
    border-bottom-color: var(--dm-border, #3a3a3f) !important;
}

html[data-theme="dark"] #cameraBox .cam-header h3 {
    color: var(--dm-text, #f5f5f5) !important;
}

html[data-theme="dark"] #cameraBox .cam-body {
    background: var(--dm-surface, #242428) !important;
}

html[data-theme="dark"] #cameraBox .retake-btn,
html[data-theme="dark"] #cameraBox .add-btn {
    background: var(--dm-bg, #1c1c1e) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
    color: var(--dm-text-secondary, #a1a1aa) !important;
}

html[data-theme="dark"] #cameraBox .retake-btn:hover,
html[data-theme="dark"] #cameraBox .add-btn:hover {
    background: var(--dm-surface-raised, #2c2c30) !important;
    border-color: var(--dm-border, #3a3a3f) !important;
    color: var(--dm-text, #f5f5f5) !important;
}

@media (max-width: 575.98px) {
    .flash-toast-stack,
    .erx-success-toast-stack {
        top: calc(var(--app-nav-height, 56px) + 0.75rem);
        bottom: auto;
        right: 1rem;
        left: 1rem;
        width: auto;
    }
}

@media (max-width: 767.98px) {
    #cartModal .modal-footer {
        display: block;
    }
    #cartModal .cart-modal-footer-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 0.5rem;
        width: 100%;
    }
    #cartModal .cart-modal-footer-actions .cart-modal-btn-cancel {
        order: 2;
    }
    #cartModal .cart-modal-footer-actions .btn.upload {
        order: 1;
    }
    #cartModal .cart-modal-footer-actions .btn,
    #cartModal .cart-modal-footer-actions .btn.upload,
    #cartModal .cart-modal-footer-actions .cart-modal-btn-cancel {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        justify-self: stretch;
        display: flex !important;
        min-height: 40px;
        height: 40px;
        padding: 0 1.5rem;
        line-height: 1;
    }
}
#cameraOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.55);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}
#cameraOverlay.active,
#cameraOverlay.modal-slide-open {
    display: flex;
}
#cameraOverlay.modal-slide-open:not(.modal-slide-closing) {
    animation: erxModalBackdropIn 0.3s ease-out both;
}
#cameraOverlay.modal-slide-closing {
    display: flex !important;
    animation: erxModalBackdropOut 0.26s ease-in both;
}
#cameraBox {
    background: #fff;
    border-radius: 20px;
    width: 94%;
    max-width: 720px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: center center;
}
#cameraBox .cam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
#cameraBox .cam-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
#cameraBox .cam-header h3 i {
    color: #1a6b3c;
    font-size: 1rem;
}
#cameraBox .cam-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.15s;
    font-family: inherit;
    outline: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}
#cameraBox .cam-close:hover {
    color: #dc2626;
}
#cameraBox .cam-body {
    padding: 1rem 1.5rem 1.5rem;
    text-align: center;
}
#cameraBox .cam-preview-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    max-height: 72vh;
}
#cameraBox video {
    display: block;
    width: 100%;
    max-height: 72vh;
    border-radius: 12px;
    background: #000;
    object-fit: cover;
}
#cameraBox .cam-preview-wrap img {
    display: block;
    width: 100%;
    max-height: 72vh;
    object-fit: cover;
    border-radius: 12px;
}
#cameraBox canvas { display: none; }
#cameraBox .cam-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
#cameraBox .cam-btn {
    border-radius: 10px;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow: none;
}
#cameraBox .cam-btn:focus,
#cameraBox .cam-btn:active,
#cameraBox .cam-btn:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}
#cameraBox .capture-btn { background: #1a6b3c; color: #fff; }
#cameraBox .capture-btn:hover { background: #13522d; }
#cameraBox .retake-btn { background: #f1f5f9; color: #475569; border: 1.5px solid #e2e8f0; }
#cameraBox .retake-btn:hover { background: #e2e8f0; }
#cameraBox .add-btn { background: #f1f5f9; color: #475569; border: 1.5px solid #e2e8f0; }
#cameraBox .add-btn:hover { background: #e2e8f0; }
#cameraBox .add-btn:disabled { opacity: 0.45; cursor: not-allowed; }
#cameraBox .confirm-btn { background: #1a6b3c; color: #fff; }
#cameraBox .confirm-btn:hover { background: #13522d; }
#cameraBox .done-btn { background: #1a6b3c; color: #fff; }
#cameraBox .done-btn:hover { background: #13522d; }

@media (max-width: 767.98px) {
    #cameraOverlay {
        padding: 0.75rem;
    }
    #cameraBox {
        width: 100%;
        max-width: 100%;
    }
    #cameraBox .cam-header {
        padding: 0.85rem 1rem;
    }
    #cameraBox .cam-body {
        padding: 0.75rem 1rem 1.25rem;
    }
    #cameraBox .cam-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        margin-top: 12px;
    }
    #cameraBox .cam-btn {
        width: 100%;
        justify-content: center;
    }
}
<?php include __DIR__ . '/includes/camera_torch_styles.php'; ?>
