/* The Excel shell (UX-SHELL-07, docs/95) — built to the owner-approved
 * prototype, `docs/prototypes/excel-shell-2026/Main.dc.html`.
 *
 * Metrics are Excel's proportions, not invented ones: a 44px title bar, a 34px
 * tab strip, a ribbon card whose Classic band is three 24px rows (72px) plus
 * padding, 16px icons in small controls and 24px icons in a large button's
 * 72px column. Simplified is one 32px row.
 *
 * Every colour is a token `editor.css` defines, so both themes and an
 * integrator's accent apply. Nothing here names a colour.
 *
 * Loaded always, active only under `.oc-chrome-ribbon`. */

.oc-ribbon { display: none; }

/* A filled accent surface carries white text in both themes. The dark theme's
 * accent is a light blue meant for text and outlines, and its paired text
 * colour is near-black — black on blue, which read badly. Deepened a quarter
 * toward black, the accent holds white at about 5:1 in dark and well above in
 * light, the same treatment `.oc-btn.primary` uses. Tokens: ribbon.tokens.css. */

/* The menu bar and the toolbar stay in the DOM and stop being drawn.
 *
 * Not `display: none` on the menu bar: `menuModel()` is wired to
 * `#menubar .menu-top` and the desktop shell's readiness poll blocks on that
 * model being non-empty. And not `display: none` on the toolbar: its reflow
 * measures it on every resize, and a zero-width bar never fits — that locked
 * the renderer once. Off-screen keeps both measurable and their nodes
 * queryable, which is all the command registry needs. */
.oc-chrome-ribbon .menubar {
  position: absolute; left: -99999px; top: 0; width: 1px; height: 1px; overflow: hidden;
}
.oc-chrome-ribbon .toolbar {
  position: absolute; left: -99999px; top: 0; width: 1400px; height: 1px; overflow: hidden;
  pointer-events: none;
}
/* A toolbar control's own popup (borders, colours, merge, orientation) is
 * re-anchored under the ribbon button that opened it. It is `position: fixed`,
 * so the parked toolbar does not clip it; it only needs its pointer back. */
.oc-chrome-ribbon .toolbar .popmenu { pointer-events: auto; }

/* ── Title bar ─────────────────────────────────────────────────────────── */

/* No `display` here: hiding the header (a host's `hide: header`, the desktop
 * shell, an embed, the collapse button) is decided by `editor.css`, and a
 * display value at this specificity would silently override every one. */
.oc-chrome-ribbon .app-header {
  height: 44px; box-sizing: border-box; align-items: center; gap: 4px;
  padding: 0 12px; background: var(--oc-surface-color); border-bottom: 0;
}
.oc-chrome-ribbon .app-header .doc-identity { display: flex; align-items: baseline; gap: 8px; margin-left: 8px; min-width: 0; }
.oc-chrome-ribbon .app-header button.doc-name { font-weight: 600; font-size: 13px; }
.oc-chrome-ribbon .app-header .doc-state { font-size: 12px; color: var(--oc-muted-text-color); }
.oc-chrome-ribbon .app-header .header-right { display: flex; align-items: center; gap: 8px; margin-left: 0; }

.rb-qat { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.rb-qat .rb-btn.rb-s { min-width: 30px; height: 30px; }

.rb-search {
  flex: 1 1 0; min-width: 0; max-width: 420px; margin: 0 auto; height: 30px; box-sizing: border-box;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--oc-background-color); border: 1px solid var(--oc-control-border-color); border-radius: 6px;
  color: var(--oc-muted-text-color);
}
.rb-search:focus-within { border-color: var(--oc-accent-color); box-shadow: 0 0 0 2px var(--oc-accent-ring); }
.rb-search-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  font: inherit; font-size: 13px; color: var(--oc-text-color);
}
.rb-search-input::-webkit-search-cancel-button { display: none; }

