/* YCW Portal RC35 | Download center, knowledgebase spacing, dark page surfaces,
 * and independent mobile records/dialogs. No changes to core WHMCS actions. */
body.ycw-portal .ycw-kb-article-topline {
  display:flex; align-items:center; flex-wrap:wrap; gap:10px 22px;
  margin:0 0 20px; min-width:0;
}
body.ycw-portal .ycw-kb-article-topline .ycw-kb-back {margin:0!important; padding:7px 0; min-height:36px;}
body.ycw-portal .ycw-kb-article-topline .ycw-kb-eyebrow {padding:7px 0; min-height:36px;}
body.ycw-portal .ycw-kb-article-hero {padding-top:16px;}
@media(max-width:680px) {
  body.ycw-portal .ycw-kb-article-topline {gap:8px 13px; margin-bottom:15px;}
  body.ycw-portal .ycw-kb-article-topline .ycw-kb-back {flex:0 1 auto;}
  body.ycw-portal .ycw-kb-article-topline .ycw-kb-eyebrow {flex:0 1 auto;}
}
/* Download cards reuse the knowledgebase design tokens, with file-specific details. */
body.ycw-portal .ycw-dl-page .ycw-dl-file-footer,
body.ycw-portal .ycw-dl-page .ycw-dl-file-footer {display:flex;align-items:center;flex-wrap:wrap;justify-content:space-between;gap:10px;width:100%;margin-top:auto;color:var(--kb-muted);}
body.ycw-portal .ycw-dl-page .ycw-dl-file-footer small {font-size:11px;color:var(--kb-muted)!important;}
body.ycw-portal .ycw-dl-page .ycw-dl-file-footer > span {display:inline-flex;align-items:center;gap:9px;color:var(--kb-accent);font-size:11px;font-weight:750;}
body.ycw-portal .ycw-dl-page .ycw-dl-lock {font-size:11px;color:var(--kb-accent)!important;margin-left:5px;}
body.ycw-portal .ycw-dl-page .ycw-kb-article-card:hover .ycw-dl-file-footer > span {text-decoration:underline;}
body.ycw-portal .ycw-dl-page .ycw-kb-category-card,
body.ycw-portal .ycw-dl-page .ycw-kb-article-card {color:var(--kb-text)!important;}

/* The old global RC30 rule was intentionally too broad. Structural wrappers do
 * not need an additional colored layer in dark mode. Real cards retain surfaces. */
