/* Desktop sidebar. Mounted only on mouse/trackpad screens (see desktop-nav.js). */
#deskNav{display:none}
body.has-desk-nav{--dnav-w:220px;padding-left:var(--dnav-w);transition:padding-left var(--t-fast,.15s) ease}
body.has-desk-nav[data-desk-nav="icons"]{--dnav-w:72px}
body.has-desk-nav[data-desk-nav="hidden"]{--dnav-w:0px}
body.has-desk-nav #deskNav{
  display:flex;flex-direction:column;position:fixed;left:0;top:var(--dnav-top,0px);bottom:0;width:var(--dnav-w);
  z-index:calc(var(--z-panel,70) + 1);overflow:hidden;background:var(--surface);border-right:1px solid var(--line);
  transition:width var(--t-fast,.15s) ease;font-family:var(--font-ui)
}
body.has-desk-nav[data-desk-nav="hidden"] #deskNav{border-right:0}
.dn-top{display:flex;justify-content:flex-end;padding:12px 12px 6px;flex:none}
body[data-desk-nav="icons"] .dn-top{justify-content:center}
.dn-toggle{width:36px;height:36px;border-radius:var(--r-md,10px);border:1px solid transparent;background:none;color:var(--muted);display:grid;place-items:center}
.dn-toggle:hover{background:var(--surface-2);color:var(--ink)}
#deskNav svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.dn-list{display:flex;flex-direction:column;gap:2px;padding:4px 10px;overflow-y:auto;flex:1;min-height:0}
.dn-list[hidden]{display:none}
.dn-item{display:flex;align-items:center;gap:12px;height:40px;padding:0 12px;border-radius:var(--r-md,10px);border:0;background:none;
  color:var(--muted);font:inherit;font-size:14px;font-weight:600;text-decoration:none;text-align:left;width:100%;white-space:nowrap;cursor:pointer}
.dn-item:hover{background:var(--surface-2);color:var(--ink)}
.dn-item.on{background:var(--surface-2);color:var(--accent-ink)}
.dn-item:focus-visible,.dn-toggle:focus-visible{outline:2px solid var(--focus-outline);outline-offset:-2px}
.dn-label{overflow:hidden;text-overflow:ellipsis;flex:1}
.dn-sub{height:34px;padding-left:44px;font-weight:500;font-size:13px}
.dn-sub svg{width:16px!important;height:16px!important}
.dn-count{font-family:var(--font-mono);font-size:12px;color:var(--muted);flex:none}
.dn-group{font-family:var(--font-ui);font-size:var(--fs-xs);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:16px 12px 6px;font-weight:var(--fw-semi)}
.dn-text{font-weight:500}
.dn-initial{display:none}
.dn-danger{color:var(--danger-ink)}
.dn-back{margin-bottom:4px}
.dn-foot{flex:none;display:flex;flex-direction:column;gap:2px;padding:8px 10px 14px;border-top:1px solid var(--line)}
.dn-me{height:48px;margin-top:4px}
.dn-avatar{width:30px;height:30px;border-radius:50%;background:var(--surface-2);border:1px solid var(--line);display:grid;place-items:center;
  font-size:11px;font-weight:700;color:var(--ink);flex:none;margin-left:-4px}
.dn-email{font-weight:500;font-size:12.5px}

/* Icons-only state */
body[data-desk-nav="icons"] .dn-label,
body[data-desk-nav="icons"] .dn-count,
body[data-desk-nav="icons"] .dn-group{display:none}
body[data-desk-nav="icons"] .dn-item{justify-content:center;padding:0;height:44px}
body[data-desk-nav="icons"] .dn-sub{display:none}
body[data-desk-nav="icons"] .dn-text .dn-initial{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;border:1px solid var(--line);font-size:13px}
body[data-desk-nav="icons"] .dn-avatar{margin-left:0}

/* ☰ in the header only when the sidebar is hidden */
#deskNavOpen{display:none!important}
body.has-desk-nav[data-desk-nav="hidden"] #deskNavOpen{display:inline-flex!important;align-items:center;justify-content:center}
#deskNavOpen svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}

/* The header ⋯ More button is touch-only now; desktop uses the sidebar */
body.has-desk-nav #shelfMoreBtn{display:none!important}

/* Settings: the sidebar becomes the settings nav, so the page loses its own */
body.has-desk-nav #settingsPage.settings-page{left:var(--dnav-w);transition:left var(--t-fast,.15s) ease}
body.desk-nav-settings #settingsPage .settings-topbar,
body.desk-nav-settings #settingsPage .settings-nav{display:none}
body.desk-nav-settings #settingsPage .settings-layout{grid-template-columns:minmax(0,1fr)}

@media (prefers-reduced-motion:reduce){
  body.has-desk-nav,body.has-desk-nav #deskNav,body.has-desk-nav #settingsPage.settings-page{transition:none}
}

/* "View:" prefix on the layout dropdown (all devices) */
.shelf-view-prefix{color:var(--muted);font-weight:500;margin-right:2px}

/* Quick on desktop: one search (Quick's own). Shelf-only header controls step aside,
   the ☰, logo, Scan and + Add stay. Content is centred like the iPad. */
body.has-desk-nav.field-view #spacebar,
body.has-desk-nav.field-view .topbar .search,
body.has-desk-nav.field-view #mLayoutBtn,
body.has-desk-nav.field-view #mVFBtn,
body.has-desk-nav.field-view #shelfSelectBtn,
body.has-desk-nav.field-view .subbar{display:none!important}

/* A 1440px touch viewport mounts desktop navigation, then returns to phone.
   Bound the desktop offset in CSS as well as JS, including the first resized
   layout before media-query listeners run. Never animate that old padding
   through the phone's available width. */
@media(max-width:700px){
  :root body.has-desk-nav{--dnav-w:0px;padding-left:env(safe-area-inset-left,0px);transition:none}
  body.has-desk-nav #deskNav{display:none}
}
body.has-desk-nav.field-view section.field-view{max-width:720px;margin-inline:auto;padding-bottom:var(--s-7)}
body.has-desk-nav.field-view #stage{margin-top:var(--dnav-top,0px)}
