/* The console's frame (docs/CONSOLE-REDESIGN.md §3, approved 14 Nov 2026): the sidebar and the header are one frame
   on --chrome-bg, darker than the content, which sits inset on a lighter surface with rounded corners and a hairline
   edge. The sidebar is 56 px of icons; hover or keyboard focus opens it to 232 px as an overlay that doesn't push the
   content, and "Keep open" (⌘.) opens it for good, pushing the content (console.js keeps the choice per member).
   Alignment (the owner's notes, §3.1): the pavilion's square sits in a row exactly --header-h tall at the top, so its
   centre is the header's, which is the breadcrumb's; Create's ＋ is an 18 px icon centred in its button on both axes.
   Flat: hairlines, no boxed cards; the only shadow is the open overlay's edge (--elev-side, tokens.css), which grows in
   with the width (--dur-3). Loaded after the other stylesheets. */

/* ---------- the grid: sidebar | header over content ---------- */
.shell { display: grid; height: 100vh; height: 100dvh; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: var(--header-h) minmax(0, 1fr);
  background: var(--chrome-bg); color: var(--chrome-fg); }
.shell[data-side="open"] { grid-template-columns: var(--side-w-open) minmax(0, 1fr); }

/* ---------- the sidebar ---------- */
.rail { grid-row: 1 / 3; grid-column: 1; position: relative; z-index: var(--z-sidebar-overlay); min-width: 0; min-height: 0; padding: 0; border: 0; background: none; display: block; }
.rail-in { position: absolute; inset: 0 auto 0 0; width: var(--side-w); display: flex; flex-direction: column; gap: 2px; padding: 0 8px 8px;
  background: var(--chrome-bg); color: var(--chrome-fg-2); overflow: hidden; transition: width var(--dur-3) var(--ease-emph), box-shadow var(--dur-3) var(--ease-out); }
.shell[data-side="open"] .rail-in { width: var(--side-w-open); }
.shell[data-side="collapsed"] .rail:hover .rail-in, .shell[data-side="collapsed"] .rail.peek .rail-in { width: var(--side-w-open); box-shadow: var(--elev-side); }
/* what shows only when the sidebar is wide: open, hovered, or focused from the keyboard; the words fade in once there is room */
.rail .lbl { opacity: 0; transition: opacity var(--dur-1) var(--ease-in); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rail:hover .lbl, .rail.peek .lbl { transition: opacity var(--dur-2) var(--ease-out) 60ms; }
.shell[data-side="open"] .rail .lbl, .rail:hover .lbl, .rail.peek .lbl { opacity: 1; }

/* the pavilion: a row as tall as the header, so the square and the breadcrumb share one centre line */
.s-brand { display: flex; align-items: center; gap: 12px; height: var(--header-h); padding: 0 8px; flex: none; white-space: nowrap; color: var(--chrome-fg); }
.pv { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; flex: none; font-size: 10.5px; font-weight: 700; line-height: 1;
  background: var(--canopy); color: var(--canopy-ink); }
.s-brand .lbl { font-weight: 600; font-size: 13.5px; flex: 1; }

/* Create: the ＋ is an icon in an 18 px box, centred in the button on both axes (never the "+" glyph) */
.s-create { display: flex; align-items: stretch; height: 36px; margin: 2px 0 6px; flex: none; border-radius: 6px; overflow: hidden; background: var(--canopy); color: var(--canopy-ink); }
.s-create .main-btn { display: flex; align-items: center; justify-content: center; gap: 0; flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: inherit; font-weight: 600; white-space: nowrap; }
.s-create .main-btn svg { width: 18px; height: 18px; flex: none; display: block; }
.s-create .main-btn .lbl { width: 0; }
.shell[data-side="open"] .s-create .main-btn, .rail:hover .s-create .main-btn, .rail.peek .s-create .main-btn { justify-content: flex-start; gap: 12px; padding: 0 11px; }
.shell[data-side="open"] .s-create .main-btn .lbl, .rail:hover .s-create .main-btn .lbl, .rail.peek .s-create .main-btn .lbl { width: auto; }
.s-create .main-btn:focus-visible { outline-offset: -3px; }

/* an item: 36 px high; collapsed, its 18 px icon sits on the sidebar's centre line (8 + 11 + 9 = 28 = 56 / 2) */
.s-item { display: flex; align-items: center; gap: 12px; height: 36px; width: 100%; padding: 0 11px; border: 0; border-radius: 6px; position: relative; flex: none;
  background: none; color: var(--chrome-fg-2); text-align: left; white-space: nowrap; font: 13.5px/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out); }