.rb-share {
  height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  border: 0; border-radius: 6px; background: var(--rb-accent-fill); color: var(--rb-on-accent);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.rb-share[hidden] { display: none; }
.rb-share:hover { background: color-mix(in srgb, var(--oc-accent-color), #000 35%); }
.rb-share:focus-visible { outline: 2px solid var(--oc-accent-color); outline-offset: 2px; }

/* ── Tab strip ─────────────────────────────────────────────────────────── */

.oc-chrome-ribbon .oc-ribbon { display: block; background: var(--oc-surface-color); user-select: none; }

.oc-chrome-ribbon .rb-tabs {
  height: 34px; display: flex; align-items: flex-end; gap: 2px; padding: 0 12px;
}
/* The roster, when a host has hidden the title bar it normally sits in. */
.oc-chrome-ribbon .rb-tabs > .presence { align-self: center; flex: none; }
.oc-chrome-ribbon .rb-tablist { display: flex; align-items: flex-end; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.oc-chrome-ribbon .rb-tablist::-webkit-scrollbar { display: none; }
.oc-chrome-ribbon .rb-file,
.oc-chrome-ribbon .rb-tab {
  position: relative; height: 30px; padding: 0 12px; border: 0; border-radius: 6px 6px 0 0;
  background: transparent; color: var(--oc-text-color); font: inherit; font-size: 13px;
  white-space: nowrap; cursor: pointer;
}
.oc-chrome-ribbon .rb-file { color: var(--oc-accent-color); font-weight: 600; }
.oc-chrome-ribbon .rb-file:hover,
.oc-chrome-ribbon .rb-tab:hover { background: var(--oc-border-color); }
.oc-chrome-ribbon .rb-tab.is-on { color: var(--oc-accent-color); font-weight: 600; box-shadow: inset 0 -3px 0 var(--oc-accent-color); }
.oc-chrome-ribbon .rb-file:focus-visible,
.oc-chrome-ribbon .rb-tab:focus-visible { outline: 2px solid var(--oc-accent-color); outline-offset: -2px; }

/* ── Ribbon band ───────────────────────────────────────────────────────── */

.oc-chrome-ribbon .rb-band {
  position: relative; margin: 0 8px; background: var(--oc-background-color);
  border: 1px solid var(--oc-border-color); border-radius: 8px;
}
.oc-chrome-ribbon .rb-panel {
  display: flex; align-items: stretch; height: 78px; box-sizing: border-box;
  padding: 3px 36px 3px 8px; overflow: hidden;
}
.oc-chrome-ribbon .rb-panel[hidden] { display: none; }
.oc-chrome-ribbon .oc-ribbon.rb-labels-captions .rb-panel { height: 96px; }

.oc-chrome-ribbon .rb-group {
  position: relative; display: flex; flex-direction: column; flex: none;
  padding: 0 8px; border-right: 1px solid var(--oc-border-color);
}
.oc-chrome-ribbon .rb-group:last-child { border-right: 0; }
.oc-chrome-ribbon .rb-items { display: flex; align-items: center; gap: 4px; flex: 1; }
/* Group names are kept in the DOM as the accessible name and drawn only when
 * File > Options > Ribbon labels asks for them (docs/95 rule 1). */
.oc-chrome-ribbon .rb-cap {
  display: none; height: 18px; align-items: center; justify-content: center;
  font-size: 11px; color: var(--oc-muted-text-color); white-space: nowrap;
}
.oc-chrome-ribbon .oc-ribbon.rb-labels-captions .rb-cap { display: flex; }
.oc-chrome-ribbon .rb-launch { display: none; }
/* A launcher sits in the caption row, as in Excel; with names off it would sit
 * on top of the group's last button, so it goes with them. Format Cells is
 * still Ctrl+1 and on the right-click menu. */
.oc-chrome-ribbon .oc-ribbon.rb-labels-captions .rb-launch { display: flex; }
.oc-chrome-ribbon .rb-launch {
  position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; padding: 0;
  align-items: center; justify-content: center;
  border: 0; border-radius: 3px; background: transparent; color: var(--oc-muted-text-color); cursor: pointer;
}
.oc-chrome-ribbon .rb-launch svg { transform: rotate(-45deg); }
.oc-chrome-ribbon .rb-launch:hover { background: var(--oc-surface-color); color: var(--oc-text-color); }

.oc-chrome-ribbon .rb-rows { display: flex; flex-direction: column; justify-content: center; gap: 6px; height: 72px; }
.oc-chrome-ribbon .rb-rows[data-rows="3"] { gap: 0; }
.oc-chrome-ribbon .rb-row { display: flex; align-items: center; gap: 2px; }

/* Buttons */
.oc-chrome-ribbon .rb-btn,
.rb-qat .rb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  border: 0; border-radius: 4px; background: transparent; color: var(--oc-text-color);
  font: inherit; cursor: pointer; padding: 0 4px; box-sizing: border-box;
}
.oc-chrome-ribbon .rb-btn[hidden] { display: none; }
.oc-chrome-ribbon .rb-s { height: 24px; min-width: 28px; }
.oc-chrome-ribbon .rb-s[aria-haspopup] { min-width: 36px; }
.oc-chrome-ribbon .rb-l {
  flex-direction: column; justify-content: center; gap: 4px;
  min-width: 40px; max-width: 72px; height: 72px; padding: 4px;
}
.oc-chrome-ribbon .rb-label { display: none; font-size: 11px; line-height: 13px; text-align: center; }
.oc-chrome-ribbon .oc-ribbon.rb-labels-full .rb-l .rb-label { display: block; }
.oc-chrome-ribbon .rb-btn:hover:not(:disabled),
.rb-qat .rb-btn:hover:not(:disabled) { background: var(--oc-surface-color); }
.oc-chrome-ribbon .rb-btn:active:not(:disabled) { background: var(--oc-border-color); }
.oc-chrome-ribbon .rb-btn:focus-visible,
.rb-qat .rb-btn:focus-visible { outline: 2px solid var(--oc-accent-color); outline-offset: -2px; }
.oc-chrome-ribbon .rb-btn[aria-pressed="true"] { background: var(--oc-accent-soft); color: var(--oc-accent-color); }
.oc-chrome-ribbon .rb-btn:disabled,
.rb-qat .rb-btn:disabled { opacity: 0.4; cursor: default; }
.rb-ico { display: block; flex: none; fill: currentColor; }
.rb-caret { display: block; flex: none; fill: currentColor; color: var(--oc-muted-text-color); }

/* Combos: font, size, number format */
.oc-chrome-ribbon .rb-combo {
  display: inline-flex; align-items: center; height: 24px; box-sizing: border-box;
  border: 1px solid var(--oc-control-border-color); border-radius: 4px; background: var(--oc-background-color);
}
.oc-chrome-ribbon .rb-combo[hidden] { display: none; }
.oc-chrome-ribbon .rb-combo:focus-within { border-color: var(--oc-accent-color); }
.oc-chrome-ribbon .rb-combo-input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent;
  padding: 0 6px; font: inherit; font-size: 12px; color: var(--oc-text-color);
}
.oc-chrome-ribbon .rb-combo-input[readonly] { cursor: pointer; }
.oc-chrome-ribbon .rb-combo-caret {
  width: 18px; height: 100%; display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; cursor: pointer; padding: 0;
}

/* Ribbon Display Options, bottom right of the band (XL-UX-093): Excel's ˅. */
.oc-chrome-ribbon .rb-layout {
  position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 4px; background: transparent; color: var(--oc-muted-text-color); cursor: pointer;
}
.oc-chrome-ribbon .rb-layout:hover { background: var(--oc-surface-color); }
/* Ribbon Display Options (XL-UX-093). Tabs only: the band leaves the layout,
 * so the grid gets its height; a clicked tab floats it over the grid. */
.oc-chrome-ribbon .oc-ribbon { position: relative; }
.oc-chrome-ribbon .oc-ribbon.rb-tabs-only .rb-band { display: none; }
.oc-chrome-ribbon .oc-ribbon.rb-tabs-only.rb-peek .rb-band {
  display: block; position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  box-shadow: var(--oc-popover-shadow);
}
.rb-pop-sep { height: 1px; margin: 4px 0; background: var(--oc-border-color); }

/* Folding: a group that does not fit becomes one large button. */
.oc-chrome-ribbon .rb-folded { display: none; }
.oc-chrome-ribbon .rb-group.is-folded > .rb-items,
.oc-chrome-ribbon .rb-group.is-folded > .rb-cap,
.oc-chrome-ribbon .rb-group.is-folded > .rb-launch { display: none; }
.oc-chrome-ribbon .rb-group.is-folded > .rb-folded { display: inline-flex; }
/* A folded group is named, as in Excel: the name is a group's, not a button
 * label, so it shows whenever group names do. */
.oc-chrome-ribbon .oc-ribbon.rb-labels-captions .rb-folded .rb-label { display: block; }
.rb-fold-pop { padding: 8px; }
.rb-fold-pop .rb-items { display: flex; align-items: center; gap: 4px; }

/* Simplified: one row, every control small, no captions. */
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-panel { height: 44px; padding-top: 6px; padding-bottom: 6px; }
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-cap,
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-launch,
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-label { display: none; }
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-group { padding: 0 6px; }
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-rows,
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-row { display: contents; }
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-items { gap: 2px; }
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-btn { height: 32px; min-width: 32px; flex-direction: row; max-width: none; padding: 0 4px; }
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-l .rb-ico { width: 18px; height: 18px; }
.oc-chrome-ribbon .oc-ribbon.rb-simplified .rb-folded .rb-ico { width: 18px; height: 18px; }

/* KeyTips */
.oc-chrome-ribbon .rb-tip {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  min-width: 16px; padding: 1px 4px; border-radius: 3px; z-index: 2;
  background: var(--oc-text-color); color: var(--oc-background-color);
  font-size: 11px; font-weight: 600; line-height: 14px; text-align: center;
}

/* ── Popovers (dropdowns, combos, search results) ─────────────────────── */

.rb-pop { position: fixed; min-width: 180px; max-height: 60vh; }
.rb-pop-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--oc-text-color); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.rb-pop-item:hover:not(:disabled), .rb-pop-item:focus-visible { background: var(--oc-surface-color); outline: none; }
.rb-pop-item:disabled { opacity: 0.45; cursor: default; }
.rb-pop-item[aria-checked="true"], .rb-pop-item[aria-selected="true"] { color: var(--oc-accent-color); font-weight: 600; }
.rb-pop-key { color: var(--oc-muted-text-color); font-size: 12px; }
.rb-pop-empty { padding: 8px 10px; color: var(--oc-muted-text-color); font-size: 13px; }

/* ── File page ─────────────────────────────────────────────────────────
 * Excel's Backstage: a rail of destinations and a page of described choices.
 * The rail is a soft tint of the accent over the surface, not a slab of it —
 * a full-strength accent rail read as a glaring block in dark mode and left
 * its labels and Back arrow at poor contrast. The accent marks only the page
 * that is open. */
.rb-backstage {
  position: fixed; inset: 0; z-index: 70; display: flex;
  background: var(--oc-background-color); color: var(--oc-text-color);
}
.rb-backstage[hidden] { display: none; }
.rb-rail {
  width: 232px; flex: none; display: flex; flex-direction: column; gap: 2px; padding: 12px 10px;
  background: color-mix(in srgb, var(--oc-accent-color) 9%, var(--oc-surface-color));
  border-right: 1px solid var(--oc-border-color); color: var(--oc-text-color);
}
.rb-back {
  width: 36px; height: 36px; margin: 0 0 12px 2px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--oc-text-color); cursor: pointer;
}
.rb-back:hover, .rb-rail-item:hover { background: color-mix(in srgb, var(--oc-accent-color) 14%, transparent); }
.rb-rail-item {
  height: 40px; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  border: 0; border-radius: 6px; background: transparent; color: var(--oc-text-color);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.rb-rail-item .rb-ico { color: var(--oc-muted-text-color); }
.rb-rail-item.is-on { background: var(--rb-accent-fill); color: var(--rb-on-accent); font-weight: 600; }
.rb-rail-item.is-on .rb-ico { color: inherit; }
.rb-back:focus-visible, .rb-rail-item:focus-visible { outline: 2px solid var(--oc-accent-color); outline-offset: 1px; }

.rb-pane { flex: 1; min-width: 0; padding: 36px 56px; overflow: auto; }
.rb-page { max-width: 720px; }
.rb-page[hidden] { display: none; }
.rb-page-title { margin: 0 0 24px; font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.rb-section { display: flex; flex-direction: column; gap: 8px; }
.rb-section + .rb-section { margin-top: 28px; }
.rb-section-title { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--oc-muted-text-color); }

/* New: template tiles. */
.rb-tiles { display: flex; flex-wrap: wrap; gap: 16px; }
.rb-tile {
  width: 168px; display: flex; flex-direction: column; gap: 8px; padding: 0;
  border: 0; background: transparent; color: var(--oc-text-color); font: inherit; text-align: left; cursor: pointer;
}
.rb-tile-art {
  width: 168px; height: 118px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--oc-control-border-color); border-radius: 8px; color: var(--oc-accent-color);
  background: var(--oc-surface-color);
}
.rb-tile:hover .rb-tile-art { border-color: var(--oc-accent-color); }
.rb-tile:focus-visible .rb-tile-art { outline: 2px solid var(--oc-accent-color); outline-offset: 2px; }
.rb-tile-label { font-size: 13px; }

