/* chrome/chrome.css: the suite's top bar, account menu, app switcher and
   sign-in pages. Link it after menu.css (its panels are [estilo-menu]).
   Two custom properties are PUBLIC contract, read by apps and never
   copied as numbers: the bar's block size and its stacking level. */
:root {
  --estilo-bar-block-size: 3.25rem;   /* 52px. PUBLIC */
  --estilo-z-bar: 45;                 /* PUBLIC: the bar's stacking level, and the ceiling for in-page layers */
  --estilo-trigger-size: 2rem;        /* 32px targets, above the 24px floor */
}
[estilo-bar] {
  position: relative;
  z-index: var(--estilo-z-bar);
  box-sizing: border-box;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--rst-sp-3);
  block-size: var(--estilo-bar-block-size);   /* fixed, not min: nothing may grow it */
  padding-inline: var(--rst-sp-4);
  background: var(--rst-surface);
  color: var(--rst-text);
  border-block-end: 1px solid var(--rst-line);
}
[estilo-bar~="sticky"] { position: sticky; inset-block-start: 0; }
[estilo-bar-brand] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
  color: var(--rst-text);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
[estilo-bar-brand] img { flex: none; inline-size: 1.75rem; block-size: 1.75rem; border-radius: 21%; }
[estilo-bar-context] {
  flex: 0 1 auto;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-inline-start: var(--rst-sp-3);
  border-inline-start: 1px solid var(--rst-line);
  color: var(--rst-text);
  font-weight: 550;
}
[estilo-bar-nav] { display: flex; align-self: stretch; gap: var(--rst-sp-4); }
[estilo-bar-nav] a {
  display: flex;
  align-items: center;
  border-block: 2px solid transparent;               /* square current marker, in-flow */
  color: var(--rst-text-muted);
  font-size: var(--rst-fs-sm);
  text-decoration: none;
  white-space: nowrap;
}
[estilo-bar-nav] a:hover { color: var(--rst-text); }
[estilo-bar-nav] a[aria-current] { border-block-end-color: var(--rst-accent); color: var(--rst-text); font-weight: 550; }
[estilo-bar-end] { display: flex; align-items: center; gap: var(--rst-sp-2); flex: none; margin-inline-start: auto; }
[estilo-bar-actions] { display: flex; align-items: center; gap: var(--rst-sp-2); }
[estilo-bar-actions] form { display: contents; }   /* a POST action lays out as its button */
[estilo-bar-trigger] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  box-sizing: border-box;
  min-inline-size: var(--estilo-trigger-size);
  block-size: var(--estilo-trigger-size);
  padding-inline: 0.4rem;
  border-radius: 0;           /* in-flow: square */
  color: var(--rst-text-muted);
  font-size: var(--rst-fs-sm);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
[estilo-bar-trigger]::-webkit-details-marker { display: none; }
[estilo-bar-trigger]::marker { content: ""; }
[estilo-bar-trigger] svg { flex: none; inline-size: 1.125rem; block-size: 1.125rem; }
[estilo-bar-trigger]:hover,
[open] > [estilo-bar-trigger] { color: var(--rst-text); background: var(--rst-surface-2); }
[estilo-bar-trigger]:focus-visible { outline: 2px solid var(--rst-accent); outline-offset: -2px; }
[estilo-bar-more] { display: none; }
@media (max-width: 799.98px) {                        /* rastrillo's shell breakpoint */
  [estilo-bar-nav], [estilo-bar-actions] { display: none; }
  [estilo-bar-more] { display: block; }
  [estilo-bar]:has([estilo-bar-context], [estilo-bar-title]) [estilo-bar-name] { display: none; }  /* the icon stays; the title gets the room */
}

/* The shell. <div estilo-shell> wraps the skip link, the bar and <main>
   on every page and has no styling of its own. estilo-shell="fill" is the
   full-height layout for the one kind of page that must fill the viewport
   (Sheets' grid): the shell is exactly the viewport, the bar keeps its
   52px, and <main> takes the rest, so the working area is the viewport
   less the bar without any app re-deriving that sum. The document never
   scrolls there, so the root drops its reserved scrollbar gutter, which
   would otherwise leave a dead strip down the inline end. <main> must be
   the shell's direct child. */
