/* FreeWebPanel emergency admin/user layout + text wrap fix v2 */
.page-shell-panel,
.page-shell-panel.panel-skin-admin,
.page-shell-panel.panel-skin-user {
  overflow-x: clip;
}

/* High-specificity: beat most panel selectors with wrap fixes */
.page-shell-panel.page-shell-panel .panel-main,
.page-shell-panel.page-shell-panel .panel-main *,
.page-shell-panel.page-shell-panel .sidebar,
.page-shell-panel.page-shell-panel .sidebar *,
.page-shell-panel.page-shell-panel .panel-header,
.page-shell-panel.page-shell-panel .panel-header * {
  word-break: normal !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  hyphens: manual !important;
  letter-spacing: normal !important;
}

/* Body copy only — do not force white-space on all controls */
.page-shell-panel.page-shell-panel .panel-main :is(h1, h2, h3, h4, h5, h6, p, span, small, strong, b, em, label, li, td, th, a),
.page-shell-panel.page-shell-panel .panel-header :is(h1, h2, h3, h4, p, span, small, strong),
.page-shell-panel.page-shell-panel .cpanel-tool-copy :is(strong, small, span),
.page-shell-panel.page-shell-panel .sidebar-link-copy :is(strong, small, span),
.page-shell-panel.page-shell-panel .list-item :is(strong, small, span, div),
.page-shell-panel.page-shell-panel .overview-tile :is(strong, small, span, p) {
  white-space: normal !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Code can still wrap long tokens */
.page-shell-panel.page-shell-panel :is(code, pre, .mini-terminal, .code-block) {
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/* Desktop two-column; avoid flex-column reorder that confuses widths */
.page-shell-panel.page-shell-panel .panel-layout:not(.panel-layout-no-sidebar) {
  display: grid !important;
  grid-template-columns: minmax(240px, 300px) minmax(min(100%, 480px), 1fr) !important;
  align-items: start !important;
  gap: 1rem !important;
  width: min(1580px, calc(100% - 1rem)) !important;
  max-width: 100% !important;
  margin-inline: auto !important;
  flex-direction: unset !important;
}

.page-shell-panel.page-shell-panel .panel-layout:not(.panel-layout-no-sidebar) > .sidebar,
.page-shell-panel.page-shell-panel .panel-layout:not(.panel-layout-no-sidebar) > .panel-main {
  order: unset !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: auto !important;
  box-sizing: border-box !important;
}

.page-shell-panel.page-shell-panel .panel-layout:not(.panel-layout-no-sidebar) > .panel-main {
  overflow-x: auto !important;
  flex: unset !important;
}

.page-shell-panel.page-shell-panel .panel-layout-no-sidebar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
}

@media (max-width: 980px) {
  .page-shell-panel.page-shell-panel .panel-layout:not(.panel-layout-no-sidebar) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .page-shell-panel.page-shell-panel .panel-layout:not(.panel-layout-no-sidebar) > .sidebar {
    max-height: none !important;
    position: relative !important;
    top: auto !important;
  }
}

/* Header full-width copy */
.page-shell-panel.page-shell-panel .panel-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0.85rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.page-shell-panel.page-shell-panel .panel-header h1 {
  font-size: clamp(1.35rem, 2.4vw, 2.1rem) !important;
  line-height: 1.2 !important;
  max-width: 100% !important;
  width: auto !important;
  display: block !important;
}

.page-shell-panel.page-shell-panel .panel-header p {
  max-width: min(80ch, 100%) !important;
  line-height: 1.5 !important;
  display: block !important;
}

/* Tool cards: icon | copy | arrow with non-collapsing copy */
.page-shell-panel.page-shell-panel .cpanel-tool-card {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 0.75rem !important;
  width: 100% !important;
}

.page-shell-panel.page-shell-panel .cpanel-tool-copy {
  min-width: 0 !important;
  max-width: 100% !important;
  width: auto !important;
  display: grid !important;
  gap: 0.2rem !important;
}

.page-shell-panel.page-shell-panel .cpanel-tool-copy strong,
.page-shell-panel.page-shell-panel .cpanel-tool-copy small {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
}

@media (max-width: 640px) {
  .page-shell-panel.page-shell-panel .cpanel-tool-card {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Login shells on /admin when logged out */
.page-shell-auth .panel-auth-card,
.page-shell-auth .panel-login-meta,
.page-shell-panel .panel-login-meta {
  min-width: 0 !important;
  max-width: 100% !important;
}

.page-shell-auth :is(h1, h2, p, span, small, strong, label) {
  word-break: normal !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}
