/*
 * Global application-shell contract.
 * Loaded after route styles so pages cannot move or hide navigation.
 */

:root {
  --page-gutter-inline: 10px;
  --page-gutter-top: 10px;
  --page-gutter-bottom: 28px;
}

/*
 * Global page identity and command bar.
 * Page identity keeps the confirmed option 2 treatment; the command bar uses
 * the subsequently confirmed compact integrated option 1 on every route.
 */
body:not(.mr3-printing) .app-topbar {
  height: 68px !important;
  min-height: 68px !important;
  padding: 0 16px 0 24px !important;
  gap: 16px !important;
  background: rgba(255, 255, 255, .97) !important;
  border-bottom: 1px solid #e5eaf5 !important;
  box-shadow: 0 7px 24px rgba(42, 62, 120, .035) !important;
  backdrop-filter: blur(20px) saturate(1.15) !important;
}

body:not(.mr3-printing) .topbar-context {
  min-width: 300px !important;
  min-height: 100% !important;
  flex: 1 1 560px !important;
  align-self: stretch !important;
  align-items: stretch !important;
  gap: 10px !important;
}

body:not(.mr3-printing) .page-identity {
  min-width: 0;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

body:not(.mr3-printing) .page-identity::after {
  content: "";
  width: 40px;
  height: 3px;
  position: absolute;
  left: 0;
  bottom: 0;
  border-radius: 3px 3px 0 0;
  background: #3267f1;
}

body:not(.mr3-printing) .page-breadcrumb {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #75819a;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
}

body:not(.mr3-printing) .page-breadcrumb > svg {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: #3d70ee;
  stroke-width: 2;
}

body:not(.mr3-printing) .page-breadcrumb-separator {
  color: #c2c9d8;
  font-weight: 500;
}

body:not(.mr3-printing) #routeBreadcrumbLeaf {
  overflow: hidden;
  color: #657089;
  text-overflow: ellipsis;
}

body:not(.mr3-printing) .page-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

body:not(.mr3-printing) .topbar-context .page-title-row h1 {
  max-width: 100%;
  margin: 0 !important;
  overflow: hidden;
  color: #17213c !important;
  font-size: 21px !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
  letter-spacing: -.025em !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.mr3-printing) .page-title-help {
  width: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  color: #8ea0c1;
  cursor: help;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

body:not(.mr3-printing) .page-title-help:hover,
body:not(.mr3-printing) .page-title-help:focus-visible {
  color: #3267f1;
  background: #eef3ff;
}

body:not(.mr3-printing) .page-title-help svg {
  width: 16px;
  height: 16px;
}

body:not(.mr3-printing) .page-identity--embedded {
  min-width: 176px;
  align-self: stretch;
}

body:not(.mr3-printing) .page-identity--embedded .page-title-row h1 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: #17213c;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:not(.mr3-printing) .pcx-page-identity {
  min-width: 176px;
}

body:not(.mr3-printing) .topbar-tools {
  min-width: 0 !important;
  flex: 0 1 850px !important;
  justify-content: flex-end !important;
  gap: 8px !important;
}

body:not(.mr3-printing) .global-search {
  width: min(430px, 31vw) !important;
  min-width: 260px !important;
  height: 44px !important;
  padding: 0 12px !important;
  grid-template-columns: 18px minmax(0, 1fr) auto !important;
  gap: 9px !important;
  border: 1px solid #dfe4f3 !important;
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(54, 73, 126, .035) !important;
}

body:not(.mr3-printing) .global-search > svg {
  width: 18px !important;
  height: 18px !important;
  color: #68738a !important;
  stroke-width: 2 !important;
}

body:not(.mr3-printing) .global-search input {
  color: #222b42 !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

body:not(.mr3-printing) .global-search input::placeholder {
  color: #858da0 !important;
  opacity: 1 !important;
}

body:not(.mr3-printing) .global-search kbd {
  min-width: 38px !important;
  padding: 4px 6px !important;
  color: #817a99 !important;
  border: 1px solid #ddd9ef !important;
  border-radius: 7px !important;
  background: #f7f5ff !important;
  box-shadow: none !important;
  font-size: 10px !important;
  line-height: 1 !important;
  text-align: center !important;
}

body:not(.mr3-printing) .period-select {
  flex: 0 0 124px !important;
}

body:not(.mr3-printing) .period-select select {
  width: 124px !important;
  height: 44px !important;
  padding: 0 34px 0 16px !important;
  color: #222b42 !important;
  border: 1px solid #dfe4f3 !important;
  border-radius: 14px !important;
  background-color: #fff !important;
  box-shadow: 0 4px 14px rgba(54, 73, 126, .035) !important;
  font-size: 13px !important;
}

body:not(.mr3-printing) #seedDemoButton:not([hidden]) {
  min-width: 152px !important;
  min-height: 44px !important;
  padding: 0 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  color: #5945d8 !important;
  border: 1px solid #e7e3fb !important;
  border-radius: 14px !important;
  background: #f3f0ff !important;
  box-shadow: 0 4px 14px rgba(79, 62, 179, .045) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  transform: none !important;
}