.s-item:active { background: var(--chrome-active); }
.s-item:hover { background: var(--chrome-hover); color: var(--chrome-fg); }
.s-item.on, .s-item[aria-current="page"] { background: var(--chrome-active); color: var(--chrome-fg); }
.s-item > svg { width: 18px; height: 18px; flex: none; }
.s-item .lbl { flex: 1; }
.s-item .state { margin-left: auto; font: 10.5px var(--mono); color: var(--chrome-fg-2); opacity: 0; flex: 0 1 auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.shell[data-side="open"] .s-item .state, .rail:hover .s-item .state, .rail.peek .s-item .state { opacity: 1; }
.s-item .state.live { color: var(--ok); } .s-item .state.ask { color: var(--warn); } .s-item .state.stuck { color: var(--bad-2); }
/* counts: on the icon while collapsed, at the right when wide. Collapsed, a count is centred on the icon's top-right
   corner (item x 31 = icon's right edge + 2) so it grows both ways: "7" to "99+" (26 px) all fit inside the 56 px
   sidebar. They used to start at x 24 and grow right, past the item's edge, where the scrolling list (overflow hidden
   sideways) cut "15" and "99+". The list now spans the sidebar's full width (its padding moved inside), and a ring in
   the ground's colour keeps the count apart from the icon under it. The 3 px above and below give a focused item's ring room
   too: it was cut at the list's edges. */
.s-item .n { position: absolute; left: 31px; top: 3px; transform: translateX(-50%); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  display: grid; place-items: center; white-space: nowrap; box-shadow: 0 0 0 2px var(--chrome-bg);
  background: var(--canopy); color: var(--canopy-ink); font: 700 10px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.s-item:hover .n { box-shadow: 0 0 0 2px var(--chrome-hover); }
.s-item.on .n, .s-item[aria-current="page"] .n { box-shadow: 0 0 0 2px var(--chrome-active); }
.shell[data-side="open"] .s-item .n, .rail:hover .s-item .n, .rail.peek .s-item .n { position: static; margin-left: auto; transform: none; box-shadow: none; }
.s-item.keepopen[aria-pressed="true"] { color: var(--chrome-fg); }

/* groups: a word when wide, a short hairline when collapsed */
.s-group { position: relative; display: flex; align-items: center; justify-content: space-between; height: 26px; padding: 0 6px 0 11px; margin-top: 8px; flex: none;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--chrome-fg-2); white-space: nowrap; }
.s-group::before { content: ""; position: absolute; left: 10px; width: 20px; height: 1px; background: var(--chrome-line); }
.shell[data-side="open"] .s-group::before, .rail:hover .s-group::before, .rail.peek .s-group::before { display: none; }
.s-group .add { opacity: 0; width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; border: 0; background: none; color: inherit; padding: 0; }
.s-group .add svg { width: 14px; height: 14px; }
.s-group .add:hover { background: var(--chrome-hover); color: var(--chrome-fg); }
.shell[data-side="open"] .s-group .add, .rail:hover .s-group .add, .rail.peek .s-group .add { opacity: 1; }

.nav.s-scroll { flex: 1; min-height: 0; margin: -3px -8px; padding: 3px 8px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; }
.nav.s-scroll::-webkit-scrollbar { display: none; }
.s-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--chrome-line); padding-top: 6px; flex: none; }
.s-foot .me { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 700 8.5px/1 var(--sans);
  background: var(--chrome-active); color: var(--chrome-fg); }

/* ---------- the header: the same frame ---------- */
.topbar { grid-row: 1; grid-column: 2; height: var(--header-h); min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px;
  background: none; border: 0; backdrop-filter: none; color: var(--chrome-fg-2); }
