/* RC32 • Targeted UI hardening • 2026-10-10
   Installed AFTER RC31. No changes to core WHMCS actions or visible/hidden state. */

/* 1. DataTables: render every row, cell and control container over a solid
   surface in dark mode. Legacy theme CSS paints the wrapper gutter white. */
html[data-ycw-theme="dark"] body.ycw-portal :is(
  .table-container, .wdes-block-table, .dataTables_wrapper,
  .dataTables_wrapper > .row, .dataTables_wrapper > .row > [class*="col-"],
  .dataTables_wrapper > .row > div, .dataTables_wrapper > div:not(table),
  .dataTables_wrapper > .dataTables_info, .dataTables_wrapper > .dataTables_filter,
  .dataTables_wrapper > .dataTables_length, .dataTables_wrapper > .dataTables_paginate
) {background:#1b293d!important;color:#dce8f7!important;border-color:#3c506a!important;}
html[data-ycw-theme="dark"] body.ycw-portal :is(.dataTables_wrapper,.table-container,.wdes-block-table) :is(.row,.clearfix)::before,
html[data-ycw-theme="dark"] body.ycw-portal :is(.dataTables_wrapper,.table-container,.wdes-block-table) :is(.row,.clearfix)::after {
  background:transparent!important;
}
html[data-ycw-theme="dark"] body.ycw-portal :is(.dataTables_wrapper,.table-container) :is(.dataTables_filter,.dataTables_length,.dataTables_info,.dataTables_paginate) {
  box-shadow:none!important;
}
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper :is(.dataTables_filter label,.dataTables_length label) {color:#dce8f7!important;background:#1b293d!important;}
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper :is(.dataTables_filter input,.dataTables_length select) {background-color:#23344d!important;color:#f0f6ff!important;border-color:#465d7c!important;}
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper .table-list > thead > tr > th {background:#253650!important;color:#f0f6ff!important;border-color:#455b77!important;}
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper .table-list > tbody > tr > td {background:#1b293d!important;color:#e2ebf9!important;border-color:#3b506a!important;}
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper .table-list > tbody > tr:hover > td {background:#263a55!important;}
/* Keep sorting, status, pagination and empty rows functional. */
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper :is(.dataTables_empty,.dataTables_processing,.dtr-details) {background:#22334b!important;color:#d5e3f5!important;}
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper :is(.pagination > li > a,.pagination > li > span) {background:#26384f!important;color:#dce8f7!important;border-color:#48607e!important;box-shadow:none!important;}
html[data-ycw-theme="dark"] body.ycw-portal .dataTables_wrapper .pagination > .active > :is(a,span) {background:#443126!important;color:#ffbd90!important;border-color:#985d39!important;}

/* 2. Dashboard dynamic panels: recent tickets, messages, ticket metadata. */
html[data-ycw-theme="dark"] body.ycw-portal.template-clientareahome .client-home-panels :is(.wdes-clientarea-panel-block,.panel-heading,.panel-body,.panel-footer,.list-group,.list-group-item) {
  background:#1b293d!important;border-color:#3c506a!important;color:#e6eefc!important;
}
html[data-ycw-theme="dark"] body.ycw-portal.template-clientareahome .client-home-panels :is(.panel-title,.ycw-home-panel-heading-text,.list-group-item > a,.list-group-item a,.list-group-item strong) {color:#f0f5fd!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-clientareahome .client-home-panels :is(.list-group-item,.panel-body,.panel-footer) :is(.text-muted,small,.small,.date,.time,em) {color:#aec0d7!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-clientareahome .client-home-panels .list-group-item:hover {background:#253951!important;}

/* 3. Announcements: the original YCW news stylesheet has !important white
   surfaces; override with component-specific rules and readable inner text. */
html[data-ycw-theme="dark"] body.ycw-portal :is(.ycw-announcements,.ycw-announcement-heading,.ycw-announcement-social,.ycw-announcement-detail-footer) {background:transparent!important;}
html[data-ycw-theme="dark"] body.ycw-portal :is(.ycw-announcements .ycw-announcement-card,.ycw-announcement-detail) {
  background:#1b293d!important;color:#dbe7f7!important;border-color:#3e526e!important;box-shadow:0 12px 26px rgba(1,9,20,.16)!important;
}
html[data-ycw-theme="dark"] body.ycw-portal :is(.ycw-announcements .ycw-announcement-title,.ycw-announcements .ycw-announcement-title a,.ycw-announcements .announcement-single a.title) {
  color:#eef4ff!important;
}
html[data-ycw-theme="dark"] body.ycw-portal :is(.ycw-announcements .ycw-announcement-title a:hover,.ycw-announcements .ycw-announcement-title a:focus-visible) {color:#ffad78!important;}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcement-date {
  color:#ffb486!important;background:#423025!important;border-color:#74513e!important;
}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcements .ycw-announcement-excerpt {
  background:#22334a!important;color:#c6d4e6!important;border-color:#3a4e69!important;
}
html[data-ycw-theme="dark"] body.ycw-portal :is(.ycw-announcements .ycw-announcement-excerpt p,.ycw-announcements .ycw-announcement-excerpt blockquote,.ycw-announcement-detail-body,.ycw-announcement-detail-body p,.ycw-announcement-detail-body li,.ycw-announcement-detail-body strong,.ycw-announcement-detail-body span) {color:#d6e3f2!important;}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcement-detail-body blockquote {background:#22334a!important;color:#ccdaed!important;border-color:#455a75!important;}
html[data-ycw-theme="dark"] body.ycw-portal :is(.ycw-announcement-excerpt a,.ycw-announcement-detail-body a) {color:#ffad78!important;}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcement-pagination a.btn {background:#25374f!important;color:#e8f1fd!important;border-color:#405573!important;}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcement-pagination a.btn:is(.active,:hover,:focus-visible) {color:#fff!important;background:#ca4b07!important;border-color:#ef6b2a!important;}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcement-detail-footer {border-top-color:#40536e!important;}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcement-back {background:#392d2a!important;color:#ffb58b!important;border-color:#684a3c!important;}
html[data-ycw-theme="dark"] body.ycw-portal .ycw-announcement-back:hover {color:#fff!important;background:#c94b07!important;}
/* Light: improve text wrapping and align date/title for long announcements. */
body.ycw-portal .ycw-announcements .ycw-announcement-card,
body.ycw-portal .ycw-announcement-detail {min-width:0;overflow-wrap:anywhere;}
body.ycw-portal .ycw-announcement-detail-body :is(img,video,iframe,table) {max-width:100%;}
body.ycw-portal .ycw-announcement-detail-body img {height:auto;}

/* 4. Login layout: eliminate double viewport heights caused by old auth rules.
   Real CAPTCHA or third-party sign-in may still require natural scrolling. */
body.ycw-portal.template-login .wdes-wrapper {min-height:100dvh!important;padding:0!important;align-items:stretch!important;}
body.ycw-portal.template-login :is(.wdes-content,.ycw-content-layout,section#main-body,.main-content) {min-height:0!important;}
body.ycw-portal.template-login section#main-body {min-height:0!important;padding:0!important;}
body.ycw-portal.template-login .ycw-login-stage {
  min-height:100vh!important;min-height:100dvh!important;
  padding:clamp(12px,2.1vh,24px) clamp(12px,2.5vw,28px)!important;
  align-items:center!important;
}
body.ycw-portal.template-login .ycw-login-card {
  min-height:0!important;width:min(1060px,100%);
  max-height:none!important;
  grid-template-columns:minmax(0,51%) minmax(0,49%);
}
body.ycw-portal.template-login .ycw-login-media {min-height:0!important;}
body.ycw-portal.template-login .ycw-login-panel-inner {max-width:530px;padding:24px 32px!important;}
body.ycw-portal.template-login .ycw-login-box {padding:19px 20px!important;}
body.ycw-portal.template-login .ycw-login-brand {margin-bottom:14px!important;}
body.ycw-portal.template-login .ycw-login-brand img {max-height:44px;max-width:min(235px,100%);}
body.ycw-portal.template-login .ycw-login-links {gap:8px;margin-top:12px!important;}
body.ycw-portal.template-login .ycw-login-security-note {margin-top:12px!important;}
body.ycw-portal.template-login .ycw-login-form .form-group {margin-bottom:11px!important;}
body.ycw-portal.template-login .ycw-login-meta {margin:10px 0 13px!important;}
body.ycw-portal.template-login .ycw-login-box-head {margin-bottom:13px!important;}
/* Light login color system remains as is; support missing dynamic logos. */
body.ycw-portal.template-login .ycw-login-brand .ycw-login-logo-dark {display:none;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-brand .ycw-login-logo-light {display:none;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-brand .ycw-login-logo-dark {display:block;}
/* Dark authentication: background, card, form fields, notices, third-party sign-in. */
html[data-ycw-theme="dark"] body.ycw-portal.template-login :is(.wdes-wrapper,.wdes-content,#main-body,.ycw-content-layout,.ycw-login-stage) {
  background:#101a2a!important;color:#e8f0fa!important;
}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-card {background:#1b293d!important;border-color:#3c506c!important;box-shadow:0 22px 55px rgba(0,0,0,.32)!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-panel {background:#1b293d!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-box {background:#213148!important;border-color:#425873!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login :is(.ycw-login-box-head h1,.ycw-login-form label) {color:#f0f5ff!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login :is(.ycw-login-box-head p,.ycw-login-security-note,.ycw-login-remember,.ycw-login-links,.ycw-login-links span) {color:#b7c8dc!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-form .form-control {background:#15253a!important;border-color:#465e7d!important;color:#f0f6ff!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-form .form-control::placeholder {color:#9fb2ca!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login :is(.ycw-login-language,.ycw-password-toggle) {background:#2b3c54!important;color:#d9e6f8!important;border-color:#4d6380!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-links a {color:#ffb182!important;}
html[data-ycw-theme="dark"] body.ycw-portal.template-login .ycw-login-linkedaccounts {border-top-color:#465b77!important;}

@media(max-width:900px) {
  body.ycw-portal.template-login .ycw-login-card {grid-template-columns:minmax(0,1fr)!important;max-width:650px;}
  body.ycw-portal.template-login .ycw-login-media {height:clamp(145px,20vh,220px)!important;min-height:0!important;}
  body.ycw-portal.template-login .ycw-login-stage {align-items:center!important;}
}
@media(max-width:560px) {
  body.ycw-portal.template-login .ycw-login-stage {padding:12px!important;align-items:flex-start!important;}
  body.ycw-portal.template-login .ycw-login-card {border-radius:18px!important;}
  body.ycw-portal.template-login .ycw-login-media {height:145px!important;}
  body.ycw-portal.template-login .ycw-login-panel-inner {padding:22px 16px!important;}
  body.ycw-portal.template-login .ycw-login-box {padding:19px 16px!important;}
  body.ycw-portal .ycw-announcements {margin-inline:0;}
}
@media (max-height:760px) and (min-width:901px) {
  body.ycw-portal.template-login .ycw-login-stage {align-items:center!important;padding:10px 20px!important;}
  body.ycw-portal.template-login .ycw-login-panel-inner {padding:16px 28px!important;}
  body.ycw-portal.template-login .ycw-login-box {padding:15px 18px!important;}
  body.ycw-portal.template-login .ycw-login-brand {margin-bottom:8px!important;}
  body.ycw-portal.template-login .ycw-login-links {margin-top:8px!important;}
}
@media print {
  html[data-ycw-theme="dark"] body.ycw-portal.template-viewannouncement :is(.ycw-announcement-detail,.ycw-announcement-detail-body) {background:#fff!important;color:#172b4b!important;border-color:#d9e1eb!important;}
}
