/* Explicit action groups; keep navigation, forms, color tokens and action order intact. */
#app .sn-tools {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:12px;
  max-width:860px;
  margin:24px 0;
  padding:20px 0 0;
  border-top:1px solid var(--line);
}
#app .sn-tools > .button {
  width:100%;
  min-width:0;
  min-height:48px;
  margin:0;
  white-space:normal;
  overflow-wrap:anywhere;
  justify-content:center;
}
#app .story-service-note .sn-tools { margin:12px 0 18px; padding:0; border:0; }

/* In-panel controls previously appeared as adjacent inline buttons. */
#overlay .modal-body :is(.actions,.ad-actions,.rm-actions,.sh-actions,.cc-actions) {
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  gap:12px;
  margin-block:16px;
}
#overlay .modal-body :is(.actions,.ad-actions,.rm-actions,.sh-actions,.cc-actions) > .button {
  margin:0;
  min-width:0;
  white-space:normal;
  overflow-wrap:anywhere;
}
#overlay .modal-body :is(.pager,.ad-pager,.ta-pager,.at-pager,.sa-pager) {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;
  margin-block:20px;
}
#overlay .modal-body .pager > p { flex-basis:100%; margin:0; }
#overlay .modal-body :is(.ad-card,.ad-panel,.rm-tools) > .button {
  margin-block:6px;
  margin-inline:0 12px;
  white-space:normal;
  overflow-wrap:anywhere;
}

/* Footer groups can wrap without button borders touching or text clipping. */
#overlay .modal .modal-footer,
#overlay .modal .modal-footer .right {
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  gap:12px;
}
#overlay .modal .modal-footer .button { min-width:0; margin-block:0; white-space:normal; overflow-wrap:anywhere; }
#app .sw-page :is(.sh-actions,.sw-page-actions) { gap:12px; flex-wrap:wrap; align-items:stretch; }
#app .sw-page :is(.sh-tabs,.sw-filters) { gap:12px; flex-wrap:wrap; }
#app .sw-page .sh-actions > .button { margin:0; min-width:0; white-space:normal; }

@media(max-width:600px) {
  #app .sn-tools { grid-template-columns:minmax(0,1fr); }
  #overlay .modal-body :is(.actions,.ad-actions,.rm-actions,.sh-actions,.cc-actions) > .button,
  #app .sw-page .sh-actions > .button { flex:1 1 140px; min-height:48px; }
  #overlay .modal-body :is(.ad-card,.ad-panel,.rm-tools) > .button { display:flex; width:100%; min-height:48px; margin:12px 0; justify-content:center; }
  #overlay .modal .modal-footer > .right { flex:1 1 100%; min-width:0; margin-inline:0; }
  #overlay .modal .modal-footer > .button,
  #overlay .modal .modal-footer .right > .button { flex:1 1 140px; min-height:48px; margin:0; }
  #overlay .modal .modal-footer .button.primary { flex-basis:100%; }
}
