/* Adaptive layout: phones, tablets and desktop-app windows (loaded after atelier.css; no scripts needed for any rule here).
   - below 768px (phones) and phones in landscape (height under 480px): the bottom tab bar from atelier.css stays.
   - 768 to 1199px (tablets, foldables unfolded, small windows) and the Windows/Mac desktop app at 768px and up: a navigation rail on the
     inline-start edge replaces the bottom bar and the top mega menu. Wider browser windows keep the full top menu.
   - 900px and up: pages that carry .split show a list and a detail pane side by side (public/js/adaptive.js fills the detail pane).
   Colours come from the :root tokens, so dark mode and the app's safe-area padding follow automatically. */
:root{--rail-w:76px}
.rail{display:none}
.rail a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:56px;padding:6px 2px;border-radius:14px;color:var(--muted);font-size:.7rem;font-weight:600;text-align:center;line-height:1.15;word-break:break-word}
.rail a svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.rail a:hover{background:var(--ground);color:var(--ink)}
.rail a.on,.rail a[aria-current=page]{color:var(--ink);background:var(--ground);font-weight:700}
.rail a:focus-visible{outline:3px solid var(--cobalt);outline-offset:-3px}
.rail .rail-more{margin-top:auto}
@media (min-width:768px) and (max-width:1199px) and (min-height:480px){
  .rail{display:flex;position:fixed;inset-block:0;inset-inline-start:0;z-index:30;width:var(--rail-w);flex-direction:column;align-items:stretch;gap:4px;padding:12px 4px calc(12px + env(safe-area-inset-bottom)) 4px;padding-inline-start:calc(4px + env(safe-area-inset-left));background:var(--card);border-inline-end:1px solid var(--rule);overflow-y:auto}
  body:not(.cshell-body){margin-inline-start:var(--rail-w);padding-bottom:0}
  .tabbar{display:none}
  nav.main{display:none}
  .sheet:target{display:block;position:fixed;inset:0;z-index:40;background:var(--ground);overflow:auto;padding-inline-start:var(--rail-w)}
  .sheet header{background:var(--inv);color:#fff;padding:8px 12px;display:flex;align-items:center;gap:8px;font-family:var(--display);font-weight:800;font-size:1.2rem}
  .sheet header a{width:44px;height:44px;display:grid;place-items:center;font-size:1.4rem}
  .sheet .sg{padding:16px;max-width:60rem}
  .sheet h3{font-family:var(--sans);font-size:.75rem;letter-spacing:.1em;color:var(--muted);margin:8px 0 10px}
  .sheet .tiles{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:12px}
  .sheet .tiles a{background:var(--card);border:1px solid var(--rule);border-radius:18px;padding:14px 6px;text-align:center;font-size:.85rem;font-weight:700}
  .sheet .tiles .ico{display:block;width:44px;height:44px;border-radius:14px;margin:0 auto 8px}
}
@media (min-width:768px){
  html.native-windows .rail,html.native-macos .rail{display:flex;position:fixed;inset-block:0;inset-inline-start:0;z-index:30;width:var(--rail-w);flex-direction:column;align-items:stretch;gap:4px;padding:12px 4px calc(12px + env(safe-area-inset-bottom)) 4px;padding-inline-start:calc(4px + env(safe-area-inset-left));background:var(--card);border-inline-end:1px solid var(--rule);overflow-y:auto}
  html.native-windows body:not(.cshell-body),html.native-macos body:not(.cshell-body){margin-inline-start:var(--rail-w);padding-bottom:0}
  html.native-windows .tabbar,html.native-macos .tabbar{display:none}
  html.native-windows nav.main,html.native-macos nav.main{display:none}
  html.native-windows .sheet:target,html.native-macos .sheet:target{display:block;position:fixed;inset:0;z-index:40;background:var(--ground);overflow:auto;padding-inline-start:var(--rail-w)}
  html.native-windows .sheet header,html.native-macos .sheet header{background:var(--inv);color:#fff;padding:8px 12px;display:flex;align-items:center;gap:8px;font-family:var(--display);font-weight:800;font-size:1.2rem}
  html.native-windows .sheet header a,html.native-macos .sheet header a{width:44px;height:44px;display:grid;place-items:center;font-size:1.4rem}
  html.native-windows .sheet .sg,html.native-macos .sheet .sg{padding:16px;max-width:60rem}
  html.native-windows .sheet h3,html.native-macos .sheet h3{font-family:var(--sans);font-size:.75rem;letter-spacing:.1em;color:var(--muted);margin:8px 0 10px}
  html.native-windows .sheet .tiles,html.native-macos .sheet .tiles{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:12px}
  html.native-windows .sheet .tiles a,html.native-macos .sheet .tiles a{background:var(--card);border:1px solid var(--rule);border-radius:18px;padding:14px 6px;text-align:center;font-size:.85rem;font-weight:700}
  html.native-windows .sheet .tiles .ico,html.native-macos .sheet .tiles .ico{display:block;width:44px;height:44px;border-radius:14px;margin:0 auto 8px}
}
/* Windows and Mac app: the head's own inline-start padding already clears the rail because body has a margin, so nothing else moves. */

/* ---- two-pane master/detail (feed, messages, Connect orders) ---- */
.wrap-wide{max-width:var(--max)}
.split{display:block}
.split-detail{display:none}
@media (min-width:900px){
  .wrap.wrap-wide,.feed-wrap{max-width:min(1400px,100%)}
  .feed-wrap>.form,.feed-wrap>.panel{max-width:46rem}
  .split{display:grid;grid-template-columns:minmax(300px,380px) minmax(0,1fr);gap:1.25rem;align-items:start}
  .split-list{min-width:0;max-height:calc(100vh - 8rem);overflow-y:auto;overscroll-behavior:contain;padding-inline-end:.25rem}
  .split-list .card{display:block}
  .split-list a[data-split-open][aria-current=true]{outline:2px solid var(--ink);outline-offset:-2px;background:var(--panel)}
  .split-detail{display:block;min-width:0;position:sticky;top:5rem;max-height:calc(100vh - 6rem);overflow-y:auto;background:var(--card);border:1px solid var(--rule);border-radius:var(--r,16px);padding:1rem 1.25rem}
  .split-detail:focus{outline:none}
  .split-detail:focus-visible{outline:3px solid var(--cobalt)}
  .split-detail .wrap{max-width:none;padding-inline:0}
  .split-detail .block{padding:0}
  .split-detail h1{font-size:1.5rem}
  .split-empty{color:var(--muted);margin:2rem 0;text-align:center}
  .split-detail[aria-busy=true]{opacity:.55}
}

/* ---- Connect dashboard: keep the sidebar open from tablet width instead of 900px ---- */
@media (min-width:768px) and (max-width:899px){
  .cshell{grid-template-columns:15rem minmax(0,1fr);grid-template-areas:"top top" "side main"}
  .cshell-side{position:sticky;grid-area:side;top:4rem;align-self:start;height:calc(100vh - 4rem);width:auto;transform:none;visibility:visible;padding-top:1rem;z-index:1}
  .cshell-burger,.cshell-scrim{display:none!important}
}

@media (prefers-reduced-motion:reduce){.split-detail{transition:none}}