body:not(.mr3-printing) #seedDemoButton:hover,
body:not(.mr3-printing) #seedDemoButton:focus-visible {
  color: #4731cb !important;
  border-color: #d8d0fa !important;
  background: #ece7ff !important;
}

body:not(.mr3-printing) #seedDemoButton svg {
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
  stroke-width: 2.2 !important;
}

body:not(.mr3-printing) #seedDemoButton[hidden] {
  display: none !important;
}

body:not(.mr3-printing) .notification-bell {
  width: 44px !important;
  height: 44px !important;
  margin-left: 10px !important;
  position: relative !important;
  flex: 0 0 44px !important;
  border: 1px solid #dfe4f3 !important;
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(54, 73, 126, .035) !important;
}

body:not(.mr3-printing) .notification-bell::before {
  content: none !important;
}

body:not(.mr3-printing) .notification-bell::after {
  content: "" !important;
  width: 1px !important;
  height: 32px !important;
  position: absolute !important;
  left: -11px !important;
  top: 5px !important;
  background: #dfe4f1 !important;
}

body:not(.mr3-printing) .notification-bell > svg {
  width: 19px !important;
  height: 19px !important;
  color: #5b4ee5 !important;
  stroke-width: 2 !important;
}

body:not(.mr3-printing) .notification-bell span {
  min-width: 19px !important;
  height: 19px !important;
  padding: 0 5px !important;
  transform: translate(14px, -15px) !important;
  border: 2px solid #fff !important;
  background: #e54870 !important;
  font-size: 8px !important;
  line-height: 1 !important;
}

body:not(.mr3-printing) .identity {
  min-width: 132px !important;
  padding-left: 2px !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
  border-left: 0 !important;
}

body:not(.mr3-printing) .identity .avatar {
  width: 42px !important;
  height: 42px !important;
  color: #5d48dc !important;
  border-radius: 50% !important;
  background: #f0edff !important;
  font-size: 10px !important;
}

body:not(.mr3-printing) .identity strong {
  color: #1d263b !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
}

body:not(.mr3-printing) .identity small {
  margin-top: 4px !important;
  font-size: 9px !important;
  line-height: 1 !important;
}

body:not(.mr3-printing) .identity small.online {
  color: #0db997 !important;
}

/* Meeting review now uses the same global header as every shared-shell page. */
body:not(.mr3-printing).meeting-review-route .app-topbar {
  display: flex !important;
}

body:not(.mr3-printing).meeting-review-route .global-search {
  display: grid !important;
}

body:not(.mr3-printing).meeting-review-route .period-select {
  display: block !important;
}

body:not(.mr3-printing).meeting-review-route #seedDemoButton:not([hidden]) {
  display: inline-flex !important;
}

body:not(.mr3-printing).meeting-review-route .notification-bell {
  display: grid !important;
}

body:not(.mr3-printing).meeting-review-route .identity {
  display: flex !important;
}

@media (max-width: 1360px) and (min-width: 941px) {
  body:not(.mr3-printing) .topbar-context {
    min-width: 260px !important;
    flex-basis: 360px !important;
  }

  body:not(.mr3-printing) .global-search {
    width: min(340px, 28vw) !important;
    min-width: 220px !important;
  }

  body:not(.mr3-printing) #seedDemoButton {
    min-width: 138px !important;
    padding-inline: 12px !important;
  }

  body:not(.mr3-printing) .identity {
    min-width: 118px !important;
  }
}

/*
 * Every business route shares one outer content boundary. Route styles own
 * their internal spacing, but may not reintroduce page-level whitespace.
 */
