/* Your menu → Layout (workbench 12/22; mock 15 navA and navB). The shell names the layout
   (data-menu-layout, from UserSettings menu.layout) and this file lays the same rail
   out for it, so the jobs, More, Spaces, Search, Alerts, Settings and You stay one
   partial. Rails is kk_rail.css as it is. Born tokens-only (shell_css_literal_ratchet).

   B · Two tiers, desktop: the rail becomes the top tier (your pinned jobs as tabs,
   More, the utilities as icons) and each page's own bar is the second tier (its
   sections and action). Phones keep the bottom tab bar (founder default, 12/22 Q2).

   A · One quiet bar, desktop (12/22 item 9): one bar. The rail keeps only the logo,
   the Space pill, the job switcher and the utilities; the page's own bar is the
   bar's middle. The information rail waits behind the bar's ⓘ. */

@media (min-width: 900px) {
  .kk-shell[data-menu-layout="two_tiers"] { --kk-tier-h: var(--kk-topbar-h); }

  /* Tier one: the rail, laid across the top. */
  .kk-shell[data-menu-layout="two_tiers"] .kk-rail {
    inset: 0 0 auto 0; width: auto; height: var(--kk-tier-h);
    flex-direction: row; align-items: center; gap: var(--kk-s-1); padding: 0 var(--kk-s-4);
    border-right: 0; border-bottom: 1px solid var(--kk-line);
    overflow-x: auto; overflow-y: hidden;
  }
  .kk-shell[data-menu-layout="two_tiers"] .kk-rail-logo { margin: 0 var(--kk-s-2) 0 0; }
  .kk-shell[data-menu-layout="two_tiers"] .kk-rsep { width: 1px; height: var(--kk-s-5); margin: 0 var(--kk-s-1); }
  .kk-shell[data-menu-layout="two_tiers"] .kk-ri {
    width: auto; min-height: var(--kk-s-6); display: inline-flex; align-items: center; gap: var(--kk-s-2);
    padding: 0 var(--kk-s-3); font-size: var(--kk-fs-meta);
  }
  .kk-shell[data-menu-layout="two_tiers"] .kk-rail.is-icons .kk-ri { min-height: var(--kk-s-6); padding: 0 var(--kk-s-2); }
  /* The utilities on the right are icons; their words stay as titles. */
  .kk-shell[data-menu-layout="two_tiers"] .kk-ri-foot { padding: 0 var(--kk-s-2); }
  .kk-shell[data-menu-layout="two_tiers"] .kk-ri-foot .kk-ri-l { display: none; }
  .kk-shell[data-menu-layout="two_tiers"] .kk-ri-dot { top: var(--kk-s-1); right: var(--kk-s-1); }
  .kk-shell[data-menu-layout="two_tiers"] .kk-ri-count { top: 0; right: 0; }

  /* The page starts under tier one; nothing sits on the left any more. */
  .kk-shell.is-rail[data-menu-layout="two_tiers"] .kk-main,
  .kk-shell.is-rail[data-menu-layout="two_tiers"] > .kk-lite { margin-left: 0; padding-top: var(--kk-tier-h); }

  /* Tier two: each page's bar, and everything that sticks under it, clears tier one. */
  .kk-shell[data-menu-layout="two_tiers"] .kk-workspace-topbar { top: var(--kk-tier-h); }
  .kk-shell[data-menu-layout="two_tiers"] .kk-sv-folder-disclosure { top: calc(var(--kk-tier-h) + var(--kk-wtopbar-h) + var(--kk-s-2)); }
  .kk-shell[data-menu-layout="two_tiers"] .kk-rpanel.kk-context-panel { top: calc(var(--kk-tier-h) + var(--kk-wtopbar-h)); }
  .kk-shell[data-menu-layout="two_tiers"] .kk-ibx-rail > p,
  .kk-shell[data-menu-layout="two_tiers"] .kk-ibx-sel-in { top: calc(var(--kk-tier-h) + var(--kk-topbar-h) + var(--kk-s-4)); }
  .kk-shell[data-menu-layout="two_tiers"] .kk-settings-tabs { top: calc(var(--kk-tier-h) + var(--kk-s-8)); }

  /* More, Alerts, You and Your menu hang under tier one on the right, not beside a rail. */
  .kk-shell[data-menu-layout="two_tiers"] .kk-rail-fly,
  .kk-shell[data-menu-layout="two_tiers"] .kk-rail-fly.is-alerts,
  .kk-shell[data-menu-layout="two_tiers"] .kk-rail-menu {
    inset: calc(var(--kk-tier-h) + var(--kk-s-1)) var(--kk-s-3) auto auto;
    max-height: calc(100dvh - var(--kk-tier-h) - var(--kk-s-4));
  }
  /* More hangs under its own tab where the browser can anchor it; else top right. */
  @supports (anchor-name: --kk-more) {
    .kk-shell[data-menu-layout="two_tiers"] .kk-rail [popovertarget="kk-rail-more"] { anchor-name: --kk-more; }
    .kk-shell[data-menu-layout="two_tiers"] #kk-rail-more { position-anchor: --kk-more; inset: auto; top: calc(anchor(bottom) + var(--kk-s-1)); left: anchor(left); }
  }
  /* The Spaces sheet slides in from the left, under tier one. */
  .kk-shell.is-rail[data-menu-layout="two_tiers"] .kk-side { left: 0; top: var(--kk-tier-h); height: auto; bottom: 0; transform: translateX(-100%); }
  .kk-shell.is-rail.is-open[data-menu-layout="two_tiers"] .kk-side { transform: translateX(0); }
}

