/* The Django tier's SHELL — Material 3 / M3 Expressive, dark, monochrome.
 *
 * SPEC §4 is the source of every number here. This file owns the frame (the
 * body grid), the rail (collapsed and expanded) and its scrim, the band and the
 * browser-style tab strip, the panes, .page-top and
 * .page-scroll, the notice slot, the list/detail split and its sticky record
 * head, reading mode, .navbusy, the FAB with its glow and the assistant panel,
 * the bubbles and the model wait, the undo bar, the phone nav bar and app bar,
 * the scroll-edge fades, and the .head rules.
 *
 * It does NOT own tokens (m3.css's :root, which loads first) except the legacy
 * --surface alias, and it holds no page rules (static/pages/*.css).
 *
 * ⚠️ TEST-PINNED LITERALS live here (SPEC §1.7): the reading-mode rule
 * `.content:not(.is-reading) .split__detail { display: none; }` verbatim,
 * `.reading__back {` with `display: none;` as its FIRST declaration, `.undo {`
 * and `.fab__panel {` each with its `[hidden]` twin, and `body {` with
 * `background: var(--md-sys-color-surface-container)`.
 *
 * ⚠️ MOTION IS ALLOWLISTED (K36): every transition and animation sits in a
 * `@media (prefers-reduced-motion: no-preference)` block right after its
 * component. The only exceptions are the scroll-driven fade longhands and the
 * zero-duration show delays (`animation: m3-appear 0s <delay> forwards`).
 *
 * ⚠️ Comments in this file are long. An edit whose old text starts inside a
 * comment must reach that comment's real end, or the parser drops the next rule.
 */

:root {
  --surface: #131314;      /* legacy name, kept by decision. NOT the body colour since the Gemini inversion (SPEC §1.8) */
}

/* ── The page hue (§2.4). workspace.js also sets --h inline on every pane,
   which wins; these give the right first paint before any script runs. The
   hue is INK only (Health's trend lines and routes read it). ⚠️ NOTHING IN THE
   SHELL IS TONED (2026-10-02, his words: "the top section / tab should NOT
   have a different color than the background of the page itself. It should
   look and feel seamless!"): the open tab is the card's own colour, and a
   fixed top or a sticky record head is the colour of the ground under it. ── */
.pane { --h: var(--h-dashboard); }
.pane[data-page="mail"] { --h: var(--h-mail); }
.pane[data-page="news"] { --h: var(--h-news); }
.pane[data-page="contacts"] { --h: var(--h-contacts); }
.pane[data-page="calendar"] { --h: var(--h-calendar); }
.pane[data-page="tasks"] { --h: var(--h-tasks); }
.pane[data-page="knowledge"] { --h: var(--h-knowledge); }
.pane[data-page="finance"] { --h: var(--h-finance); }
.pane[data-page="nutrition"] { --h: var(--h-nutrition); }
.pane[data-page="exercise"] { --h: var(--h-exercise); }
.pane[data-page="sleep"] { --h: var(--h-sleep); }
.pane[data-page="body"] { --h: var(--h-body); }
.pane[data-page="chat"] { --h: var(--h-chat); }
.pane[data-page="dashboard"] { --h: var(--h-dashboard); }

/* ════════════════════════════════════════════════════════════ THE FRAME ══
   §4.1. At ≥721px: the rail x 0–96 (fixed, transparent: the canvas shows),
   the band x 96–1440 y 0–64, the content x 96–1416 y 64–876 — the right and
   bottom 24px are the frame margin. The canvas is the LIGHTER grey and the
   content card the darker one (the Gemini inversion, K27). The page never
   scrolls; only a view's own scrollers do (K24). */
*, ::before, ::after { box-sizing: border-box; }
html { height: 100%; }
body { background: var(--md-sys-color-surface-container); }          /* the pinned rule (§1.8): keep "body {" and this declaration */
body.shell {
  display: grid;
  grid-template-columns: var(--app-rail-w) minmax(0, 1fr);
  grid-template-rows: var(--app-band-h) minmax(0, 1fr);
  height: 100dvh; overflow: hidden; overscroll-behavior: none;
}
.band    { grid-column: 2; grid-row: 1; }
.content { grid-column: 2; grid-row: 2; min-height: 0; min-width: 0; overflow: hidden;
           display: grid; padding: 0 var(--app-frame) var(--app-frame) 0; }
.panes   { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--app-spacer); min-height: 0; min-width: 0; }
.content.is-split .panes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

@media (max-width: 720px) {
  body.shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: calc(var(--app-band-h) + env(safe-area-inset-top, 0px)) minmax(0, 1fr) var(--app-navbar-offset);
  }
  .band    { grid-column: 1; grid-row: 1; }
  .content { grid-column: 1; grid-row: 2; padding: 0 8px; }
  .rail    { grid-column: 1; grid-row: 3; }
}

/* The page head (§3.23): invisible by design (K26), still in the DOM — the
   screen reader reads the page name and smoke-workspace reads .head__title.
   A page whose head carries real controls or data opts in with .head--shown.
   Every head that holds a control now says so (2026-10-01: the interim
   `:has(button, a[href], …)` fallback is gone), so a head WITHOUT the class
   is sr-only even if a control is added to it later: mark it .head--shown. */
.head:not(.head--shown) {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.head--shown {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; row-gap: 8px; margin-bottom: 16px;
}
.head[hidden] { display: none; }
.head__title {
  margin: 0; color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-title-large-size); line-height: var(--md-sys-typescale-title-large-line-height);
  font-weight: var(--md-sys-typescale-title-large-weight);
}
.head__sub {
  margin: 0; color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size); line-height: var(--md-sys-typescale-body-medium-line-height);
}

/* ═════════════════════════════════════════════════════════════ THE RAIL ══
   §4.3. COLLAPSED (K13): 96px, icon-only, the labels screen-reader text. The
   menu button (an S standard icon button) sits on the tabs' centre line; the
   page groups scroll under the 40px fade when the window is shorter than they
   need (Q2, answered: 56px items, the rail scrolls); the account is pinned to
   the foot. Each item is a 96x56 slot (the whole slot is the target) and
   hover, press and selection paint ONLY the 56x56 circular indicator (D17).
   The selected indicator grows from the icon's centre: one registered progress
   (--_p) drives a round-ended clip-path AND its alpha together, on expressive
   default-spatial (noticed moment #1). Never a scaleX: that squashes the ends. */
@property --_p { syntax: "<number>"; inherits: false; initial-value: 0; }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--app-rail-w); z-index: 1;
  display: flex; flex-direction: column; gap: 4px; padding: 8px 0 16px; overflow: hidden;
}
.rail__menu   { align-self: flex-start; flex: none; margin: 0 0 36px 24px; }  /* 48px box at x 24-72, y 8-56: the tabs' centre line. 36 + the 4px gap = M3E's 40px header space */
.rail__groups { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
                display: flex; flex-direction: column; gap: 4px; }            /* THE scroller (a vertical fade, below); the menu and the account stay put */
.rail__group, .rail__group--clone { display: flex; flex-direction: column; gap: 4px; flex: none; }
.rail__group + .rail__group { margin-top: 12px; position: relative; }
.rail__group + .rail__group::before {
  content: ""; position: absolute; top: -8px; left: 36px; width: 24px; height: 1px;
  background: var(--md-sys-color-outline-variant);
}
.rail__item, .rail__clone {
  display: grid; place-items: center; flex: none; height: var(--app-rail-item-h); width: 100%;
  color: var(--md-sys-color-on-surface-variant); text-decoration: none; position: relative; --_fill: 0;
  -webkit-tap-highlight-color: transparent;
}
.rail__item:hover, .rail__clone:hover { text-decoration: none; }
.rail__item .ico, .rail__clone .ico {
  width: 56px; height: 56px; border-radius: var(--md-sys-shape-corner-extra-large); display: grid; place-items: center;   /* the 56x56 circle (D17) */
  --_icon: var(--app-icon-size-large); --_opsz: 24; --_ind-r: var(--md-sys-shape-corner-extra-large); position: relative; isolation: isolate;
  background-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--_state), transparent);
}
.rail__item .ico::before, .rail__clone .ico::before {             /* the active indicator */
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: var(--md-sys-color-secondary-container);
  --_p: 0; opacity: var(--_p);
  clip-path: inset(0 calc(50% - 50% * var(--_p)) round var(--_ind-r));
}
.rail__item.is-on, .rail__clone.is-on { color: var(--md-sys-color-on-surface); }
.rail__item.is-on .ico, .rail__clone.is-on .ico { --_fill: 1; }
.rail__item.is-on .ico::before, .rail__clone.is-on .ico::before { --_p: 1; }
@media (hover: hover) {
  .rail__item:hover .ico, .rail__clone:hover .ico { --_state: var(--md-sys-state-hover-state-layer-opacity); }
}
.rail__item:active .ico, .rail__clone:active .ico { --_state: var(--md-sys-state-pressed-state-layer-opacity); }
.rail__item.is-on:hover .ico::before {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, var(--md-sys-color-secondary-container));
}
.rail__item:focus-visible { outline: none; }
.rail__item:focus-visible .ico { outline: var(--app-focus-ring); outline-offset: 2px; }
.rail__item--foot { flex: none; }                 /* after .rail__groups, which takes the free height: pinned to the foot */
.rail__item--old { opacity: .38; }
/* THE LABEL IS STILL HERE, just not drawn: the mark is a glyph with no meaning
   of its own, so this span is the link's only accessible name (display: none
   would take it from a screen reader too). The `title` is what a mouse gets. */