body:not(.mr3-printing) .app-content,
body:not(.mr3-printing):has(.view.active) .app-content,
body:not(.mr3-printing).task-confirmation-route .app-content,
body:not(.mr3-printing).meeting-review-route .app-content,
body:not(.mr3-printing):has(.progress-collection-view.active) .app-content {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: var(--page-gutter-top) var(--page-gutter-inline) var(--page-gutter-bottom) !important;
}

body:not(.mr3-printing) .view.active,
body:not(.mr3-printing):has(.view.active) .view.active {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Full-height desktop collection must fit inside the shared 10/10/28 shell. */
@media (min-width: 1121px) {
  body:not(.mr3-printing):has(.progress-collection-view.active) .progress-collection-view.active,
  body:not(.mr3-printing):has(.progress-collection-view.active) #progressCollectionApp,
  body:not(.mr3-printing):has(.progress-collection-view.active) .pcx-shell {
    height: calc(100vh - var(--page-gutter-top) - var(--page-gutter-bottom)) !important;
    min-height: 0 !important;
  }
}

@media (min-width: 941px) {
  :root,
  body,
  body.sidebar-collapsed,
  body.task-confirmation-route,
  body.task-confirmation-route.sidebar-collapsed,
  body:has(.view.active),
  body:has(#ai-studio.view.active),
  body:has(#ai-studio.view.active).sidebar-collapsed {
    --sidebar: 190px !important;
    --sidebar-expanded: 190px !important;
  }

  body:not(.mr3-printing) .app-sidebar,
  body:not(.mr3-printing).task-confirmation-route .app-sidebar,
  body:not(.mr3-printing):has(.view.active) .app-sidebar,
  body:not(.mr3-printing):has(.progress-collection-view.active) .app-sidebar {
    width: 190px !important;
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 40 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Every route inherits the same sidebar geometry and visual rhythm. */
  body:not(.mr3-printing) .app-sidebar .brand-lockup {
    height: 72px !important;
    min-height: 72px !important;
    padding: 0 10px !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    border-bottom: 1px solid #eef1f7 !important;
  }

  body:not(.mr3-printing) .app-sidebar .brand-mark {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
    border-radius: 12px !important;
  }

  body:not(.mr3-printing) .app-sidebar .brand-mark svg {
    width: 35px !important;
    height: 35px !important;
  }

  body:not(.mr3-printing) .app-sidebar .brand-title {
    color: #111b38 !important;
    font-size: 15px !important;
    letter-spacing: .03em !important;
  }

  body:not(.mr3-printing) .app-sidebar .brand-subtitle {
    margin-top: 1px !important;
    color: #7c8498 !important;
    font-size: 8px !important;
    font-weight: 650 !important;
  }

  body:not(.mr3-printing) .app-sidebar .workspace-switcher {
    padding: 8px !important;
    border-bottom: 1px solid #eef1f7 !important;
    background: #fbfcff !important;
  }

  body:not(.mr3-printing) .app-sidebar .workspace-switcher > span { display: none !important; }
  body:not(.mr3-printing) .app-sidebar .workspace-switcher button {
    width: 100% !important;
    height: 52px !important;
    margin: 0 !important;
    padding: 6px !important;
    grid-template-columns: 30px minmax(0, 1fr) 13px !important;
    place-items: initial !important;
    align-items: center !important;
    gap: 6px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: #f5f7ff !important;
    box-shadow: none !important;
  }

  body:not(.mr3-printing) .app-sidebar .workspace-icon {
    width: 30px !important;
    height: 30px !important;
    color: #3368ee !important;
    background: #e8edff !important;
  }

  body:not(.mr3-printing) .app-sidebar .primary-nav {
    padding: 7px 7px 5px !important;
  }

  body:not(.mr3-printing) .app-sidebar .nav-group-label {
    width: auto !important;
    height: 28px !important;
    margin: 0 !important;
    padding: 0 8px 0 26px !important;
    color: var(--nav-tone) !important;
    background: transparent !important;
    font-size: 11px !important;
  }

  body:not(.mr3-printing) .app-sidebar .nav-track .nav-item {
    width: 100% !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 6px 0 27px !important;
    grid-template-columns: 24px minmax(0, 1fr) !important;
    place-items: center stretch !important;
    justify-content: stretch !important;
    gap: 5px !important;
    color: #27314d !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body:not(.mr3-printing) .app-sidebar .nav-track .nav-item:hover,
  body:not(.mr3-printing) .app-sidebar .nav-track .nav-item.active {
    color: var(--nav-tone) !important;
    background: var(--nav-soft) !important;
  }

  body:not(.mr3-printing) .app-sidebar .nav-track .nav-icon,
  body:not(.mr3-printing) .app-sidebar .nav-track .nav-item.active .nav-icon {
    width: 24px !important;
    height: 24px !important;
    color: currentColor !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body:not(.mr3-printing) .app-sidebar .sidebar-footer {
    padding: 7px 7px 10px !important;
    border-top: 1px solid #edf0f6 !important;
    background: #fff !important;
  }

  body:not(.mr3-printing) .app-sidebar .nav-item.utility {
    width: 100% !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    grid-template-columns: 25px minmax(0, 1fr) !important;
    place-items: center stretch !important;
    justify-content: stretch !important;
    gap: 6px !important;
    border-radius: 9px !important;
  }

  body:not(.mr3-printing) .app-main,
  body:not(.mr3-printing).task-confirmation-route .app-main,
  body:not(.mr3-printing):has(.view.active) .app-main,
  body:not(.mr3-printing):has(#ai-studio.view.active) .app-main,
  body:not(.mr3-printing):has(.progress-collection-view.active) .app-main {
    width: auto !important;
    min-width: 0 !important;
    margin-left: 190px !important;
  }

  /* Desktop has one stable navigation state; route changes only move active. */
  body.sidebar-collapsed .app-sidebar { width: 190px !important; }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .workspace-copy,
  body.sidebar-collapsed .workspace-chevron,
  body.sidebar-collapsed .nav-label {
    width: auto !important;
    height: auto !important;
    position: static !important;
    display: block !important;
    overflow: hidden !important;
    clip: auto !important;
  }

  /* Progress collection used to opt out of the shared application shell. */
  body:has(.progress-collection-view.active) .app-content {
    width: 100% !important;
    max-width: none !important;
  }

  body:has(.progress-collection-view.active) .pcx-workspace {
    grid-template-columns: minmax(280px, 29%) minmax(0, 71%);
  }

  body:has(.progress-collection-view.active) .pcx-workspace.is-collection-open {
    grid-template-columns: minmax(280px, 29%) minmax(360px, 38%) minmax(330px, 33%);
  }
}

@media (min-width: 941px) and (max-height: 760px) {
  body:not(.mr3-printing) .app-sidebar .brand-lockup {
    height: 62px !important;
    min-height: 62px !important;
  }

  body:not(.mr3-printing) .app-sidebar .workspace-switcher { padding-block: 5px !important; }
  body:not(.mr3-printing) .app-sidebar .workspace-switcher button { height: 46px !important; }
  body:not(.mr3-printing) .app-sidebar .nav-group-label { height: 24px !important; }
  body:not(.mr3-printing) .app-sidebar .nav-track .nav-item { min-height: 34px !important; }
  body:not(.mr3-printing) .app-sidebar .nav-item.utility { min-height: 38px !important; }
}

@media (max-width: 940px) {
  :root,
  body,
  body.sidebar-collapsed,
  body:has(.view.active) {
    --sidebar: 260px !important;
    --sidebar-expanded: 260px !important;
  }

  body .app-main,
  body.task-confirmation-route .app-main,
  body:has(.view.active) .app-main,
  body:has(.progress-collection-view.active) .app-main {
    width: 100% !important;
    margin-left: 0 !important;
  }

  body:not(.sidebar-open) .app-sidebar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(-100%) !important;
  }

  body.sidebar-open .app-sidebar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
  }

  body:not(.mr3-printing) .app-topbar {
    padding-inline: 14px !important;
  }

  body:not(.mr3-printing) .topbar-context {
    min-width: 0 !important;
    flex-basis: auto !important;
    gap: 8px !important;
  }

  body:not(.mr3-printing) .page-identity {
    flex: 1 1 auto;
  }

  body:not(.mr3-printing) .page-breadcrumb {
    font-size: 10px;
  }

  body:not(.mr3-printing) .topbar-context .page-title-row h1 {
    font-size: 18px !important;
  }
}

@media (max-width: 680px) {
  body:not(.mr3-printing) .app-topbar {
    height: 68px !important;
    min-height: 68px !important;
  }

  body:not(.mr3-printing) #routeEyebrow,
  body:not(.mr3-printing) .page-breadcrumb-separator {
    display: none;
  }

  body:not(.mr3-printing) .page-identity::after {
    width: 32px;
  }

  body:not(.mr3-printing) .page-title-help {
    display: none;
  }

  body:not(.mr3-printing) #seedDemoButton {
    display: none !important;
  }
}
