/* shared/shell.css — Cerebro app page shell (MP-F3, D1 P-07).

   The shell every app page mounts into: centered page column on the
   approved gutter ladder, shared header (wordmark + primary nav + menu
   button), page footer, skip link, and the workspace menu <dialog>.
   shared/shell.js hydrates .shell-header and appends .shell-dialog; the
   markup below is what it emits (also usable statically, e.g. specimens).

   Column widths are page-family variants (.shell--*) reproducing the
   per-page geometries that existed before F3 — see LANE-REPORT.md for the
   divergence matrix. Gutters use the P-03/P-07 tokens; values without a
   token stay literal. Requires shared/tokens.css; safe to load after
   components/motion/skeleton (all .c-* rules stay inert on app pages). */

/* ---------- page column ---------- */
.shell { width:min(calc(100% - 2 * var(--c-space-page-gutter-lg)), var(--c-size-page)); margin-inline:auto; }

/* Width variants — one per distinct pre-F3 column geometry. */
.shell--w1040 { width:min(calc(100% - 2 * var(--c-space-page-gutter-lg)), 1040px); }
.shell--w1060 { width:min(calc(100% - 2 * var(--c-space-page-gutter-lg)), 1060px); }
.shell--w1080 { width:min(calc(100% - 2 * var(--c-space-page-gutter-lg)), 1080px); }
.shell--editor { width:min(calc(100% - 2 * var(--c-space-page-gutter-lg)), 1060px); }
.shell--work { width:min(calc(100% - 2 * var(--c-space-page-gutter-lg)), 1100px); }
.shell--chat { width:min(calc(100% - 2 * var(--c-space-page-gutter-lg)), 1100px); height:100%; display:flex; flex-direction:column; }
/* .shell--manage intentionally has no base rule: it keeps the .shell
   920px column and only overrides the ≤980/≤760 steps below. */

/* ---------- skip link ---------- */
.skip-link { position:fixed; z-index:var(--c-layer-sticky); left:var(--c-space-16); top:var(--c-space-16); transform:translateY(-180%); padding:var(--c-space-12); background:#fff; color:#161616; border-radius:8px; }
.skip-link:focus { transform:translateY(0); }

/* ---------- header ---------- */
.shell-header { display:flex; align-items:center; justify-content:space-between; gap:var(--c-space-28); padding-block:30px var(--c-space-28); border-bottom:1px solid var(--c-border-default); }
.shell-header:empty { display:none; }
.shell-header a { color:inherit; text-decoration:none; }
.wordmark { display:inline-flex; align-items:baseline; flex:0 0 auto; font-size:27px; letter-spacing:-1.5px; font-weight:var(--c-weight-semibold); }
.brand-dot { width:5px; height:5px; margin-left:3px; background:var(--c-text-primary); border-radius:50%; }

.shell-nav { display:flex; align-items:center; gap:var(--c-space-28); }
.shell-nav a { display:flex; align-items:center; gap:var(--c-space-8); min-height:var(--c-size-touch); color:var(--c-text-secondary); font-size:var(--c-type-body); transition:color var(--c-motion-fast) var(--c-motion-ease); }
.shell-nav a[aria-current="page"] { color:var(--c-text-primary); text-decoration:underline; text-underline-offset:8px; }
.shell-nav .icon { width:18px; height:18px; }

.shell-menu-button { display:flex; align-items:center; justify-content:center; gap:var(--c-space-10); min-width:var(--c-size-touch); min-height:var(--c-size-touch); padding:var(--c-space-8) var(--c-space-14); border:1px solid var(--c-border-input); border-radius:var(--c-radius-round); font-size:var(--c-type-label); background:none; transition:background-color var(--c-motion-fast) var(--c-motion-ease), border-color var(--c-motion-fast) var(--c-motion-ease); }
.shell-menu-button .icon { width:18px; height:18px; }

/* ---------- footer ---------- */
.shell-footer { display:flex; justify-content:space-between; gap:var(--c-space-16); padding-block:var(--c-space-28) max(var(--c-space-28), var(--c-safe-bottom)); color:var(--c-text-muted); font-size:var(--c-type-meta); }
/* No .shell-footer a rule: pre-F3 .page-footer links kept natural line
   height; favorites/notice keep their page-level 44px opt-ins. A global
   44px footer target is a B-slice/D1 decision, not F3 geometry. */

/* ---------- workspace menu dialog ---------- */
.shell-dialog { width:min(640px, calc(100% - 32px)); max-height:calc(100dvh - 32px); margin:auto; padding:var(--c-space-28); border:1px solid var(--c-border-strong); border-radius:16px; background:var(--c-surface-raised); color:var(--c-text-primary); overflow:auto; }
.shell-dialog::backdrop { background:var(--c-backdrop); backdrop-filter:var(--c-backdrop-filter); }
.shell-dialog-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:22px; }
.shell-dialog-heading h2 { font-size:23px; font-weight:var(--c-weight-regular); }
/* Icon-button grammar (.c-icon-btn): quiet secondary glyph → primary on
   hover over a surface wash; border/background reset kills UA chrome. */