.rail__label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .rail__item .ico::before, .rail__clone .ico::before {
    transition: --_p var(--md-sys-motion-expressive-default-spatial-duration) var(--md-sys-motion-expressive-default-spatial);
  }
  .rail__item .ico, .rail__clone .ico {
    transition: background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects),
                font-variation-settings var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
}

/* EXPANDED (D13): a MODAL 256px drawer over a scrim, desktop only, opened by
   the menu button (shell.js). The labels show, the account says his name. The
   icon does not move sideways between the two states: collapsed its left edge
   is at 36 (the 56px circle centred at 48), expanded 20 + 16 = 36. Only the
   4px in-group gaps close (M3E: 0dp between items in the expanded rail). */
.rail.is-expanded {
  width: var(--app-rail-w-expanded); z-index: var(--app-z-scrim);
  background: var(--md-sys-color-surface-container); box-shadow: var(--md-sys-elevation-level2);
  border-start-end-radius: var(--md-sys-shape-corner-large); border-end-end-radius: var(--md-sys-shape-corner-large);
  /* no mask here: the fade lives on .rail__groups inside it, so the rail's own shadow is never clipped */
}
.rail.is-expanded :is(.rail__groups, .rail__group) { gap: 0; }
.rail.is-expanded .rail__item {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;   /* M3E: 8dp icon-to-label */
  height: 56px; width: auto; margin-inline: 20px; padding: 0 16px; border-radius: var(--md-sys-shape-corner-extra-large);
  background-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--_state), transparent);
}
@media (hover: hover) {
  .rail.is-expanded .rail__item:hover { --_state: var(--md-sys-state-hover-state-layer-opacity); }
  .rail.is-expanded .rail__item:hover .ico { --_state: 0%; }
}
.rail.is-expanded .rail__item:active { --_state: var(--md-sys-state-pressed-state-layer-opacity); }
.rail.is-expanded .rail__item:active .ico { --_state: 0%; }
.rail.is-expanded .rail__item .ico { width: 24px; height: 24px; background: none; }
.rail.is-expanded .rail__item .ico::before { display: none; }
.rail.is-expanded .rail__item.is-on {
  background-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--_state), var(--md-sys-color-secondary-container));
}
.rail.is-expanded .rail__item:focus-visible { outline: var(--app-focus-ring); outline-offset: -3px; }
.rail.is-expanded .rail__item:focus-visible .ico { outline: none; }
.rail.is-expanded .rail__label {            /* un-sr-only */
  position: static; width: auto; height: auto; clip-path: none; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; min-width: 0; opacity: 1;
  font-size: var(--md-sys-typescale-label-large-size); line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
}
.rail.is-expanded .rail__item.is-on .rail__label {
  font-weight: var(--md-sys-typescale-emphasized-label-large-weight);
  font-variation-settings: "ROND" var(--md-sys-typescale-emphasized-rond);
}
.rail.is-expanded .rail__group + .rail__group::before { left: 20px; width: calc(100% - 40px); }
.rail-scrim { position: fixed; inset: 0; z-index: var(--app-z-scrim); background: var(--app-color-scrim); }
.rail-scrim[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .rail {
    transition: width var(--md-sys-motion-spring-fast-spatial-duration) var(--md-sys-motion-spring-fast-spatial),
                box-shadow var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects),
                background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  .rail__label {
    transition: opacity var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  .rail.is-expanded .rail__item {
    transition: background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  .rail-scrim {
    transition: opacity var(--md-sys-motion-spring-default-effects-duration) var(--md-sys-motion-spring-default-effects);
  }
  @starting-style { .rail-scrim:not([hidden]) { opacity: 0; } }
}

/* ══════════════════════════════════════════════════════════════ NAVBUSY ══
   §4.5. The navigation's linear INDETERMINATE progress indicator (§3.20's
   two segments in Compose's 1750ms loop, the #333537 track with 4px gaps cut
   as mask holes, so the band shows through them), across the window's top
   edge at every width. The markup does not change. Its show delay and its four
   edge animations share ONE animation declaration, which is why it carries the
   track and bar rules itself rather than the .m3-progress--indeterminate class.
   ⚠️ The 220ms delay is load-bearing: a fast page never shows the bar. It is a
   zero-duration delay, so it is allowed outside the motion block (§2.10). */
.navbusy { position: fixed; top: 0; left: 0; right: 0; height: var(--app-progress-h); z-index: var(--app-z-progress);
           pointer-events: none; overflow: hidden; opacity: 0; }
.navbusy::before, .navbusy::after { content: ""; position: absolute; inset: 0; border-radius: var(--app-shape-corner-mark); }
.navbusy::before {                 /* the track, with a hole (segment + 4px each side) under each segment */
  background: var(--md-sys-color-secondary-container);
  mask-image: linear-gradient(to right,
    black calc(var(--_s2t) - 4px), transparent 0 calc(var(--_s2h) + 4px),
    black 0 calc(var(--_s1t) - 4px), transparent 0 calc(var(--_s1h) + 4px), black 0);
}
.navbusy::after {                  /* the two segments; segment 2 trails segment 1 */
  background: var(--md-sys-color-primary);
  mask-image: linear-gradient(to right,
    transparent var(--_s2t), black 0 var(--_s2h), transparent 0 var(--_s1t), black 0 var(--_s1h), transparent 0);
}
.navbusy.htmx-request { animation: m3-appear 0s 220ms forwards; }
@media (prefers-reduced-motion: no-preference) {
  .navbusy.htmx-request {
    animation: m3-appear 0s 220ms forwards,
               m3-lp-s1h var(--app-motion-progress) infinite, m3-lp-s1t var(--app-motion-progress) infinite,
               m3-lp-s2h var(--app-motion-progress) infinite, m3-lp-s2t var(--app-motion-progress) infinite;
  }
}
@media (prefers-reduced-motion: reduce) {
  .navbusy::before { display: none; }
  .navbusy::after { mask-image: none; opacity: .38; }       /* a still, full bar */
}

/* ═════════════════════════════════════════════ THE BAND AND THE TAB STRIP ══
   §4.4 (K38). The band row is 64px; tabs hang from y 8. An idle tab is 48
   tall; the OPEN tab is 56, so its square bottom sits on the card's top edge
   at y 64, with 12px concave flared feet on both sides, painted in the CARD'S
   OWN COLOUR so the open tab and the card are one surface (2026-10-02: "it
   should look and feel seamless"; the tab and the card's top strip used to be
   washed in the page hue). The strip starts 24px in
   from the card's left edge (the card's 12px corner + the 12px foot), so the
   first foot lands on the straight edge. One strip per pane: split, the band
   takes the panes' two columns. --app-tab-radius cuts the tab, its top
   corners, both feet and .band__split (C4): the shape is one token. */
.band { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--app-spacer);
        padding-right: var(--app-frame); min-width: 0; }
body:has(.content.is-split) .band { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tabbar { display: flex; align-items: flex-start; height: var(--app-band-h); min-width: 0;
          padding: var(--app-tab-top) 12px 0 24px; overflow-x: auto; overflow-y: hidden; }   /* a sideways fade scroller */
.tabbar[hidden] { display: none; }
#ws-tabs-b, body:not(:has(.content.is-split)) #ws-tabs { padding-right: 68px; }            /* clear the split button */
.tab {
  flex: 0 0 var(--app-tab-w); min-width: 0; height: var(--app-tab-h); position: relative;   /* min-width 0: a flex item's automatic minimum is its nowrap name's full width (a story title grew the tab to ~770px) */
  display: flex; align-items: center; gap: 12px; padding: 0 8px 0 16px;
  border-radius: var(--app-tab-radius); text-decoration: none; user-select: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-title-small-size); line-height: var(--md-sys-typescale-title-small-line-height);
  font-weight: var(--md-sys-typescale-title-small-weight);
  --_icon: var(--app-icon-size-medium); --_opsz: 20; --_fill: 0;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { text-decoration: none; }
.tab__ico { flex: none; color: inherit; }
.tab__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab--preview .tab__name { font-style: italic; }
.tab:not(.is-active)[data-state="hover"] { background: var(--md-sys-color-surface-container-high); }
@media (hover: hover) { .tab:not(.is-active):hover { background: var(--md-sys-color-surface-container-high); } }
.tab:not(.is-active) + .tab:not(.is-active)::before {           /* the separator between two idle tabs */
  content: ""; position: absolute; left: 0; top: 14px; width: 1px; height: 20px;
  background: var(--md-sys-color-outline-variant);
}
.tab:is(:hover, [data-state="hover"]) + .tab:not(.is-active)::before,
.tab:not(.is-active):is(:hover, [data-state="hover"])::before { display: none; }   /* never the open tab's ::before: that is its left foot */
.tab.is-active {
  height: var(--app-tab-open-h); background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface);
  border-radius: var(--app-tab-radius) var(--app-tab-radius) 0 0;
}
.tab.is-active .tab__ico { --_fill: 1; }                  /* ink, as the name: no page hue on a tab (2026-10-02) */
.tab.is-active .tab__name { font-weight: var(--md-sys-typescale-emphasized-title-small-weight); font-variation-settings: "ROND" var(--md-sys-typescale-emphasized-rond); }
.tab.is-active::before, .tab.is-active::after {
  content: ""; position: absolute; bottom: 0; width: var(--app-tab-radius); height: var(--app-tab-radius); background: var(--md-sys-color-surface);
}
.tab.is-active::before { left: calc(-1 * var(--app-tab-radius));
  mask: radial-gradient(circle at 0 0, transparent var(--app-tab-radius), black calc(var(--app-tab-radius) + .5px)); }
.tab.is-active::after  { right: calc(-1 * var(--app-tab-radius));
  mask: radial-gradient(circle at 100% 0, transparent var(--app-tab-radius), black calc(var(--app-tab-radius) + .5px)); }
.tab:is(:focus-visible, [data-state="focus"]) { outline: var(--app-focus-ring); outline-offset: -3px; }
body:has(.content.is-split) .tabbar:not(.tabbar--focused) .tab.is-active .tab__name {
  font-weight: var(--md-sys-typescale-title-small-weight); font-variation-settings: "ROND" 0;
  color: var(--md-sys-color-on-surface-variant);          /* the unfocused pane's open tab is quieter */
}
/* The tab's close: an XS standard icon button (workspace.js gives it
   .m3-icon-btn--xs): 32 visible in a 48 box, FILL 0. The tab's 8px end padding
   and the box's cancelling margin end the box exactly at the tab's edge.
   Hidden until the tab is open, hovered or focused; always shown on touch. */
.tab__close { opacity: 0; }
.tab.is-active .tab__close, .tab:is(:hover, [data-state="hover"]) .tab__close, .tab:focus-within .tab__close { opacity: 1; }
@media (hover: none), (pointer: coarse) { .tab__close { opacity: 1; } }
/* The split toggle: an S standard icon TOGGLE that stands in the tab row, so
   it takes the tab family's corner in both states (a control joins the family
   it stands in), pressed 8. Hidden where the split is refused (<=839px). */
.band__split { position: absolute; right: var(--app-frame); top: 8px; margin: 0;
               --_r-round: var(--app-tab-radius); --_r-sq: var(--app-tab-radius); }
@media (max-width: 839px) { .band__split { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  .tab {
    transition: background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects),
                color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  .tab__close {
    transition: opacity var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects),
                border-radius var(--md-sys-motion-spring-default-effects-duration) var(--md-sys-motion-spring-default-effects),
                background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
}

/* ════════════════════════════════════════════════════════════ THE PANES ══
   §4.6. A pane is the content CARD: #131314, radius 12, level-1 shadow, 16px
   padding (one card padding, K28). One colour edge to edge: the open tab is
   the same #131314, so the two read as one surface (the washed 16px RIM it
   used to flow into is gone, 2026-10-02). The
   pane body is a flex column that scrolls; a page that brings its own
   scrollers (.page-scroll, .split, .board, .cal-layout) turns that off.
   --fabreach is the end-reserve under the FAB, given to the pane that has the
   bottom-right corner (never Chat: its composer owns the corner, K6). */
.pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
  border-radius: var(--md-sys-shape-corner-medium); padding: var(--app-viewpad);
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-level1);
  --fabreach: 0px;
}
.pane[hidden] { display: none; }
.content:not(.is-split) .pane[data-pane="0"], .content.is-split .pane[data-pane="1"] { --fabreach: var(--app-fabclear); }
.content .pane[data-page="chat"][data-pane] { --fabreach: 0px; }      /* (0,4,0), written after the rule above: it wins */
body:has(.content.is-split .pane[data-pane="1"][data-page="chat"]) .fab { display: none; }   /* Chat in the right pane: its composer owns the corner (K6) */
.pane__body { flex: 1; min-height: 0; display: flex; flex-direction: column;
              overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding-bottom: var(--fabreach); }
