/* ==========================================================================
   App shell: sidebar + top bar + content; login screen.
   ========================================================================== */

.shell { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-4) var(--space-3); background: var(--surface); border-right: var(--border-width) solid var(--border); }
.brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-1) var(--space-2); min-height: 36px; }
/* a shop's own logo shows whole (a wide one with words isn't cropped), on a quiet tile */
.brand__logo { width: 30px; height: 30px; border-radius: var(--radius-sm); object-fit: cover; flex: none; }
.brand__logo:not([src^="/admin/img/"]) { object-fit: contain; padding: 2px; background: var(--surface-2); }
.brand__mark { width: 30px; height: 30px; border-radius: var(--radius-sm); flex: none; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-weight: var(--weight-semibold); }
.brand__name { font-weight: var(--weight-semibold); font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: grid; gap: 2px; overflow-y: auto; }
.nav__label { padding: var(--space-3) var(--space-3) var(--space-1); font-size: var(--text-xs); color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: 0.05em; }
.nav__link { display: flex; align-items: center; gap: var(--space-3); height: 34px; padding: 0 var(--space-3);
  border-radius: var(--radius); color: var(--text-muted); font-weight: var(--weight-medium); text-decoration: none; }
.nav__link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav__link.is-active { background: color-mix(in oklab, var(--accent) 18%, var(--surface-hover)); color: var(--text);
  font-weight: var(--weight-semibold, 600); box-shadow: inset 3px 0 0 var(--accent); }  /* readable with any accent, light or dark */
.nav__link svg { width: 18px; height: 18px; flex: none; }
.sidebar__footer { margin-top: auto; display: grid; gap: var(--space-2); padding-top: var(--space-3); border-top: var(--border-width) solid var(--border); }
.account { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); }
.account__avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; }
.account__name { font-size: var(--text-sm); font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; }
.account__role { font-size: var(--text-xs); color: var(--text-subtle); text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; height: var(--topbar-height); display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-6); background: color-mix(in oklab, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: var(--border-width) solid var(--border); }
.topbar__title { font-size: var(--text-lg); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__menu { display: none; }
.topbar__actions { margin-left: auto; display: flex; gap: var(--space-2); flex-shrink: 0; align-items: center; }
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-6); display: grid; gap: var(--space-5); align-content: start; }
.content > *, .stack > *, .grid-2 > * { min-width: 0; }
.grid-2 { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

/* Mobile: sidebar becomes an off-canvas panel */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; width: min(280px, 86vw); transform: translateX(-100%);
    transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg); }
  .shell.is-nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 40; background: var(--overlay); }
  .topbar { padding: 0 var(--space-3); gap: var(--space-2); }
  .topbar__actions { gap: 2px; }
  .topbar__actions .btn, .topbar > .kbd-search, .topbar__menu { min-width: var(--tap); height: var(--tap); padding: 0 var(--space-2); }
  .topbar__menu { display: inline-flex; }
  .content { padding: var(--space-4); }
  .dl { grid-template-columns: 1fr; gap: 2px var(--space-4); }
  .dl dd { margin-bottom: var(--space-2); }
}

/* 📱 Today · Orders · Plan (js/app.js tabBar): Opal's floating bar at the thumb, phones only. Solid, no glass. */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar { position: fixed; z-index: 30; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; width: min(360px, calc(100vw - 32px)); padding: 6px;
    border-radius: var(--radius-pill); background: var(--surface-2); border: var(--border-width) solid var(--border);
    box-shadow: var(--shadow-lg); }
  .tabbar__tab { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--tabbar-h); border-radius: var(--radius-pill);
    color: var(--text-muted); font-size: 0.78rem; font-weight: 700; text-decoration: none;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
  .tabbar__tab svg { width: 20px; height: 20px; }
  .tabbar__tab.is-active { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
  .tabbar__tab.is-active svg { color: var(--accent); }
  .tabbar__tab:active { transform: scale(0.97); }
  /* room for the bar under the last card, and everything that sits at the bottom moves above it */
  .shell:has(.tabbar) { --tabbar-room: calc(var(--tabbar-h) + 36px + env(safe-area-inset-bottom, 0px)); }
  .shell:has(.tabbar) .content { padding-bottom: calc(var(--space-4) + var(--tabbar-room)); }
  .shell:has(.tabbar) .save-bar { bottom: calc(var(--space-3) + var(--tabbar-room)); }
  body:has(.tabbar) #toasts, body:has(.tabbar) .update-bar { bottom: calc(var(--space-4) + 84px + env(safe-area-inset-bottom, 0px)); }
}

/* Login */
/* Sign-in pages (dashboard login, /join): charcoal with the coal glow rising from below (Ember), a solid card, a headline
   panel on wide screens. No drifting blobs, no glass, no gradient text (DESIGN.md). */
.login { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; gap: var(--space-8);
  padding: var(--space-6) var(--space-4); overflow: hidden; isolation: isolate; background: var(--bg); }
.login::before { content: ""; position: absolute; left: -30%; right: -30%; bottom: -40vh; height: 85vh; z-index: -1;
  pointer-events: none; background: var(--glow); }
.login__side { display: grid; gap: var(--space-4); justify-items: center; width: min(420px, 100%); }
.login__card { width: 100%; padding: var(--space-8) var(--space-6); display: grid; gap: var(--space-5); border-radius: calc(var(--radius-lg) + 6px);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.login__brand { display: grid; justify-items: center; gap: var(--space-3); text-align: center; }
.login__brand .brand__mark, .login__brand .brand__logo { width: 56px; height: 56px; font-size: 1.4rem; border-radius: 16px; }
.login__brand .topbar__title { font-size: 1.55rem; letter-spacing: -0.01em; }
.login__subtitle { color: var(--text-muted); font-size: var(--text-sm); }
.login__foot { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.login__foot a { color: var(--text-muted); text-decoration: none; }
.login__foot a:hover { color: var(--accent); }
.login__hero { display: none; }
@media (min-width: 960px) {
  .login--split { grid-template-columns: minmax(0, 480px) 420px; justify-content: center; align-items: center; column-gap: clamp(48px, 7vw, 120px); }
  .login__hero { display: grid; gap: var(--space-4); align-content: center; }
}
.login__headline { margin: 0; padding-bottom: 0.12em; font-size: clamp(2rem, 3.2vw, 2.9rem); line-height: 1.12; letter-spacing: -0.02em;
  color: var(--text); }
.login__lede { margin: 0; font-size: 1.05rem; color: var(--text-muted); max-width: 44ch; }
.login__points { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.login__points li { display: flex; align-items: center; gap: var(--space-3); }
.login__tick { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%;
  color: var(--on-accent); background: var(--accent); }
.login__tick svg { width: 15px; height: 15px; }
.terms-check { align-items: flex-start; line-height: 1.45; }
.terms-check input { margin-top: 3px; }
.is-locked { opacity: 0.45; pointer-events: none; filter: grayscale(0.6); }
.policy-text { white-space: pre-wrap; line-height: 1.6; max-height: 55vh; overflow: auto; padding-right: var(--space-2); }
.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--text-subtle); font-size: var(--text-xs); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.telegram-login { display: flex; justify-content: center; min-height: 40px; }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--text-subtle); }

/* 🔥 The coal glow (js/backdrop.js): Ember's one coloured light, rising from below the bottom edge. Static, Daylight has none
   (--glow: none), and it sits behind everything so cards stay readable. */
html[data-backdrop="coals"] body::before { content: ""; position: fixed; left: -25vw; right: -25vw; bottom: -38vh; height: 80vh;
  z-index: -1; pointer-events: none; background: var(--glow); }