[estilo-shell~="fill"] {
  display: flex;
  flex-direction: column;
  block-size: 100dvh;
}
[estilo-shell~="fill"] > [estilo-bar] { flex: none; }
[estilo-shell~="fill"] > main { flex: 1 1 auto; min-block-size: 0; }
:root:has([estilo-shell~="fill"]) { scrollbar-gutter: auto; }

/* The editable title slot: the open object's title, renamed in place. The
   input is a bordered control, so it keeps the theme's radius; its block size is
   fixed so an input in the bar can never grow the bar. */
[estilo-bar-title] {
  display: flex;
  align-items: center;
  gap: var(--rst-sp-2);
  flex: 0 1 22rem;
  min-inline-size: 0;
  margin: 0;
  padding-inline-start: var(--rst-sp-3);
  border-inline-start: 1px solid var(--rst-line);
}
[estilo-bar-title-input] {
  box-sizing: border-box;
  block-size: 2rem;
  inline-size: 100%;
  min-inline-size: 6rem;
  padding-inline: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--rst-radius-sm);
  background: transparent;
  color: var(--rst-text);
  font: inherit;
  font-weight: 550;
  text-overflow: ellipsis;
}
[estilo-bar-title-input]:hover { border-color: var(--rst-line); }
[estilo-bar-title-input]:focus { border-color: var(--rst-accent); outline: none; background: var(--rst-surface); }
/* iOS zooms the page into a text field under 16px. tokens.css lifts fields
   to 16px on a coarse pointer, but with a bare `input` selector, which
   font: inherit above outweighs. Same rule, restated at this weight. */
@media (pointer: coarse) {
  [estilo-bar-title-input] {
    font-size: max(1rem, 1em);
  }
}
[estilo-bar-title-submit] { position: absolute; clip-path: inset(50%); inline-size: 1px; block-size: 1px; overflow: hidden; white-space: nowrap; }
[estilo-bar-title]:focus-within [estilo-bar-title-submit] { position: static; clip-path: none; inline-size: auto; block-size: 2rem; overflow: visible; flex: none; }
/* Below the shell breakpoint the row has no room for the button beside the
   field: it would sit under Menu or the switcher, and a click at its centre
   would open them instead (found in the first review, at 390px and 320px).
   So the field takes whatever width is left, down to nothing but its own
   padding, and on focus the button floats just under it, over the page,
   where nothing in the bar competes for it. Enter renames at every width. */
@media (max-width: 799.98px) {
  [estilo-bar-title] { position: relative; }
  [estilo-bar-title-input] { min-inline-size: 0; }
  [estilo-bar-title]:focus-within [estilo-bar-title-submit] {
    position: absolute;
    inset-block-start: calc(100% + 0.5rem);
    inset-inline-start: var(--rst-sp-3);
    border: 1px solid var(--rst-line);
    border-radius: var(--estilo-float-radius, 9px);   /* a float */
    background: var(--rst-surface);
    box-shadow: var(--rst-shadow-pop);
  }
}

/* The app switcher: a float, so its tiles may be rounded. */
[estilo-switcher] { position: relative; }
[estilo-switcher-panel] { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 4px); }
[estilo-switcher-grid] { display: grid; grid-template-columns: repeat(3, 5.5rem); gap: 0.25rem; }
[estilo-switcher-app] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.25rem;
  border-radius: var(--rst-radius-sm);   /* inside a float: rounded is allowed */
  color: var(--rst-text);
  font-size: var(--rst-fs-xs);
  text-decoration: none;
}
[estilo-switcher-app]:hover,
[estilo-switcher-app]:focus-visible { background: var(--rst-accent-soft); }
[estilo-switcher-app][aria-current] { background: var(--rst-accent-soft); font-weight: 600; }
[estilo-switcher-app] img { border-radius: 21%; }
/* Three 5.5rem tiles hung from the trigger overflow a phone's inline start
   (at 320px, and sooner when the corner is the wider "Sign in" link), so
   below 30rem the panel spans the bar instead, as menubar panels do, and
   the three columns share its width. */
