/* PressFly 3.5.86 — unified dark-mode completion layer
 * Loaded after legacy theme files. It intentionally uses theme-scoped selectors
 * so light mode and media content are never altered.
 */
html.dark-mode-site,
html.dark-mode,
body.dark-mode-site,
body.dark-mode,
body.dark {
    color-scheme: dark;
    --pf-dark-page: #07101d;
    --pf-dark-surface: #0f172a;
    --pf-dark-surface-2: #111c30;
    --pf-dark-surface-3: #172033;
    --pf-dark-border: #2b3a50;
    --pf-dark-text: #eef4ff;
    --pf-dark-muted: #a7b4c7;
    --pf-dark-accent: #60a5fa;
    --pf-dark-input: #0a1322;
}

/* Page chrome */
html.dark-mode-site body,
html.dark-mode body,
body.dark-mode-site,
body.dark-mode,
body.dark,
html.dark-mode-site .content-wrapper,
html.dark-mode .content-wrapper,
body.dark-mode-site .content-wrapper,
body.dark-mode .content-wrapper,
body.dark .content-wrapper,
html.dark-mode-site .content,
html.dark-mode .content,
body.dark-mode-site .content,
body.dark-mode .content,
body.dark .content {
    background: var(--pf-dark-page) !important;
    color: var(--pf-dark-text) !important;
}

html.dark-mode-site .main-header,
html.dark-mode .main-header,
body.dark-mode-site .main-header,
body.dark-mode .main-header,
body.dark .main-header,
html.dark-mode-site .navbar-white,
html.dark-mode .navbar-white,
body.dark-mode-site .navbar-white,
body.dark-mode .navbar-white,
body.dark .navbar-white {
    background: #0b1424 !important;
    border-color: var(--pf-dark-border) !important;
    color: var(--pf-dark-text) !important;
}

html.dark-mode-site .main-header .nav-link,
html.dark-mode .main-header .nav-link,
body.dark-mode-site .main-header .nav-link,
body.dark-mode .main-header .nav-link,
body.dark .main-header .nav-link {
    color: #d8e3f3 !important;
}

/* Common surfaces — admin, member and public account pages */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.card, .card-header, .card-body, .card-footer, .modal-content, .dropdown-menu,
    .list-group-item, .tab-content, .accordion, .accordion-item, .collapse-card,
    .settings-tabs-card, .pf-settings-tabs-card, .pf-settings-command,
    .pf-settings-health-card, .pf-settings-summary-card, .pf-settings-module-card,
    .pf-settings-tab-pane, .pf-settings-section, .pf-settings-panel,
    .pf-admin-card, .pf-panel, .pf-box, .pf-widget, .pf-form-card,
    .pf-cleanup-card, .pf-cleanup-panel, .pf-cleanup-section,
    .pf-earnings-card, .pf-option-card, .info-box, .small-box) {
    background-color: var(--pf-dark-surface) !important;
    border-color: var(--pf-dark-border) !important;
    color: var(--pf-dark-text) !important;
    box-shadow: none !important;
}

:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.card-header, .card-footer, .modal-header, .modal-footer, .pf-settings-command,
    .pf-settings-tabs-card > .card-header, .settings-tabs-card > .card-header) {
    background-color: #0c1627 !important;
    border-color: var(--pf-dark-border) !important;
}

/* Settings center: fix white islands and inherited black text */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.pf-settings-hero, .pf-settings-command, .pf-settings-health, .pf-settings-summary,
    .pf-settings-modules, .pf-settings-grid, .pf-settings-tabs-card,
    .pf-settings-tabs-card .tab-pane, #form-settings .tab-pane) {
    color: var(--pf-dark-text) !important;
}

:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.pf-settings-hero {
    background: radial-gradient(circle at 10% 0%, rgba(37,99,235,.22), transparent 38%),
                linear-gradient(135deg,#111c30,#0a1322) !important;
    border-color: #31415a !important;
}

:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.pf-settings-module-card, .pf-settings-health-card, .pf-settings-summary-card) {
    background: linear-gradient(180deg,#111c30,#0d1728) !important;
}

:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.pf-settings-hero h1, .pf-settings-hero h2, .pf-settings-hero h3,
    .pf-settings-command h1, .pf-settings-command h2, .pf-settings-command h3,
    .pf-settings-module-card strong, .pf-settings-health-card strong,
    .pf-settings-summary-card strong, .card-title, .modal-title, legend, label) {
    color: var(--pf-dark-text) !important;
}

:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.pf-settings-hero p, .pf-settings-command p, .pf-settings-module-card span,
    .text-muted, small, .help-block, .form-text) {
    color: var(--pf-dark-muted) !important;
}

