/* ==========================================================================
   Application shell - sidebar, top bar, content canvas
   ==========================================================================

   PLATFORM VISUAL TRANSFORMATION, BUILD 1. This file was rewritten, not
   restyled. The previous shell was a two-column grid with a dark Frazil-blue
   sidebar carrying light text and the account control at its foot, and no
   desktop top bar at all. None of that survives.

   THE AUTHORITY IS THE APPROVED EXECUTIVE SUMMARY RENDERING. It shows:

     - a LIGHT sidebar, pale blue, with dark-blue labels
     - the brand artwork occupying the lower portion of that sidebar
     - a persistent top bar across the work area, not across the logo
     - an atmospheric pale-icy-blue canvas, not a flat grey page
     - deep Frazil blue reserved for the active destination and primary action

   The sidebar inversion is the single largest change here and is the reason
   the application is recognisable as a different product before the page
   title is read.

   CONTRAST IS MEASURED AGAINST THE SCRIM, NOT THE PHOTOGRAPH. The navigation
   block sits on an opaque surface token; the artwork never contributes to the
   contrast of a label, at any scroll position, over any part of the image.
   That is what `--sidebar-surface` is for, and it is why these ratios hold
   rather than merely looking acceptable in a screenshot.

   NO LITERAL COLOUR APPEARS IN THIS FILE and no rule uses !important. Both
   are enforced by tests/test_design_tokens.py.
   ========================================================================== */

/* ---------------------------------------------------------------- layout

   Two columns, two rows. The sidebar spans both rows so the logo sits
   beside the top bar rather than under it - which is what the rendering
   shows, and what keeps the brand mark at the true top-left corner of the
   product. */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  /* Three rows: the top bar, the workspace bar, and the work area.

     The middle row is `auto`, so on Home - which has no pages of its own -
     the bar is not rendered and the row collapses to nothing rather than
     leaving a gap where navigation would have been. */
  grid-template-rows: var(--topbar-height) auto minmax(0, 1fr);
  grid-template-areas:
    "sidebar topbar"
    "sidebar workspace"
    "sidebar content";
  min-height: 100vh;
  background: var(--canvas-bg);
  background-image: linear-gradient(
    180deg,
    var(--canvas-bg-top) 0%,
    var(--canvas-bg) 45%,
    var(--canvas-bg-bottom) 100%
  );
  background-attachment: fixed;
}

/* ================================================================ SIDEBAR */

.sidebar {
  grid-area: sidebar;
  /* STICKY, FULL VIEWPORT HEIGHT - the "fixed or stable desktop sidebar"
     the build requires, and a correctness fix rather than a preference.

     As an ordinary grid item the sidebar stretches to the height of the
     DOCUMENT, not the viewport. On a long report that made the artwork
     band - which is a percentage of its height, anchored to its bottom -
     resolve hundreds of pixels below the fold, so the brand photograph
     was never on screen and the navigation scrolled away with the page.

     `align-self: start` stops the stretch; `top: 0` and `height: 100vh`
     pin it. The nav region inside it is the part that scrolls. */
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sidebar-surface);
  border-right: 1px solid var(--sidebar-border);
  overflow: hidden;
}

/* ---- the strawberry-and-water artwork --------------------------------

   THE APPROVED ASSET, UNMODIFIED. `Water and Strawberry.png` is 627x2508 -
   exactly 1:4 - which is a vertical strip authored for this placement. At a
   264px sidebar the native proportion is reproduced almost exactly, so
   `cover` crops a few pixels rather than distorting anything.

   It occupies the LOWER portion only (--sidebar-art-height), anchored to the
   bottom, which is where the rendering puts it and which keeps the strongest
   detail - the strawberry itself - clear of the navigation labels above.

   `background-attachment` is deliberately NOT fixed: the artwork belongs to
   the sidebar, and a viewport-fixed image would slide against it as the
   navigation scrolls.

   It is decorative and conveys nothing, so it is a CSS background on an
   aria-hidden element rather than an <img> that a screen reader must skip. */