@media (min-width: 900px) {
  .kk-shell[data-menu-layout="one_bar"] {
    --kk-onebar-pill: calc(var(--kk-s-8) * 2);
    --kk-onebar-start: calc(var(--kk-s-3) + var(--kk-s-6) + var(--kk-onebar-pill) * 2 + var(--kk-s-1) * 4);
    --kk-onebar-end: calc(var(--kk-s-3) + var(--kk-s-6) * 4 + var(--kk-s-1) * 4);
  }

  /* The rail lies across the top, transparent, so the page's bar shows through its middle. */
  .kk-shell[data-menu-layout="one_bar"] .kk-rail {
    inset: 0 0 auto 0; width: auto; height: var(--kk-wtopbar-h);
    flex-direction: row; align-items: center; gap: var(--kk-s-1); padding: 0 var(--kk-s-3);
    border-right: 0; background: transparent; overflow: visible; pointer-events: none;
  }
  .kk-shell[data-menu-layout="one_bar"] .kk-rail > * { pointer-events: auto; }
  .kk-shell[data-menu-layout="one_bar"] .kk-rail > .kk-rgrow { pointer-events: none; }
  /* The jobs and More wait behind the switcher. */
  .kk-shell[data-menu-layout="one_bar"] :is(.kk-ri-job, .kk-ri-more, .kk-rsep) { display: none; }
  .kk-shell[data-menu-layout="one_bar"] .kk-rail-logo { width: var(--kk-s-6); height: var(--kk-s-6); margin: 0; }
  .kk-shell[data-menu-layout="one_bar"] .kk-ri { width: var(--kk-s-6); min-height: var(--kk-s-6); }
  .kk-shell[data-menu-layout="one_bar"] .kk-ri-foot .kk-ri-l { display: none; }
  .kk-shell[data-menu-layout="one_bar"] .kk-ri-dot { top: var(--kk-s-1); right: var(--kk-s-1); }
  .kk-shell[data-menu-layout="one_bar"] .kk-ri-count { top: 0; right: 0; }

  /* The Space pill ("● Stocklive ▾") and the switcher ("Today ▾"): named, quiet. */
  .kk-shell[data-menu-layout="one_bar"] :is(.kk-ri.is-space, .kk-ri-switch) {
    width: var(--kk-onebar-pill); display: inline-flex; align-items: center; gap: var(--kk-s-2);
    padding: 0 var(--kk-s-2); color: var(--kk-ink); font: 600 var(--kk-fs-body) / 1 var(--kk-font-ui);
  }
  .kk-shell[data-menu-layout="one_bar"] .kk-ri.is-space .kk-ri-spq {
    width: var(--kk-s-2); height: var(--kk-s-2); flex: none; border-radius: var(--kk-r-pill);
    background: var(--kk-current-accent, var(--kk-text-soft)); font-size: 0;
  }
  .kk-shell[data-menu-layout="one_bar"] :is(.kk-ri-scope, .kk-ri.is-space .kk-ri-l, .kk-ri-switch .kk-ri-l) {
    display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
  }
  .kk-ri-chev { width: var(--kk-s-4); height: var(--kk-s-4); flex: none; color: var(--kk-text-soft); }

  /* The page sits where the rail was; its own bar is the bar's middle. The pill and
     the switcher say where you are, so the page's own name and state leave it. */
  .kk-shell.is-rail[data-menu-layout="one_bar"] .kk-main { margin-left: 0; }
  .kk-shell[data-menu-layout="one_bar"] .kk-workspace-topbar { padding: 0 var(--kk-onebar-end) 0 var(--kk-onebar-start); }
  .kk-shell[data-menu-layout="one_bar"] .kk-workspace-topbar :is(.kk-workspace-nav, .kk-workspace-context) { display: none; }
  /* What is left of the cluster (ⓘ, Comments) keeps its size beside the chips. */
  .kk-shell[data-menu-layout="one_bar"] .kk-workspace-topbar .kk-context-cluster { flex: none; }
  /* One action in the bar (mock A): members and Share are the Members & Sharing chip,
     New link the Links chip, Analytics the rail's About › Insights. */
  .kk-shell[data-menu-layout="one_bar"] .kk-workspace-topbar .kk-bar-secondary { display: none; }
  /* A page without its own bar: the rail paints the bar itself. */
  .kk-shell[data-menu-layout="one_bar"]:not(:has(.kk-workspace-topbar)) .kk-rail {
    background: var(--kk-bg); border-bottom: 1px solid var(--kk-line); pointer-events: auto;
  }
  .kk-shell.is-rail[data-menu-layout="one_bar"]:not(:has(.kk-workspace-topbar)) .kk-main,
  .kk-shell.is-rail[data-menu-layout="one_bar"] > .kk-lite { margin-left: 0; padding-top: var(--kk-wtopbar-h); }

  /* Go to hangs under the switcher; Alerts, You and Your menu at the right, under their buttons. */
  .kk-shell[data-menu-layout="one_bar"] .kk-rail-fly,
  .kk-shell[data-menu-layout="one_bar"] .kk-rail-fly.is-alerts,
  .kk-shell[data-menu-layout="one_bar"] .kk-rail-menu {
    inset: calc(var(--kk-wtopbar-h) + var(--kk-s-1)) var(--kk-s-3) auto auto;
    max-height: calc(100dvh - var(--kk-wtopbar-h) - var(--kk-s-4));
  }
  .kk-shell[data-menu-layout="one_bar"] .kk-rail-fly.is-goto {
    inset: calc(var(--kk-wtopbar-h) + var(--kk-s-1)) auto auto calc(var(--kk-s-3) + var(--kk-s-6) + var(--kk-onebar-pill) + var(--kk-s-1) * 2);
    width: 22rem;
  }

  /* The information rail (12/22 item 8) waits behind the bar's ⓘ: no docked strip and
     no room kept until the ⓘ opens it, then the open panel at its last tab. */
  .kk-shell[data-menu-layout="one_bar"] .kk-iconbtn.kk-context-rail-open { display: inline-flex; }
  .kk-shell[data-menu-layout="one_bar"] .kk-rpanel.kk-context-panel:not(:popover-open) { display: none; }
  .kk-shell[data-menu-layout="one_bar"] .kk-rpanel.kk-context-panel:popover-open { width: 20rem; }
  .kk-shell[data-menu-layout="one_bar"] .kk-context-panel:popover-open .kk-context-rail-sheethead { display: flex; padding: var(--kk-s-3) var(--kk-s-4) 0; }
  .kk-shell[data-menu-layout="one_bar"] .kk-context-panel:popover-open .kk-context-rail-toggle { display: none; }
  .kk-shell[data-menu-layout="one_bar"] .kk-context-panel:popover-open .kk-rp-rail { flex-direction: row; padding: var(--kk-s-2) var(--kk-s-3); border-bottom: 1px solid var(--kk-line); }
  .kk-shell[data-menu-layout="one_bar"] .kk-rpanel.kk-context-panel:popover-open .kk-rp-body { display: block; }
  .kk-shell[data-menu-layout="one_bar"] .kk-main-inner:has(.kk-context-panel) { padding-right: var(--kk-s-6); }

  /* The Spaces sheet slides in from the left, under the bar. */
  .kk-shell.is-rail[data-menu-layout="one_bar"] .kk-side { left: 0; top: var(--kk-wtopbar-h); height: auto; bottom: 0; transform: translateX(-100%); }
  .kk-shell.is-rail.is-open[data-menu-layout="one_bar"] .kk-side { transform: translateX(0); }
}