.pane__body:has(> :is(.page-scroll, .split, .board, .cal-layout)) { overflow: hidden; padding-bottom: 0; }
.pane__body > * { flex-shrink: 0; }
.pane__body > :is(.split, .board, .cal-layout, .page-scroll, .pane__empty, .pane__loading, .pane__blank) { flex: 1 1 auto; min-height: 0; }
.pane__empty, .pane__loading { flex: 1; }
.pane__loading { display: grid; place-items: center; height: 100%; }
.pane__loading[hidden] { display: none; }
@media (max-width: 720px) { .pane { border-radius: var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large) 0 0; box-shadow: none; } }
/* Pane B entering on split (noticed moment #5). */
@media (prefers-reduced-motion: no-preference) {
  .content.is-split .pane[data-pane="1"] {
    transition: opacity var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects),
                translate var(--md-sys-motion-expressive-default-spatial-duration) var(--md-sys-motion-expressive-default-spatial);
  }
  @starting-style { .content.is-split .pane[data-pane="1"] { opacity: 0; translate: 24px 0; } }
}

/* THE NOTICE SLOT (§3.27): the first child of every pane body, so the pane-B
   loader (which copies .pane__body's innerHTML) carries a page's notices along.
   Server-rendered page messages go in {% block notices %}. */
.notices { display: grid; gap: 8px; margin-bottom: 16px; }
.notices:empty { display: none; }
.notices[hidden] { display: none; }

/* .page-top / .page-scroll (K19, K45). A page whose top holds controls or key
   data that STAY PUT renders them in the fixed top, and everything else in
   .page-scroll, which paints nothing so it can be a masked scroller. ⚠️ THE TOP
   IS THE CARD'S OWN COLOUR (2026-10-02, "seamless"): no wash and no lip. It
   needs neither to read as fixed, because nothing passes under it: the
   scroller below is its own box, and its 40px top fade takes what rises. */
.pane:has(> .pane__body > .page-top) { padding: 0; }
.pane__body > .page-top { order: -1; }
.page-top { flex: none; position: relative; z-index: 1; background: var(--md-sys-color-surface);
            padding: var(--app-viewpad) var(--app-viewpad) 16px; }
.page-top[hidden] { display: none; }
.page-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
               padding: 28px var(--app-viewpad) calc(var(--app-viewpad) + var(--fabreach)); }  /* 28px under the fixed top, where its lip used to end */
.page-scroll[hidden] { display: none; }
.pane__body:has(> .page-top) > .notices { margin: 16px var(--app-viewpad) 0; }   /* the slot comes first in the DOM, so no sibling combinator can reach it */
.page-top ~ .split { margin: 28px var(--app-viewpad) var(--app-viewpad); }          /* list/detail pages with a fixed top (Mail, Finance) */

/* ═══════════════════════════════════════════════ THE LIST / DETAIL SPLIT ══
   §4.7. The list column has no fill (it sits on the card: implicit grouping);
   the reading region is #1B1B1B, painted BEHIND the detail scroller by
   .split::before (D12: a masked scroller must not paint the ground it fades
   into). Heights come from the grid, never a 100vh-minus-a-guess. */
.split {
  position: relative; isolation: isolate; flex: 1; min-height: 0; height: 100%;
  display: grid; grid-template-columns: var(--app-list-w) minmax(0, 1fr); column-gap: var(--app-spacer);
}
.split[hidden] { display: none; }
.split::before {                                        /* the reading region, painted BEHIND the detail scroller (D12) */
  content: ""; position: absolute; z-index: -1;
  inset: 0 0 0 calc(var(--app-list-w) + var(--app-spacer));
  background: var(--md-sys-color-surface-container-low); border-radius: var(--md-sys-shape-corner-large);
}
.split__list   { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }
.split__list[hidden] { display: none; }
.split__list > .split__search { flex: none; }          /* the 56px bar must not give up its height to the list below it */
.split__detail { min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden;
                 padding: 24px 24px calc(24px + var(--fabreach)); }
@media (min-width: 1200px) { :root { --app-list-w: 412px; } }
/* IN A HALF OF A SPLIT THERE IS NO LIST COLUMN AT ALL (2026-10-05): a half is
   one pane, the list OR the record — see READING MODE, below. The 280px column
   that followed the focused pane ([list · record] [record]) is gone with the
   rules that squeezed a record beside it. */

/* The detail is a loading host (§3.19): each row's open control carries
   hx-indicator="#<detail-id>", and while that request runs the record dims and
   the M3E loading indicator shows over it (after 300ms, so a fast answer never
   flashes a shape). The same rules as .m3-loading-host, for the detail. */