.sidebar-art {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: var(--sidebar-art-height);
  background-image: url("../img/brand/Water and Strawberry.png");
  background-size: cover;
  /* NOT `center bottom`, which is what this started as and what the crop
     geometry quietly defeats. The asset is 627x2508; scaled to a 264px
     sidebar it becomes 264x1056, and the strawberry occupies y 359-549 of
     that. A bottom-anchored region 46% of the viewport tall shows y
     573-1056 - water, and no fruit at all. "Maintain the strawberry and
     water as recognizable branding" is a locked requirement, so the
     position is chosen to satisfy it rather than to sound tidy.

     41% centres the fruit in the band, fully in frame, with water above
     and below it. The band now sits entirely below the navigation and
     carries no text at all, so the photograph needs no scrim over it and
     renders at full saturation.

     The direction is counter-intuitive and cost two attempts: a HIGHER
     percentage scrolls the visible window DOWN the image, which moves the
     fruit UP in the frame. The screenshot caught that; the arithmetic on
     its own did not. */
  background-position: center 41%;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
}

/* The three content blocks ride above the photograph. Without this they
   would share its layer and the image would cover the navigation - which
   `z-index: -1` on the art does not fix, because a negative layer inside
   an isolated stacking context paints behind the sidebar's own background
   and the artwork disappears entirely. */
.sidebar-head,
.sidebar-body {
  position: relative;
  z-index: 1;
}

/* The controlled light-blue overlay the spec requires.

   It is now a SEAM TREATMENT rather than a readability device. The band
   below carries no navigation and no text, so nothing on it needs
   protecting; what it does need is to not begin with a hard horizontal
   edge where the photograph meets the flat sidebar tint. The scrim is
   opaque at the very top and clear by 22% of the band.

   Readability of the navigation is handled structurally instead - the
   nav block sits entirely above this band, on an opaque surface token -
   which is a stronger guarantee than a gradient, because it holds at
   every viewport height and every scroll position. */
.sidebar-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    var(--sidebar-surface) 0%,
    transparent var(--sidebar-art-fade),
    transparent 100%
  );
}

/* ---- logo -------------------------------------------------------------

   The approved master has NO internal clear space - its content touches all
   four edges - so `.brand-logo` supplies padding equal to 25% of the
   rendered height on every side. `height` drives the size and `width: auto`
   follows, which makes distortion structurally impossible.

   It now sits on --sidebar-surface, a pale blue. The mark's own elements are
   #0B479D, white and #88BBD9. The white is the risk on a light ground, so
   the logo block gets its own near-white plate rather than sitting directly
   on the tint - which also separates the brand mark from the navigation, as
   the rendering does. It is still never placed on --brand-light (#97C9E9),
   where its light-blue element would be 1.17:1 and vanish. */

.sidebar-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--topbar-height);
  padding: var(--space-3) var(--space-5);
  background: var(--sidebar-surface-strong);
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar .brand-logo {
  --brand-logo-height: 34px;
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  padding: calc(var(--brand-logo-height) * var(--logo-clear-space-ratio));
}

.brand-logo img {
  height: var(--brand-logo-height);
  width: auto;
  display: block;
}

.mobile-topbar .brand-logo {
  --brand-logo-height: 26px;
  margin-bottom: 0;
  padding: calc(var(--brand-logo-height) * var(--logo-clear-space-ratio)) 0;
}

.auth-card .brand-logo {
  --brand-logo-height: 54px;
  margin: 0 auto var(--space-6);
}

/* ---- the scrollable navigation region --------------------------------

   The navigation scrolls; the logo and the primary action do not. On a
   short viewport with every folder open this is what keeps the brand mark
   visible and stops the artwork being pushed out of the sidebar entirely. */

.sidebar-body {
  /* `0 1 auto`, NOT `1 1 auto`. The nav block takes only the height its
     content needs and the artwork fills whatever is left below it.

     BUILD 3 FIXED A REAL CONTRAST DEFECT HERE. While this stretched to
     fill the sidebar it was transparent, so a long navigation - Payroll or
     Benefits expanded, which is the common case - put labels directly over
     the photograph. Measured against the asset's visible band, 17.9% of
     those pixels fall below 4.5:1 for --sidebar-text, worst case 1.00:1 on
     the strawberry's own shadow, where a label is simply invisible.

     An opaque scrim under the whole nav block is the fix. Build 1's locked
     requirements already asked for it in words - "navigation on readable
     translucent or opaque-enough surfaces", "keep navigation readable at
     all scroll positions" - and the build's own rule is that contrast
     takes priority over visual effect. When the navigation is short the
     artwork shows below it exactly as before; when it is long the
     photograph gives way, which is the correct trade. */
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-5) var(--space-4) var(--space-8);
  background: var(--sidebar-surface);
}

