/* App shell (appshell.js): side navigation on wide screens, bottom tab bar below 1180px. Loaded after theme-ref.css; tokens only.
   Layers: header 5, tab bar 6, "more" sheet 7, dialog 50, "?" balloon 80. */
:root{--as-w:232px;--as-tab:62px}

.has-shell .as-side,.has-shell .as-tabbar,.has-shell .as-sheet{box-sizing:border-box}
.has-shell nav.as-side{display:none}
.has-shell nav.as-tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:6;height:calc(var(--as-tab) + env(safe-area-inset-bottom));padding:0 var(--sp-1) env(safe-area-inset-bottom);
  gap:0;background:var(--card);border:0;border-top:1px solid var(--line);border-radius:0;box-shadow:0 -6px 20px rgba(12,30,70,.07)}
.has-shell{padding-bottom:calc(var(--as-tab) + env(safe-area-inset-bottom))}

/* tab bar: five equal one-thumb targets */
.as-tab{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:var(--as-tab);padding:6px 2px;border:0;border-radius:0;background:none;
  color:var(--muted);font:inherit;font-size:var(--fs-12);font-weight:700;text-decoration:none;position:relative;cursor:pointer;line-height:1.2}
.as-tab:hover:not(:disabled){background:none;color:var(--ink)}
.as-tab .as-ico{width:24px;height:24px}
.as-tab .as-lb{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.as-tab[aria-current=page],.as-tab.cur{color:var(--accent-dark)}
.as-tab[aria-current=page]::before,.as-tab.cur::before{content:"";position:absolute;top:0;left:22%;right:22%;height:3px;border-radius:0 0 3px 3px;background:var(--accent)}
.as-more[aria-expanded=true]{color:var(--accent-dark)}

.as-ico{flex:0 0 auto;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* "more" sheet above the tab bar */
.has-shell .as-sheet{position:fixed;left:var(--sp-2);right:var(--sp-2);bottom:calc(var(--as-tab) + env(safe-area-inset-bottom) + var(--sp-2));z-index:7;max-height:calc(100dvh - var(--as-tab) - 96px);overflow:auto;
  padding:var(--sp-2);background:var(--card);border:1px solid var(--line);border-radius:var(--r-3);box-shadow:var(--sh-3);animation:popin var(--t-base) var(--ease) both}
.as-sheet[hidden]{display:none}
.as-sheet .as-item,.as-sheet .as-sub{min-height:48px}
.as-foot{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-3) var(--sp-3) var(--sp-2);margin-top:var(--sp-2);border-top:1px solid var(--line)}

/* menu rows (side and sheet) */
.as-item,.as-sub{display:flex;align-items:center;gap:var(--sp-3);min-height:44px;padding:0 var(--sp-3);border-radius:var(--radius);color:var(--ink);font:inherit;font-size:var(--fs-16);font-weight:700;text-decoration:none;
  background:none;border:0;width:100%;text-align:left;cursor:pointer;transition:background var(--t-fast),color var(--t-fast)}
.as-item:hover,.as-sub:hover{background:var(--field);color:var(--ink)}
.as-item[aria-current=page],.as-sub[aria-current=page]{background:var(--accent-soft);color:var(--accent-dark)}
.as-item .as-ico{color:var(--muted)}
.as-item[aria-current=page] .as-ico{color:var(--accent)}
.as-sub{font-weight:600;font-size:var(--fs-14);padding-left:calc(var(--sp-3) + 20px + var(--sp-3));min-height:40px}
.as-sub:has(.as-ico){padding-left:calc(var(--sp-3) + 20px)}
.as-head .as-lb{flex:1 1 auto}
.as-head .as-ico:last-child{width:16px;height:16px;transition:transform var(--t-fast)}
.as-group.open .as-head .as-ico:last-child{transform:rotate(180deg)}
.as-kids{display:none}
.as-group.open .as-kids{display:block}
.as-row{display:flex;align-items:center}
.as-row .as-item{flex:1 1 auto;width:auto}
.as-tog{flex:0 0 auto;width:36px;min-height:44px;padding:0;border-radius:var(--radius);background:none;color:var(--muted)}
.as-tog:hover:not(:disabled){background:var(--field);color:var(--ink)}
.as-tog .as-ico{width:16px;height:16px;transition:transform var(--t-fast)}
.as-group.open .as-tog .as-ico{transform:rotate(180deg)}

/* header: the existing page header keeps its tabs; the second link to Settings moves into the menu */
.has-shell header.top a.adminlink:not(.setuplink){display:none}
@media (max-width:640px){
  .has-shell header.top .brand{font-size:0;gap:0;flex:0 0 auto}
  .has-shell header.top .setuplink{display:none}
  .has-shell header.top.menu-open .setuplink{display:flex}
}
.has-shell header.top #userbox{margin-left:auto}
.has-shell header.top .setuplink{margin-left:auto}
.has-shell header.top .setuplink ~ #userbox{margin-left:0}

/* ---------- wide screens: side navigation ---------- */
@media (min-width:1180px){
  .has-shell{padding-left:var(--as-w);padding-bottom:0}
  .has-shell nav.as-side{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:var(--as-w);z-index:6;padding:var(--sp-4) var(--sp-3);gap:var(--sp-4);
    background:var(--card);border:0;border-right:1px solid var(--line);border-radius:0;overflow:auto}
  .has-shell nav.as-tabbar,.has-shell .as-sheet{display:none}
  .as-brand{display:flex;align-items:center;gap:10px;padding:var(--sp-2) var(--sp-3);min-height:48px;font-weight:800;font-size:var(--fs-18);letter-spacing:-.03em;color:var(--ink);text-decoration:none}
  .as-brand::before{content:"";flex:0 0 auto;width:26px;height:26px;border-radius:8px;
    background:linear-gradient(#fff,#fff) 50% 9px/12px 2.5px no-repeat,linear-gradient(#fff,#fff) 50% 15px/8px 2.5px no-repeat,var(--accent)}
  .as-brand:hover{color:var(--ink)}
  .as-list{display:flex;flex-direction:column;gap:2px}
  .has-shell header.top .brand{display:none}
  .has-shell header.top{justify-content:flex-start}
  .has-shell header.top .moremenu{display:none}
}
@media (max-width:1179px){
  .has-shell .wizbar,.has-shell .bar{bottom:calc(var(--as-tab) + env(safe-area-inset-bottom))}
  .has-shell main{padding-bottom:calc(var(--as-tab) + 140px)}
  .has-shell:not(:has(#bar)) main{padding-bottom:var(--sp-6)}
}
@media print{.as-side,.as-tabbar,.as-sheet{display:none!important}.has-shell{padding:0}}

.as-item .as-lb,.as-sub .as-lb{min-width:0;overflow-wrap:anywhere;hyphens:auto;line-height:1.25}
.as-item,.as-sub{padding-top:6px;padding-bottom:6px}

/* the retired weekly wizard points to the new workspace */
.wsnew{display:inline-flex;margin:var(--sp-3) 0}