@media (max-width: 30rem) {
  [estilo-switcher] { position: static; }
  [estilo-switcher-panel] { inset-inline: 0.5rem; inline-size: auto; min-inline-size: 0; max-inline-size: none; }
  [estilo-switcher-grid] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The account menu. The account is always the last thing at the inline
   end of the bar: the "same corner" rule. */
[estilo-account] { position: relative; }
[estilo-account-panel] { position: absolute; inset-inline-end: 0; inset-block-start: calc(100% + 4px); min-inline-size: 15rem; }
[estilo-avatar] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  border-radius: 50%;   /* an identity mark, not a highlight */
  background: var(--rst-accent-soft);
  color: var(--rst-accent);
  font-size: var(--rst-fs-xs);
  font-weight: 650;
}
[estilo-menu-identity] { display: grid; gap: 0.1rem; padding: 0.5rem var(--estilo-item-padding-inline, 0.65rem); }
[estilo-menu-identity-label] { color: var(--rst-text-muted); font-size: var(--rst-fs-xs); }
[estilo-menu-identity-name] { font-weight: 600; overflow-wrap: anywhere; }
[estilo-menu-identity-address] { color: var(--rst-text-muted); overflow-wrap: anywhere; }
[estilo-menu-identity-name] + [estilo-menu-identity-address] { font-size: var(--rst-fs-xs); }
[estilo-bar-signin] { flex: none; }

/* The account at a sidebar rail's foot (Account.Rail), for an app whose
   chrome is a rail rather than the bar. The trigger is a row the rail's
   width: the avatar, then who is signed in, cut short with an ellipsis.
   It stays in the page flow, so its highlight stays square. The panel is
   the foot's own width, edge to edge with the trigger: hung from the
   inline end of a foot narrower than the bar's 15rem panel it ran off
   the window's start edge, and from the inline start it ran past the
   rail, whose overflow-y: auto clips it (Fichas' first screenshot). */