.shell-dialog-heading button { width:var(--c-size-touch); display:grid; place-items:center; border:0; background:none; border-radius:var(--c-radius-control); color:var(--c-text-secondary); transition:background-color var(--c-motion-fast) var(--c-motion-ease), color var(--c-motion-fast) var(--c-motion-ease); }
.shell-menu-groups { display:grid; grid-template-columns:1fr 1fr; gap:var(--c-space-24); }
.shell-menu-groups h3 { font-size:var(--c-type-label); color:var(--c-text-secondary); font-weight:var(--c-weight-regular); margin:0 0 var(--c-space-10); }
.shell-menu-groups a { display:flex; align-items:center; min-height:var(--c-size-touch); text-decoration:none; color:var(--c-text-primary); font-size:var(--c-type-section); }
.shell-menu-groups a[aria-current="page"] { text-decoration:underline; text-underline-offset:5px; }
.shell-guide-link { display:flex; align-items:center; min-height:var(--c-size-touch); font-size:var(--c-type-label); color:var(--c-text-secondary); margin-top:22px; border-top:1px solid var(--c-border-default); padding-top:var(--c-space-16); }
/* Unread-count pill written by notifications-settings.js badge() — the
   span lives inside the menu's 通知 link so the page script keeps its
   #nav-unread contract (it used to sit in the per-page header nav). */
#nav-unread:not(:empty) { font-size:var(--c-type-meta); border:1px solid var(--c-border-default); border-radius:50%; min-width:20px; height:20px; display:grid; place-items:center; }
@media(hover:hover) {
  .shell-menu-groups a:hover, .shell-guide-link:hover { text-decoration:underline; text-underline-offset:5px; }
  .shell-nav a:hover { color:var(--c-text-primary); }
  .shell-menu-button:hover { background:var(--c-surface-hover); }
  .shell-dialog-heading button:hover { background:var(--c-surface-hover); color:var(--c-text-primary); }
}

/* ---------- base mobile step ---------- */
@media(max-width:680px) {
  .shell { width:calc(100% - 2 * var(--c-space-page-gutter-md)); }
  .shell-header { gap:var(--c-space-16); padding-block:19px 17px; }
  .wordmark { font-size:25px; }
  .shell-nav { display:none; }
  .shell-menu-button span { display:none; }
  .shell-menu-button { padding:var(--c-space-10); }
  .shell-dialog { padding:var(--c-space-20); }
  .shell-menu-groups { gap:18px; }
  .shell-menu-groups a { font-size:var(--c-type-body); }
}
@media(max-width:360px) {
  .shell { width:calc(100% - 2 * var(--c-space-page-gutter-sm)); }
}

/* ---------- variant steps (must stay after the base steps so equal-
   specificity width rules resolve to the variant) ---------- */
@media(max-width:980px) {
  .shell--editor { width:calc(100% - 2 * var(--c-space-20)); }
  .shell--manage { width:min(calc(100% - 2 * var(--c-space-20)), var(--c-size-page)); }
}
@media(max-width:800px) {
  .shell--chat { width:calc(100% - 2 * var(--c-space-page-gutter-md)); }
}
@media(max-width:760px) {
  .shell--w1040, .shell--w1060, .shell--work { width:min(calc(100% - 2 * var(--c-space-page-gutter-md)), 600px); }
  .shell--w1080 { width:calc(100% - 2 * var(--c-space-page-gutter-md)); }
  .shell--editor, .shell--manage { width:min(calc(100% - 2 * var(--c-space-page-gutter-md)), 560px); }

  /* Footer clearance for the work family's fixed bottom tab bar (the bar
     itself is .shell--work .shell-nav below). Other families' fixed-bar
     clearance stays in their page CSS (offers/case/billing/company/post). */
  .shell--work .shell-footer { padding-bottom:calc(108px + var(--c-safe-bottom)); gap:var(--c-space-20); }

  /* Work pages tighten the header at ≤760 (was .work-header in work.css).
     No gap override: the old cascade let .app-header.workspace-header's
     28px/16px gap win over .work-header's 20px, so the base .shell-header
     steps already reproduce the effective values. */
  .shell--work .shell-header { padding-block:12px; }

  /* Work-family mobile bottom navigation: the primary .shell-nav becomes
     a fixed tab bar (it already carries the 4 primary destinations).
     Literal colors/sizes preserve the pre-F3 .work-nav geometry exactly —
     no token maps to #1d1d1f/#4a4a50 or the 11px/21px/51px tab spec. */
  .shell--work .shell-nav { position:fixed; left:0; right:0; bottom:0; z-index:6; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0; padding:9px var(--c-space-12) calc(9px + var(--c-safe-bottom)); background:#1d1d1f; border-top:1px solid #4a4a50; }
  .shell--work .shell-nav a { flex-direction:column; justify-content:center; gap:6px; min-height:51px; font-size:11px; }
  .shell--work .shell-nav .icon { width:21px; height:21px; }
  .shell--work .shell-nav a[aria-current="page"] > span { text-decoration:none; font-weight:var(--c-weight-semibold); }
  .shell--work .shell-nav a[aria-current="page"] .icon { stroke-width:2; }
}
@media(max-width:680px) {
  .shell--chat { width:100%; }
}