.sidebar-cta {
  display: block;
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--brand-primary);
  color: var(--text-inverse);
  font-size: var(--type-body-sm-size);
  font-weight: var(--font-weight-label);
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow-control);
  transition: background var(--motion-fast) var(--motion-ease);
}

.sidebar-cta:hover {
  background: var(--brand-primary-hover);
  color: var(--text-inverse);
}

/* ---- navigation -------------------------------------------------------

   Every row is one grid: a fixed icon column and a label column. One rule
   for links, sub-links and folder toggles, so an icon can never knock a
   label out of alignment with the row above it. */

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item,
.nav-subitem,
.nav-folder-toggle {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-3) var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: var(--type-body-sm-size);
  font-weight: var(--font-weight-label);
  line-height: var(--type-body-sm-line);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) var(--motion-ease);
}

.nav-label {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-icon {
  grid-column: 1;
  width: 20px;
  height: 20px;
  color: var(--sidebar-icon);
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover,
.nav-subitem:hover,
.nav-folder-toggle:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}

/* The active destination: deep Frazil blue, per the locked requirement and
   the rendering. The bright-blue rail on the leading edge is a SECOND
   signal, so "which page am I on" is never carried by colour alone - it is
   also announced by aria-current, which the template sets. */
.nav-item.active,
.nav-subitem.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  box-shadow: inset 3px 0 0 0 var(--sidebar-active-marker);
}

.nav-item.active .nav-icon,
.nav-subitem.active .nav-icon {
  color: var(--sidebar-icon-active);
}

.nav-item.active:hover,
.nav-subitem.active:hover {
  background: var(--brand-primary-hover);
  color: var(--sidebar-active-text);
}

/* A folder whose current page is inside it: marked, but never mistaken for
   the destination itself. Weight and colour only - no fill, which stays
   reserved for the one active row. */
.nav-folder.active > .nav-folder-toggle {
  color: var(--brand-primary);
  font-weight: var(--font-weight-subhead);
}

.nav-folder.active > .nav-folder-toggle .nav-icon {
  color: var(--brand-primary);
}

/* ---- folders ----------------------------------------------------------

   The caret is the third grid column and rotates to face down when open.
   It is driven by aria-expanded rather than a class, so the painted state
   and the announced state cannot disagree - there is only one source. */

.nav-folder-caret {
  grid-column: 3;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  transition: transform var(--motion-fast) var(--motion-ease);
}

.nav-folder-toggle[aria-expanded="true"] .nav-folder-caret {
  transform: rotate(90deg);
}

.nav-folder-items {
  list-style: none;
  margin: var(--space-1) 0 var(--space-2);
  padding: 0 0 0 var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  /* The rail that makes a nested group read as one run rather than as
     loose links that happen to be indented. */
  border-left: 1px solid var(--sidebar-border);
  margin-left: var(--space-4);
}

.nav-subitem {
  grid-template-columns: 16px minmax(0, 1fr) auto;
  min-height: var(--control-height-sm);
  font-weight: var(--font-weight-body);
}

.nav-subitem .nav-icon {
  width: 16px;
  height: 16px;
}

.nav-folder-nested > .nav-folder-toggle {
  font-size: var(--type-body-sm-size);
  font-weight: var(--font-weight-label);
}

/* A destination the product intends to build but has not. Labelled rather
   than hidden, so the state is known before the click rather than after. */
.nav-status {
  grid-column: 3;
  justify-self: end;
  font-size: var(--type-caption-size);
  font-weight: var(--font-weight-body);
  color: var(--sidebar-text-muted);
}

.nav-coming-soon {
  color: var(--sidebar-text-muted);
}

/* ================================================================ TOP BAR

   New in Build 1. The previous shell had none; the account control lived at
   the foot of the sidebar.

   WHAT IS DELIBERATELY NOT HERE. The reference renderings show a global
   search field and a notification bell carrying a count. This application
   has neither a search route nor a notification system, and the build
   forbids creating a visual approximation of a control that does not work.
   Both are omitted rather than faked. */

.topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--space-7);
  background: var(--topbar-surface);
  border-bottom: 1px solid var(--topbar-border);
  backdrop-filter: blur(var(--topbar-blur));
}