[estilo-account~="rail"] > [estilo-bar-trigger] {
  justify-content: flex-start;
  gap: var(--rst-sp-2);
  inline-size: 100%;
  block-size: auto;
  min-block-size: 2.5rem;
  color: var(--rst-text);
}
[estilo-account-who] { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[estilo-account~="rail"] > [estilo-account-panel] { inset-inline: 0; inline-size: auto; min-inline-size: 0; max-inline-size: none; }
/* A drop-up where the rail is the viewport's height (rastrillo's shell
   breakpoint): below the foot there is only the window's edge. Below
   800px the rail is a disclosure at the top of the page, with the page
   under it and too little above, so the panel opens downward there. */
@media (min-width: 800px) {
  [estilo-account~="rail"] > [estilo-account-panel] {
    inset-block-start: auto;
    inset-block-end: calc(100% + 4px);
    max-block-size: max(calc(100dvh - 5rem), 8rem);
  }
}

/* Visually hidden, still announced. */
[estilo-visually-hidden] { position: absolute; clip-path: inset(50%); inline-size: 1px; block-size: 1px; overflow: hidden; white-space: nowrap; }

/* Sign-in, check-your-email and signed-out pages: the Oficina door. The
   suite's sky behind (estilo sky.css places and animates it), one card on
   it with the app's mark and name at its head — the same door Home draws
   at id.oficina.works, in the app's own colour. The door spans the page
   whatever the app's layout gives it, so the sky is never boxed in. */
:root:has([estilo-door]) { overflow-x: clip; --rst-scrollbar-gutter: auto; scrollbar-gutter: auto; }
[estilo-door] {
  box-sizing: border-box;
  margin-inline: calc(50% - 50vw);
  padding: max(40px, 9vh) var(--rst-sp-4) var(--rst-sp-6);
  min-block-size: 680px;
  /* The whole sky lies inside the door, fading in and out, so the door's
     edges never cut it: under an app's bar there is no page top to hide
     an edge behind, as there is on Home. A sky's layers overhang its box
     by 12% above and below (sky.css), and fade in over their first 22%
     and out from 58% to 92% — so a 560px sky placed 67px down starts
     transparent at the door's top and has faded out by 640px. */
  --estilo-sky-top: 67px;
  --estilo-sky-height: 560px;
}
[estilo-signin] {
  box-sizing: border-box;
  max-inline-size: 460px;
  margin: 0 auto;
  padding: 34px 40px 32px;
  background: var(--rst-surface);
  border-radius: 20px;
  box-shadow: 0 0 0 1px light-dark(transparent, var(--rst-line)), var(--rst-shadow-lift);
}
[estilo-signin] > [estilo-brand] { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; }
[estilo-signin] > [estilo-brand] [estilo-brand-icon] { inline-size: 36px; block-size: 36px; }
[estilo-signin] h1 { margin: 0; font-size: 1.75rem; font-weight: 620; letter-spacing: -0.02em; line-height: 1.15; }
[estilo-signin-lede] { margin: 0.5rem 0 var(--rst-sp-4); color: var(--rst-text-muted); }
[estilo-signin] > h1 + :not([estilo-signin-lede]) { margin-block-start: var(--rst-sp-4); }
[estilo-signin-form] { max-inline-size: none; margin-block-start: var(--rst-sp-4); }
[estilo-signin-body] { margin: var(--rst-sp-4) 0; }
@media (max-width: 520px) {
  [estilo-door] { padding-inline: 14px; padding-block-start: 28px; }
  [estilo-signin] { padding: 26px 22px 24px; }
}
[estilo-signin-foot] { margin-block-start: var(--rst-sp-6); font-size: var(--rst-fs-xs); color: var(--rst-text-muted); }
/* The door's links are drawn here, not left to the app: an app that does
   not link base.css (Calendar, Memoria, Calls, Fichas) showed the browser's
   blue on the card. As base.css does, a link in the card is the app's
   colour at the lowest specificity, so a link drawn as a button keeps the
   button's; the foot's is quiet, like its text. */
:where([estilo-signin]) a { color: var(--rst-accent); text-underline-offset: 0.15em; }
[estilo-signin-foot] a { color: inherit; }
[estilo-signin-foot] a:hover, [estilo-signin-foot] a:focus-visible { color: var(--rst-text); }

/* ── Bar stack (Docs' I2 editor header, spec 2026-11-11) ────────────────
   Everything below is opt-in. Each rule is keyed on a hook only a bar
   with a slot, a WideOnly action or the Appearance form renders, so a bar
   with neither Menubar nor Lead looks exactly as it did
   (TestEverythingAfterTheMarkerIsOptIn holds this, and that main's rules
   above are unchanged).

   The hooks: [estilo-bar~="stacked"] (Bar.Menubar), [estilo-bar-stack]
   and [estilo-bar-menubar] inside it, [estilo-bar-lead] (Bar.Lead),
   [estilo-bar-control] (each action in a bar with a slot),
   [estilo-bar-wide] (Action.WideOnly) and [estilo-appearance].

   Breakpoints: 800px is rastrillo's shell breakpoint, the rule above
   this section and every app's, so it stays in px: restated in rem it
   would move apart from them whenever the reader's default font size is
   not 16px. 64rem is where a WideOnly action appears, the same 64rem
   Docs' inspector uses. */

/* A WideOnly action exists only from 64rem (Docs' Format: the inspector
   it toggles exists only there). It is also left out of the Menu sheet
   (the template). (0,2,0), so it outweighs a POST action's display:
   contents form. */
@media (max-width: 63.99rem) {
  [estilo-bar-actions] [estilo-bar-wide],
  [estilo-bar-actions] [estilo-bar-control~="wide"] { display: none; }
}

/* Each action in a bar with a slot sits in its own wrapper, which lays
   out as its control. */
[estilo-bar-control] { display: contents; }
[estilo-bar-lead] { display: flex; align-items: center; gap: var(--rst-sp-2); }

/* The stacked bar's title is as wide as its title, never the bar's
   room: its size attribute is the first paint's guess, chrome.js
   measures the field and corrects it, and it is capped at the space it
   has, where a longer title scrolls inside the field as it always has.
   No ellipsis: the field is as wide as its title, so one would only ever
   mark a guess that came out short, not a title cut off. */
[estilo-bar~="stacked"] [estilo-bar-title] { flex: none; max-inline-size: 100%; }
[estilo-bar~="stacked"] [estilo-bar-title-input] { flex: 0 1 auto; inline-size: auto; min-inline-size: 0; max-inline-size: 100%; text-overflow: clip; }
[estilo-bar~="stacked"] [estilo-bar-context] { max-inline-size: 100%; }
[estilo-bar~="stacked"] [estilo-menubar-title] { cursor: pointer; }

/* Below 800px the stacked header does not fit a phone (spec C6: File to
   Help needs 261px, and at 320px the title fell to "U…"). So the bar
   stays today's one row, and the app's menus are a full-width second
   row under it: the stack dissolves and the same markup lays out on a
   grid. The header grows by that row, and the published block size
   with it. A menubar that wraps (English at 320px; a long locale
   sooner) grows it further: chrome.js then publishes the header's real
   height, and 85px is what a page without script gets. */
@media (max-width: 799.98px) {
  :root:has([estilo-bar~="stacked"]) { --estilo-bar-block-size: calc(3.25rem + 2rem + 1px); }   /* 85px: the bar's row, one menubar row and the bottom border. PUBLIC */
  [estilo-bar~="stacked"] {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 3.25rem auto;
    grid-template-areas: "brand title end" "menus menus menus";
    column-gap: var(--rst-sp-3);
    row-gap: 0;
    align-items: center;
    block-size: auto;
  }
  [estilo-bar~="stacked"] > [estilo-bar-brand] { grid-area: brand; }
  [estilo-bar~="stacked"] > [estilo-bar-end] { grid-area: end; }
  [estilo-bar~="stacked"] [estilo-bar-stack] { display: contents; }
  [estilo-bar~="stacked"] [estilo-bar-title],
  [estilo-bar~="stacked"] [estilo-bar-context] { grid-area: title; justify-self: start; }
  [estilo-bar~="stacked"] [estilo-bar-menubar] {
    grid-area: menus;
    align-self: stretch;
    min-inline-size: 0;
    margin-inline: calc(var(--rst-sp-3) - var(--rst-sp-4));   /* the menus' edge 12px in, as Docs' own row had it */
  }
}

/* From 800px, the 56px stacked header: a 32px icon 12px in, and beside
   it a 44px stack, the 24px title row (16px, 600) over the 20px menu row
   (13px, muted), both starting at 56px (12 + 32 + 12). The app's name
   goes: the icon is the brand. Optical balance, measured at 2x in WebKit
   on the mock-up: the title's capitals start at the icon's top, so its
   row sits 2.5px low; the menu row sits 1px low, its 24px highlight
   stops 3px above the header's bottom edge, and an open panel hangs from
   1px above that edge. */
@media (min-width: 800px) {
  :root:has([estilo-bar~="stacked"]) { --estilo-bar-block-size: 56px; }   /* PUBLIC */
  [estilo-bar~="stacked"] { gap: 12px; padding-inline: 12px; }
  [estilo-bar~="stacked"] [estilo-bar-brand] img { inline-size: 32px; block-size: 32px; }
  [estilo-bar~="stacked"] [estilo-bar-name] { display: none; }
  [estilo-bar-stack] {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex: 1 1 auto;
    min-inline-size: 0;
    block-size: 44px;
  }
  [estilo-bar~="stacked"] [estilo-bar-title] {
    position: relative;
    inset-block-start: 2.5px;
    block-size: 24px;
    margin: 0;
    padding: 0;
    border: 0;
  }
  [estilo-bar~="stacked"] [estilo-bar-title-input] {
    block-size: 24px;
    padding-block: 0;
    margin-inline-start: calc(-0.4rem - 1px);   /* the field's padding and border pulled back: the text sits on the edge */
    max-inline-size: calc(100% + 0.4rem + 1px);   /* the form is that much narrower than the field: the cap gives it back */
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  [estilo-bar~="stacked"] [estilo-bar-context] {
    position: relative;
    inset-block-start: 2.5px;
    padding: 0;
    border: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  /* Rename, while the title is being edited: a 22px pill in the
     accent's tint inside the 24px title row, not the 2rem button. The
     box is the row's 24px, the 24px target floor (AGENTS.md); a
     transparent 1px border with the fill clipped inside it paints the
     22px pill. */
  [estilo-bar~="stacked"] [estilo-bar-title]:focus-within [estilo-bar-title-submit] {
    align-self: center;
    box-sizing: border-box;
    block-size: 24px;
    min-block-size: 0;
    min-inline-size: 0;
    margin: 0;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background-color: var(--rst-accent-soft);
    background-image: none;
    background-clip: padding-box;
    box-shadow: none;
    color: var(--rst-accent);
    font: 600 12px/22px var(--rst-font);
  }
  [estilo-bar~="stacked"] [estilo-bar-title]:focus-within [estilo-bar-title-submit]:hover {
    border-color: transparent;
    background-color: var(--rst-accent);
    color: var(--rst-on-accent);
  }

  /* The menu row. estilo's 32px menubar floor goes here, and only here:
     the row is 20px, and each title's highlight is a 24px pill with a 6px
     radius, 2px over each edge by negative margins, so it takes no room. */
  [estilo-bar-menubar] {
    position: relative;
    inset-block-start: 1px;
    block-size: 20px;
    max-inline-size: calc(100% + 7px);
    margin-inline-start: -7px;   /* the titles' padding pulled back: the first title's text sits on the edge */
  }
  [estilo-bar~="stacked"] [estilo-menubar] { block-size: 20px; min-block-size: 0; align-items: center; flex-wrap: nowrap; }
  [estilo-bar~="stacked"] [estilo-menubar-menu] { block-size: 20px; }
  [estilo-bar~="stacked"] [estilo-menubar-title] {
    block-size: 24px;
    min-block-size: 0;
    margin-block: -2px;
    padding-inline: 7px;
    border-radius: 6px;
    color: var(--rst-text-muted);
    font-size: 13px;
    line-height: 24px;
  }
  [estilo-bar~="stacked"] [estilo-menubar-title]:hover,
  [estilo-bar~="stacked"] [open] > [estilo-menubar-title] { color: var(--rst-text); }
  [estilo-bar~="stacked"] [estilo-menubar-menu] > [estilo-menu] { inset-block-start: calc(100% + 4.5px); }   /* the row ends at 50.5 (the stack is centred in 55px inside the border): 55, 1px above the 56px edge */

  /* Every panel in the stacked header matches it: 28px rows, 13px type,
     shortcuts muted, 4px padding and a 10px radius. */
  [estilo-bar~="stacked"] [estilo-menu] {
    --estilo-float-padding: 4px;
    --estilo-item-padding-block: 4px;
    --estilo-item-padding-inline: 10px;
    border-radius: 10px;
    font-size: 13px;
  }
  [estilo-bar~="stacked"] [estilo-menu-item] { min-block-size: 28px; border-radius: 6px; }
  [estilo-bar~="stacked"] [estilo-menu] hr { margin-block: 4px; }
  [estilo-bar~="stacked"] [estilo-menu-key] { color: var(--rst-text-muted); font-size: 12px; }

  /* The controls set, in a bar with a slot: every action a 28px pill,
     13px semibold, 8px apart; the primary the one filled pill; the
     account its circle; and a divider between the page's controls and
     the person's. Lit from above as the index's New document is, and far
     fainter in dark. */
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end],
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-actions] { gap: 8px; }
  :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
    block-size: 28px;
    min-block-size: 28px;
    min-inline-size: 28px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background-color: transparent;
    box-shadow: inset 0 1px 0 light-dark(rgb(255 255 255 / 0.7), rgb(255 255 255 / 0.06));
    color: var(--rst-text-muted);
    font: 600 13px/1 var(--rst-font);
    text-decoration: none;
    white-space: nowrap;
  }
  :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button) svg { flex: none; inline-size: 15px; block-size: 15px; }
  :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button):hover:not(:disabled) {
    background-color: var(--rst-surface-2);
    color: var(--rst-text);
    box-shadow: inset 0 1px 0 light-dark(rgb(255 255 255 / 0.8), rgb(255 255 255 / 0.08)), 0 1px 2px rgb(23 32 60 / 0.08);
  }
  /* A toggle whose region is shown takes the accent's tint. */
  :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button)[aria-expanded="true"] {
    background-color: var(--rst-accent-soft);
    color: var(--rst-accent);
    box-shadow: inset 0 1px 0 light-dark(rgb(255 255 255 / 0.8), rgb(255 255 255 / 0.08)), 0 1px 2px rgb(23 32 60 / 0.08);
  }
  /* The primary: the one filled pill, a fine highlight on its top edge
     and a shadow tinted with its own accent, 0 5px 12px -5px. */
  :is([estilo-bar-control~="primary"] > a, [estilo-bar-control~="primary"] > button, [estilo-bar-control~="primary"] > form > button),
  :is([estilo-bar-control~="primary"] > a, [estilo-bar-control~="primary"] > button, [estilo-bar-control~="primary"] > form > button):hover:not(:disabled) {
    padding-inline: 14px;
    background-color: var(--rst-accent);
    color: var(--rst-on-accent);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.22),
      0 1px 1px rgb(23 32 60 / 0.10),
      0 5px 12px -5px light-dark(color-mix(in srgb, var(--rst-accent) 75%, transparent), color-mix(in srgb, var(--rst-accent) 25%, transparent));
  }
  :is([estilo-bar-control~="primary"] > a, [estilo-bar-control~="primary"] > button, [estilo-bar-control~="primary"] > form > button):hover:not(:disabled) {
    background-color: var(--rst-accent-strong);
  }

  /* The account is its circle: no square box behind it on hover or
     open. The avatar darkens on hover and takes a 2px ring while its menu
     is open; with no initials the glyph's own circle does the same. */
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] > [estilo-bar-trigger] {
    inline-size: 28px;
    min-inline-size: 0;
    block-size: 28px;
    padding: 0;
    border-radius: 50%;
    background: none;
  }
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] > [estilo-bar-trigger]:focus-visible { outline-offset: 2px; }
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] [estilo-avatar] {
    inline-size: 28px;
    block-size: 28px;
    font-size: 12px;
    box-shadow: inset 0 1px 0 light-dark(rgb(255 255 255 / 0.8), rgb(255 255 255 / 0.06)), 0 1px 2px rgb(23 32 60 / 0.08);
    transition: background-color 120ms ease, box-shadow 120ms ease;
  }
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] > [estilo-bar-trigger]:hover [estilo-avatar] {
    background: color-mix(in srgb, var(--rst-accent) 18%, var(--rst-surface));
  }
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account][open] [estilo-avatar],
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account][open] > [estilo-bar-trigger]:not(:has([estilo-avatar])) {
    box-shadow: 0 0 0 2px var(--rst-surface), 0 0 0 4px color-mix(in srgb, var(--rst-accent) 45%, transparent);
  }
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] > [estilo-bar-trigger]:not(:has([estilo-avatar])):hover {
    background: var(--rst-surface-2);
  }

  /* The divider: a 20px hairline before the account, 12px either side
     (the set's 8px gap and 4px more, then 12px of padding), drawn as the
     account's own background so it takes no element. Only when something
     of the page's precedes it: never on a bar with no actions and no
     lead. Below 64rem a WideOnly action is hidden, so it does not count
     there. */
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-lead], > [estilo-bar-actions] > :not([estilo-bar-control~="wide"])) > [estilo-account] {
    margin-inline-start: 4px;
    padding-inline-start: 12px;
    background: linear-gradient(var(--rst-line), var(--rst-line)) left center / 1px 20px no-repeat;
  }
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-lead], > [estilo-bar-actions] > :not([estilo-bar-control~="wide"])) > [estilo-account]:dir(rtl) {
    background-position: right center;
  }

  /* Coarse pointers: the header's controls rise to 32px, and the menubar
     titles keep their 24px look in the 20px row but take 32px of hit
     area, 4px over each edge, drawn by nothing and taking no room. Where
     that reaches up under the title field, the field stays on top
     (z-index): it keeps all of its own 24px, and a menu under it keeps
     24px from the field's foot to the header's edge. */
  @media (pointer: coarse) {
    :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button) { block-size: 32px; min-block-size: 32px; }
    :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] > [estilo-bar-trigger],
    :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] [estilo-avatar] { inline-size: 32px; block-size: 32px; }
    [estilo-bar~="stacked"] [estilo-menubar-title] { position: relative; }
    [estilo-bar~="stacked"] [estilo-menubar-title]::before { content: ""; position: absolute; inset-inline: 0; inset-block: -4px; }
    [estilo-bar~="stacked"] [estilo-bar-title] { z-index: 1; }
  }
}
@media (min-width: 64rem) {
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-actions]) > [estilo-account] {
    margin-inline-start: 4px;
    padding-inline-start: 12px;
    background: linear-gradient(var(--rst-line), var(--rst-line)) left center / 1px 20px no-repeat;
  }
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-actions]) > [estilo-account]:dir(rtl) {
    background-position: right center;
  }
}
/* Forced colours drop the controls' fills and shadows, leaving their
   border to draw them, and the set's border: 0 above outweighs
   rastrillo's own forced-colors border on its buttons: Share and Format
   would lose every edge. So the set gives it back, at its own weight and
   after it. An expanded toggle's tint is gone too, so it is drawn in Highlight,
   two pixels deep with the outline (left to the focus ring while that
   shows). At every width: below 800px the same border is rastrillo's. */