.split__detail { position: relative; }
/* ⚠️ `> .is-waiting`, NEVER `.htmx-request > *` — see m3.css's loading host. */
.split__detail > .is-waiting { opacity: .38; }
.split__detail.htmx-request::after {
  content: ""; position: absolute; left: 50%; top: min(50%, 160px); width: 32.9px; height: 32.9px;
  translate: -50% -50%; background: var(--md-sys-color-primary);
  clip-path: polygon(50% 0.82%, 52.54% 1.5%, 54.83% 4.02%, 56.79% 7.16%, 58.51% 9.94%, 60.15% 12.14%, 61.97% 13.17%, 64.05% 13.39%, 66.67% 12.55%, 69.72% 11.3%, 73.16% 9.88%, 76.47% 9.24%, 78.9% 10.22%, 80.56% 12.26%, 80.94% 15.64%, 80.67% 19.33%, 80.43% 22.6%, 80.46% 25.33%, 81.33% 27.24%, 82.89% 28.64%, 85.5% 29.5%, 88.7% 30.28%, 92.32% 31.16%, 95.37% 32.58%, 96.77% 34.8%, 96.91% 37.43%, 95.22% 40.39%, 92.84% 43.21%, 90.73% 45.72%, 89.14% 47.95%, 88.73% 50%, 89.16% 52.05%, 90.77% 54.28%, 92.9% 56.79%, 95.31% 59.63%, 96.95% 62.58%, 96.77% 65.2%, 95.34% 67.4%, 92.24% 68.81%, 88.65% 69.69%, 85.46% 70.48%, 82.87% 71.35%, 81.33% 72.76%, 80.47% 74.68%, 80.46% 77.43%, 80.71% 80.71%, 81% 84.43%, 80.59% 87.77%, 78.9% 89.78%, 76.45% 90.73%, 73.12% 90.04%, 69.69% 88.65%, 66.66% 87.41%, 64.05% 86.59%, 61.97% 86.83%, 60.15% 87.88%, 58.52% 90.09%, 56.79% 92.9%, 54.84% 96.07%, 52.54% 98.54%, 50% 99.18%, 47.46% 98.5%, 45.17% 95.98%, 43.21% 92.84%, 41.49% 90.06%, 39.85% 87.86%, 38.03% 86.83%, 35.95% 86.61%, 33.33% 87.45%, 30.28% 88.7%, 26.84% 90.12%, 23.53% 90.76%, 21.1% 89.78%, 19.44% 87.74%, 19.06% 84.36%, 19.33% 80.67%, 19.57% 77.4%, 19.54% 74.67%, 18.67% 72.76%, 17.11% 71.36%, 14.5% 70.5%, 11.3% 69.72%, 7.68% 68.84%, 4.63% 67.42%, 3.23% 65.2%, 3.09% 62.57%, 4.78% 59.61%, 7.16% 56.79%, 9.27% 54.28%, 10.86% 52.05%, 11.27% 50%, 10.84% 47.95%, 9.23% 45.72%, 7.1% 43.21%, 4.69% 40.37%, 3.05% 37.42%, 3.23% 34.8%, 4.66% 32.6%, 7.76% 31.19%, 11.35% 30.31%, 14.54% 29.52%, 17.13% 28.65%, 18.67% 27.24%, 19.53% 25.32%, 19.54% 22.57%, 19.29% 19.29%, 19% 15.57%, 19.41% 12.23%, 21.1% 10.22%, 23.55% 9.27%, 26.88% 9.96%, 30.31% 11.35%, 33.34% 12.59%, 35.95% 13.41%, 38.03% 13.17%, 39.85% 12.12%, 41.48% 9.91%, 43.21% 7.1%, 45.16% 3.93%, 47.46% 1.46%);
  opacity: 0; pointer-events: none; animation: m3-appear 0s 300ms forwards;
}
@media (prefers-reduced-motion: no-preference) {
  .split__detail.htmx-request::after {
    animation: m3-appear 0s 300ms forwards,
               m3-loading-morph var(--app-motion-loading-morph) linear infinite,
               m3-loading-step var(--app-motion-loading-step) linear infinite,
               m3-loading-spin var(--app-motion-loading-spin) linear infinite;
  }
}

/* THE RECORD HEAD IS THE DETAIL'S FIXED TOP (K19). The first head of a record
   in a .split__detail sticks to the top of the reading region while the record
   scrolls under it. ⚠️ IT IS THE REGION'S OWN COLOUR (2026-10-02, "seamless"):
   at rest it is no band at all, only the top of the record. What rises under
   it fades out over the app's 40px, as at every scroller's edge, through a
   SKIRT painted below the head: the scroller's own mask cannot do it, because a
   mask fades the whole group and would dissolve the pinned head with it. The
   skirt's length ramps with the scroll exactly as the masks do (the fades
   section, below), so a record at its top has none. The detail itself is
   therefore a BOTTOM-only fade scroller. */
.split__detail { --detail-tone: var(--md-sys-color-surface-container-low); }
.split__detail:has(> [data-tab-name] > :is(.card-detail__head, .fin__head, .chat__title):first-child) { padding-top: 0; }
.split__detail > [data-tab-name] > :is(.card-detail__head, .fin__head, .chat__title):first-child {
  position: sticky; top: 0; z-index: 2;
  margin: 0 -24px 12px; padding: 24px 24px 16px;              /* full width of the region; 12 + the record's 16px gap = 28px to the record */
  background: var(--detail-tone); border-radius: var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large) 0 0;   /* the region's own corners: square ones would poke out of its arc */
}
.split__detail > [data-tab-name] > :is(.card-detail__head, .fin__head, .chat__title):first-child::after {   /* the skirt */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: var(--m3-fade-start); pointer-events: none;
  background: linear-gradient(var(--detail-tone), transparent);
}

/* ════════════════════════════════════════════════════════ READING MODE ══
   §4.8 (K10, C3). At <=839px (M3 compact + medium) a list/detail page shows
   the LIST or the RECORD, never both. A tap enters .is-reading and pushes ONE
   history marker (workspace.js); the system back, or the shell's Back at the
   top of the record, pops it. The record enters on @starting-style (the old
   readin/listback keyframes are deleted: they fought the fades); an arrival
   on the list is still, as every arrival is. */
.reading__back {
  display: none;                                       /* FIRST declaration, test-pinned */
  --_inset: 0px;
  align-items: center; gap: 8px; height: calc(40px + 2 * var(--_inset)); padding: 0 16px 0 12px;
  margin: 0 0 calc(8px - 2 * var(--_inset));           /* flush with the record (the detail clips: a negative start margin cut off the button and its ring); 48px tall in all, with or without the touch inset */
  border: var(--_inset) solid transparent; background-clip: padding-box;
  border-radius: calc(20px + var(--_inset)); cursor: pointer; color: var(--md-sys-color-on-surface);
  --_container: transparent; --_state-color: var(--md-sys-color-on-surface);
  background-color: color-mix(in srgb, var(--_state-color) var(--_state, 0%), var(--_container));
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-label-large-size); line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight); --_icon: var(--app-icon-size-medium); --_opsz: 20; --_fill: 0;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .reading__back:hover { --_state: var(--md-sys-state-hover-state-layer-opacity); } }
/* The ring is drawn INSIDE the visible pill (§2.14: a clipping parent): the
   record scroller clips at the button's edges. */
.reading__back:focus-visible { --_state: var(--md-sys-state-focus-state-layer-opacity);
                               outline-offset: calc(var(--app-focus-offset-inner) - var(--_inset)); }
/* The 48px target on touch (§2.12): a 4px transparent border around the 40px
   pill, its corner 20 + 4, so the visible shape is unchanged. The bottom margin
   gives the inset back, so the Back row still takes 48px (Mail sizes its body
   against that). */
@media (pointer: coarse) { .reading__back { --_inset: 4px; } }
.reading__back:active { --_state: var(--md-sys-state-pressed-state-layer-opacity); }
@media (max-width: 839px) {
  /* (0,2,0), not (0,1,0): a page's own two-column grid on its .split (Knowledge's
     .kb, which loads after this file) must not survive into one-pane mode — it
     drew the record in a 290px column with the card empty beside it. */
  .content .split { grid-template-columns: minmax(0, 1fr); }
  .split::before { display: none; }
  /* LIST MODE: the list scroller is the pane's only scroller, so IT reserves
     the end under the FAB (K6) — the last row must scroll clear of the corner.
     A page whose list is not a scroller of its own (Finance's .rows; Knowledge's
     tree, which flows at this width) scrolls in the list COLUMN instead, so
     that reserve can be reached at all: the pane body does not scroll here. */
  .content:not(.is-reading) .split__list :is(.people, .messages, .stories, .convos, .kb__list),
  .content:not(.is-reading) .split__list > .rows { padding-bottom: var(--fabreach); }
  /* (0,4,0): Knowledge's tree is set to flow at this width (pages/knowledge.css),
     which let it overflow its own box and kept its reserve out of reach.
     ⚠️ NO TWIN below: a half of a split keeps the accordion (Klaus, 2026-10-20),
     the open folder its only scroller — test_design check 12 names this rule. */
  .content:not(.is-reading) .split__list .kb__list { overflow-y: auto; }
  .content:not(.is-reading) .split__list { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; }
  .content:not(.is-reading) .split__list::-webkit-scrollbar { display: none; }
  .content:not(.is-reading) .split__detail { display: none; }
  .content.is-reading .split__list { display: none; }
  .content.is-reading .head { display: none; }
  .content.is-reading .reading__back { display: inline-flex; }
  .split__detail { padding: 0 0 calc(16px + var(--fabreach)); }
  .split__detail { --detail-tone: var(--md-sys-color-surface); }   /* no reading region at this width: the head is the card's colour */
  .split__detail > [data-tab-name] > :is(.card-detail__head, .fin__head, .chat__title):first-child {
    margin-inline: 0; padding: 16px; border-radius: var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0 0;
  }
}
/* THE SAME, IN EACH HALF OF A SPLIT, AT ANY WIDTH. Klaus, 2026-10-05: "when in
   split view, the individual views should behave like they are in mobile
   (meaning no sidebars, but rather have a back button that leads to the list.
   and when in an element, dont show the list at all)". A half is one pane: its
   LIST, or its RECORD with the shell's Back at the top. The state is the
   PANE's here (`.pane.is-reading`, workspace.js) because the two halves do not
   move together; <main> carries the class on a phone only. No history marker:
   two panes cannot share one back, so the ← is the way to the list.
   ⚠️ EVERY RULE OF THE BLOCK ABOVE IS RESTATED, declaration for declaration.
   CSS cannot say "this media query OR that class" in one rule, so the one-pane
   tier is written twice — here and in each page file that has a
   `(max-width: 839px)` block. A rule added for the phone and not for the split
   is a list beside a record again: test_design check 12 compares the two.
   ⚠️ AND AT THE SAME WEIGHT. `.content.is-split` is written inside :where(),
   and `.pane` stands where `.content` stood, so each twin weighs exactly what
   its original does and sits right after it. A heavier twin would start
   beating page rules the phone's rule loses to on purpose (Knowledge's
   `.kb__detail { padding: 0 }` is one: its note brings its own insets). */