html[data-ycw-theme='dark'] body.ycw-portal :is(
  .wdes-block,.wdes-block-table,.block-knb,.kbarticles,.kb-article-content,
  .kb-article-details,.contact-page,.form-horizontal,.account,.account-details,
  .billing-details,.kb-search,.list-group,.ycw-dashboard-section,.ycw-dashboard-services
) {background:transparent!important;box-shadow:none;}
/* Do not remove true card backgrounds or interactive dialog surfaces. */
html[data-ycw-theme='dark'] body.ycw-portal :is(
  .ycw-kb-hero,.ycw-kb-category-card,.ycw-kb-article-card,.ycw-kb-reading-card,
  .ycw-kb-vote,.ycw-kb-support,.panel,.card,.modal-content,.list-group-item,
  .ticketmessage,.ticket-reply,.ticket-reply-container,.ycw-dashboard-action-card
) {border-color:var(--ycw30-border,#3d516c);}

/* Mobile records replace the tiny DataTables responsive '+' control on selected lists.
 * DataTables itself remains active behind the cards (filter, sort, pagination). */
body.ycw-portal .ycw-mobile-records {display:none;}
@media(max-width:767px) {
  body.ycw-portal .ycw-mobile-records {display:grid;grid-template-columns:minmax(0,1fr);gap:12px;margin:14px 0 18px;min-width:0;}
  body.ycw-portal .ycw-mobile-records + table[data-ycw-mobile-records] {display:none!important;}
  body.ycw-portal .ycw-record-card {min-width:0;padding:18px;background:#fff;border:1px solid #dfe7f0;border-radius:17px;box-shadow:0 8px 22px rgba(15,35,65,.04);}
  body.ycw-portal .ycw-record-card-top {display:flex;align-items:flex-start;justify-content:space-between;gap:14px;}
  body.ycw-portal .ycw-record-card-title {display:block;min-width:0;font:750 14px/1.5 Poppins,sans-serif;color:#152843;overflow-wrap:anywhere;}
  body.ycw-portal .ycw-record-card-summary {display:block;margin-top:5px;color:#6c7c95;font:500 11px/1.65 Poppins,sans-serif;overflow-wrap:anywhere;}
  body.ycw-portal .ycw-record-card-status {flex:0 0 auto;max-width:48%;font-size:11px;}
  body.ycw-portal .ycw-record-card-status .status {max-width:100%;white-space:normal!important;text-align:center;}
  body.ycw-portal .ycw-record-open {display:flex!important;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;margin-top:15px;padding:12px 15px;border-radius:11px;border:1px solid #ff5900;background:#ff5900;color:#fff!important;font:750 12px/1.5 Poppins,sans-serif;text-align:left;cursor:pointer;}
  body.ycw-portal .ycw-record-open i {font-size:14px;}
  body.ycw-portal .ycw-record-open:focus-visible {outline:3px solid #ff9a60;outline-offset:3px;}
  html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-card {background:#1c2b3f!important;border-color:#3c506d!important;box-shadow:none;}
  html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-card-title {color:#eff5ff!important;}
  html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-card-summary {color:#afc0d7!important;}
  html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-open {color:#fff!important;}
}
body.ycw-portal .ycw-record-dialog[hidden] {display:none!important;}
body.ycw-portal .ycw-record-dialog {position:fixed;inset:0;z-index:100000;display:flex;align-items:center;justify-content:center;padding:14px;background:rgba(6,15,30,.76);}
body.ycw-portal .ycw-record-dialog-panel {width:min(100%,560px);max-height:calc(100dvh - 28px);overflow:auto;overscroll-behavior:contain;background:#fff;color:#172b49;border:1px solid #dfe7f1;border-radius:21px;box-shadow:0 24px 80px rgba(0,0,0,.25);}
body.ycw-portal .ycw-record-dialog-head {display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 22px;border-bottom:1px solid #e4ebf3;}
body.ycw-portal .ycw-record-dialog-heading {min-width:0;}
body.ycw-portal .ycw-record-dialog-eyebrow {display:block;color:#ff5900;text-transform:uppercase;font:750 10px/1.5 Poppins,sans-serif;letter-spacing:.1em;margin:0 0 5px;}
body.ycw-portal .ycw-record-dialog-heading h2 {margin:0!important;color:#172b49!important;font:750 18px/1.45 Poppins,sans-serif!important;overflow-wrap:anywhere;}
body.ycw-portal .ycw-record-dialog-close {display:grid;place-items:center;flex:0 0 44px;height:44px;border-radius:11px;border:1px solid #dce5ee;background:#f5f8fc;color:#263953;cursor:pointer;}
body.ycw-portal .ycw-record-dialog-content {padding:20px 22px 16px;}
body.ycw-portal .ycw-record-dialog-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
body.ycw-portal .ycw-record-detail {min-width:0;padding:14px;background:#f6f8fc;border:1px solid #e5ebf3;border-radius:12px;}
body.ycw-portal .ycw-record-detail-label {display:block;color:#6f8098;font:600 11px/1.4 Poppins,sans-serif;margin-bottom:6px;}
body.ycw-portal .ycw-record-detail-value {display:block;color:#182c49;font:700 12px/1.65 Poppins,sans-serif;overflow-wrap:anywhere;}
body.ycw-portal .ycw-record-dialog-actions {display:grid;gap:9px;margin-top:18px;}
body.ycw-portal .ycw-record-dialog-actions a {display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:46px;padding:12px 14px;border-radius:11px;border:1px solid #ffc8ab;color:#da4b00!important;background:#fff4ed;text-decoration:none;font:750 12px/1.5 Poppins,sans-serif;}
body.ycw-portal .ycw-record-dialog-actions a i {margin-left:auto;}
body.ycw-portal .ycw-record-dialog-footer {padding:12px 22px 20px;}
body.ycw-portal .ycw-record-dialog-done {width:100%;min-height:45px;border-radius:11px;border:1px solid #dfe6f0;background:#f6f8fc;color:#20334f;font-weight:750;cursor:pointer;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-dialog-panel {background:#1b293d!important;color:#ecf3ff!important;border-color:#3c506a!important;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-dialog-head {border-color:#3c506a!important;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-dialog-heading h2 {color:#ecf3ff!important;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-dialog-close,
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-dialog-done {background:#263851!important;border-color:#405675!important;color:#eaf2ff!important;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-detail {background:#22354d!important;border-color:#405675!important;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-detail-label {color:#b6c5d9!important;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-detail-value {color:#ecf3ff!important;}
html[data-ycw-theme='dark'] body.ycw-portal .ycw-record-dialog-actions a {background:#342b27!important;border-color:#80543c!important;color:#ffae7c!important;}
@media(max-width:430px) {
  body.ycw-portal .ycw-record-dialog {align-items:flex-end;padding:0;}
  body.ycw-portal .ycw-record-dialog-panel {width:100%;max-height:calc(100dvh - 12px);border-radius:21px 21px 0 0;}
  body.ycw-portal .ycw-record-dialog-head {padding:18px;}
  body.ycw-portal .ycw-record-dialog-content {padding:16px 18px;}
  body.ycw-portal .ycw-record-dialog-footer {padding:8px 18px max(17px,env(safe-area-inset-bottom));}
  body.ycw-portal .ycw-record-dialog-grid {grid-template-columns:minmax(0,1fr);}
}
@media print {body.ycw-portal .ycw-record-dialog,body.ycw-portal .ycw-mobile-records {display:none!important;}body.ycw-portal table[data-ycw-mobile-records] {display:table!important;}}

/* RC35: precise editor palettes. RC31's blanket text override was too broad:
   previews and rich text fields could have pale text on an unthemed light editor.
   Treat controls, rendered preview, and toolbar as separate surfaces. */
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor,.markdown-editor,.redactor-box,.redactor-editor) {
  background-color:#1b2a3f!important;
  border-color:#405571!important;
  color:#e7f0fd!important;
}
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor .md-header,.md-editor .md-toolbar,.markdown-editor .toolbar,.redactor-toolbar,.redactor-toolbar-box) {
  background-color:#25374f!important;
  border-color:#405571!important;
  color:#e7f0fd!important;
}
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor .md-input,.md-editor textarea,.md-editor .md-preview,.markdown-editor textarea,.markdown-editor .md-preview,.redactor-editor,[contenteditable='true'].redactor-editor) {
  background:#19283b!important;
  border-color:#405571!important;
  color:#e7f0fd!important;
  caret-color:#ff995d;
}
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor .md-preview,.markdown-editor .md-preview,.redactor-editor) :is(p,div,span,label,ul,ol,li,blockquote,h1,h2,h3,h4,h5,h6) {
  color:inherit!important;
  background:transparent;
}
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor .md-header,.md-editor .md-toolbar,.redactor-toolbar) :is(button,.btn,a) {
  background:#2b405a!important;
  color:#edf4ff!important;
  border-color:#435a78!important;
}
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor .md-header,.md-editor .md-toolbar,.redactor-toolbar) :is(button,.btn,a):hover,
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor .md-header,.md-editor .md-toolbar,.redactor-toolbar) :is(button,.btn,a):focus-visible {
  background:#364c68!important;
  color:#fff!important;
}
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor .md-preview,.markdown-editor .md-preview,.redactor-editor) :is(pre,code) {
  background:#111e2f!important;
  border-color:#405571!important;
  color:#dcecff!important;
}
html[data-ycw-theme='dark'] body.ycw-portal :is(.md-editor textarea,.markdown-editor textarea,.redactor-editor)[aria-invalid='true'] {
  border-color:#ff8691!important;
}
/* Keep third-party payment fields, CAPTCHA and any iframe's own document untouched. */
@media print {
  html[data-ycw-theme='dark'] body.ycw-portal :is(.md-preview,.redactor-editor) {
    background:#fff!important;color:#172b49!important;
  }
}