/* Readability must not depend on a filter the browser may decline to
   apply. Where backdrop-filter is unsupported the surface becomes opaque. */
@supports not (backdrop-filter: blur(1px)) {
  .topbar {
    background: var(--topbar-surface-opaque);
  }
}

.topbar-context {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  margin-right: auto;
}

/* The section the current page belongs to, taken from the SAME navigation
   tree the sidebar renders. Not a breadcrumb widget and not a new concept -
   it is the folder that is already marked active, named. */
.topbar-section {
  font-size: var(--type-metric-label-size);
  font-weight: var(--font-weight-label);
  letter-spacing: var(--type-metric-label-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
}

.topbar-page {
  font-size: var(--type-subhead-size);
  font-weight: var(--font-weight-subhead);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 0 0 auto;
}

/* ---- account menu -----------------------------------------------------

   The SAME <details> element the old sidebar carried, moved into the top
   bar and restyled. Its behaviour is unchanged: native disclosure, no
   JavaScript required to open it, the same two actions inside.

   `position: relative` on the element and `absolute` on the body is what
   makes it a menu rather than a block that pushes the bar taller. */

.profile-menu {
  position: relative;
}

.profile-menu-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
  list-style: none;
  transition: background var(--motion-fast) var(--motion-ease);
}

.profile-menu-summary::-webkit-details-marker {
  display: none;
}

.profile-menu-summary:hover {
  background: var(--brand-primary-subtle);
}

/* The initials disc. Derived from the signed-in user's own name - it is
   not an avatar feature and no image is fetched. */
.profile-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--brand-primary);
  color: var(--text-inverse);
  font-size: var(--type-caption-size);
  font-weight: var(--font-weight-subhead);
  letter-spacing: 0.02em;
}

.profile-menu-identity {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  text-align: left;
}

.profile-menu-name {
  font-size: var(--type-body-sm-size);
  font-weight: var(--font-weight-label);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.profile-menu-roles {
  font-size: var(--type-caption-size);
  font-weight: var(--font-weight-body);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.profile-menu-caret {
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  transition: transform var(--motion-fast) var(--motion-ease);
}

.profile-menu[open] .profile-menu-caret {
  transform: rotate(180deg);
}

/* A menu is a data-heavy surface by the spec's own split, so it is opaque
   white rather than frosted. */
.profile-menu-body {
  position: absolute;
  top: calc(100% + var(--space-3));
  right: 0;
  z-index: var(--z-raised);
  min-width: 15rem;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-menu);
}

.profile-menu-email {
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--type-caption-size);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.profile-menu-logout {
  display: block;
  width: 100%;
  padding: var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--type-body-sm-size);
  font-weight: var(--font-weight-label);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-fast) var(--motion-ease);
}

.profile-menu-logout:hover {
  background: var(--brand-primary-subtle);
  color: var(--brand-primary);
}

/* ========================================================= CONTENT CANVAS

   The work surface. Branding is subordinate here: no artwork, no tint, no
   photography behind tables, forms, modals or employee data. The canvas
   gradient is on .app-shell and everything on it is opaque or near-opaque. */

.content {
  grid-area: content;
  min-width: 0;
  padding: var(--space-8) var(--space-page-gutter) var(--space-10);
}

/* A bounded work canvas rather than a full-bleed one. Beyond about 1600px
   a table row becomes a tracking exercise, and the gutters keep the
   measure readable on an ultrawide display. */
.content > * {
  max-width: var(--canvas-max-width);
  margin-inline: auto;
}

/* Focus is moved here by the skip link, which is a programmatic target
   rather than a control - so it takes no visible ring of its own. */
.content:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--brand-primary);
  color: var(--text-inverse);
  font-weight: var(--font-weight-label);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--motion-fast) var(--motion-ease);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--text-inverse);
}

/* ============================================================= RESPONSIVE

   Three states:

     >= 1100px  sidebar and top bar as above
     <  1100px  sidebar becomes an off-canvas drawer; the top bar gains the
                toggle that opens it
     <  640px   the drawer narrows and the artwork is dropped

   The drawer is the SAME element with the same markup and the same
   behaviour - `nav.js` toggles one class and one aria-expanded. Nothing
   here is a second navigation implementation. */

