/* Shieldy UI stability R3 — UI-only overrides. */

/* Generic OFF bodies in Extra utilities must respect the hidden attribute. */
body[data-account-page="bots"] [data-module-panel="sh-other"] .feature-settings-body[hidden]{
  display:none!important;
}

/* Complaints/report card: no dangling save/reset row while OFF. */
body[data-account-page="bots"] [data-module-panel="sh-other"] #shieldy-report-settings.jj-report-off-clean:not(.jj-report-save-failed) [data-report-body]{
  display:none!important;
}
body[data-account-page="bots"] [data-module-panel="sh-other"] #shieldy-report-settings.jj-report-off-clean:not(.jj-report-save-failed) .shieldy-report-actions{
  display:none!important;
}
body[data-account-page="bots"] [data-module-panel="sh-other"] #shieldy-report-settings.jj-report-save-failed [data-report-body]{
  display:block!important;
}
body[data-account-page="bots"] [data-module-panel="sh-other"] #shieldy-report-settings.jj-report-save-failed .shieldy-report-layout{
  display:none!important;
}
body[data-account-page="bots"] [data-module-panel="sh-other"] #shieldy-report-settings.jj-report-save-failed .shieldy-report-actions{
  display:flex!important;
}

/* Journal master OFF: collapse the master card's fields. Existing save bar is
   deliberately left visible so the normal form can persist the switch. */
body[data-account-page="bots"] [data-module-panel="sh-punishments"] #shieldy-channels-form.jj-journal-master-off .log-collection-master>.log-general-grid{
  display:none!important;
}

/* Journal appearance toggle OFF: only heading/toggle remains. This is the bug
   shown in the screenshot — controls/preview must not stay expanded. */
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-off .log-customization-layout{
  display:none!important;
}
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-on .log-customization-layout{
  display:grid!important;
}

/* Welcome preview: one stable owner for message composition. */
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-preview-card-slot{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:12px!important;
  min-width:0!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-preview-card-slot:empty{
  display:none!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome [data-preview-primary-message][hidden],
body[data-account-page="bots"] #sh-interaction-view-welcome [data-preview-secondary-message][hidden],
body[data-account-page="bots"] #sh-interaction-view-welcome [data-preview-native-embed][hidden],
body[data-account-page="bots"] #sh-interaction-view-welcome [data-preview-embed][hidden]{
  display:none!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-preview-message-stack,
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-inline-preview{
  overflow-anchor:none;
}

/* Separate really looks like a second bot message. */
body[data-account-page="bots"] #sh-interaction-view-welcome [data-preview-secondary-message][data-preview-delivery="shieldy-card"]{
  margin-top:4px!important;
  padding:12px!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome [data-preview-secondary-message] [data-jj-secondary-author]{
  display:flex;
  margin:0 0 7px!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome [data-preview-secondary-message] [data-preview-secondary-card-slot]>.welcome-embed-preview{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
}

/* Mode cards explain the actual requested delivery model. */
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-mode-option.jj-mode-unavailable{
  opacity:.62!important;
  cursor:not-allowed!important;
  transform:none!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-mode-option [data-jj-mode-status]{
  grid-column:2;
  display:block;
  margin-top:2px;
  color:var(--account-muted,#656d76);
  font-size:10px;
  font-style:normal;
  font-weight:750;
  line-height:1.35;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-mode-option:not(.jj-mode-unavailable) [data-jj-mode-status]{
  color:#1a7f37;
}

/* Free media remains reachable in Free mode. Premium controls stay hidden. */
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-event-form[data-jj-welcome-section="free"] .welcome-dependent.is-open > .welcome-card-editor.jj-free-media-surface{
  display:block!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-event-form[data-jj-welcome-section="free"] .welcome-card-editor.jj-free-media-surface > .welcome-section-head{
  display:flex!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-event-form[data-jj-welcome-section="free"] .welcome-card-editor.jj-free-media-surface > .welcome-free-visual-guide-v756,
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-event-form[data-jj-welcome-section="free"] .welcome-card-editor.jj-free-media-surface > .welcome-free-banner-presets,
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-event-form[data-jj-welcome-section="free"] .welcome-card-editor.jj-free-media-surface > .shieldy-site-media-stack{
  display:grid!important;
  visibility:visible!important;
  opacity:1!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-event-form[data-jj-welcome-section="free"] .welcome-card-editor.jj-free-media-surface > .welcome-card-standard-note{
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
}
body[data-account-page="bots"] #sh-interaction-view-welcome .welcome-event-form[data-jj-welcome-section="free"] .welcome-card-editor.jj-free-media-surface > .welcome-card-customization{
  display:none!important;
}

/* R3 — Premium journal customization must be a compact row when OFF.
   This direct :has() fallback follows the real checkbox state even before
   any JS lifecycle event runs, while the R3 JS also hides the body at DOM
   level. No API/save/network behavior is changed. */
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-off,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization]:has(input[name="logs_customization_enabled"]:not(:checked)){
  padding:14px 16px!important;
}
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-off .log-customization-head,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization]:has(input[name="logs_customization_enabled"]:not(:checked)) .log-customization-head{
  align-items:center!important;
  gap:12px!important;
}
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-off .log-customization-head>div>p,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization]:has(input[name="logs_customization_enabled"]:not(:checked)) .log-customization-head>div>p{
  display:none!important;
}
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-off .log-customization-layout,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-off .log-premium-lock,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization]:has(input[name="logs_customization_enabled"]:not(:checked)) .log-customization-layout,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization]:has(input[name="logs_customization_enabled"]:not(:checked)) .log-premium-lock,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] #shieldy-channels-form.jj-journal-master-off [data-log-customization] .log-customization-layout,
body[data-account-page="bots"] [data-module-panel="sh-punishments"] #shieldy-channels-form.jj-journal-master-off [data-log-customization] .log-premium-lock{
  display:none!important;
}
@media(max-width:640px){
  body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization].jj-log-customization-off .log-customization-head,
  body[data-account-page="bots"] [data-module-panel="sh-punishments"] [data-log-customization]:has(input[name="logs_customization_enabled"]:not(:checked)) .log-customization-head{
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
  }
}