/* Described choices: icon, name, one line of what it does. */
.rb-page-list {
  display: flex; flex-direction: column; border: 1px solid var(--oc-border-color); border-radius: 8px;
  background: var(--oc-background-color); overflow: hidden;
}
.rb-page-item {
  min-height: 56px; display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  border: 0; background: transparent; color: var(--oc-text-color);
  font: inherit; text-align: left; cursor: pointer;
}
.rb-page-item + .rb-page-item { border-top: 1px solid var(--oc-border-color); }
.rb-page-item > .rb-ico { color: var(--oc-accent-color); }
.rb-page-item:hover { background: var(--oc-surface-color); }
.rb-page-item:focus-visible { outline: 2px solid var(--oc-accent-color); outline-offset: -2px; }
.rb-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rb-item-label { font-size: 14px; font-weight: 500; }
.rb-item-desc { font-size: 12.5px; color: var(--oc-muted-text-color); }

/* Options: a label and one control per row. */
.rb-options { display: flex; flex-direction: column; }
.rb-option {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid var(--oc-border-color); border-radius: 8px; background: var(--oc-background-color);
}
.rb-option-label { font-size: 14px; font-weight: 500; }
.rb-seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--oc-surface-color); border: 1px solid var(--oc-border-color); }
.rb-seg-btn {
  height: 30px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent;
  color: var(--oc-text-color); font: inherit; font-size: 13px; cursor: pointer;
}
.rb-seg-btn:hover { background: color-mix(in srgb, var(--oc-accent-color) 10%, transparent); }
.rb-seg-btn[aria-checked="true"] { background: var(--oc-background-color); color: var(--oc-accent-color); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 18, 22, .12); }
.rb-seg-btn:focus-visible { outline: 2px solid var(--oc-accent-color); outline-offset: 1px; }