/* A narrow desktop leaves the bar's middle little room: the pill and the switcher
   narrow, the chips drop their counts and the bar's gaps tighten, so New page and ⋯
   stay whole (at 900 the middle was 174px short). */
@media (min-width: 900px) and (max-width: 1199px) {
  .kk-shell[data-menu-layout="one_bar"] { --kk-onebar-pill: calc(var(--kk-s-7) + var(--kk-s-6)); }
  .kk-shell[data-menu-layout="one_bar"] .kk-workspace-topbar .kk-actionbar { gap: var(--kk-s-1); }
  .kk-shell[data-menu-layout="one_bar"] .kk-space-sections .ct { display: none; }
  .kk-shell[data-menu-layout="one_bar"] .kk-topbar-chip { padding: 0 var(--kk-s-2); }
}

/* Phones keep the bottom tab bar in every layout (12/22 Q2): no switcher, no pill. */
@media (max-width: 899px) {
  .kk-shell[data-menu-layout="one_bar"] :is(.kk-ri-switch, .kk-ri-scope, .kk-ri-chev) { display: none; }
}

/* Go to's rows: the job, then what it is for. */
.kk-goto-h { margin: var(--kk-s-2) var(--kk-s-3) 0; color: var(--kk-ink); font: 650 var(--kk-fs-body) / var(--kk-lh-title) var(--kk-font-ui); }
.kk-goto-g {
  margin: var(--kk-s-3) var(--kk-s-3) var(--kk-s-1); color: var(--kk-text-soft);
  font: 600 var(--kk-fs-micro) / var(--kk-lh-micro) var(--kk-font-mono); letter-spacing: .08em; text-transform: uppercase;
}
.kk-goto-i {
  display: flex; align-items: flex-start; gap: var(--kk-s-3); width: 100%; padding: var(--kk-s-2) var(--kk-s-3);
  border: 0; border-radius: var(--kk-r-sm); background: none; color: var(--kk-text); text-align: left; text-decoration: none; cursor: pointer;
}
.kk-goto-i:hover, .kk-goto-i.is-on { background: var(--kk-fill); }
.kk-goto-i.is-greyed { color: var(--kk-text-soft); }
.kk-goto-i .kk-fi-i { flex: none; margin-top: var(--kk-s-1); color: var(--kk-text-soft); }
.kk-goto-m { display: grid; gap: var(--kk-s-1); min-width: 0; }
.kk-goto-t { color: var(--kk-ink); font: 600 var(--kk-fs-body) / var(--kk-lh-title) var(--kk-font-ui); }
.kk-goto-s { color: var(--kk-text-soft); font-size: var(--kk-fs-meta); line-height: var(--kk-lh-meta); }