.content:where(.is-split) .split { grid-template-columns: minmax(0, 1fr); }
:where(.content.is-split) .split::before { display: none; }
:where(.content.is-split) .pane:not(.is-reading) .split__list :is(.people, .messages, .stories, .convos, .kb__list),
:where(.content.is-split) .pane:not(.is-reading) .split__list > .rows { padding-bottom: var(--fabreach); }
:where(.content.is-split) .pane:not(.is-reading) .split__list { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; }
:where(.content.is-split) .pane:not(.is-reading) .split__list::-webkit-scrollbar { display: none; }
:where(.content.is-split) .pane:not(.is-reading) .split__detail { display: none; }
:where(.content.is-split) .pane.is-reading .split__list { display: none; }
:where(.content.is-split) .pane.is-reading .head { display: none; }
:where(.content.is-split) .pane.is-reading .reading__back { display: inline-flex; }
:where(.content.is-split) .split__detail { padding: 0 0 calc(16px + var(--fabreach)); }
:where(.content.is-split) .split__detail { --detail-tone: var(--md-sys-color-surface); }   /* no reading region in a half either: the head is the card's colour */
:where(.content.is-split) .split__detail > [data-tab-name] > :is(.card-detail__head, .fin__head, .chat__title):first-child {
  margin-inline: 0; padding: 16px; border-radius: var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0 0;
}
@media (prefers-reduced-motion: no-preference) {
  .reading__back {
    transition: background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 839px) {
  .content.is-reading .split__detail {
    transition: translate var(--md-sys-motion-spring-default-spatial-duration) var(--md-sys-motion-spring-default-spatial),
                opacity var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  @starting-style { .content.is-reading .split__detail { translate: 24px 0; opacity: 0; } }
}
@media (prefers-reduced-motion: no-preference) {                 /* …and the record enters a half the same way */
  :where(.content.is-split) .pane.is-reading .split__detail {
    transition: translate var(--md-sys-motion-spring-default-spatial-duration) var(--md-sys-motion-spring-default-spatial),
                opacity var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  @starting-style { :where(.content.is-split) .pane.is-reading .split__detail { translate: 24px 0; opacity: 0; } }
}

/* ═════════════════════════════════════════════ THE FAB AND THE ASSISTANT ══
   §3.3, §4.9 (K6). ⚠️ THE BOTTOM-RIGHT CORNER BELONGS TO THIS BUTTON, and it
   is absent on /chat/. At >=721px the MEDIUM FAB (80x80, corner 20, a 28px
   glyph); at <=720px the 56px FAB (corner 16), lifted clear of the phone nav
   bar. Grey (#333537) with an on-surface state layer, never a coloured fill
   (answer 1). The Google-gradient GLOW (.fab::before) is its hover affordance
   (K50: the FAB carries no tooltip) and the scheme's one sanctioned
   polychrome mark: at rest a hairline ring 1.5px outside the FAB, a blurred
   bloom on hover, focus and while the panel is open. The square is re-derived
   for both sizes, concentric at scale .865: 96 -> 83 visible (80 + 1.5 a
   side), corner 25 -> 21.6 = 20 + 1.5; 68 -> 58.8, 20 -> 17.3 = 16 + 1.4. */
@property --app-fab-spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.fab { position: fixed; right: var(--app-frame); bottom: calc(var(--app-frame) + var(--app-navbar-offset)); z-index: var(--app-z-assistant);
       display: grid;
       --_fab-r: var(--md-sys-shape-corner-large-increased); --_fab-icon: 28px; --_glow: 96px; --_glow-off: -8px; --_glow-r: 25px; }
.fab[hidden] { display: none; }
@media (max-width: 720px) {
  .fab { right: 16px; bottom: calc(var(--app-navbar-offset) + 16px);
         --_fab-r: var(--md-sys-shape-corner-large); --_fab-icon: var(--app-icon-size-large); --_glow: 68px; --_glow-off: -6px; --_glow-r: 20px; }
}
.fab::before {
  content: ""; position: absolute; right: var(--_glow-off); bottom: var(--_glow-off);
  width: var(--_glow); height: var(--_glow);
  border-radius: var(--_glow-r);
  z-index: 0; opacity: .9; transform: scale(.865); pointer-events: none;
  background: conic-gradient(from calc(var(--app-fab-spin) + 210deg),
    var(--app-color-glow-1), var(--app-color-glow-2), var(--app-color-glow-3),
    var(--app-color-glow-4), var(--app-color-glow-5), var(--app-color-glow-6), var(--app-color-glow-1));
}
.fab:has(.fab__button:is(:hover, :focus-visible, [aria-expanded="true"], [data-state]))::before { transform: scale(.95); filter: blur(6px); }
.fab__button {
  position: relative; z-index: 1;
  width: var(--app-fab); height: var(--app-fab); border-radius: var(--_fab-r);
  display: grid; place-items: center; padding: 0; border: 0; cursor: pointer;
  --_container: var(--md-sys-color-primary-container); --_state-color: var(--md-sys-color-on-primary-container);
  background-color: color-mix(in srgb, var(--_state-color) var(--_state), var(--_container));
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-level3);
  --_icon: var(--_fab-icon); --_opsz: 28; --_fill: 1;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 2px;
}
@media (max-width: 720px) { .fab__button { --_opsz: 24; } }
.fab__button[data-state="hover"] { --_state: var(--md-sys-state-hover-state-layer-opacity); box-shadow: var(--md-sys-elevation-level4); }
@media (hover: hover) {
  .fab__button:hover { --_state: var(--md-sys-state-hover-state-layer-opacity); box-shadow: var(--md-sys-elevation-level4); }
}
.fab__button:is(:focus-visible, [data-state="focus"]) { --_state: var(--md-sys-state-focus-state-layer-opacity); }
.fab__button[aria-expanded="true"] { --_state: var(--md-sys-state-pressed-state-layer-opacity); }
.fab__button:is(:active, [data-state="pressed"]) { --_state: var(--md-sys-state-pressed-state-layer-opacity); box-shadow: var(--md-sys-elevation-level3); }
/* While the undo bar is up the FAB steps out of its way: the 48px bar + 16. */
body:has(#undo:not([hidden])) .fab { translate: 0 -64px; }
@media (prefers-reduced-motion: no-preference) {
  .fab::before {
    animation: m3-fab-spin var(--app-motion-fab-spin) linear infinite;
    transition: transform var(--md-sys-motion-spring-default-spatial-duration) var(--md-sys-motion-spring-default-spatial),
                filter var(--md-sys-motion-spring-default-effects-duration) var(--md-sys-motion-spring-default-effects);
  }
  .fab__button {
    transition: background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects),
                box-shadow var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  .fab {
    transition: translate var(--md-sys-motion-spring-default-spatial-duration) var(--md-sys-motion-spring-default-spatial);
  }
}
@keyframes m3-fab-spin { to { --app-fab-spin: 360deg; } }

/* THE PANEL (noticed moment #3): it opens out of the FAB's corner on
   expressive default-spatial. Capped against the VIEWPORT, so on a phone in
   landscape the composer (the one part that must always be reachable) never
   goes off the bottom.
   ⚠️ `hidden` loses to the `display: flex` below; the [hidden] rule is what
   makes it mean hidden (a test holds the pair together). */
.fab__panel {
  position: absolute; right: 0; bottom: calc(var(--app-fab) + 16px);
  width: min(400px, 100vw - 48px); height: min(600px, 100dvh - var(--app-fab) - 128px);
  display: flex; flex-direction: column; overflow: hidden; transform-origin: 100% 100%;
  background: var(--md-sys-color-surface-container-high); border-radius: var(--md-sys-shape-corner-extra-large);
  box-shadow: var(--md-sys-elevation-level3);
}
.fab__panel[hidden] { display: none; }
.fab__head { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 8px 8px 24px; flex: none; }
.fab__head b {
  color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-title-medium-size); line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: var(--md-sys-typescale-title-medium-weight);
}
.fab__model {                                   /* who answers: the model's name, never cut mid-word by the link */
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-medium-size); line-height: var(--md-sys-typescale-label-medium-line-height);
  font-weight: var(--md-sys-typescale-label-medium-weight);
}
.fab__model:empty { display: none; }
.fab__hand {                                    /* a text-button-shaped LINK to the Chat page */
  flex: none; margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px;
  height: 40px; padding: 0 12px 0 16px; border-radius: 20px; text-decoration: none;
  color: var(--md-sys-color-on-surface);
  --_container: transparent; --_state-color: var(--md-sys-color-on-surface);
  background-color: color-mix(in srgb, var(--_state-color) var(--_state), var(--_container));
  font-size: var(--md-sys-typescale-label-large-size); line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
}
.fab__hand:hover { text-decoration: none; }
@media (hover: hover) { .fab__hand:hover { --_state: var(--md-sys-state-hover-state-layer-opacity); } }
.fab__hand:focus-visible { --_state: var(--md-sys-state-focus-state-layer-opacity); }
.fab__hand:active { --_state: var(--md-sys-state-pressed-state-layer-opacity); }
/* aria-disabled while an answer streams (leaving would lose the turn): M3's
   disabled label and no state layer. After the state rules, which weigh the same. */
.fab__hand[aria-disabled="true"] {
  --_state: 0%; cursor: default;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-disabled-content-opacity), transparent);
}
.fab__hand .ico { --_icon: var(--app-icon-size-medium); --_opsz: 20; color: var(--md-sys-color-on-surface-variant); }
.fab__close { flex: none; }
.fab__thread { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 24px 16px;
               display: flex; flex-direction: column; gap: 12px; }