@media (max-width: 600px) {
  .rb-backstage { flex-direction: column; }
  .rb-rail { width: auto; flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--oc-border-color); }
  .rb-back { margin: 0 4px 0 0; flex: none; }
  .rb-rail-item { flex: none; }
  .rb-pane { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .oc-chrome-ribbon .rb-layout svg { transition: none; }
}

/* Phones: the band scrolls sideways rather than overflowing the page. */
@media (max-width: 600px) {
  .rb-search, .rb-share span { display: none; }
  .oc-chrome-ribbon .rb-panel { overflow-x: auto; scrollbar-width: none; }
  .oc-chrome-ribbon .rb-panel::-webkit-scrollbar { display: none; }
}

/* ── Phone: Excel mobile's bottom command bar (prototype `Phone.dc.html`) ── */
.rb-mobile { display: none; }
.oc-chrome-ribbon.oc-phone .rb-tabs,
.oc-chrome-ribbon.oc-phone .rb-band { display: none; }
.oc-chrome-ribbon.oc-phone .rb-mobile {
  display: block; flex: none; background: var(--oc-background-color);
  border-top: 1px solid var(--oc-control-border-color); box-shadow: 0 -4px 16px rgba(20, 30, 60, .08);
}
.rb-mrow { height: 60px; display: flex; align-items: center; gap: 2px; padding: 0 4px 0 8px; }
.rb-mpick {
  flex: none; height: 40px; display: flex; align-items: center; gap: 4px; padding: 0 10px;
  border: 0; border-radius: 8px; background: var(--oc-surface-color); color: var(--oc-accent-color);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.rb-mobile.is-open .rb-mpick .rb-caret { transform: rotate(180deg); }
.rb-micons { flex: 1; min-width: 0; display: flex; overflow-x: auto; scrollbar-width: none; }
.rb-micons::-webkit-scrollbar { display: none; }
.rb-mbtn {
  flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--oc-text-color); cursor: pointer;
}
.rb-mbtn[aria-pressed="true"] { background: var(--oc-accent-soft); color: var(--oc-accent-color); }
.rb-msheet { padding-top: 8px; }
.rb-msheet[hidden] { display: none; }
.rb-mchips { display: flex; gap: 6px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.rb-mchip {
  flex: none; height: 36px; padding: 0 14px; border: 1px solid var(--oc-control-border-color); border-radius: 18px;
  background: var(--oc-background-color); color: var(--oc-text-color); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.rb-mchip[aria-pressed="true"] { background: var(--rb-accent-fill); border-color: var(--rb-accent-fill); color: var(--rb-on-accent); }
.rb-mlist { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.rb-mitem {
  min-height: 48px; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  border: 0; border-top: 1px solid var(--oc-surface-color); background: transparent;
  color: var(--oc-text-color); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.rb-mitem span { flex: 1; }

/* Colour controls carry their current colour as a bar under the icon. */
.oc-chrome-ribbon .rb-btn.rb-swatch { position: relative; }
.oc-chrome-ribbon .rb-btn.rb-swatch > .rb-ico { margin-bottom: 3px; }
.oc-chrome-ribbon .rb-btn.rb-swatch::after {
  content: ""; position: absolute; left: 6px; bottom: 2px; width: 16px; height: 3px; border-radius: 1px;
  background: var(--rb-swatch, transparent);
}
.oc-chrome-ribbon .rb-btn.rb-swatch[data-cmd="toolbar.fontcolor"]::after { background: var(--rb-swatch, var(--oc-text-color)); }
.oc-chrome-ribbon .rb-btn.rb-swatch[data-cmd="toolbar.border"]::after { background: var(--rb-swatch, currentColor); }

/* ── Host chrome regions (`<opencalc-sheet>.chrome()`, the page's `?hide=`) ──
 *
 * The region names predate this shell and hosts already use them, so they are
 * mapped onto it rather than renamed (`embed.js` documents the table): the
 * menu bar is the tab row, the toolbar is the band. Written as a compound on
 * the element that carries both classes — `<html>` on the page, the embed's
 * shell element in a shadow root — so the two mounts read the same rule.
 *
 * The roster is not chrome (`UX-CHROME-01`): with the tab row hidden the row
 * keeps it alone, and collapses to nothing when there is nobody to show. */
.oc-chrome-ribbon.oc-hide-toolbar .oc-ribbon .rb-band,
.oc-chrome-ribbon.oc-hide-toolbar .oc-ribbon.rb-peek .rb-band,
.oc-chrome-ribbon.oc-hide-toolbar .rb-mobile { display: none; }
.oc-chrome-ribbon.oc-hide-menubar .rb-tabs > :not(.presence),
.oc-chrome-ribbon.oc-hide-menubar .rb-mpick,
.oc-chrome-ribbon.oc-hide-menubar .rb-mchips { display: none; }
.oc-chrome-ribbon.oc-hide-menubar .rb-tabs { height: auto; }

/* ── Embedded: the shell is the element's, not the window's ──────────────
 *
 * `oc-phone` is set from the element's own width when embedded, so the rules
 * the page takes from `max-width: 600px` are restated on the class. On the
 * page the class and the query agree, so this changes nothing there. */
.oc-phone .rb-search, .oc-phone .rb-share span { display: none; }
.oc-phone .rb-backstage { flex-direction: column; }
.oc-phone .rb-rail { width: auto; flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--oc-border-color); }
.oc-phone .rb-back { margin: 0 4px 0 0; flex: none; }
.oc-phone .rb-rail-item { flex: none; }
.oc-phone .rb-pane { padding: 20px 16px; }
/* The File page covers the editor, not the host's page around it. */
:host .editor-body.oc-chrome-ribbon { position: relative; }
:host .rb-backstage { position: absolute; }
