/* Theme ID 2 is dark; every other theme keeps light content surfaces.
   Loaded after seasonal CSS so themed banners do not dictate control contrast. */
body.theme-light {
    --hq-surface: #ffffff;
    --hq-surface-alt: #f4f6f8;
    --hq-border: rgba(15, 23, 42, .14);
    --hq-text: #3d4450;
    --hq-text-muted: #626e80;
    --hq-accent: #286889;
    --hq-success: #216d61;
    --hq-violet: #7043a5;
    --hq-warning: #79530d;
    --hq-danger: #aa3434;
}
body.theme-dark {
    --hq-surface: #262a31;
    --hq-surface-alt: #2e333b;
    --hq-border: rgba(255, 255, 255, .14);
    --hq-text: #d7dbe2;
    --hq-text-muted: #a2acba;
    --hq-accent: #8fc9e4;
    --hq-success: #73d3c1;
    --hq-violet: #c7a8ef;
    --hq-warning: #edc777;
    --hq-danger: #f3a1a1;
}

/* global.css forces white !important text and an image onto every .btn.
   Neutral and outline controls need explicit foregrounds on light surfaces. */
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .btn {
    background-image: none;
    text-shadow: none;
}
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) :is(.btn-primary, .btn-info) {
    background-color: #357b9d !important;
    border-color: #357b9d;
    color: #ffffff !important;
}
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .btn-success { background-color: #216d61 !important; border-color: #216d61; color: #ffffff !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .btn-danger { background-color: #aa3434 !important; border-color: #aa3434; color: #ffffff !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .btn-secondary { background-color: #566170 !important; border-color: #566170; color: #ffffff !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .btn-warning { background-color: #edc777 !important; border-color: #edc777; color: #30230a !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) :is([class*="btn-outline-"], .btn-light, .btn-link) {
    color: var(--hq-text) !important;
    background-color: transparent !important;
    border: 1px solid var(--hq-border);
}
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .btn-outline-danger { color: var(--hq-danger) !important; border-color: var(--hq-danger); }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .btn-outline-success { color: var(--hq-success) !important; border-color: var(--hq-success); }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) :is(.btn-outline-primary, .btn-outline-info) { color: var(--hq-accent) !important; border-color: var(--hq-accent); }
#maincontainer :is(.home-refresh, .profile-page) :is(.home-section-btn, .profile-edit-link) { color: var(--hq-text) !important; background-color: var(--hq-surface) !important; border: 1px solid var(--hq-border); text-shadow: none; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) :is([class*="btn-outline-"], .btn-light, .btn-link):is(:hover, :focus-visible, :active) { background-color: var(--hq-surface-alt) !important; }

body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .text-muted { color: var(--hq-text-muted) !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .text-success { color: var(--hq-success) !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .text-danger { color: var(--hq-danger) !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .text-warning { color: var(--hq-warning) !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) :is(.text-info, .text-primary) { color: var(--hq-accent) !important; }
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .form-control:disabled,
body :is(.panel-page, .panel-dialog, .admin-dashboard, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .form-control[readonly] { background: var(--hq-surface-alt); color: var(--hq-text-muted); opacity: 1; }
body :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) select option { background: var(--hq-surface); color: var(--hq-text); }
body.theme-dark :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) :is(input, select, textarea) { color-scheme: dark; }
body.theme-light :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) :is(input, select, textarea) { color-scheme: light; }

/* Editor chrome uses mode colours; keep user-authored BBCode colours intact. */
body :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .wysibb { background: var(--hq-surface); border-color: var(--hq-border); }
body :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .wysibb .wysibb-toolbar { background: var(--hq-surface-alt); border-color: var(--hq-border); }
body :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .wysibb .wysibb-body { color: var(--hq-text); }
body :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .wysibb .wysibb-toolbar-btn { color: var(--hq-text-muted); text-shadow: none; }
body :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .wysibb .wysibb-toolbar-btn .fonticon { color: inherit; text-shadow: none; }

/* Status labels retain their meaning without relying on pale fixed text. */
body :is(.panel-page, .panel-dialog, .usercp-page) :is(.status-badge.open, .status-badge.active, .priority-badge.normal) { color: var(--hq-accent); }
body :is(.panel-page, .panel-dialog, .usercp-page) :is(.status-badge.closed, .priority-badge.high, .priority-badge.urgent) { color: var(--hq-danger); }
body :is(.panel-page, .panel-dialog, .usercp-page) .shop-category-badge { color: var(--hq-text-muted); background: var(--hq-surface-alt); }
body :is(.panel-page, .panel-dialog, .usercp-page) :is(.status-badge.active, .priority-badge.high, .leave-badge-pending, .ticket-status-badge.active, .tickets-status-badge.active) { color: var(--hq-warning); }
body :is(.panel-page, .panel-dialog, .usercp-page) :is(.sub-badge-active, .sub-icon-active, .hp-badge-on, .ub-status-visible, .leave-badge-approved) { color: var(--hq-success); }
body :is(.panel-page, .panel-dialog, .usercp-page) :is(.sub-badge-inactive, .sub-icon-inactive, .leave-badge-declined, .ticket-status-badge.closed, .tickets-status-badge.closed) { color: var(--hq-danger); }
body :is(.panel-page, .panel-dialog, .usercp-page) :is(.priority-badge.low, .leave-badge-ended, .hp-badge-off, .ub-status-hidden) { color: var(--hq-text-muted); }
body :is(.panel-page, .panel-dialog, .usercp-page) :is(.ticket-status-badge.open, .tickets-status-badge.open) { color: var(--hq-accent); }
body :is(.panel-page, .panel-dialog, .usercp-page, .profile-page, .home-refresh, .feed-entry, .hq-modal-body) .wysibb .wbb-list { background: var(--hq-surface); color: var(--hq-text); border-color: var(--hq-border); }