.fab__composer { flex: none; width: auto; margin: 0 16px 16px; }
/* Send: a filled S icon button (ink, white on hover, a 24px FILL 1 arrow). No
   48px border: the 56px composer is its target area. */
.fab__composer .btn--primary {
  --_inset: 0px; --_pad: 0px; --_icon: var(--app-icon-size-large); --_opsz: 24; --_fill: 1;
  --_elev-1: var(--app-elevation-none);
  width: 40px; min-width: 40px; margin: 0; flex: none;
}
@media (max-width: 720px) {
  .fab__panel { position: fixed; left: 8px; right: 8px; width: auto;
                bottom: calc(var(--app-navbar-offset) + 16px + var(--app-fab) + 8px);
                height: min(560px, 100dvh - var(--app-navbar-offset) - 160px); }
}
@media (prefers-reduced-motion: no-preference) {
  .fab__panel:not([hidden]) {
    transition: scale var(--md-sys-motion-expressive-default-spatial-duration) var(--md-sys-motion-expressive-default-spatial),
                opacity var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
  @starting-style { .fab__panel:not([hidden]) { scale: .8; opacity: 0; } }
  .fab__hand {
    transition: background-color var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects);
  }
}

/* BUBBLES (shared by the panel and /chat/). The user's question is a bubble
   with one extra-small corner (M3E: mix round and square); the model's reply
   is unbubbled text, as in Gemini. */
.bubble {
  max-width: 82%; margin: 0; border-radius: var(--md-sys-shape-corner-large-increased); padding: 12px 16px;
  font-size: var(--md-sys-typescale-body-large-size); line-height: var(--md-sys-typescale-body-large-line-height);
  font-weight: var(--md-sys-typescale-body-large-weight);
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--md-sys-color-on-surface);
}
.bubble[hidden] { display: none; }
.bubble--user  { align-self: flex-end; background: var(--md-sys-color-surface-container-highest); border-end-end-radius: var(--md-sys-shape-corner-extra-small); }
.bubble--model { align-self: stretch; max-width: none; padding: 0; background: none; }
/* .bubble--by is the line over an answer that names the model that wrote it
   (and, when it is not the default, why the default did not). */
.bubble--tool, .bubble--by {
  align-self: flex-start; padding: 0; background: none; color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-medium-size); line-height: var(--md-sys-typescale-label-medium-line-height);
  font-weight: var(--md-sys-typescale-label-medium-weight);
}
a.bubble--tool { color: var(--app-color-accent); text-decoration: none; }
a.bubble--tool:hover { text-decoration: underline; }
.bubble--error { align-self: flex-start; padding: 0; background: none; color: var(--md-sys-color-error); display: flex; gap: 8px; }
.bubble--error::before {
  content: "error"; flex: none; font-family: var(--app-typeface-icon); font-weight: normal; font-style: normal;
  font-size: var(--app-icon-size-medium); line-height: 24px; font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "opsz" 20;
}

/* WHAT AN ANSWER USED (shell.js, Dashboard.reply.tools): one row OVER the
   answer — the fold, then a label chip per tool, side by side until the line
   is full; folded, the fold alone ("3 tools"). The chips are data
   (.m3-chip--label), one step above the ground: #333537 on the panel's #282A2C
   and the Chat page's #1B1B1B, #282A2C where that thread lies on the card
   (pages/chat.css). The fold is an outlined chip at their 24, in a 48 box
   pulled back to the visible one, so the row is as tall as its chips; its end
   margin leaves 16 between it and the first chip, which its box cannot reach.
   ⚠️ IT STARTS AT THE THREAD'S EDGE, ring drawn inside: the Chat thread has no
   side padding under ~800px and clips sideways, so a hover layer hung off the
   text's left edge would be cut. */
.toolrow {
  --_chip: var(--md-sys-color-surface-container-highest);
  align-self: stretch; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.toolrow__fold {
  --_h: 24px; --_inset: 12px; --_pad-s: 8px;
  --_r: var(--md-sys-shape-corner-small); --_r-press: var(--md-sys-shape-corner-extra-small);
  --_label: var(--md-sys-color-on-surface-variant);
  gap: 2px; margin: -12px -4px -12px -12px;
  font-size: var(--md-sys-typescale-label-medium-size); line-height: var(--md-sys-typescale-label-medium-line-height);
  font-weight: var(--md-sys-typescale-label-medium-weight);
  outline-offset: calc(var(--app-focus-offset-inner) - var(--_inset));
}
.toolrow > .toolrow__item { --_container: var(--_chip); min-width: 0; max-width: 100%; }
.toolrow__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.toolrow.is-folded > .toolrow__item { display: none; }

/* AN ANSWER'S MARKDOWN (shell.js, Dashboard.reply). A model's turn is rendered,
   on the Knowledge reading view's scale (pages/knowledge.css, .kbr__body) so a
   note and an answer about it read as one document, at the bubble's own 24px
   line and with the shorter air a reply's heads want. Monochrome: inline code
   and a mark are the grey step, a block of code is a well one step off its
   ground (--_well: the card's #131314 under the assistant's panel and the Chat
   page's reading region; pages/chat.css lifts it where the thread lies on the
   card itself), a quote is a line. `.md-*` and `.md__*` are the renderer's own
   names (kblive/ai.js).
   ⚠️ `white-space` goes back to normal: `.bubble`'s pre-wrap is for the text a
   turn is while nothing has rendered it, and would keep a model's indentation. */
.bubble--md { --_well: var(--md-sys-color-surface); white-space: normal; }
.bubble--md :is(p, ul, ol, blockquote) { margin: 0 0 12px; }
.bubble--md del { color: var(--app-color-on-surface-low); }
.bubble--md mark {
  padding: 1px 4px; border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-surface);
}
/* The reading view's ladder (K43): weight names a section, and the air is
   above a head, which belongs to what follows it. h2 and h3 share 16px. */
.bubble--md :is(h1, h2, h3, h4, h5, h6) { margin: 20px 0 4px; color: var(--md-sys-color-on-surface); }
.bubble--md h1 {
  margin-top: 28px; margin-bottom: 8px;
  font-family: var(--md-ref-typeface-brand);
  font-size: var(--md-sys-typescale-title-large-size);
  line-height: var(--md-sys-typescale-title-large-line-height);
  font-weight: var(--md-sys-typescale-emphasized-title-large-weight);
  font-variation-settings: "ROND" var(--md-sys-typescale-emphasized-rond);
}
.bubble--md h2 {
  margin-top: 24px; margin-bottom: 8px;
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: var(--md-ref-typeface-weight-semibold);
  font-variation-settings: "ROND" var(--md-sys-typescale-emphasized-rond);
}
.bubble--md h3 {
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: var(--md-sys-typescale-title-medium-weight);
}
.bubble--md :is(h4, h5, h6) {
  margin-top: 16px;
  font-size: var(--md-sys-typescale-title-small-size);
  line-height: var(--md-sys-typescale-title-small-line-height);
  font-weight: var(--md-sys-typescale-title-small-weight);
}
.bubble--md h6 { color: var(--md-sys-color-on-surface-variant); }
.bubble--md :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) { margin-top: 8px; }   /* two heads in a row are one thing */

.bubble--md :is(ul, ol) { padding-inline-start: 24px; }
.bubble--md li { margin: 2px 0; }
.bubble--md li > :is(ul, ol) { margin: 2px 0 4px; }
.bubble--md li::marker { color: var(--md-sys-color-on-surface-variant); }
/* A task is the reading view's: a glyph, not a checkbox that looks pressable
   and is not. The renderer's disabled input stays for a screen reader, unseen. */
.bubble--md li.md__task { position: relative; list-style: none; margin-inline-start: -24px; padding-inline-start: 28px; }
.bubble--md li.md__task > input { position: absolute; opacity: 0; pointer-events: none; }
.bubble--md li.md__task::before {
  content: "check_box_outline_blank"; position: absolute; inset-inline-start: 0; top: 0;
  font-family: var(--app-typeface-icon); font-weight: normal; font-style: normal;
  font-size: var(--app-icon-size-medium); line-height: 24px; font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "opsz" 20;
  color: var(--md-sys-color-on-surface-variant);
}
.bubble--md li.md__task.is-done { color: var(--app-color-on-surface-low); text-decoration: line-through; }
.bubble--md li.md__task.is-done::before { content: "check_box"; font-variation-settings: "FILL" 1, "opsz" 20; }

.bubble--md blockquote {
  padding-inline-start: 16px;
  border-inline-start: 3px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
}
.bubble--md blockquote > :last-child { margin-bottom: 0; }
.bubble--md hr { height: 1px; margin: 16px 0; border: 0; background: var(--md-sys-color-outline-variant); }
.bubble--md a { text-decoration: underline; text-underline-offset: 3px; }   /* accent ink (m3.css); underlined, as a link inside prose is */
.bubble--md .md__img { max-width: 100%; height: auto; border-radius: var(--md-sys-shape-corner-small); }

/* The well's CODE is the sideways scroller, so the fade dissolves the text and
   never the well's own ground and corners (§4.13). */
