/* V460 — final dark-theme coverage for all JoyJoy account pages.
   Loaded after every cabinet stylesheet so legacy light surfaces cannot win. */
html[data-theme="dark"] {
  color-scheme: dark;
  --joyjoy-dark-bg: var(--account-bg, #0b1320);
  --joyjoy-dark-surface: var(--account-surface, #111c2e);
  --joyjoy-dark-soft: var(--account-surface-soft, #162338);
  --joyjoy-dark-strong: var(--account-surface-strong, #1c2c45);
  --joyjoy-dark-border: var(--account-border, #2c405b);
  --joyjoy-dark-border-strong: var(--account-border-strong, #3a5475);
  --joyjoy-dark-text: var(--account-text, #eef6ff);
  --joyjoy-dark-muted: var(--account-muted, #9eb0c4);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .account-page,
html[data-theme="dark"] .account-main,
html[data-theme="dark"] .account-content,
html[data-theme="dark"] .bot-workspace,
html[data-theme="dark"] .bot-module-content,
html[data-theme="dark"] .developer-console-shell {
  background-color: var(--joyjoy-dark-bg);
  color: var(--joyjoy-dark-text);
}

html[data-theme="dark"] :is(
  .github-card,
  .stat-card,
  .bot-card,
  .console-card,
  .account-card,
  .profile-card,
  .security-card,
  .subscription-card,
  .premium-card,
  .promo-card,
  .general-control-card,
  .routing-card,
  .music-surface-card,
  .command-settings-card,
  .prefix-card,
  .equalizer-card,
  .player-appearance-section,
  .player-appearance-switch-row,
  .automod-master-card,
  .automod-module,
  .automod-shared-card,
  .shieldy-settings-card,
  .shieldy-block,
  .ticket-center-v452,
  .ticket-card,
  .ticket-panel-card,
  .gamey-card,
  .gamey-setting-card,
  .gamey-stat-card,
  .gamey-tournament-card,
  .minigame-settings-card,
  .economy-settings-card,
  .service-row,
  .linked-service-row,
  .security-row,
  .settings-row,
  .settings-list > div,
  .account-section,
  .admin-section,
  .admin-widget,
  .admin-table-wrap,
  .developer-console-card,
  .developer-console-panel,
  .console-section,
  .modal-card,
  .dialog-card
) {
  background: var(--joyjoy-dark-surface) !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: var(--joyjoy-dark-text) !important;
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .card-header,
  .card-footer,
  .section-header,
  .settings-group,
  .settings-subgroup,
  .control-row,
  .option-row,
  .toggle-row,
  .form-row,
  .server-id-item,
  .bot-settings-server-card,
  .clone-history-item,
  .custom-message-row,
  .sequence-row,
  .reaction-role-row,
  .automod-rule-row,
  .ticket-type-row,
  .ticket-panel-row,
  .premium-assignment-row,
  .subscription-history-row,
  .payment-history-row,
  .admin-list-row,
  .console-list-row
) {
  background-color: var(--joyjoy-dark-soft) !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: var(--joyjoy-dark-text) !important;
}

html[data-theme="dark"] :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  select,
  textarea,
  [contenteditable="true"],
  .fake-input,
  .custom-select-trigger,
  .shieldy-custom-dropdown-trigger,
  .managed-server-trigger-v196,
  .joyjoy-save-server-trigger-v459,
  .search-input,
  .code-input
) {
  background-color: #0d1828 !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
  -webkit-text-fill-color: var(--joyjoy-dark-text);
}

html[data-theme="dark"] :is(input, textarea, [contenteditable="true"])::placeholder {
  color: #8295aa !important;
  opacity: 1;
}

html[data-theme="dark"] :is(input, select, textarea, button):disabled,
html[data-theme="dark"] [aria-disabled="true"] {
  color: #73869c !important;
  border-color: #26384f !important;
  background-color: #101b2b !important;
  opacity: .72;
}

html[data-theme="dark"] :is(
  .managed-server-menu-v196,
  .joyjoy-save-server-menu-v459,
  .shieldy-custom-dropdown-menu,
  .custom-sequence-menu,
  .timer-datepicker-popover,
  .account-user-dropdown,
  .bot-picker-menu,
  .dropdown-menu,
  .context-menu,
  .autocomplete-menu,
  .select-menu,
  .modal-window,
  .dialog-window,
  .popover
) {
  background: #101b2d !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .42) !important;
}

html[data-theme="dark"] :is(
  .managed-server-option-v196,
  .joyjoy-save-server-option-v459,
  .shieldy-custom-dropdown-option,
  .custom-sequence-option,
  .dropdown-option,
  .select-option,
  .account-user-dropdown button,
  .account-user-dropdown a
) {
  color: var(--joyjoy-dark-text) !important;
  background: transparent !important;
  border-color: transparent !important;
}

html[data-theme="dark"] :is(
  .managed-server-option-v196,
  .joyjoy-save-server-option-v459,
  .shieldy-custom-dropdown-option,
  .custom-sequence-option,
  .dropdown-option,
  .select-option,
  .account-user-dropdown button,
  .account-user-dropdown a
):is(:hover, :focus-visible, .is-active, [aria-selected="true"]) {
  background: var(--joyjoy-dark-strong) !important;
  color: #ffffff !important;
}

html[data-theme="dark"] :is(
  .joyjoy-save-dock-v459,
  .sticky-save-bar,
  .universal-save-bar-v186,
  .form-actions,
  .prefix-card-actions
) {
  background: rgba(13, 24, 40, .96) !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
  box-shadow: 0 -14px 35px rgba(0, 0, 0, .28) !important;
  backdrop-filter: blur(15px);
}

html[data-theme="dark"] :is(
  .status-pill,
  .premium-badge,
  .staff-role-label,
  .staff-role-label.is-administrator,
  .service-status,
  .server-limit-badge,
  .module-status,
  .api-status,
  .joyjoy-save-result-v459
) {
  background: rgba(88, 113, 145, .18) !important;
  border-color: rgba(134, 163, 199, .32) !important;
  color: #dceaff !important;
}

html[data-theme="dark"] :is(.status-pill.is-success, .joyjoy-save-result-v459.is-success, .api-form-message.is-success, .panel-save-message.is-success) {
  background: rgba(27, 156, 100, .18) !important;
  border-color: rgba(62, 214, 146, .38) !important;
  color: #79efb7 !important;
}

html[data-theme="dark"] :is(.status-pill.is-error, .joyjoy-save-result-v459.is-error, .api-form-message.is-error, .panel-save-message.is-error, .staff-role-label.is-administrator) {
  background: rgba(214, 64, 88, .16) !important;
  border-color: rgba(255, 104, 128, .38) !important;
  color: #ff9bad !important;
}

html[data-theme="dark"] :is(.service-logo.google, .service-logo.yandex, .service-logo.lolka, .service-logo.email) {
  background: var(--joyjoy-dark-strong) !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
}

html[data-theme="dark"] :is(table, .admin-table, .console-table, .payment-table, .subscription-table) {
  color: var(--joyjoy-dark-text) !important;
  border-color: var(--joyjoy-dark-border) !important;
}

html[data-theme="dark"] :is(th, thead td) {
  background: #162439 !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: #dceaff !important;
}

html[data-theme="dark"] :is(td, tbody th) {
  background: var(--joyjoy-dark-surface) !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: var(--joyjoy-dark-text) !important;
}

html[data-theme="dark"] tbody tr:hover :is(td, th) {
  background: var(--joyjoy-dark-soft) !important;
}

html[data-theme="dark"] :is(
  .muted,
  .muted-status,
  .form-hint,
  .field-hint,
  .settings-note,
  .description,
  small,
  .subtitle,
  .secondary-text,
  .server-id,
  .server-meta,
  .ticket-meta,
  .payment-meta
) {
  color: var(--joyjoy-dark-muted) !important;
}

html[data-theme="dark"] :is(code, pre, .code-block, .console-output, .log-output, .json-viewer) {
  background: #08111e !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: #cfe7ff !important;
}

html[data-theme="dark"] :is(.secondary-button, .outline-button, .ghost-button, .icon-button, button.secondary, button.outline, .danger-outline) {
  background: var(--joyjoy-dark-soft) !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
}

html[data-theme="dark"] :is(.secondary-button, .outline-button, .ghost-button, .icon-button, button.secondary, button.outline, .danger-outline):hover {
  background: var(--joyjoy-dark-strong) !important;
}

html[data-theme="dark"] :is(hr, .divider, .section-divider) {
  border-color: var(--joyjoy-dark-border) !important;
  background-color: var(--joyjoy-dark-border) !important;
}

html[data-theme="dark"] :is(.empty-state, .server-empty-state, .loading-state, .error-state, .notice-card, .info-card) {
  background: var(--joyjoy-dark-soft) !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: var(--joyjoy-dark-muted) !important;
}

html[data-theme="dark"] ::selection {
  background: rgba(76, 201, 255, .32);
  color: #fff;
}

html[data-theme="dark"] * {
  scrollbar-color: #3b536f #0b1422;
}

/* Keep deliberately visual previews, uploaded banners and colour swatches intact. */
html[data-theme="dark"] :is(
  .welcome-banner-preview,
  .welcome-card-preview,
  .player-embed-preview,
  [data-player-embed-preview],
  [data-preview-banner],
  [data-preview-logo],
  .gamey-minigame-preview,
  .color-swatch,
  input[type="color"]
) {
  color-scheme: normal;
}

/* Beat the highly specific legacy save-dock light background. */
html[data-theme="dark"] body[data-account-page="bots"] #panel-bot-control [data-module-panel].is-active .joyjoy-save-dock-v459,
html[data-theme="dark"] body[data-account-page="bots"] #panel-bot-control [data-module-panel][aria-hidden="false"] .joyjoy-save-dock-v459 {
  background: rgba(13, 24, 40, .96) !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
  box-shadow: 0 -14px 35px rgba(0, 0, 0, .28) !important;
}

/* V463 — complete Shieldy ticket-center coverage. The ticket editor owns highly
   specific light surfaces, so every nested surface is themed explicitly. */
html[data-theme="dark"] .ticket-center-badge-v452 {
  background: rgba(45, 164, 78, .14) !important;
  border-color: rgba(88, 218, 130, .34) !important;
  color: #7ce9a0 !important;
}

html[data-theme="dark"] :is(
  .ticket-center-summary-v452 > div,
  .ticket-metrics-grid-v452 > div,
  .ticket-tab-panel-v452,
  .ticket-builder-card-v452,
  .ticket-panel-types-v452,
  .ticket-panel-types-v452 label,
  .ticket-premium-box-v452,
  .ticket-toggle-grid-v452 > label,
  .ticket-question-row-v452,
  .ticket-question-required-v452,
  .ticket-embed-toggle-v452,
  .ticket-dashboard-row-v452
) {
  background: var(--joyjoy-dark-surface) !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: var(--joyjoy-dark-text) !important;
}

html[data-theme="dark"] :is(
  .ticket-tab-panel-v452,
  .ticket-panel-types-v452,
  .ticket-question-required-v452,
  .ticket-toggle-grid-v452 > label
) {
  background: var(--joyjoy-dark-soft) !important;
}

html[data-theme="dark"] .ticket-center-tabs-v452 {
  background: #0d1828 !important;
  border-color: var(--joyjoy-dark-border) !important;
}
html[data-theme="dark"] .ticket-center-tabs-v452 button {
  color: var(--joyjoy-dark-muted) !important;
}
html[data-theme="dark"] .ticket-center-tabs-v452 button:hover {
  background: var(--joyjoy-dark-strong) !important;
  color: var(--joyjoy-dark-text) !important;
}
html[data-theme="dark"] .ticket-center-tabs-v452 button.is-active {
  background: rgba(45, 164, 78, .18) !important;
  border-color: rgba(88, 218, 130, .42) !important;
  color: #8bf0aa !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  .ticket-section-head-v452 h4,
  .ticket-builder-card-head-v452 strong,
  .ticket-center-summary-v452 strong,
  .ticket-metrics-grid-v452 strong,
  .ticket-dashboard-row-v452 strong,
  .ticket-premium-head-v452 strong
) {
  color: var(--joyjoy-dark-text) !important;
}
html[data-theme="dark"] :is(
  .ticket-section-head-v452 p,
  .ticket-center-summary-v452 span,
  .ticket-metrics-grid-v452 span,
  .ticket-premium-head-v452 small,
  .ticket-embed-toggle-v452 small
) {
  color: var(--joyjoy-dark-muted) !important;
}

html[data-theme="dark"] .ticket-builder-index-v452 {
  background: rgba(45, 164, 78, .17) !important;
  color: #80eda5 !important;
}
html[data-theme="dark"] .ticket-premium-box-v452 {
  background: rgba(126, 87, 194, .10) !important;
  border-color: rgba(173, 139, 235, .30) !important;
}
html[data-theme="dark"] .ticket-inline-status-v452 {
  background: rgba(45, 164, 78, .12) !important;
  border-color: rgba(88, 218, 130, .28) !important;
  color: #87e8a6 !important;
}
html[data-theme="dark"] .ticket-embed-toggle-v452 {
  background: rgba(45, 164, 78, .11) !important;
  border-color: rgba(88, 218, 130, .30) !important;
}

html[data-theme="dark"] .ticket-remove-button-v452 {
  background: rgba(201, 62, 82, .13) !important;
  border-color: rgba(255, 111, 132, .34) !important;
  color: #ff9bab !important;
}
html[data-theme="dark"] .ticket-publish-button-v452 {
  background: rgba(45, 164, 78, .14) !important;
  border-color: rgba(88, 218, 130, .34) !important;
  color: #84eda6 !important;
}

html[data-theme="dark"] .ticket-dashboard-row-v452 {
  background: var(--joyjoy-dark-soft) !important;
}
html[data-theme="dark"] .ticket-status-pill-v452 {
  background: rgba(66, 149, 235, .16) !important;
  color: #8fc8ff !important;
}
html[data-theme="dark"] .ticket-status-pill-v452.waiting_user {
  background: rgba(224, 157, 24, .16) !important;
  color: #ffd077 !important;
}
html[data-theme="dark"] .ticket-status-pill-v452.closed,
html[data-theme="dark"] .ticket-status-pill-v452.deleted {
  background: rgba(126, 145, 168, .16) !important;
  color: #bac8d8 !important;
}
html[data-theme="dark"] .ticket-priority-pill-v452 {
  background: rgba(45, 164, 78, .16) !important;
  color: #83eaa4 !important;
}
html[data-theme="dark"] .ticket-priority-pill-v452.high {
  background: rgba(224, 126, 25, .16) !important;
  color: #ffc178 !important;
}
html[data-theme="dark"] .ticket-priority-pill-v452.urgent {
  background: rgba(214, 64, 88, .17) !important;
  color: #ff9cac !important;
}
html[data-theme="dark"] .ticket-priority-pill-v452.low {
  background: rgba(82, 126, 176, .16) !important;
  color: #a9c9ed !important;
}

/* Native form controls inside tickets must stay dark even when legacy ticket
   selectors have equal or greater specificity. */
html[data-theme="dark"] .ticket-center-v452 :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  select,
  textarea
) {
  background: #0d1828 !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
  -webkit-text-fill-color: var(--joyjoy-dark-text) !important;
}
html[data-theme="dark"] .ticket-center-v452 :is(input, textarea)::placeholder {
  color: #8194aa !important;
}

/* V463 — high-specificity pass for legacy account controls that declared light
   backgrounds with !important. Use background shorthand so no old gradient or
   shorthand can keep a white surface behind dark-theme text. */
html[data-theme="dark"] body :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select,
  textarea,
  [contenteditable="true"]
) {
  background: #0d1828 !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
  -webkit-text-fill-color: var(--joyjoy-dark-text) !important;
  caret-color: #ffffff;
}
html[data-theme="dark"] body :is(
  .managed-server-trigger-v196,
  .joyjoy-save-server-trigger-v459,
  .shieldy-custom-dropdown-trigger,
  .custom-select-trigger,
  .account-user-trigger,
  .profile-edit-icon,
  .topbar-icon
) {
  background: var(--joyjoy-dark-soft) !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
}
html[data-theme="dark"] body :is(
  .player-customization-controls,
  .player-customization-workspace,
  .player-control-group,
  .player-style-controls,
  .journal-filter-bar,
  .shieldy-log-toolbar,
  .shieldy-log-filter-panel
) {
  background: var(--joyjoy-dark-surface) !important;
  border-color: var(--joyjoy-dark-border) !important;
  color: var(--joyjoy-dark-text) !important;
}

html[data-theme="dark"] body :is(
  .bot-switch-button.is-active,
  [data-module].is-active,
  [data-music-tab].is-active,
  .automod-message-tab.is-active,
  .shieldy-log-filter-chip.is-active,
  .custom-message-tab.is-active
) {
  background: var(--joyjoy-dark-strong) !important;
  border-color: var(--joyjoy-dark-border-strong) !important;
  color: var(--joyjoy-dark-text) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body :is(
  .management-role-badge,
  .admin-live-dot,
  .admin-bot-live-status,
  .admin-state-pill,
  .plan-badge,
  .gamey-event-status,
  .gamey-tournament-status
) {
  background: rgba(88, 113, 145, .18) !important;
  border-color: rgba(134, 163, 199, .32) !important;
  color: #dceaff !important;
}
html[data-theme="dark"] body :is(
  .admin-live-dot.is-ok,
  .admin-bot-live-status.is-ok,
  .admin-state-pill.is-ok
) {
  background: rgba(27, 156, 100, .18) !important;
  border-color: rgba(62, 214, 146, .38) !important;
  color: #79efb7 !important;
}
html[data-theme="dark"] body :is(
  .admin-state-pill.is-warning,
  .gamey-event-status.is-planned,
  .gamey-tournament-status.is-planned
) {
  background: rgba(224, 157, 24, .16) !important;
  border-color: rgba(255, 194, 76, .34) !important;
  color: #ffd077 !important;
}
html[data-theme="dark"] body :is(
  .danger-button,
  button.danger,
  .danger-action
) {
  background: rgba(201, 62, 82, .14) !important;
  border-color: rgba(255, 111, 132, .36) !important;
  color: #ff9bab !important;
}

/* V463 — final specificity fixes found by full-page dark-theme scan. */
html[data-theme="dark"] body .bot-module-panel .automod-message-tabs .automod-message-tab.is-active,
html[data-theme="dark"] body .automod-card .automod-message-tabs .automod-message-tab.is-active {
  background: #162338 !important;
  border-color: #334864 !important;
  color: #f3f7fc !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body .ticket-center-heading-v452 .ticket-center-always-on-v453,
html[data-theme="dark"] body .ticket-center-v452 .ticket-center-always-on-v453 {
  background: rgba(35, 178, 112, .16) !important;
  border-color: rgba(74, 224, 153, .34) !important;
  color: #80efbc !important;
}

html[data-theme="dark"] body .custom-element-card-preview {
  background: #162338 !important;
  border-color: #334864 !important;
  color: #cfe0f4 !important;
}
html[data-theme="dark"] body .custom-element-card-preview :is(i, em) {
  background: #314661 !important;
  border-color: #4f6886 !important;
}

html[data-theme="dark"] body .game-choice-card.is-pending > em,
html[data-theme="dark"] body .game-choice-card[data-game-planned="1"] > em {
  background: rgba(224, 157, 24, .16) !important;
  border: 1px solid rgba(255, 194, 76, .34) !important;
  color: #ffd077 !important;
}

html[data-theme="dark"] body .premium-plan-card .plan-badge,
html[data-theme="dark"] body .subscription-plan-card .plan-badge,
html[data-theme="dark"] body .plan-card .plan-badge {
  background: rgba(224, 157, 24, .16) !important;
  border-color: rgba(255, 194, 76, .34) !important;
  color: #ffd077 !important;
}

html[data-theme="dark"] body #shieldy-settings-form .automod-message-tab.is-active {
  background: #162338 !important;
  border-color: #334864 !important;
  color: #f3f7fc !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body [data-module-panel="gm-premium"] .bot-premium-plan .plan-badge {
  background: rgba(224, 157, 24, .16) !important;
  border-color: rgba(255, 194, 76, .34) !important;
  color: #ffd077 !important;
}