.mobile-topbar {
  display: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  height: var(--control-height);
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-default);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  background: var(--brand-primary);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: var(--overlay);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar-height) auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "workspace"
      "content";
  }

  .nav-toggle {
    display: flex;
  }

  /* Off-canvas, not hidden: it keeps its own scroll, its focus order and
     its ARIA, and slides in as one piece. */
  .sidebar {
    position: fixed;
    height: auto;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: var(--z-sidebar);
    width: min(var(--sidebar-width), 86vw);
    transform: translateX(-100%);
    transition: transform var(--motion-base) var(--motion-ease);
    box-shadow: var(--shadow-elevated);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .topbar {
    padding-inline: var(--space-5);
  }

  .content {
    padding: var(--space-7) var(--space-page-gutter-sm) var(--space-9);
  }
}

@media (max-width: 640px) {
  /* "Reduce or omit most decorative artwork" - an unintelligible crop is
     worse than none, and at this width the strip would show water and no
     strawberry. */
  .sidebar-art {
    display: none;
  }

  .sidebar {
    background: var(--sidebar-surface-strong);
  }

  /* The section eyebrow is the first thing to go when the bar is tight;
     the page name is what tells somebody where they are. */
  .topbar-section {
    display: none;
  }

  .profile-menu-identity {
    display: none;
  }

  .topbar {
    gap: var(--space-3);
    padding-inline: var(--space-4);
  }

  .content {
    padding: var(--space-6) var(--space-4) var(--space-8);
  }
}

/* Browser zoom at 200% presents as a narrow viewport in CSS pixels, so the
   drawer behaviour above already covers it. What it does NOT cover is a
   short viewport: at 200% on a laptop the sidebar is ~380 CSS px tall, and
   without this the navigation would be unreachable below the fold. */
@media (max-height: 560px) {
  .sidebar-art {
    display: none;
  }
}

/* ========================================================= REDUCED MOTION

   The duration tokens are already neutralised at source in tokens.css, so
   every transition above collapses. The drawer transform is the one thing
   that must also not animate, because it moves a large region. */

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}


/* ========================================================= WORKSPACE BAR

   THE PRIMARY PAGE NAVIGATION. The sidebar selects a workspace; this
   selects a page within it.

   It uses the approved `.tab-bar` from Build 1 rather than a new control -
   the transformation changes the information architecture, not the visual
   system - and adds only what a bar pinned under the top bar needs: a
   surface, a sticky position, and horizontal overflow.

   STICKY, SO IT SURVIVES A LONG PAGE. A page navigation that scrolls away
   is a page navigation people stop using. It sits directly below the top
   bar, which is itself sticky, so the two never overlap. */

.workspace-bar {
  grid-area: workspace;
  position: sticky;
  top: var(--topbar-height);
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-page-gutter);
  background: var(--topbar-surface);
  border-bottom: 1px solid var(--topbar-border);
  backdrop-filter: blur(var(--topbar-blur));
}

@supports not (backdrop-filter: blur(1px)) {
  .workspace-bar {
    background: var(--topbar-surface-opaque);
  }
}

/* Inside the bar the tab strip carries no surface of its own - the bar is
   the surface. Without this the frosted strip would sit on the frosted bar
   and read as a box inside a box. */
.workspace-bar .tab-bar {
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  backdrop-filter: none;
  /* HORIZONTAL OVERFLOW, NEVER WRAPPING. HR carries eleven entries; wrapped
     onto two rows they would push the page down and the row somebody wants
     would move as the viewport changed. Scrolling keeps every page
     reachable and the bar one row tall - and no page is hidden behind an
     overflow menu, which is the other way this is usually solved and the
     one that loses things. */
  overflow-x: auto;
  scrollbar-width: thin;
}

/* The second row, for a nested area. Quieter than the row above it, so the
   hierarchy reads at a glance: workspace, then area, then page. */
.tab-bar--sub {
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-default);
}

.tab-bar--sub a {
  min-height: var(--control-height-sm);
  font-size: var(--type-body-sm-size);
  font-weight: var(--font-weight-body);
}

.tab-bar--sub [aria-current="page"] {
  font-weight: var(--font-weight-label);
}

@media (max-width: 1100px) {
  .workspace-bar {
    padding-inline: var(--space-page-gutter-sm);
  }
}

@media (max-width: 640px) {
  .workspace-bar {
    padding-inline: var(--space-4);
  }
}
