/* Site OS page-root widths only. Match semantic roots through display:contents
   wrappers without changing wrapper layout, workspace gutters, grids or prose. */
[data-site-workspace-surface] main.operator-workspace .site-app-store[data-site-apps-root],
[data-site-workspace-surface] main.operator-workspace .site-app-detail[data-site-app-detail],
[data-site-workspace-surface] main.operator-workspace .site-settings-page[data-site-settings],
[data-site-workspace-surface] main.operator-workspace .billing-workspace--site[data-site-billing] {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin-inline: 0;
}

/* Site OS internal navigation only. Load after the existing workspace styles.
   Preserve mobile chooser breakpoints; no content width or page-layout changes. */
[data-site-workspace-surface] main .site-access-workspace .sa-rail,
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation {
  box-shadow: none;
}

/* One flat rail for the two existing desktop navigation structures. */
@media (min-width: 900px) {
  [data-site-workspace-surface] main .site-access-workspace .sa-rail,
  [data-site-workspace-surface] main [data-site-settings] .site-settings-navigation {
    padding: 4px 8px;
    border: 0;
    border-inline-end: 1px solid var(--siteos-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
}

[data-site-workspace-surface] main .site-access-workspace .sa-rail {
  gap: 12px;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail nav,
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-list {
  gap: 2px;
}

/* These selectors outrank the global theme's rounded tabs and the two 72px
   Settings rules. The default stays touch-sized; fine-pointer desktop is below. */
[data-site-workspace-surface] main .site-access-workspace .sa-rail :is(.sa-nav-main, .sa-nav-children > button, .sa-rail-secondary > button),
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  gap: 8px;
  width: 100%;
  height: auto;
  min-height: 44px;
  padding: 8px 9px;
  border: 0;
  border-inline-start: 2px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--siteos-muted);
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: normal;
  text-align: start;
  white-space: normal;
  transition: color 120ms ease, background-color 120ms ease;
  touch-action: manipulation;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-nav-main > svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-nav-main > span:first-of-type {
  min-width: 0;
  flex: 1;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-nav-count {
  min-width: 20px;
  min-height: 20px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 18px;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-nav-children {
  gap: 2px;
  margin: 2px 0 6px 19px;
  padding-inline-start: 9px;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-nav-children > button {
  font-size: 12px;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-rail-secondary {
  gap: 2px;
  padding-block-start: 8px;
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-rail-secondary > button > svg {
  margin-inline-start: auto;
}

/* Settings keeps its secondary descriptions in the accessible name, without
   forcing two-line cards. Its icon and label now match the app workspace rail. */
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item strong {
  font-size: 13px;
  font-weight: inherit;
  line-height: 18px;
}
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item small {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 0;
  background: transparent;
  color: inherit;
}
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-arrow {
  display: none;
}

[data-site-workspace-surface] main .site-access-workspace .sa-rail :is(.sa-nav-main, .sa-nav-children > button, .sa-rail-secondary > button):is(.is-active, [aria-current="page"]),
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item[data-state="active"] {
  border-color: transparent;
  border-inline-start-color: var(--siteos-accent);
  background: color-mix(in srgb, var(--siteos-accent-soft) 55%, transparent);
  color: var(--siteos-ink);
  box-shadow: none;
  font-weight: 650;
}
@media (hover: hover) {
  [data-site-workspace-surface] main .site-access-workspace .sa-rail :is(.sa-nav-main, .sa-nav-children > button, .sa-rail-secondary > button):hover:not(:disabled),
  [data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item:hover:not(:disabled) {
    background: color-mix(in srgb, var(--siteos-accent-soft) 40%, transparent);
    color: var(--siteos-ink);
    box-shadow: none;
  }
}
[data-site-workspace-surface] main .site-access-workspace .sa-rail :is(.sa-nav-main, .sa-nav-children > button, .sa-rail-secondary > button):focus-visible,
[data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item:focus-visible {
  outline: 2px solid var(--siteos-accent);
  outline-offset: 2px;
}

@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  [data-site-workspace-surface] main .site-access-workspace .sa-rail :is(.sa-nav-main, .sa-nav-children > button, .sa-rail-secondary > button),
  [data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item {
    min-height: 38px;
    padding-block: 7px;
  }
  [data-site-workspace-surface] main .site-access-workspace .sa-rail .sa-nav-children > button {
    min-height: 36px;
    padding-block: 6px;
  }
}
/* Hybrid devices retain touch-sized targets even with a fine primary pointer. */
@media (any-pointer: coarse) {
  [data-site-workspace-surface] main .site-access-workspace .sa-rail :is(.sa-nav-main, .sa-nav-children > button, .sa-rail-secondary > button),
  [data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item {
    min-height: 44px;
    padding-block: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-site-workspace-surface] main .site-access-workspace .sa-rail button,
  [data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item {
    transition: none;
  }
}
@media (forced-colors: active) {
  [data-site-workspace-surface] main .site-access-workspace .sa-rail :is(.sa-nav-main, .sa-nav-children > button, .sa-rail-secondary > button):is(.is-active, [aria-current="page"]),
  [data-site-workspace-surface] main [data-site-settings] .site-settings-navigation .site-settings-nav-item[data-state="active"] {
    border-inline-start-color: Highlight;
    color: ButtonText;
    background: Canvas;
  }
}
