/* Near-Native group context starts directly below the fixed top menu. */
body.spu-near-native .spu-group-context-header {
  --spu-group-context-sticky-top: calc(
    var(--spu-native-menu-offset, 0px) +
      var(--gwf2-near-context-rail-height, 0px)
  );
}

body.spu-near-native .spu-groups-page-shell {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

body.spu-near-native .page {
  padding-top: var(--spu-native-menu-offset, 0px) !important;
  margin-top: 0 !important;
}

/* The body already reserves the fixed topbar. Reserve only the shallow grip
   inside the scroll frame; expanded selectors stay in normal page flow. */
body.spu-near-native .page.gwf2-group-context-frame {
  padding-top: var(--gwf2-near-context-rail-height, 0px) !important;
  gap: 0 !important;
}

body.spu-near-native .spu-groups-page-shell.gwf2-group-context-frame {
  padding-top: var(--gwf2-near-context-rail-height, 0px) !important;
}

body.spu-near-native .spu-group-context-header {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* A textless pull tab is flush to the bottom edge of the native app header. */
body.spu-near-native .gwf2-near-context-stack {
  position: fixed;
  top: var(--spu-native-menu-offset, 0px);
  left: 0;
  z-index: 141;
  display: grid;
  width: 100%;
  height: var(--gwf2-near-context-rail-height, 19px);
  place-items: start center;
  overflow: visible;
  pointer-events: none;
}

body.spu-near-native .gwf2-near-context-stack[hidden],
body.spu-near-native .gwf2-near-context-flow[hidden],
body.spu-near-native .gwf2-near-context-options[hidden],
body.spu-near-native .gwf2-near-context-dock-panel[hidden] {
  display: none !important;
}

body.spu-near-native .gwf2-near-context-dock-handle {
  display: grid;
  width: 96px;
  min-width: 96px;
  height: 19px !important;
  min-height: 19px !important;
  max-height: 19px !important;
  box-sizing: border-box !important;
  place-items: center;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 0 9px 9px;
  color: #fff;
  background: var(--gwf2-near-context-header-color, #104a39);
  box-shadow: 0 2px 5px rgb(0 0 0 / 16%);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

body.spu-near-native .gwf2-near-context-dock-handle:active {
  cursor: grabbing;
}

body.spu-near-native .gwf2-near-context-dock-grip {
  display: block;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: rgb(255 255 255 / 78%);
}

body.spu-near-native .gwf2-near-context-dock-handle:focus-visible {
  outline: 2px solid var(--text, #17324d);
  outline-offset: 2px;
}

/* This selector sits before the group page header in normal document flow. */
body.spu-near-native .gwf2-near-context-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto 12px;
  padding: 0 clamp(8px, 1.8vw, 16px);
}

body.spu-near-native .gwf2-near-context-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--accent, #176d59) 26%, var(--border, #a9c4d2));
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface, #fff) 96%, var(--accent-soft, #dceff4));
}

body.spu-near-native .gwf2-near-context-option {
  flex: 0 1 auto;
  min-width: 110px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--accent, #176d59) 38%, var(--border, #a9c4d2));
  border-radius: 8px;
  color: var(--text, #17324d);
  background: var(--surface, #fff);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

body.spu-near-native .gwf2-near-context-option[hidden] {
  display: none !important;
}

body.spu-near-native .gwf2-near-context-option[aria-pressed='true'] {
  border-color: var(--accent, #176d59);
  color: var(--accent-contrast, #fff);
  background: var(--accent, #176d59);
}

body.spu-near-native .gwf2-near-context-dock-panel {
  position: static;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 10px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--accent, #176d59) 32%, var(--border, #a9c4d2));
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface, #fff) 98%, var(--accent-soft, #dceff4));
  box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
}

body.spu-near-native .gwf2-near-context-pane-inactive {
  display: none !important;
}

body.spu-near-native .gwf2-near-context-pane-active {
  max-width: 100%;
  max-height: none;
  margin: 0 !important;
}

body.spu-near-native .spu-group-context-tabs.gwf2-near-context-tabs-hidden {
  display: none !important;
}

/* The mode tabs are presented in the dock above. Remove their old wrapper as
   well, including its unrelated App & Support gear, so it cannot leave an
   empty overlapping strip in the page flow. Keep the header only when it has
   an opted-in status message to show. */
body.spu-near-native
  .spu-group-context-switcher.gwf2-near-context-switcher-docked,
body.spu-near-native .spu-group-context-header.gwf2-near-context-header-docked {
  display: none !important;
}

/* Keep the three group tabs, view controls and status line on their own,
   non-wrapping rows even when the organization's shared stylesheet is loaded
   dynamically after this file. */
body.spu-near-native .spu-group-context-switcher {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  min-width: 0;
  overflow: hidden;
}

body.spu-near-native .spu-group-context-tabs {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-wrap: nowrap !important;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

body.spu-near-native .spu-group-context-tabs > .spu-group-context-button {
  flex: 0 0 auto !important;
  white-space: nowrap;
}

body.spu-near-native .spu-group-view-controls {
  display: flex !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  min-width: 0 !important;
  white-space: nowrap;
}

body.spu-near-native .spu-group-view-controls > .spu-group-view-button {
  flex: 0 0 34px !important;
  width: 34px;
  min-width: 34px;
}

body.spu-near-native .spu-group-context-status-line {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

body.spu-near-native .spu-group-context-status-label {
  flex: 0 0 auto !important;
  white-space: nowrap;
}

body.spu-near-native .spu-group-context-status-text {
  display: block;
  flex: 1 1 auto !important;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

body.spu-near-native .spu-group-context-status-toggle {
  flex: 0 0 26px !important;
  margin-left: auto;
}

/* Near-Native workspace selection is a real table.  Keep the list itself as
   the scroll surface while the row action menu opens independently. */
body.spu-near-native :is(.spu-group-workspace-list, .teams-workspace-list) {
  touch-action: pan-x pan-y;
  display: block !important;
  max-height: min(62vh, 560px);
  overflow-x: auto;
  overflow-y: auto;
  padding: 2px 4px 4px 0;
  scrollbar-gutter: stable;
}

/* Use the freed phone viewport for the actual workspace chooser instead of
   spending it on outer card margins and padding. */
body.spu-near-native :is(.spu-group-workspace-browser, .teams-workspace-browser) {
  margin-top: 8px !important;
  margin-bottom: 8px !important;
  padding: 12px !important;
}

.gwf2-workspace-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  touch-action: pan-x pan-y;
}

.gwf2-workspace-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text, #24211c);
  background: var(--surface, #fff);
}

.gwf2-workspace-table th,
.gwf2-workspace-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(23, 109, 89, 0.14);
  text-align: left;
  vertical-align: top;
}

.gwf2-workspace-table tr.spu-group-workspace-item,
.gwf2-workspace-table tr.teams-workspace-item {
  display: table-row !important;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* Table rows form the stacking order for their action popover.  Without an
   elevated open row, a later row can paint its tool icon over the open menu. */
.gwf2-workspace-table tbody > tr {
  position: relative;
  z-index: 0;
}

.gwf2-workspace-table tbody > tr.gwf2-workspace-row-menu-open {
  z-index: 100;
}

.gwf2-workspace-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted, #64746c);
  background: var(--surface, #fff);
  font-size: 0.78rem;
  white-space: nowrap;
}

.gwf2-workspace-table tr.is-selected {
  background: color-mix(in srgb, var(--accent-soft, rgba(23, 109, 89, 0.12)) 65%, transparent);
}

.gwf2-workspace-table tr.is-archived {
  opacity: 0.78;
}

.gwf2-workspace-table-main {
  width: 100%;
  min-width: 0;
}

.gwf2-workspace-table-main > .spu-group-workspace-item-main,
.gwf2-workspace-table-main > .teams-workspace-item-main {
  display: block;
  min-width: 0;
}

.gwf2-workspace-table-main h2 {
  margin: 8px 0 6px;
  overflow-wrap: anywhere;
}

.gwf2-workspace-table-actions {
  position: relative;
  width: 48px;
  min-width: 48px;
  text-align: right;
}

.gwf2-workspace-actions-menu {
  position: relative;
  display: inline-block;
  z-index: 5;
}

.gwf2-workspace-actions-menu[open] {
  z-index: 110;
}

.gwf2-workspace-actions-menu > summary {
  display: grid;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  border: 1px solid rgba(23, 109, 89, 0.25);
  border-radius: 10px;
  color: var(--accent-strong, #176d59);
  background: var(--surface, #fff);
  cursor: pointer;
  font-size: 1.2rem;
  list-style: none;
}

.gwf2-workspace-actions-menu > summary::-webkit-details-marker {
  display: none;
}

.gwf2-workspace-actions-menu > summary:focus-visible {
  outline: 2px solid var(--accent-strong, #176d59);
  outline-offset: 2px;
}

.gwf2-workspace-actions-menu[open] > summary {
  background: var(--accent-soft, rgba(23, 109, 89, 0.12));
}

.gwf2-workspace-actions-menu > :is(.spu-group-workspace-item-actions, .teams-workspace-item-actions) {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: min(220px, calc(100vw - 42px));
  max-height: min(52vh, 300px);
  margin: 0;
  padding: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(23, 109, 89, 0.24);
  border-radius: 12px;
  background: var(--surface, #fff);
  box-shadow: 0 12px 28px rgba(20, 45, 37, 0.2);
}

.gwf2-workspace-actions-menu :is(.spu-group-workspace-lifecycle-actions, .teams-workspace-lifecycle-actions) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: auto;
}

.gwf2-workspace-actions-menu :is(button, a) {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  white-space: nowrap;
}

html[data-theme-mode='dark'] .gwf2-workspace-table,
html[data-theme-mode='dark'] .gwf2-workspace-table th,
html[data-theme-mode='dark'] .gwf2-workspace-actions-menu > :is(.spu-group-workspace-item-actions, .teams-workspace-item-actions),
html[data-theme-mode='dark'] .gwf2-workspace-actions-menu > summary {
  color: var(--text, #d9eee2);
  background: var(--surface, #14281f);
}
/* Teams NLR group switcher:use the GUI-Studio tokens for the context tabs
   and status strip instead of the legacy indigo/green palette. */
body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-context-header {
  color: var(--teams-nlr-text, #163047);
  background: color-mix(in srgb, var(--teams-nlr-surface, #fff) 94%, transparent);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-context-switcher {
  border-color: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 24%, var(--teams-nlr-border, #b9cfe0));
  background: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 7%, var(--teams-nlr-surface, #fff));
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-context-button,
body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-view-button {
  color: var(--teams-nlr-accent, #176d8c);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-context-button.is-active,
body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-view-button.is-active {
  border-color: var(--teams-nlr-accent, #176d8c);
  color: var(--teams-nlr-text, #163047);
  background: var(--teams-nlr-surface, #fff);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--teams-nlr-text, #163047) 16%, transparent);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-view-controls {
  border-left-color: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 24%, var(--teams-nlr-border, #b9cfe0));
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-context-status {
  color: var(--teams-nlr-accent, #176d8c);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .spu-group-context-status-toggle {
  border-color: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 24%, var(--teams-nlr-border, #b9cfe0));
  color: var(--teams-nlr-accent, #176d8c);
  background: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 7%, var(--teams-nlr-surface, #fff));
}




body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .gwf2-near-context-dock-handle {
  background: var(--teams-nlr-accent, #176d8c);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .gwf2-near-context-options {
  border-color: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 28%, var(--teams-nlr-border, #b9cfe0));
  background: color-mix(in srgb, var(--teams-nlr-surface, #fff) 96%, var(--teams-nlr-accent, #176d8c) 4%);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .gwf2-near-context-option {
  border-color: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 40%, var(--teams-nlr-border, #b9cfe0));
  color: var(--teams-nlr-text, #163047);
  background: var(--teams-nlr-surface, #fff);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .gwf2-near-context-option[aria-pressed='true'] {
  border-color: var(--teams-nlr-accent, #176d8c);
  color: #fff;
  background: var(--teams-nlr-accent, #176d8c);
}

body:is([data-spu-teams-app='true'], [data-spu-group-workspaces-app='true']) .gwf2-near-context-dock-panel {
  border-color: color-mix(in srgb, var(--teams-nlr-accent, #176d8c) 34%, var(--teams-nlr-border, #b9cfe0));
  background: color-mix(in srgb, var(--teams-nlr-surface, #fff) 98%, var(--teams-nlr-accent, #176d8c) 2%);
}
