/* YCW Portal 1.1.5 RC6: consistent auto-sized buttons and right-rail structure.
 * Loaded after RC3 and RC5. All WHMCS forms, IDs and actions are preserved.
 */

/* The right rail belongs to the page area BELOW the header, not beside the header.
   This gives the header the entire available width, without a fixed overlay. */
body.ycw-portal .wdes-wrapper > .wdes-content {
  min-width: 0 !important;
  flex: 1 1 0% !important;
  width: auto !important;
  max-width: none !important;
}
body.ycw-portal .wdes-content > .ycw-content-layout {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  gap: 0 !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.ycw-portal .wdes-content > .ycw-content-layout > section#main-body {
  float: none !important;
  display: block !important;
  flex: 1 1 0% !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
}
body.ycw-portal .wdes-content > .ycw-content-layout > section#main-body > .container,
body.ycw-portal .wdes-content > .ycw-content-layout > section#main-body > .container-fluid {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
}
body.ycw-portal .wdes-content > .ycw-content-layout > aside.whm-sidebar {
  position: relative !important;
  z-index: 1 !important;
  order: 2 !important;
  flex: 0 0 var(--ycw-context) !important;
  align-self: stretch !important;
  width: var(--ycw-context) !important;
  min-width: 0 !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 26px 22px 32px 8px !important;
  overflow: visible !important;
  background: var(--ycw-bg) !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.ycw-portal .wdes-content > .ycw-content-layout > aside.whm-sidebar .ycw-context-label {
  margin: 0 8px 12px;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: .11em;
  text-transform: uppercase;
}
/* Page header stays in normal document flow and spans above the context rail. */
body.ycw-portal .wdes-content > section#header.ycw-modern-header {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}
@media (max-width: 1230px) {
  body.ycw-portal .wdes-content > .ycw-content-layout > aside.whm-sidebar {
    display: none !important;
  }
}

/* Action buttons are content-sized, not full-width bars.
   Full-size cards, search fields, select menus and non-button blocks are unaffected. */
body.ycw-portal .wdes-content :is(a.btn, button.btn, input.btn),
body.ycw-portal .whm-sidebar :is(a.btn, button.btn, input.btn),
body.ycw-portal .wdes-sidebar .ycw-help-card :is(a.btn, button.btn),
body.ycw-portal .wdes-content a.ycw-action,
body.ycw-portal .wdes-content button[type="submit"].btn,
body.ycw-portal .wdes-content input[type="submit"].btn {
  width: fit-content !important;
  min-width: 0 !important;
  max-width: 100% !important;
  flex: 0 0 auto;
  justify-content: center;
  vertical-align: middle;
  text-align: center;
}
body.ycw-portal .wdes-content :is(a.btn, button.btn),
body.ycw-portal .whm-sidebar :is(a.btn, button.btn),
body.ycw-portal .wdes-sidebar .ycw-help-card :is(a.btn, button.btn) {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  white-space: normal;
}
body.ycw-portal .wdes-content .btn-block,
body.ycw-portal .whm-sidebar .btn-block {
  display: inline-flex !important;
  margin-right: 0;
  margin-left: 0;
}
/* Buttons within composed input controls keep their own intrinsic width.
   Preserve the full width of the input GROUP itself. */
body.ycw-portal .wdes-content :is(.input-group-btn, .btn-group) .btn {
  flex: initial;
}
/* Keep genuine navigation tabs and radio groups consistent as grouped controls. */
body.ycw-portal .wdes-content .btn-group-justified .btn {
  width: 100% !important;
  min-width: 0 !important;
}
body.ycw-portal .wdes-content .btn-group-justified {
  display: table !important;
}
/* Prevent accidental stretching within flex action rows. */
body.ycw-portal .wdes-content :is(.ycw-dashboard-head-actions, .ycw-hero-actions, .ycw-domainchecker-actions, .btn-toolbar, .modal-footer) {
  align-items: center;
}
@media (max-width: 620px) {
  body.ycw-portal .wdes-content :is(a.btn, button.btn, input.btn, a.ycw-action) {
    max-width: 100% !important;
  }
}
