/*
 * Wedding Planner — App Shell v2
 * Phase 1 / 40.562.7
 *
 * This stylesheet is intentionally limited to application geometry:
 * document shell, workspace grid, sidebar, main column and sidebar collapse.
 * Module/card/form styling remains in wedding-planner.css until migrated.
 *
 * Contract:
 * - desktop >= 1101px: 280px sidebar / flexible main
 * - tablet 821–1100px: 220px sidebar / flexible main
 * - mobile <= 820px: single-column main; sidebar hidden
 * - collapsed desktop rail: 72px
 */

html.wpwp-app-document,
body.wpwp-app-body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body.wpwp-app-body {
  box-sizing: border-box;
  overflow-x: hidden;
}

body.wpwp-app-body *,
body.wpwp-app-body *::before,
body.wpwp-app-body *::after {
  box-sizing: border-box;
}

body.wpwp-app-body .wpwp-app-shell {
  width: 100%;
  min-height: 100vh;
}

body.wpwp-app-body .wpwp-frontend-dashboard {
  width: 100%;
  max-width: none;
  min-width: 0;
}

body.wpwp-app-body .wpwp-frontend-dashboard .wedding-planner-wrap {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
}

body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout {
  width: min(1440px, 100%);
  max-width: 1440px;
  margin: 0 auto;
  display: grid !important;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

body.wpwp-app-body .wpwp-app-sidebar.wpwp-sidebar-v2 {
  width: 280px;
  min-width: 250px;
  max-width: 280px;
  min-height: 0;
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  position: sticky;
  top: 16px;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 40;
}

body.wpwp-app-body .wpwp-sidebar-nav-v2 {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.wpwp-app-body .wpwp-sidebar-brand,
body.wpwp-app-body .wpwp-sidebar-footer {
  flex: 0 0 auto;
}

body.wpwp-app-body .wpwp-app-main {
  width: auto;
  max-width: none;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-x: hidden;
}

/* Sidebar collapse is a shell concern; labels/icons remain module-owned. */
body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar {
  grid-template-columns: 72px minmax(0, 1fr) !important;
}

body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-app-sidebar.wpwp-sidebar-v2,
body.wpwp-app-body .wpwp-app-sidebar.wpwp-sidebar-v2.is-collapsed {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  padding-left: 8px;
  padding-right: 8px;
  overflow: visible;
}

body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-brand-copy,
body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-label,
body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-nav a b,
body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-settings b {
  display: none;
}

body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-nav a,
body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-settings {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}

body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-nav a span,
body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar .wpwp-sidebar-settings span {
  width: auto;
}

body.wpwp-app-body .wpwp-app-main.is-module-mode {
  display: block;
  min-height: calc(100vh - 40px);
}

body.wpwp-app-body .wpwp-app-main.is-module-mode > .tab-content {
  margin: 0;
  scroll-margin-top: 24px;
}

body.wpwp-app-body .wpwp-app-main > .wpwp-workspace-hidden {
  display: none;
}

@media (min-width: 1101px) {
  body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.has-collapsed-sidebar {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

@media (max-width: 1100px) and (min-width: 821px) {
  body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
  }

  body.wpwp-app-body .wpwp-app-sidebar.wpwp-sidebar-v2 {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    top: 12px;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  body.wpwp-app-body .wpwp-app-sidebar.wpwp-sidebar-v2.is-collapsed {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
  }
}

@media (max-width: 820px) {
  body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  body.wpwp-app-body .wpwp-app-sidebar.wpwp-sidebar-v2 {
    display: none;
  }

  body.wpwp-app-body .wpwp-app-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 14px;
  }

  body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.wpwp-app-body * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* 40.562.9: V2 shell must win over legacy !important shell declarations. */
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
  display: grid !important;
  position: relative !important;
  margin: 0 auto !important;
  width: 100% !important;
  max-width: 1440px !important;
  grid-template-columns: 280px minmax(0, 1fr) !important;
  gap: 24px !important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar {
  grid-template-columns: 72px minmax(0, 1fr) !important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
  position: sticky !important;
  left: auto !important;
  top: 16px !important;
  bottom: auto !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  height: calc(100vh - 32px) !important;
  max-height: calc(100vh - 32px) !important;
  margin: 0 !important;
  padding: 12px !important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar .wpwp-sidebar-v2 {
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
}
@media (max-width: 1100px) and (min-width: 821px) {
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
    grid-template-columns: 220px minmax(0, 1fr) !important;
    gap: 18px !important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
    width: 220px !important; min-width: 220px !important; max-width: 220px !important;
    top: 12px !important; height: calc(100vh - 24px) !important; max-height: calc(100vh - 24px) !important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar {
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }
}
@media (max-width: 820px) {
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
    display: block !important; width: 100% !important; max-width: none !important; margin: 0 !important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
    display: none !important;
  }
}


/* 40.563.14 — canonical shell authority after the V2 flag became the default.
 * Legacy wedding-planner.css contains historical shell contracts. This block
 * intentionally owns only the shell geometry; module-specific media queries
 * remain in their original stylesheet.
 */
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
  display:grid!important;
  position:relative!important;
  grid-template-columns:280px minmax(0,1fr)!important;
  gap:18px!important;
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding:0!important;
  min-width:0!important;
  align-items:start!important;
  box-sizing:border-box!important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
  grid-column:1!important;
  grid-row:1!important;
  position:sticky!important;
  left:auto!important;
  right:auto!important;
  width:280px!important;
  min-width:280px!important;
  max-width:280px!important;
  margin:0!important;
  box-sizing:border-box!important;
  z-index:100!important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-app-main {
  grid-column:2!important;
  grid-row:1!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  margin:0!important;
  padding:0!important;
  box-sizing:border-box!important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar {
  grid-template-columns:72px minmax(0,1fr)!important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar .wpwp-sidebar-v2 {
  width:72px!important;
  min-width:72px!important;
  max-width:72px!important;
}
@media (max-width:1100px) and (min-width:821px) {
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
    grid-template-columns:220px minmax(0,1fr)!important;
    gap:18px!important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
    width:220px!important;
    min-width:220px!important;
    max-width:220px!important;
  }
}
@media (max-width:820px) {
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell,
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar {
    display:block!important;
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2,
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar .wpwp-sidebar-v2 {
    display:none!important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-app-main,
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar .wpwp-app-main {
    display:block!important;
    width:100%!important;
    margin:0!important;
    padding:0 12px 96px!important;
  }
}

/* Normal dashboard guide is document content, not an application overlay. */
html body.wpwp-app-body:not(.wpwp-guide-mode) .wpwp-start-guide {
  position:relative!important;
  z-index:1!important;
  pointer-events:auto!important;
}
html body.wpwp-app-body:not(.wpwp-guide-mode) .wpwp-start-guide * {
  pointer-events:auto!important;
}
/* Full-screen guide mode remains opt-in and may intentionally own the viewport. */
html body.wpwp-app-body.wpwp-guide-mode .wpwp-start-guide {
  position:relative!important;
  z-index:2000000!important;
}


/* 40.563.52 — hardened shell geometry + sticky fix.
 * body overflow-x:hidden created a scroll container that prevented the sidebar
 * from sticking. overflow-x:clip clips horizontal overflow without breaking
 * position:sticky. This block also re-declares the full sidebar geometry so the
 * sidebar is self-contained and its navigation scrolls independently. */
body.wpwp-app-body { overflow-x: clip !important; }

html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
  display: grid !important;
  grid-template-columns: 280px minmax(0, 1fr) !important;
  gap: 18px !important;
  align-items: start !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
  grid-column: 1 !important;
  grid-row: 1 !important;
  align-self: start !important;
  position: sticky !important;
  top: 16px !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  height: calc(100vh - 32px) !important;
  max-height: calc(100vh - 32px) !important;
  margin: 0 !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 100 !important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-nav-v2 {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain !important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-app-main {
  grid-column: 2 !important;
  grid-row: 1 !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 0 80px !important;
  box-sizing: border-box !important;
}
@media (max-width: 1100px) and (min-width: 821px) {
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
    grid-template-columns: 220px minmax(0, 1fr) !important;
    gap: 18px !important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
    width: 220px !important; min-width: 220px !important; max-width: 220px !important;
    top: 12px !important; height: calc(100vh - 24px) !important; max-height: calc(100vh - 24px) !important;
  }
}
@media (max-width: 820px) {
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell,
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar {
    display: block !important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-sidebar-v2 {
    display: none !important;
  }
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell .wpwp-app-main {
    display: block !important;
    width: 100% !important;
    padding: 0 12px 96px !important;
  }
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar {
  grid-template-columns: 72px minmax(0, 1fr) !important;
}
html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell.has-collapsed-sidebar .wpwp-sidebar-v2 {
  width: 72px !important; min-width: 72px !important; max-width: 72px !important;
}


/* 40.563.59 — desktop shell restored to the 40.563.52 geometry.
 * The 40.563.56/57 fixed-sidebar experiment offset the whole wrap, which moved
 * the menu to the viewport edge and pushed the content column too far right.
 * The canonical desktop layout is the centered 40.563.52 grid:
 *   wrap: centered, max 1240px; layout: 280px + 18px gap + content column.
 * External tab-* modules are siblings of the layout, so in that view the
 * layout is stretched to the full wrap height with absolute positioning. The
 * sidebar stays sticky inside it (always pinned) while the module gets the
 * same left offset as the main column, so it can never render under the menu. */
@media (min-width: 821px) {
  /* Keep the menu fully visible below the WP admin bar while pinned. */
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell[data-dashboard-theme] > aside.wpwp-app-sidebar.wpwp-sidebar-v2 {
    top: calc(var(--wp-admin--admin-bar--height, 0px) + 16px) !important;
    height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - 32px) !important;
    max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - 32px) !important;
  }

  /* External module view: the shell becomes a full-height sticky rail. */
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active {
    position: relative !important;
  }
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    display: grid !important;
    grid-template-columns: 280px minmax(0, 1fr) !important;
    gap: 18px !important;
    align-items: start !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    z-index: 0 !important;
  }
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell > .wpwp-sidebar-v2 {
    grid-column: 1 !important;
    pointer-events: auto !important;
  }
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell > .wpwp-app-main {
    display: none !important;
  }
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-module-workspace[data-wpwp-route-module="1"],
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-workspace-header.wpwp-router-module-header {
    margin-left: calc(280px + 18px) !important;
    width: calc(100% - (280px + 18px)) !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-workspace-header.wpwp-router-module-header {
    top: var(--wp-admin--admin-bar--height, 0px) !important;
  }

  /* Tablet: 220px rail + 18px gap. */
  @media (max-width: 1100px) {
    html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
      grid-template-columns: 220px minmax(0, 1fr) !important;
    }
    html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-module-workspace[data-wpwp-route-module="1"],
    html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-workspace-header.wpwp-router-module-header {
      margin-left: calc(220px + 18px) !important;
      width: calc(100% - (220px + 18px)) !important;
    }
  }

  /* Collapsed rail: 72px + 18px gap. */
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active:has(.wpwp-app-layout.has-collapsed-sidebar) > .wpwp-app-layout.wpwp-shell-modern-layout.wpwp-css-v2-shell {
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active:has(.wpwp-app-layout.has-collapsed-sidebar) > .wpwp-module-workspace[data-wpwp-route-module="1"],
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active:has(.wpwp-app-layout.has-collapsed-sidebar) > .wpwp-workspace-header.wpwp-router-module-header {
    margin-left: calc(72px + 18px) !important;
    width: calc(100% - (72px + 18px)) !important;
  }
}

/* 40.563.59 — wp-admin desktop: align the app shell with the pinned menu.
 * WordPress forces #wpcontent to 100% width on top of its 160px left margin,
 * which creates horizontal scroll. The fixed app menu is viewport-positioned,
 * so any horizontal scroll slides the content column underneath it. Constrain
 * the admin content area to the real viewport width, align the wrap with the
 * menu's 16px inset, and keep the home grids inside their column. */
@media (min-width: 1101px) {
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app #wpcontent,
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app #wpbody-content {
    width: auto !important;
    max-width: none !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wedding-planner-wrap {
    width: min(1440px, calc(100vw - 192px)) !important;
    max-width: 1440px !important;
    margin: 0 0 0 16px !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp-app-main > #wpwp-start-guide {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp25-hub {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp25-hub > * {
    min-width: 0 !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp25-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp25-grid > * {
    min-width: 0 !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp25-kpis {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp25-kpis > * {
    min-width: 0 !important;
  }
}

/* 40.563.59 — wp-admin tablet: the generic frontend wrap width is based on the
 * full viewport, so below 1101px it is wider than the admin content column once
 * the WP menu is visible. That overflow lets the router scroll the whole shell
 * sideways, which slides the sticky app rail under the WP menu. Constrain the
 * wrap to the real content area; the layout then fills it and the 220px tablet
 * grid stays intact. Breakpoints mirror WP: the menu auto-folds at 960px. */
@media (min-width: 961px) and (max-width: 1100px) {
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wedding-planner-wrap {
    width: min(1440px, calc(100vw - 192px)) !important;
    max-width: 1440px !important;
    margin: 0 0 0 16px !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp-app-layout[data-dashboard-theme] {
    width: 100% !important;
    max-width: 100% !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp-app-main > #wpwp-start-guide {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}
@media (min-width: 821px) and (max-width: 960px) {
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wedding-planner-wrap {
    width: min(1440px, calc(100vw - 68px)) !important;
    max-width: 1440px !important;
    margin: 0 0 0 16px !important;
  }
  html body.wp-admin.wp-core-ui.wpwp-app-body.wpwp-admin-app .wpwp-app-layout[data-dashboard-theme] {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ==========================================================================
   Phase 1: Mobile & Tablet Foundation (Accessibility, Touch Targets, iOS Zoom)
   ========================================================================== */
@media (max-width: 820px) {
  /* Prevent iOS automatic zoom on focus: inputs, selects and textareas must be at least 16px */
  html body.wpwp-app-body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  html body.wpwp-app-body select,
  html body.wpwp-app-body textarea {
    font-size: 16px !important;
  }

  /* Accessible Touch Targets (min 44px WCAG / Apple HIG) */
  html body.wpwp-app-body input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]),
  html body.wpwp-app-body select,
  html body.wpwp-app-body .button,
  html body.wpwp-app-body a.button,
  html body.wpwp-app-body button.button,
  html body.wpwp-app-body .wpwp-circle-pill,
  html body.wpwp-app-body .wpwp-drawer-link {
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Touch-friendly checkboxes & radios */
  html body.wpwp-app-body input[type="checkbox"],
  html body.wpwp-app-body input[type="radio"] {
    min-width: 22px !important;
    min-height: 22px !important;
    cursor: pointer;
    touch-action: manipulation;
  }

  /* Safe container bottom spacing: prevent floating bottom-nav from covering page content */
  html body.wpwp-app-body .wedding-planner-wrap,
  html body.wpwp-app-body .wpwp-app-main {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* -------------------------------------------------------------------------
     iOS WebKit Viewport & Module Containment Shield
     Fixes: "w aplikacji mobilnej na ios nie widac dobrze wszystkich modułów,
     są za duże i uciekają poza prawy róg ekranu"
     ------------------------------------------------------------------------- */

  /* 1. Strictly constrain root document on iOS to prevent canvas expansion */
  html,
  html.wpwp-app-document,
  body.wpwp-app-body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    position: relative !important;
    -webkit-text-size-adjust: 100% !important;
    margin: 0 !important;
  }

  /* In wp-admin on mobile: prevent #wpcontent and #wpbody from overflowing viewport */
  html body.wp-admin.wp-core-ui.wpwp-app-body #wpcontent,
  html body.wp-admin.wp-core-ui.wpwp-app-body #wpbody,
  html body.wp-admin.wp-core-ui.wpwp-app-body #wpbody-content {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    float: none !important;
  }

  /* 2. Main app shell & containers strictly contained */
  html body.wpwp-app-body .wedding-planner-wrap,
  html body.wpwp-app-body .wpwp-app-shell,
  html body.wpwp-app-body .wpwp-frontend-dashboard .wedding-planner-wrap,
  html body.wpwp-app-body .wpwp-frontend-route .wedding-planner-wrap {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    padding-left: max(10px, env(safe-area-inset-left, 10px)) !important;
    padding-right: max(10px, env(safe-area-inset-right, 10px)) !important;
  }

  html body.wpwp-app-body .wpwp-app-layout,
  html body.wpwp-app-body .wpwp-app-layout.wpwp-shell-modern-layout,
  html body.wpwp-app-body .wpwp-app-layout.wpwp-css-v2-shell,
  html body.wpwp-app-body .wpwp-app-layout.has-collapsed-sidebar {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  html body.wpwp-app-body .wpwp-app-sidebar,
  html body.wpwp-app-body .wpwp-sidebar-v2 {
    display: none !important;
  }

  html body.wpwp-app-body .wpwp-app-main {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* 3. External modules & headers must never inherit desktop margin-left or width */
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-module-workspace[data-wpwp-route-module="1"],
  html body.wpwp-app-body .wedding-planner-wrap.is-external-workspace-active > .wpwp-workspace-header.wpwp-router-module-header,
  html body.wpwp-app-body .wedding-planner-wrap > .wpwp-router-module-header {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* 4. All cards, module workspaces, and tab contents strictly contained */
  html body.wpwp-app-body .wp-wedding-planner-card,
  html body.wpwp-app-body .wpwp-module-workspace,
  html body.wpwp-app-body .tab-content,
  html body.wpwp-app-body .wpwp-workspace-card,
  html body.wpwp-app-body .wpwp-dashboard-module,
  html body.wpwp-app-body .wpwp25-card,
  html body.wpwp-app-body .wpwp-start-section,
  html body.wpwp-app-body .wpwp-start {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    padding: 16px 14px !important;
    margin: 10px 0 !important;
    border-radius: 16px !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* 5. Mobile workspace bar: stack elements cleanly without spilling off right */
  html body.wpwp-app-body .wpwp-workspace-bar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
  }
  html body.wpwp-app-body .wpwp-workspace-switcher {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
  }
  html body.wpwp-app-body .wpwp-workspace-switcher select,
  html body.wpwp-app-body .wedding-selector select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 15px !important;
    height: 44px !important;
    box-sizing: border-box !important;
  }
  html body.wpwp-app-body .wpwp-workspace-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  html body.wpwp-app-body .wpwp-workspace-actions > * {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
    text-align: center !important;
    justify-content: center !important;
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    font-size: 12px !important;
  }

  /* 6. Typography & Headings: prevent oversized headings from pushing layout */
  html body.wpwp-app-body h1 {
    font-size: clamp(20px, 6vw, 28px) !important;
    line-height: 1.2 !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }
  html body.wpwp-app-body h2 {
    font-size: clamp(18px, 5vw, 24px) !important;
    line-height: 1.25 !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }
  html body.wpwp-app-body h3 {
    font-size: clamp(16px, 4.5vw, 20px) !important;
    line-height: 1.3 !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }
  html body.wpwp-app-body .card-head,
  html body.wpwp-app-body .wpwp-page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  html body.wpwp-app-body .wpwp-dashboard-brand {
    padding: 16px 14px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  html body.wpwp-app-body .wpwp-dashboard-brand h1 {
    font-size: clamp(24px, 7vw, 32px) !important;
  }
  html body.wpwp-app-body .wp-wedding-planner-hero {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 16px 14px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  html body.wpwp-app-body .hero-countdown {
    width: 100% !important;
    min-width: 0 !important;
  }
  html body.wpwp-app-body .hero-countdown strong {
    font-size: 36px !important;
  }

  /* 7. Grids: convert desktop multi-column grids to 1 or 2 columns */
  html body.wpwp-app-body .wedding-details-form,
  html body.wpwp-app-body .wpwp-location-editor-grid,
  html body.wpwp-app-body .wpwp-contact-grid,
  html body.wpwp-app-body .wpwp-two,
  html body.wpwp-app-body .wpwp-grid-2,
  html body.wpwp-app-body .wpwp25-grid,
  html body.wpwp-app-body .wpwp-smart-grid,
  html body.wpwp-app-body .wpwp-os-grid,
  html body.wpwp-app-body .wpwp-os-people,
  html body.wpwp-app-body .wpwp-os-lower,
  html body.wpwp-app-body .wpwp-copilot-grid,
  html body.wpwp-app-body .wpwp-ai-grid,
  html body.wpwp-app-body .wpwp-wizard-grid,
  html body.wpwp-app-body .wpwp-template-layout,
  html body.wpwp-app-body .wpwp-logistics-detail-grid,
  html body.wpwp-app-body .wpwp-logistics-summary {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  html body.wpwp-app-body .wpwp-kpis,
  html body.wpwp-app-body .wp-wedding-planner-kpis,
  html body.wpwp-app-body .wpwp25-kpis,
  html body.wpwp-app-body .wpwp-command-strip,
  html body.wpwp-app-body .wpwp-os-metrics,
  html body.wpwp-app-body .wpwp-copilot-metrics,
  html body.wpwp-app-body .wpwp-operating-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    gap: 8px !important;
  }

  /* 8. Tables: never force whole page width, always scroll within wrapper */
  html body.wpwp-app-body .wpwp-table-wrap,
  html body.wpwp-app-body .wpwp-table-scroll,
  html body.wpwp-app-body .rsvp-guest-list,
  html body.wpwp-app-body .wpwp-finance-table-wrap,
  html body.wpwp-app-body .wpwp25-table-wrap,
  html body.wpwp-app-body .wpwp-day-items,
  html body.wpwp-app-body .wpwp-event-roles-table-wrap,
  html body.wpwp-app-body .wpwp-rsvp-master-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }

  /* 9. Floorplan canvas contained */
  html body.wpwp-app-body #tab-floorplan #wpwp-floorplan-workspace,
  html body.wpwp-app-body #tab-floorplan .wpwp-floor-viewport-wrap,
  html body.wpwp-app-body #tab-floorplan #wpwp-floor-viewport {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
  }

  /* 10. All form elements, media & images must shrink to container */
  html body.wpwp-app-body input,
  html body.wpwp-app-body select,
  html body.wpwp-app-body textarea,
  html body.wpwp-app-body button,
  html body.wpwp-app-body img,
  html body.wpwp-app-body svg {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