.bubble--md code {
  padding: 1px 4px; border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-surface);
}
.bubble--md pre {
  margin: 0 0 12px; padding: 12px 0;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--_well);
  overflow: hidden;
}
.bubble--md pre > code {
  display: block; padding: 0 16px; border-radius: 0; background: none;
  overflow-x: auto; overflow-y: hidden; white-space: pre; overflow-wrap: normal;
  color: var(--md-sys-color-on-surface-variant);
}
/* ⚠️ `overflow-wrap: break-word`, not the bubble's `anywhere`: `anywhere` counts
   towards a cell's minimum width, so a table too wide for the card squeezed its
   columns to a letter each instead of scrolling. */
.bubble--md .md-table { margin: 0 0 12px; overflow-x: auto; overflow-y: hidden; }
.bubble--md table {
  border-collapse: collapse; overflow-wrap: break-word;
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
  font-variant-numeric: tabular-nums;
}
.bubble--md :is(th, td) {
  padding: 8px 12px; text-align: start; vertical-align: top;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.bubble--md th {
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-title-small-size);
  line-height: var(--md-sys-typescale-title-small-line-height);
  font-weight: var(--md-sys-typescale-title-small-weight);
}

/* Maths. Until KaTeX has drawn it (the answer is still arriving) the TeX shows,
   set apart in mono and never as italics that could be read as the answer.
   Left, not centred, as in a note. (0,3,0) over katex.min.css's two centrings. */
.bubble--md .md-math:not([data-done]) {
  font-family: var(--app-typeface-mono);
  font-size: var(--app-typescale-mono-size);
  color: var(--app-color-on-surface-low);
}
.bubble--md .md-mathblock { margin: 12px 0; overflow-x: auto; overflow-y: hidden; }
.bubble--md .md-math .katex { color: inherit; }
.bubble--md .md-math .katex-display { margin: 0; }
.bubble--md .md-math .katex-display,
.bubble--md .md-math .katex-display > .katex { text-align: left; }

.bubble--md .md__fnref { line-height: 0; }
.bubble--md .md__fnref a { text-decoration: none; }
.bubble--md .md__footnotes {
  margin: 16px 0 0; padding-top: 8px; padding-inline-start: 24px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
}
/* After every block's own margins, which weigh the same. */
.bubble--md > :first-child { margin-top: 0; }
.bubble--md > :last-child { margin-bottom: 0; }

/* THE WAIT FOR A MODEL (K51): three bobbing full stops set in the answer's
   type, not the loading indicator. assistant.js (and chat.js) append it as the
   thread's last child and remove it on the first frame. Still under reduced
   motion. */
.thinking { display: inline-flex; }
.thinking__dot { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .thinking__dot { animation: m3-thinking var(--app-motion-thinking) var(--md-sys-motion-easing-standard) infinite; }
  .thinking__dot:nth-child(2) { animation-delay: 160ms; }
  .thinking__dot:nth-child(3) { animation-delay: 320ms; }
}
@keyframes m3-thinking { 0%, 55%, 100% { translate: 0 0; } 25% { translate: 0 -0.25em; } }   /* half the x-height */

/* ════════════════════════════════════════════════════════ THE UNDO BAR ══
   §3.13, §4.10 (K1, K2, K54). ⚠️ A delete NEVER asks: it happens, and this
   holds it for 6 seconds. There is no confirm dialog anywhere in this app.
   Pinned to the bottom edge (above the phone nav bar), a grey ladder step (not
   M3's inverse snackbar), square bottom corners, rising out of the edge on
   expressive default-spatial (noticed moment #4). The 8px skirt shadow in the
   bar's own colour keeps the pinned edge from lifting off the window at the
   rise's ~0.7px overshoot. Centred by margins, so `translate` stays free for
   the rise. Undo is the accent's text use (K54); the x is on-surface-variant.
   ⚠️ `hidden` LOSES TO ANY `display` RULE: the [hidden] twin is what makes the
   empty bar actually hidden (a test holds the pair together). */
.undo {
  position: fixed; bottom: var(--app-navbar-offset); left: 0; right: 0; margin-inline: auto;
  width: fit-content; min-width: min(344px, 100vw - 32px); max-width: min(600px, 100vw - 32px);
  min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px;
  border-radius: var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0 0;
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface);
  box-shadow: 0 8px 0 0 var(--md-sys-color-surface-container-high), var(--app-elevation-level3-up);
  z-index: var(--app-z-snackbar);
}
.undo[hidden] { display: none; opacity: 0; }
.undo__text {
  flex: 1; min-width: 0; margin: 0; padding: 14px 0;
  font-size: var(--md-sys-typescale-body-medium-size); line-height: var(--md-sys-typescale-body-medium-line-height);
}
.undo__action { flex: none; --_label: var(--app-color-accent); color: var(--app-color-accent); margin-inline: 0; }
.undo__close { flex: none; margin-inline: 0; }
@media (prefers-reduced-motion: no-preference) {
  .undo {
    transition: translate var(--md-sys-motion-expressive-default-spatial-duration) var(--md-sys-motion-expressive-default-spatial),
                opacity var(--md-sys-motion-spring-fast-effects-duration) var(--md-sys-motion-spring-fast-effects),
                display var(--md-sys-motion-spring-fast-effects-duration) allow-discrete;
  }
  @starting-style { .undo:not([hidden]) { translate: 0 100%; } }
}

/* ═══════════════════════════════════════════════════ THE PHONE NAV BAR ══
   §4.11 (K12). At <=720px the rail is the bottom bar: icon-only, grouped, ONE
   group at a time, swiped, looping both ways (static/navbar.js clones the end
   groups), no dots, no account (that lifts to the app bar). .rail__groups is
   the swipe track (a snap carousel, so not a fade scroller). An item is a
   64px slot whose indicator is 56x32 (the M3E flexible bar's indicator with
   the label line removed; a 56px circle would not fit a 64px bar), growing
   exactly as on the rail. Labels stay screen-reader text. No shadow, no top
   border: the bar is the canvas, the card above it is #131314. */
@media (max-width: 720px) {
  .rail {
    position: static; width: auto; height: var(--app-navbar-offset); z-index: auto;
    display: block; padding: 0 0 env(safe-area-inset-bottom, 0px); overflow: visible;
    background: var(--md-sys-color-surface-container);
  }
  .rail__menu { display: none; }
  .rail__groups {
    position: relative;                             /* the groups' offsetParent: navbar.js reads their offsetLeft */
    height: var(--app-navbar-h); display: flex; flex-direction: row; gap: 0;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .rail__groups::-webkit-scrollbar { display: none; }
  .rail__group, .rail__group--clone {
    flex: 0 0 100%; height: var(--app-navbar-h); margin: 0; gap: 0;
    display: flex; flex-direction: row; align-items: center; justify-content: space-around;
    scroll-snap-align: start; scroll-snap-stop: always;
  }
  .rail__group + .rail__group { margin-top: 0; }
  .rail__group + .rail__group::before { display: none; }
  .rail__item, .rail__clone { flex: 1 1 0; width: auto; height: var(--app-navbar-h); min-width: 64px; }
  .rail__item .ico, .rail__clone .ico { height: 32px; border-radius: var(--md-sys-shape-corner-large); --_ind-r: var(--md-sys-shape-corner-large); }

  /* THE PHONE APP BAR (§4.12; K11, D6): the band's 64px row. No tabs on a
     phone (the strip's DOM stays, hidden) and NO TITLE: the nav bar says which
     page this is and an open record names itself in its own head. It holds
     the account disc at the top right: the same element as the rail's foot,
     moved by one override. */
  .band { grid-template-columns: minmax(0, 1fr); padding: env(safe-area-inset-top, 0px) 0 0; }
  .band .tabbar, .band .band__split { display: none; }
  .rail__item--foot {
    position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); right: 8px; z-index: var(--app-z-float);
    width: 48px; height: 48px; min-width: 0; margin: 0;
  }
  .rail__item--foot .ico { width: 40px; height: 40px; border-radius: 20px; }
  .rail__item--foot .ico::before { display: none; }
}

/* WHILE HE TYPES ON A PHONE (the keyboard is up: resizes-content shrinks the
   viewport) the nav bar and the FAB step away — the Gmail rule. On a 560px
   viewport the app bar and nav bar together took 128px, and the FAB sat on the
   bottom-right of the reply textarea, where long text ends up. Zeroing the
   OFFSET (not only hiding the bar) gives its row back to the card and lets
   everything anchored to it (undo bar, the calendar sheet) follow. Only fields
   that raise a keyboard count: a select opens a picker, a checkbox none. The
   assistant's own composer is not in a .pane, so its panel stays put.
   ⚠️ AND WHILE FOCUS IS ANYWHERE IN A FORM THAT HOLDS ONE (2026-10-01). A tap on
   Save or a reach radio moves focus off the field FIRST: the bar came back, the
   FAB landed on Contacts' Save and the calendar sheet jumped 64px, so the tap
   hit nothing. Chrome focuses the tapped button, so with :focus-within nothing
   moves under the finger. ⚠️ EDITING forms only, named: a list whose every row
   is a small form (Finance's flags) would lose its nav bar to a tap on a chip. */
