/* Dark surfaces for secondary screens and dynamically rendered components. */
html[data-theme="dark"] :is(.account-contract-card,.account-credit-history,.account-data-export-formats,.account-deletion-checklist,.account-legal-links,.account-wizard-progress,.affiliate-choice-options,.affiliate-link-box,.affiliate-value-control,.audit-change,.audit-pagination,.auditor-access-card-heading,.auditor-access-create,.auditor-access-credentials,.auditor-access-fields,.auditor-access-item,.auditor-access-overview,.backup-category-card,.backup-dataset-nav,.backup-mode-options,.backup-record-browser,.booking-methods-settings-block,.booking-renewal,.broadcast-directory-tabs,.broadcast-mail-panel,.broadcast-overview,.broadcast-search,.broadcast-steps,.broadcast-wizard,.contract-sign-card,.contract-signed-upload,.cron-jobs-catalog,.cron-jobs-runtime-details,.customer-activity-filter,.customer-activity-search,.customer-contract-row,.customer-document-card,.customer-document-item,.customer-document-list,.customer-hosting-manage,.customer-link-user,.customer-mail-journal-item,.customer-note-card,.customer-note-form,.customer-note-list,.customer-partner-code,.customer-partner-summary,.customer-record-hosting-actions,.customer-retention-action,.customer-support-list,.email-change-option,.general-settings-card,.invoice-delete-confirm,.invoice-payment-method,.legal-archive-overview,.legal-document-card,.legal-version-dialog,.legal-version-history,.legal-version-panel,.mail-account-detail,.mail-account-list-item,.mail-account-workspace,.mail-editor-mode,.mail-editor-toolbar,.mail-journal-detail-body,.mail-journal-entry,.mail-journal-list,.mail-protocol-card,.mail-route-row,.mail-routing-group,.mail-template-card,.mail-template-detail-body,.mail-template-directory,.mail-template-list,.mail-template-list-item,.mail-template-search,.mail-template-workspace,.mail-template-workspace-shell,.mail-test-run-row,.mail-test-target-card,.maintenance-detail-card,.notification-preference-group,.partner-account-code,.partner-code-row,.payments-affiliate-block,.payments-currency-control,.payments-provider-block,.paypal-merchant-banner,.permission-group,.permission-option,.plesk-ip-check,.plesk-settings-health,.plesk-settings-hero,.required-birth-date-card,.required-notice-admin-card,.required-notice-confirm,.required-notice-gate-card,.role-permission-editor,.role-permission-search,.software-update-checks,.software-update-confirm,.software-update-dropzone,.software-update-progress,.software-update-wizard-card,.software-update-wizard-steps,.storage-settings-actionbar,.ticket-attachment,.ticket-detail-side-card,.ticket-quick-replies,.ticket-quick-reply-manager-editor,.ticket-quick-reply-manager-list,.ticket-reply-composer,.ticket-reply-file-previews,.ticket-reply-page,.ticket-thread-panel,.two-factor-backup-actions,.two-factor-backup-card,.two-factor-backup-list,.unmatched-support-mail-list,.wizard-role-option){border-color:var(--dark-line);background:var(--dark-panel);color:var(--dark-ink);box-shadow:none}
html[data-theme="dark"] :is(.customer-record-page-header,.procedure-documentation-modal-head,.mail-account-toolbar,.broadcast-send-bar,.ticket-detail-header,.ticket-reply-composer>header,.contract-sign-card>header,.required-notice-admin-card>header){border-color:var(--dark-line);background:linear-gradient(135deg,#17243a,#111d30)}
html[data-theme="dark"] :is(.account-deletion-blocked,.login-maintenance-notice,.maintenance-master-switch,.software-update-confirm){border-color:#66502d;background:#2b2317;color:#efc47d}
html[data-theme="dark"] :is(.affiliate-option-check,.backup-category-check,.permission-group-switch,.permission-switch,.notification-channel-toggle,.mail-account-state-switch,.mail-protocol-switch,.paypal-auto-toggle,.registration-consent-check){border-color:#3a4961;background:#1a2941;color:#c7d1df}
html[data-theme="dark"] :is(.customer-note-add-trigger,.customer-record-back,.customer-activity-reset,.template-back-button,.template-placeholder-search,.template-segmented,.template-tool-group,.template-zoom,.mail-template-fullscreen-toggle,.mail-journal-open,.team-room-add,.ticket-attachment-preview-content button){border-color:#35455e;background:#17253a;color:#bdc8d8}
html[data-theme="dark"] :is(.customer-note-add-trigger,.customer-record-back,.customer-activity-reset,.template-back-button,.mail-template-fullscreen-toggle):hover{border-color:#596da2;background:#223451;color:#fff}
html[data-theme="dark"] :is(.mail-account-list-item,.mail-template-list-item,.mail-journal-entry,.customer-mail-journal-item,.customer-document-item,.customer-contract-row,.auditor-access-item,.ticket-attachment):hover{background:#192941}
html[data-theme="dark"] :is(.plesk-input-icon,.storage-input-icon,.mail-placeholder-select,.payments-currency-control,.affiliate-value-control,.expense-interval-field){border-color:#33445d;background:#0d1729;color:#dce5f0}
html[data-theme="dark"] :is(.account-contract-card,.customer-contract-row,.legal-document-card,.required-notice-admin-card,.auditor-access-item,.software-update-wizard-card,.ticket-detail-side-card) :is(h3,h4,strong,b){color:#e8eef8}
html[data-theme="dark"] :is(.account-contract-card,.customer-contract-row,.legal-document-card,.required-notice-admin-card,.auditor-access-item,.software-update-wizard-card,.ticket-detail-side-card) :is(p,small,span){color:#9eacc0}
html[data-theme="dark"] .team-link-preview{border-color:#34445c;background:#152238;color:#dce5f0}
html[data-theme="dark"] .role-preview-banner{border-color:#4c5582;background:#202747;color:#d8dcff}

/* Native and editor controls keep readable contrast without changing document previews. */
html[data-theme="dark"] :is(.mail-editor-toolbar,.template-studio-toolbar) button{color:#c7d2e2}
html[data-theme="dark"] :is(.mail-editor-toolbar,.template-studio-toolbar) button:hover{background:#223149;color:#fff}
html[data-theme="dark"] option{background:#111d30;color:#e8eef8}
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator{filter:invert(.82)}
html[data-theme="dark"] input[type="search"]::-webkit-search-cancel-button{filter:invert(.78)}

/* PDF, mail and signature canvases intentionally remain paper-white. */
html[data-theme="dark"] :is(.invoice-template-preview,.mail-template-preview,.broadcast-preview,.mail-test-message-frame,.procedure-documentation-paper,.two-factor-qr,.contract-signature-paper){background:#fff;color:#1f2937}

/* The fixed workspace bar must reserve its full height on dedicated detail pages. */
body.ticket-detail-active .main-content{padding-top:108px}
body.role-preview-active.ticket-detail-active .main-content{padding-top:192px}

/* Billing editors and recurring-plan cards are application UI, not paper previews. */
html[data-theme="dark"] :is(.offer-item,.schedule-card,.invoice-number-notice,.file-drop){
  border-color:var(--dark-line);
  background:linear-gradient(145deg,#17243a,#111d30);
  color:var(--dark-ink);
  box-shadow:none;
}
html[data-theme="dark"] .offer-item .form-control{background:#0d1729;color:#e8eef8}
html[data-theme="dark"] :is(.offer-item,.schedule-card,.invoice-number-notice) :is(strong,b,.form-label,.offer-line-total){color:#e5edf8}
html[data-theme="dark"] :is(.offer-item,.schedule-card,.invoice-number-notice) :is(p,small,span,.offer-items-copy){color:#98a8bd}
html[data-theme="dark"] .file-drop:hover{border-color:#6676d9;background:#1a2941}
html[data-theme="dark"] .file-drop-icon{background:#25345b;color:#aeb7ff}
html[data-theme="dark"] .file-drop-title{color:#e8eef8}
html[data-theme="dark"] .file-drop-copy{color:#9aa9bd}
html[data-theme="dark"] .file-drop .file-input{color:#dbe5f2;background:#0d1729}
html[data-theme="dark"] .file-drop .file-input::file-selector-button{border:0;background:#25345b;color:#e6ebff}

/* Ticket detail: conversation, composer and interactive controls share one dark palette. */
html[data-theme="dark"] .ticket-detail-page-header{border-color:var(--dark-line);background:linear-gradient(145deg,#17243a,#111d30);box-shadow:none}
html[data-theme="dark"] .ticket-detail-page-heading h2{color:#eef3fb}
html[data-theme="dark"] .ticket-detail-page-heading p{color:#9aa9bd}
html[data-theme="dark"] .ticket-detail-page-icon{background:#25345b;color:#aeb7ff}
html[data-theme="dark"] .ticket-thread-heading{border-color:var(--dark-line)}
html[data-theme="dark"] .ticket-thread-heading h3{color:#e8eef8}
html[data-theme="dark"] .ticket-thread-heading>span{background:#223149;color:#b8c5d6}
html[data-theme="dark"] .ticket-conversation-page{background:linear-gradient(180deg,#0d1729,#101b2d)}
html[data-theme="dark"] .ticket-message-avatar{background:#223149;color:#c0ccdc;box-shadow:none}
html[data-theme="dark"] .ticket-message>div:last-child{border-color:#314159;background:#16243a;box-shadow:none}
html[data-theme="dark"] .ticket-message-team>div:last-child{border-color:#425185;background:#1d2948}
html[data-theme="dark"] .ticket-message header strong{color:#e6edf7}
html[data-theme="dark"] .ticket-message header span{color:#91a0b5}
html[data-theme="dark"] .ticket-message p{color:#c2cedd}
html[data-theme="dark"] .ticket-reply-composer{border-color:var(--dark-line);background:#111d30}
html[data-theme="dark"] .ticket-composer-heading .form-label{color:#e7eef8}
html[data-theme="dark"] .ticket-attachment-picker{border-color:#3b4c65;background:#0d1729;color:#dfe8f4}
html[data-theme="dark"] .ticket-attachment-picker:hover,
html[data-theme="dark"] .ticket-attachment-picker.dragging{border-color:#6979df;background:#192845}
html[data-theme="dark"] .ticket-attachment-picker>i{background:#25345b;color:#aeb7ff}
html[data-theme="dark"] .ticket-attachment-picker :is(small,em){color:#91a1b6}
html[data-theme="dark"] .ticket-quick-replies{border-color:#33445d;background:#152238}
html[data-theme="dark"] .ticket-quick-replies :is(button,.ticket-custom-quick-reply){border-color:#394a63;background:#0d1729;color:#c7d2e2}
html[data-theme="dark"] .ticket-quick-replies :is(button,.ticket-custom-quick-reply):hover{border-color:#6676d9;background:#223252;color:#fff}
html[data-theme="dark"] .ticket-reply-file-previews article{border-color:#33445d;background:#152238}
html[data-theme="dark"] .ticket-reply-file-previews strong{color:#e3ebf6}
html[data-theme="dark"] .ticket-upload-progress{border-color:#33445d;background:#152238}
html[data-theme="dark"] .ticket-upload-progress>div{background:#29384d}
html[data-theme="dark"] .ticket-internal-toggle{border-color:#4d5274;background:#202747}
html[data-theme="dark"] .ticket-internal-toggle strong{color:#d9dcff}
html[data-theme="dark"] .ticket-internal-toggle small{color:#a5afc9}
html[data-theme="dark"] .ticket-message-internal .ticket-message-avatar{border-color:#725a29;background:#302719!important;color:#efc46e!important}
html[data-theme="dark"] .ticket-message-internal>div:last-child{border-color:#725a29!important;border-left-color:#d19a32!important;background:linear-gradient(145deg,#2e271a,#272116)!important;box-shadow:none!important}
html[data-theme="dark"] .ticket-message-internal header strong{color:#f1d49a!important}
html[data-theme="dark"] .ticket-message-internal header span{background:#493919;color:#efc46e!important}
html[data-theme="dark"] .ticket-message-internal p{color:#dbcba9!important}

@media(max-width:1023px){
  body.ticket-detail-active .main-content{padding-top:98px}
  body.role-preview-active.ticket-detail-active .main-content{padding-top:174px}
}
@media(max-width:680px){body.ticket-detail-active .main-content{padding-top:91px}}

/* Remaining non-document workspaces that still use hard-coded light surfaces. */
html[data-theme="dark"] :is(
  .key-rotation-panel,.key-rotation-card,.key-rotation-progress,.key-rotation-scope article,
  .product-overview article,.customer-hosting-card,.customer-hosting-details,
  .booking-steps,.booking-content,.booking-payment-grid label,.booking-payment-order,
  .booking-comparison-scroll,.booking-checkout>section,.booking-cart,.booking-provisioning,
  .ticket-stats article,.broadcast-audience,.broadcast-composer,
  .invoice-detail-stats article,.invoice-detail-card
){border-color:var(--dark-line);background:#111d30;color:var(--dark-ink);box-shadow:none}
html[data-theme="dark"] :is(.key-rotation-panel,.key-rotation-card,.key-rotation-progress){background:linear-gradient(145deg,#17243a,#111d30)}
html[data-theme="dark"] :is(.key-rotation-card,.key-rotation-progress,.product-overview article,.customer-hosting-card,.booking-steps,.booking-content,.booking-payment-grid label,.booking-payment-order,.booking-checkout>section,.booking-cart,.ticket-stats article,.invoice-detail-card) :is(h2,h3,h4,strong,b){color:#e8eef8}
html[data-theme="dark"] :is(.key-rotation-card,.key-rotation-progress,.product-overview article,.customer-hosting-card,.booking-steps,.booking-content,.booking-payment-grid label,.booking-payment-order,.booking-checkout>section,.booking-cart,.ticket-stats article,.invoice-detail-card) :is(p,small,em){color:#98a8bd}
html[data-theme="dark"] :is(.booking-back,.customer-hosting-manage,.finance-analysis-back){border-color:#35455e;background:#17253a;color:#c7d2e2}
html[data-theme="dark"] :is(.booking-back,.customer-hosting-manage,.finance-analysis-back):hover{border-color:#6475d2;background:#223451;color:#fff}
html[data-theme="dark"] .booking-steps>span>i{border-color:#3b4b62;background:#17253a;color:#c7d2e2}
html[data-theme="dark"] .booking-billing-switch button.active{background:#24334e;color:#cbd5ff;box-shadow:none}
html[data-theme="dark"] .booking-comparison tbody th{background:#152238}
html[data-theme="dark"] .invoice-detail-card>header,
html[data-theme="dark"] .invoice-detail-totals>div{border-color:var(--dark-line)}
html[data-theme="dark"] .invoice-detail-facts strong{color:#dce5f0}
html[data-theme="dark"] .invoice-detail-notes{color:#aab7ca}

/* Page and workspace headings belong to their surrounding surface. */
html[data-theme="dark"] .tab-view :is(
  .invoice-panel-heading,.expense-panel-heading,.product-section-heading,
  .journal-panel-heading,.backup-panel-heading,.settings-workspace-heading,
  .account-workspace-heading,.user-management-panel-heading
){
  background:transparent;
  box-shadow:none;
}
html[data-theme="dark"] .tab-view :is(
  .invoice-panel-heading,.expense-panel-heading,.product-section-heading
){border-color:transparent}