/* Tabs and navigation */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.nav-tabs {
    border-color: var(--pf-dark-border) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.nav-tabs .nav-link {
    color: #b9c7da !important;
    background: transparent !important;
    border-color: transparent !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.nav-tabs .nav-link:hover {
    background: #17233a !important;
    color: #fff !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.nav-tabs .nav-link.active {
    background: #1b2b47 !important;
    border-color: #3b5272 !important;
    color: #fff !important;
}

/* Forms, Select2, custom controls */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.form-control, .custom-select, input[type="text"], input[type="email"], input[type="url"],
    input[type="number"], input[type="password"], input[type="search"], input[type="date"],
    input[type="time"], input[type="datetime-local"], textarea, select) {
    background-color: var(--pf-dark-input) !important;
    border-color: #3a4b64 !important;
    color: var(--pf-dark-text) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.form-control, .custom-select, input, textarea, select)::placeholder {
    color: #7f8ea3 !important;
    opacity: 1 !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.form-control, .custom-select, input, textarea, select):focus {
    background-color: #0b1628 !important;
    border-color: var(--pf-dark-accent) !important;
    color: #fff !important;
    box-shadow: 0 0 0 .18rem rgba(96,165,250,.16) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
input:disabled,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
select:disabled,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
textarea:disabled,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.form-control[readonly] {
    background: #131f32 !important;
    color: #9fb0c5 !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.input-group-text {
    background: #17233a !important;
    border-color: #3a4b64 !important;
    color: #dce7f7 !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.select2-container--default .select2-selection--single,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.select2-container--default .select2-selection--multiple {
    background: var(--pf-dark-input) !important;
    border-color: #3a4b64 !important;
    color: var(--pf-dark-text) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.select2-dropdown,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.select2-results__option {
    background: #0f172a !important;
    border-color: var(--pf-dark-border) !important;
    color: #dce7f7 !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.select2-results__option--highlighted[aria-selected] {
    background: #244a7c !important;
    color: #fff !important;
}

/* Tables */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.table,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.table-responsive {
    color: var(--pf-dark-text) !important;
    background: var(--pf-dark-surface) !important;
    border-color: var(--pf-dark-border) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.table thead th {
    background: #0b1424 !important;
    color: #dce7f7 !important;
    border-color: var(--pf-dark-border) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.table td,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.table th {
    border-color: var(--pf-dark-border) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(255,255,255,.025) !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.table-hover tbody tr:hover {
    background: rgba(96,165,250,.08) !important;
    color: #fff !important;
}

/* Modals, popovers, dropdowns and editors */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.dropdown-item, .popover-body, .popover-header, .tooltip-inner) {
    color: #dce7f7 !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.dropdown-item:hover,
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.dropdown-item:focus {
    background: #1b2b47 !important;
    color: #fff !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.note-editor, .note-toolbar, .note-statusbar, .note-editable, .CodeMirror, .CodeMirror-gutters) {
    background: #0b1424 !important;
    border-color: var(--pf-dark-border) !important;
    color: var(--pf-dark-text) !important;
}

/* Alerts retain semantic meaning without white panels */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.alert-light {
    background: #172033 !important;
    border-color: #334155 !important;
    color: #e5edf8 !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.alert-info { background:#102b3c!important;border-color:#155e75!important;color:#cffafe!important; }
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.alert-warning { background:#382a0d!important;border-color:#92400e!important;color:#fde68a!important; }
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.alert-danger { background:#3b1219!important;border-color:#991b1b!important;color:#fecaca!important; }
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
.alert-success { background:#102d22!important;border-color:#166534!important;color:#bbf7d0!important; }

/* Pagination and buttons that were white in settings */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.btn-light, .btn-default, .page-link) {
    background: #17233a !important;
    border-color: #3a4b64 !important;
    color: #e7eef9 !important;
}
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(.btn-light, .btn-default, .page-link):hover {
    background: #213553 !important;
    border-color: #557091 !important;
    color: #fff !important;
}

/* Keep actual media and color previews untouched */
:is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
:is(img, picture, video, canvas, iframe, .minicolors-swatch-color, [style*="background-image"]) {
    filter: none !important;
}

/* Improve native controls on mobile dark mode */
@media (max-width: 767.98px) {
    :is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
    :is(.card, .modal-content, .pf-settings-tabs-card, .settings-tabs-card) {
        border-radius: 16px !important;
    }
    :is(html.dark-mode-site, html.dark-mode, body.dark-mode-site, body.dark-mode, body.dark)
    :is(.form-control, .custom-select, button, .btn) {
        min-height: 44px;
    }
}