@media (max-width: 720px) and (pointer: coarse) {
  :root:has(.pane :is(input:is(:not([type]), [type="text"], [type="search"], [type="email"], [type="url"],
                               [type="tel"], [type="number"], [type="password"]),
                      textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]):focus,
            .pane :is(form.card-detail, form.card--editing, form.column__add, form.setform, form.kb__note--editing, form.chat__composer):focus-within :is(input:is(:not([type]), [type="text"], [type="search"], [type="email"], [type="url"],
                               [type="tel"], [type="number"], [type="password"]),
                      textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"])) {
    --app-navbar-offset: 0px;
  }
  body:has(.pane :is(input:is(:not([type]), [type="text"], [type="search"], [type="email"], [type="url"],
                              [type="tel"], [type="number"], [type="password"]),
                     textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]):focus,
          .pane :is(form.card-detail, form.card--editing, form.column__add, form.setform, form.kb__note--editing, form.chat__composer):focus-within :is(input:is(:not([type]), [type="text"], [type="search"], [type="email"], [type="url"],
                              [type="tel"], [type="number"], [type="password"]),
                     textarea, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]))
    :is(.fab, .rail__groups) { display: none; }
}

/* ═════════════════════════════════════════════════ SCROLL-EDGE FADES ══
   §4.13 (K25). No visible scrollbars anywhere; a scroller's edge fades
   instead, by EXACTLY 40px (or 20px for the short ones), and only once there
   is something past that edge: a scroll-driven animation ramps each end's
   fade length over the first and last 40px of travel, so a box with nothing
   to scroll (an inactive timeline) has no fade at all. The lists are written
   with :where() so these rules weigh nothing and any component or page rule
   overrides them. ⚠️ These scrollers must NOT use the `animation` shorthand
   (it resets animation-timeline) and must not paint the ground they fade into.
   A NEW SCROLLER JOINS A LIST, OR IT GETS NO AFFORDANCE; page scrollers join
   in their page's own file as [data-page="<id>"] rules.
   ⚠️ AND A SCROLLER THAT FADES MUST NEVER BE TOGGLED WITH `display: none`.
   Chromium's renderer crashes ("Target crashed", no script on the stack) when
   an element carrying this scroll-timeline animation loses or gains its box
   under a real pointer click — found 2026-10-05 on the Knowledge tree's folder
   bodies. Hide such a box by keeping it at no height (pages/knowledge.css). */
@property --m3-fade-start { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --m3-fade-end   { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes m3-fade-start { from { --m3-fade-start: 0px; } to { --m3-fade-start: var(--m3-fade, 40px); } }
@keyframes m3-fade-end   { from { --m3-fade-end: var(--m3-fade, 40px); } to { --m3-fade-end: 0px; } }

:where(.pane__body:not(:has(> :is(.page-scroll, .split, .board, .cal-layout))), .page-scroll,
       .people, .messages, .stories, .convos, .kb__list, .chat__thread, .column__cards, .cal__body,
       .fab__thread, .spine, .dash__widget .rows, .picker__list,
       .split__detail:not(#kb-detail):not(:has(> .chat)),
       .tabbar, .board, .m3-chip-row, .tiles, .kbr__propval, .gallery__scrollbox,
       .bubble--md pre > code, .bubble--md .md-table, .bubble--md .md-mathblock,
       .rail__groups, .pdf, .m3-sheet, #event-detail) { scrollbar-width: none; }
:where(.pane__body:not(:has(> :is(.page-scroll, .split, .board, .cal-layout))), .page-scroll,
       .people, .messages, .stories, .convos, .kb__list, .chat__thread, .column__cards, .cal__body,
       .fab__thread, .spine, .dash__widget .rows, .picker__list,
       .split__detail:not(#kb-detail):not(:has(> .chat)),
       .tabbar, .board, .m3-chip-row, .tiles, .kbr__propval, .gallery__scrollbox,
       .bubble--md pre > code, .bubble--md .md-table, .bubble--md .md-mathblock,
       .rail__groups, .pdf, .m3-sheet, #event-detail)::-webkit-scrollbar { display: none; }

/* A SCROLLER CAN BE A TAB STOP: Chrome makes a scrollable box focusable when
   nothing inside it is (/sleep/, /body/), and the pane clips an outer ring.
   So a scroller's ring is drawn inside it (§2.14). (0,2,0): over the base
   :focus-visible offset. */
:is(.pane__body, .page-scroll, .split__list, .split__detail, .people, .messages, .stories, .convos,
    .kb__list, .chat__thread, .column__cards, .cal__body, .fab__thread, .spine, .board,
    .rail__groups, .m3-sheet):focus-visible { outline-offset: var(--app-focus-offset-inner); }

@supports (animation-timeline: scroll(self)) {
  /* VERTICAL (40px; the SHORT ones 20px) */
  :where(.pane__body:not(:has(> :is(.page-scroll, .split, .board, .cal-layout))), .page-scroll,
         .people, .messages, .stories, .convos, .kb__list, .chat__thread, .column__cards, .cal__body,
         .fab__thread, .spine, .dash__widget .rows, .picker__list) {
    mask-image: linear-gradient(to bottom, transparent 0, black var(--m3-fade-start),
                                black calc(100% - var(--m3-fade-end)), transparent 100%);
    animation-name: m3-fade-start, m3-fade-end;
    animation-duration: auto, auto; animation-timing-function: linear, linear; animation-fill-mode: both, both;
    animation-timeline: scroll(self block), scroll(self block);
    animation-range: 0px var(--m3-fade, 40px), calc(100% - var(--m3-fade, 40px)) 100%;
  }
  /* BOTTOM (the end fade only: the record's sticky head covers the top edge) */
  :where(.split__detail:not(#kb-detail):not(:has(> .chat))) {
    mask-image: linear-gradient(to bottom, black calc(100% - var(--m3-fade-end)), transparent 100%);
    animation-name: m3-fade-end; animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both;
    animation-timeline: scroll(self block); animation-range: calc(100% - var(--m3-fade, 40px)) 100%;
  }
  /* ...and THAT top edge's fade is the head's SKIRT (THE RECORD HEAD, above):
     its length ramps 0 to 40px over the record's first 40px of travel, on the
     detail's own timeline. A detail that does not scroll (Chat's) has an
     inactive timeline, so no skirt. */
  .split__detail > [data-tab-name] > :is(.card-detail__head, .fin__head, .chat__title):first-child::after {
    animation-name: m3-fade-start; animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both;
    animation-timeline: scroll(nearest block); animation-range: 0px var(--m3-fade, 40px);
  }
  /* SIDEWAYS (40px; .kbr__propval 20px). An answer's code, table and display
     formula (.bubble--md) are the reading view's three, in a reply. */
  :where(.tabbar, .board, .m3-chip-row, .tiles, .kbr__propval, .gallery__scrollbox,
         .bubble--md pre > code, .bubble--md .md-table, .bubble--md .md-mathblock) {
    mask-image: linear-gradient(to right, transparent 0, black var(--m3-fade-start),
                                black calc(100% - var(--m3-fade-end)), transparent 100%);
    animation-name: m3-fade-start, m3-fade-end;
    animation-duration: auto, auto; animation-timing-function: linear, linear; animation-fill-mode: both, both;
    animation-timeline: scroll(self inline), scroll(self inline);
    animation-range: 0px var(--m3-fade, 40px), calc(100% - var(--m3-fade, 40px)) 100%;
  }
  /* SHORT */
  :where(.fab__thread, .spine, .dash__widget .rows, .picker__list, .kbr__propval) { --m3-fade: 20px; }
  /* The list COLUMN in one-pane list mode (<=839px, §4.7), where it can be the
     scroller (above): an inactive timeline when an inner list scrolls instead. */
  @media (max-width: 839px) {
    :where(.content:not(.is-reading) .split__list) {
      mask-image: linear-gradient(to bottom, transparent 0, black var(--m3-fade-start),
                                  black calc(100% - var(--m3-fade-end)), transparent 100%);
      animation-name: m3-fade-start, m3-fade-end;
      animation-duration: auto, auto; animation-timing-function: linear, linear; animation-fill-mode: both, both;
      animation-timeline: scroll(self block), scroll(self block);
      animation-range: 0px var(--m3-fade, 40px), calc(100% - var(--m3-fade, 40px)) 100%;
    }
  }
  /* …and in a half of a split, which is the same one-pane list mode. */
  :where(.content.is-split .pane:not(.is-reading) .split__list) {
    mask-image: linear-gradient(to bottom, transparent 0, black var(--m3-fade-start),
                                black calc(100% - var(--m3-fade-end)), transparent 100%);
    animation-name: m3-fade-start, m3-fade-end;
    animation-duration: auto, auto; animation-timing-function: linear, linear; animation-fill-mode: both, both;
    animation-timeline: scroll(self block), scroll(self block);
    animation-range: 0px var(--m3-fade, 40px), calc(100% - var(--m3-fade, 40px)) 100%;
  }
  /* The rail's page groups, at >=721px only: on a phone they are the nav
     bar's snap carousel, which takes no mask. */
  @media (min-width: 721px) {
    :where(.rail__groups) {
      mask-image: linear-gradient(to bottom, transparent 0, black var(--m3-fade-start),
                                  black calc(100% - var(--m3-fade-end)), transparent 100%);
      animation-name: m3-fade-start, m3-fade-end;
      animation-duration: auto, auto; animation-timing-function: linear, linear; animation-fill-mode: both, both;
      animation-timeline: scroll(self block), scroll(self block);
      animation-range: 0px var(--m3-fade, 40px), calc(100% - var(--m3-fade, 40px)) 100%;
    }
  }
}

/* ═════════════════════════════════════════════════════ A BARE PAGE ══
   §4.14. The sign-in page renders no rail, band, panes, undo bar, navbusy or
   FAB: one card, centred. Everything else is pages/account.css's. */
body.bare { display: grid; place-items: center; min-height: 100dvh; margin: 0; padding: 24px 16px; box-sizing: border-box; }