.topbar .crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; color: var(--chrome-fg-2); white-space: nowrap; overflow: hidden; }
.topbar .crumbs b { color: var(--chrome-fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs .sl { opacity: .6; }
.topbar .grow { flex: 1; }
.topbar .faces:empty, .topbar .hd-slot:empty { display: none; }
.hbtn { height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 6px; border: 0; background: none; color: var(--chrome-fg-2); white-space: nowrap; font-size: 13px; }
.hbtn:hover { background: var(--chrome-hover); color: var(--chrome-fg); }
.hbtn svg { width: 16px; height: 16px; flex: none; }
.hbtn.on { color: var(--chrome-fg); }
.hd-pv, .hd-create { display: none; }

/* ---------- the content: lighter, rounded, inset ---------- */
.main { grid-row: 2; grid-column: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative;
  margin: 0 var(--content-inset) var(--content-inset) 0; border-radius: var(--content-radius); box-shadow: 0 0 0 1px var(--chrome-line);
  --ink-1: var(--content-bg); background: var(--content-bg); color: var(--text); }

/* ---------- focus mode on a view (views.js): compact keeps the icons and drops the header; hidden drops the frame ---------- */
body.chrome-compact .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
body.chrome-compact .rail-in { width: var(--side-w); }
body.chrome-compact .rail .lbl, body.chrome-compact .rail .state { opacity: 0; }
body.chrome-compact .main { grid-row: 1 / 3; margin-top: var(--content-inset); }
body.chrome-hidden .shell { grid-template-columns: minmax(0, 1fr); }
body.chrome-hidden .main { grid-column: 1; grid-row: 1 / 3; margin: 0; border-radius: 0; box-shadow: none; }

/* ---------- the phone ---------- */
@media (max-width: 780px) {
  .shell, .shell[data-side="open"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--header-h) minmax(0, 1fr) auto; }
  .rail { display: none; }
  .topbar { grid-column: 1; padding: 0 6px 0 12px; gap: 8px; }
  .topbar .crumbs { display: flex; }
  .topbar .crumbs > :not(.pav) { display: none; }
  .topbar .crumbs .pav { color: var(--chrome-fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
  .hd-pv { display: grid; }
  /* Create's ＋ left the header for the bar's round ＋ (step 10); the header keeps the square, the name and presence. */
  .hd-create { display: none; }
  .main { grid-column: 1; grid-row: 2; margin: 0; border-radius: 14px 14px 0 0; box-shadow: none; }
  /* The bar (§3.4, D7): Chats · Tasks · ＋ · Search · More on the frame surface, fixed, above the home indicator. */
  .mnav { grid-row: 3; grid-column: 1; display: flex; align-items: stretch; height: auto; min-height: 56px; padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    background: var(--chrome-bg); border-top: 1px solid var(--chrome-line); }
  .mnav button { flex: 1 1 0; min-width: 0; height: 56px; color: var(--chrome-fg-2); border-radius: 0; }
  .mnav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .mnav button.on { color: var(--chrome-fg); }
  .mnav button:focus-visible { outline: var(--focus-w, 2px) solid var(--focus); outline-offset: -4px; }
  .mnav .mn-create { flex: 0 0 64px; }
  .mnav .mn-create::before { display: none; }
  /* the round ＋: an icon centred in a 44 px circle on both axes (the alignment rule, §3.1), never the "+" glyph */
  .mnav .mn-plus { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--canopy); color: var(--canopy-ink); }
  .mnav .mn-plus svg { width: 22px; height: 22px; display: block; }
  .mnav .mn-create:focus-visible { outline: 0; }
  .mnav .mn-create:focus-visible .mn-plus { outline: var(--focus-w, 2px) solid var(--focus); outline-offset: 2px; }
  body.chrome-compact .main, body.chrome-hidden .main { grid-row: 1 / 3; margin: 0; }
  body.chrome-hidden .shell { grid-template-rows: minmax(0, 1fr); }
  body.chrome-hidden .main { grid-row: 1; border-radius: 0; }
}

/* ---------- Settings (#/setup): the index of everything set up once, and the member's own sidebar ---------- */
.set-page { max-width: 880px; }
.set-group { border-top: var(--hair, 1px solid var(--line)); padding: 14px 0 6px; margin-bottom: 14px; }
.set-group > h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.set-group > p.dim { margin: 0 0 8px; font-size: 13px; }
.set-row { display: flex; align-items: center; gap: 12px; border-bottom: var(--hair, 1px solid var(--line)); min-height: 46px; }
.set-row:last-of-type { border-bottom: 0; }
.set-go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 2px; background: none; border: 0; color: var(--text); text-align: left; font-size: 14.5px; }
.set-go svg { width: 18px; height: 18px; color: var(--text-2); flex: none; }
.set-go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-go em { font: 11px var(--mono); font-style: normal; color: var(--text-3); margin-left: 4px; }
.set-go:hover span { text-decoration: underline; text-underline-offset: 3px; }
.set-pin { flex: none; }
.set-acts { padding: 10px 0 0; }