@media (forced-colors: active) {
  :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button) { border: 1px solid ButtonBorder; }
  :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button)[aria-expanded="true"] { border-color: Highlight; }
  :is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button)[aria-expanded="true"]:not(:focus-visible) { outline: 1px solid Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  :is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] [estilo-avatar] { transition: none; }
}

/* Appearance, in every app's account menu: Light, Dark and System as
   three equal segments in one well, an icon over each word. The one in
   force is raised (the surface, a step lighter in dark, where the
   surface is barely off the well), bold, with its icon in the accent:
   raised and bold, so more than colour says which. aria-pressed is the
   state. chrome.js switches it in place. */
[estilo-appearance] {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin: 2px 6px 6px;
  padding: 3px;
  border-radius: 10px;
  background: var(--rst-surface-2);
  box-shadow: inset 0 1px 2px light-dark(rgb(23 32 60 / 0.06), rgb(0 0 0 / 0.25));
}
[estilo-appearance] [estilo-menu-item] {
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-block-size: 46px;
  padding: 6px 4px;
  border-radius: 8px;
  background: none;
  color: var(--rst-text-muted);
  font-size: 12px;
  text-align: center;
}
[estilo-appearance] [estilo-menu-label] { flex: none; max-inline-size: 100%; overflow-wrap: anywhere; }
[estilo-appearance-icon] { display: inline-flex; flex: none; inline-size: 16px; block-size: 16px; }
[estilo-appearance-icon] svg { inline-size: 100%; block-size: 100%; }
[estilo-appearance] [estilo-menu-item]:hover:not([aria-pressed="true"]) {
  background: light-dark(rgb(255 255 255 / 0.5), rgb(255 255 255 / 0.04));
  color: var(--rst-text);
}
[estilo-appearance] [estilo-menu-item][aria-pressed="true"] {
  background: light-dark(var(--rst-surface), #2f333d);
  color: var(--rst-text);
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 light-dark(rgb(255 255 255 / 0.9), rgb(255 255 255 / 0.06)),
    0 1px 2px rgb(23 32 60 / 0.12),
    0 0 0 1px light-dark(rgb(23 32 60 / 0.06), rgb(255 255 255 / 0.06));
}
[estilo-appearance] [estilo-menu-item][aria-pressed="true"] [estilo-appearance-icon] { color: var(--rst-accent); }
