@layer tokens, base, ui, shell, surface;
/* The desktop and tablet shell (shells/desktop), in Signal (docs/signal.md). The desk is the theme's desk
   gradient; on it sit glass panes with 8 px of desk between them: the left column (the rail or the
   sidebar), the Assistant, the tabs (stage) and Highlights. Columns ease between widths; a column without
   room slides over the tabs as a floating pane. The window primitives (.os-window) are shared with the
   phone, which restyles them for itself. */

/* Registered so the columns ease between widths instead of snapping. */
@property --gx-left { syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --gx-assist { syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --gx-div { syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --gx-hl { syntax: "<length>"; inherits: true; initial-value: 0px; }
@property --gx-hlgap { syntax: "<length>"; inherits: true; initial-value: 0px; }

@layer shell {
  /* ---- windows: a bar over a body (desktop panes, the Assistant column; the phone's open things) ---- */
  :where(.os-window) { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; }
  :where(.os-window__bar, .os-window__header) { display: flex; align-items: center; gap: 4px; min-width: 0; user-select: none; }
  :where(.os-window__identity) { display: flex; align-items: center; gap: 7px; min-width: 0; }
  :where(.os-window__title) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  :where(.os-window__header-slot) { flex: 1; min-width: 0; }
  :where(.os-window__actions) { display: flex; align-items: center; gap: 2px; flex: none; }
  :where(.os-window__body) { position: relative; min-width: 0; min-height: 0; overflow: hidden; }

  /* ---- shared desktop pieces (also used by Highlights, Home and the extension's panel) --------- */
  /* An icon button in a bar: the same as .icon-btn. */
  .gx-iconbtn {
    display: inline-grid; place-items: center; flex: none;
    width: var(--h-md); height: var(--h-md); border-radius: var(--r-md);
    color: var(--color-ink-secondary);
    transition: background var(--d) var(--ease), color var(--d) var(--ease);
  }
  .gx-iconbtn:hover, .gx-iconbtn.is-open, .gx-iconbtn[aria-pressed="true"] { background: var(--s-spot), var(--s-tint-2); color: var(--color-ink); }
  .gx-iconbtn svg { width: 16px; height: 16px; }
  .gx-iconbtn:disabled { opacity: 0.4; pointer-events: none; }
  /* A loading line: a tint that breathes while the thing it stands for arrives. */
  .gx-skel { display: block; width: 78%; height: 10px; margin: 7px 0; border-radius: var(--r-sm); background: var(--s-tint-3); animation: sg-breathe 1.6s ease-in-out infinite; }
  .gx-skel.is-short { width: 52%; }

  /* ---- the frame ------------------------------------------------------------------------------- */
  .gx {
    --gx-pad: 8px;
    --assist-w: 400px; /* set by shell.js */
    --hl-w: 340px; /* set by shell.js */
    --gx-left: 56px; /* the rail; its 8 px gutter is inside the track */
    --gx-assist: var(--assist-w);
    --gx-div: var(--gx-pad); /* the gutter between the Assistant and the tabs is the divider */
    --gx-hl: 0px;
    --gx-hlgap: 0px;
    position: fixed; inset: 0; isolation: isolate;
    display: grid;
    grid-template-columns: var(--gx-left) var(--gx-assist) var(--gx-div) minmax(0, 1fr) var(--gx-hlgap) var(--gx-hl);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "left assist divider stage hlgap hl";
    padding: max(var(--gx-pad), env(safe-area-inset-top, 0px)) calc(var(--gx-pad) + env(safe-area-inset-right, 0px))
      max(var(--gx-pad), env(safe-area-inset-bottom, 0px)) calc(var(--gx-pad) + env(safe-area-inset-left, 0px));
    transition: --gx-left var(--d-panel) var(--ease), --gx-assist var(--d-panel) var(--ease), --gx-div var(--d-panel) var(--ease),
      --gx-hl var(--d-panel) var(--ease), --gx-hlgap var(--d-panel) var(--ease);
  }
  .gx.is-side-docked { --gx-left: 260px; }
  .gx.is-hl-docked { --gx-hl: var(--hl-w); --gx-hlgap: var(--gx-pad); }
  /* The tabs closed: the Assistant takes the room they had. */
  .gx.is-stage-closed {
    --gx-div: 0px;
    --gx-assist: calc(100vw - var(--gx-left) - var(--gx-hl) - var(--gx-hlgap) - 2 * var(--gx-pad)
      - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  }
  .gx:is(.is-collapsed, .is-slideover) { --gx-assist: 0px; --gx-div: 0px; }
  .gx.is-resizing { transition: none; }
  .gx.is-resizing, .gx.is-resizing * { cursor: col-resize; user-select: none; -webkit-user-select: none; }

  /* Every column is a glass pane. */
  .gx > :is(.gx-rail, .gx-side, .gx-assist, .gx-stage, .gx-hl) {
    min-width: 0; min-height: 0; overflow: hidden;
    border-radius: var(--r-2xl); background: var(--s-glass); box-shadow: var(--e-flat);
  }
  /* A column floating over the tabs (no room beside them): the floating surface, a modal shadow. */
  .gx.is-slideover .gx-assist, .gx.is-hl-over .gx-hl, .gx.is-side-float .gx-side {
    position: fixed; top: max(var(--gx-pad), env(safe-area-inset-top, 0px)); bottom: max(var(--gx-pad), env(safe-area-inset-bottom, 0px));
    background: var(--s-float); -webkit-backdrop-filter: var(--s-blur); backdrop-filter: var(--s-blur); box-shadow: var(--e-modal);
  }

  /* ---- the rail -------------------------------------------------------------------------------- */
  .gx-rail {
    grid-area: left; margin-right: var(--gx-pad);
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0;
  }
  .gx-rail__space { flex: 1; }
  /* The mark heads the rail (it opens the Assistant popover); its button comes last in the markup. */
  .gx-rail > .gx-rail__mark { order: -1; margin-bottom: 6px; }
  .gx-rail [data-toggle="assist"] { animation: sg-fade var(--d) var(--ease); }

  .gx-rail__btn {
    position: relative; display: inline-grid; place-items: center; flex: none;
    width: var(--h-md); height: var(--h-md); border-radius: var(--r-md);
    color: var(--color-ink-secondary);
    transition: background var(--d) var(--ease), color var(--d) var(--ease), box-shadow var(--d) var(--ease);
  }
  .gx-rail__btn svg { width: 16px; height: 16px; }
  .gx-rail__btn:hover, .gx-rail__btn.is-open { background: var(--s-spot), var(--s-tint-2); color: var(--color-ink); }
  .gx-rail__btn[aria-pressed="true"] { color: var(--color-ink); }
  .gx-rail__btn.is-on { background: var(--s-tint-3); color: var(--color-ink); }
  .gx-rail__btn.is-on:hover { background: var(--s-spot), var(--s-tint-3); }
  /* Highlights hidden on pages and apps: the eye struck through, faint. */
  .gx-rail__marks.is-off { color: var(--color-ink-faint); }
  /* The highlighter: the act fill while it draws; on with nothing to draw on, an act ring, waiting. */
  .gx-rail__pen.is-on { background: var(--color-accent-fill); color: var(--color-on-accent); box-shadow: var(--s-act-rim); }
  .gx-rail__pen.is-on:hover { background: var(--s-spot-lit), var(--color-accent-fill); }
  .gx-rail__pen.is-waiting, .gx-rail__pen.is-waiting:hover {
    background: var(--s-glass); color: var(--color-ink);
    box-shadow: var(--s-hi), 0 0 0 1px color-mix(in srgb, var(--color-accent-fill) 45%, transparent);
  }
  .gx-rail__pen[aria-disabled="true"] { opacity: 0.4; cursor: default; }
  .gx-rail__pen[aria-disabled="true"]:hover { background: none; color: var(--color-ink-secondary); }

  /* A count on a rail button: unread notifications are "needs you" (measure); the Highlights count is quiet. */
  .gx-badge {
    position: absolute; top: -3px; right: -4px; display: grid; place-items: center;
    min-width: 15px; height: 15px; padding: 0 4px; border-radius: var(--r-round);
    background: var(--color-measure); color: var(--color-bg); box-shadow: 0 0 0 2px var(--color-surface-raised);
    font: 500 var(--t-10) / 1 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0;
    pointer-events: none; animation: sg-fade var(--d) var(--ease);
  }
  .gx-badge--hl { background: var(--color-surface-raised); color: var(--color-ink-secondary); box-shadow: 0 0 0 1px var(--s-edge-2); }

  /* The mark: it opens the Assistant popover. No disc behind it: it rings only while it listens. */
  .gx-rail__mark {
    position: relative; display: inline-grid; place-items: center; flex: none;
    width: var(--h-lg); height: var(--h-lg); border-radius: var(--r-lg);
    touch-action: manipulation;
    transition: background var(--d) var(--ease), box-shadow var(--d) var(--ease);
  }
  .gx-rail__mark > .gm { width: 24px; height: 24px; }
  .gx-rail__mark:hover { background: var(--s-spot), var(--s-tint-2); }
  .gx-rail__mark[aria-pressed="true"] { background: var(--s-tint-3); }
  .gx-rail__mark[data-voice-state="recording"] { box-shadow: var(--s-live-ring); }

  /* ---- the sidebar: the tank, the toggles, chats and settings ---------------------------------- */
  .gx-side { grid-area: left; margin-right: var(--gx-pad); display: flex; flex-direction: column; }
  /* Its rows keep their width while the column eases open or shut around them. */
  .gx-side > * { min-width: 252px; }
  /* Pinned without room, peeked from the rail or tapped open: over everything at the left. */
  .gx.is-side-float .gx-side {
    left: calc(var(--gx-pad) + env(safe-area-inset-left, 0px)); z-index: calc(var(--z-panel) + 6);
    width: 260px; margin: 0;
    animation: sg-slide-l var(--d-panel) var(--ease);
  }
  /* The tank switcher, the bell and the mark head the sidebar (they come last in the markup). */
  .gx-side__foot { order: -2; display: flex; flex: none; align-items: center; gap: 2px; padding: 8px 8px 2px; }
  .gx-side__foot .gx-rail__mark { margin-left: 2px; }
  .gx-side__head { order: -1; display: flex; flex: none; align-items: center; gap: 2px; padding: 2px 8px 6px; }
  .gx-side__body { display: flex; flex: 1; flex-direction: column; min-height: 0; }
  .gx-side__body > .assistant-sidebar { flex: 1; }

  .gx-side__tank {
    display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0;
    height: var(--h-md); padding: 0 8px 0 3px; border-radius: var(--r-md);
    font-size: var(--t-13); font-weight: 500; color: var(--color-ink); text-align: left;
    transition: background var(--d) var(--ease);
  }
  .gx-side__tank:hover, .gx-side__tank.is-open { background: var(--s-spot), var(--s-tint-2); }
  .gx-side__avatar { display: grid; flex: none; place-items: center; }
  .gx-side__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* The chat list (also the Chats surface's, which restyles it for its place). */
  .assistant-sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
  .assistant-sidebar__inner { display: flex; flex: 1; flex-direction: column; width: 100%; min-height: 0; }
  .assistant-sidebar__top { display: flex; flex: none; flex-direction: column; gap: 2px; padding: 0 8px 6px; }
  .assistant-sidebar__new {
    display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: var(--r-md);
    font-size: var(--t-13); font-weight: 500; color: var(--color-ink);
    transition: background var(--d) var(--ease);
  }
  .assistant-sidebar__new svg { width: 15px; height: 15px; color: var(--color-ink-secondary); }
  .assistant-sidebar__new:hover { background: var(--s-spot), var(--s-tint-2); }
  .assistant-sidebar__search {
    display: flex; align-items: center; gap: 8px; height: var(--h-md); padding: 0 8px; border-radius: var(--r-md);
    background: var(--field-paint, var(--s-tint-2)); box-shadow: var(--field-shadow, none); color: var(--color-ink-faint); cursor: text;
    transition: background var(--d) var(--ease), box-shadow var(--d) var(--ease);
  }
  .assistant-sidebar__search:hover { background: var(--field-paint, var(--s-tint-3)); }
  .assistant-sidebar__search:focus-within { background: var(--field-paint, var(--s-glass-strong)); box-shadow: var(--field-shadow, var(--e-focus)); }
  .assistant-sidebar__search svg { width: 14px; height: 14px; }
  .assistant-sidebar__search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--color-ink); font-size: var(--t-13); outline: none; }
  .assistant-sidebar__search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }

  .assistant-sidebar__list {
    display: flex; flex: 1; flex-direction: column; gap: 1px; min-height: 0;
    padding: 0 8px 8px; overflow-y: auto; overscroll-behavior: contain;
  }
  .assistant-sidebar__label { padding: 12px 8px 4px; font-size: 11.5px; font-weight: 500; color: var(--color-ink-faint); }
  .assistant-sidebar__label:first-child { padding-top: 6px; }
  .assistant-sidebar__row { display: flex; align-items: center; flex: none; border-radius: var(--r-md); }
  .assistant-sidebar__row.is-active { background: var(--s-tint-3); }
  .assistant-sidebar__pick {
    display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0;
    height: 30px; padding: 0 8px; border-radius: inherit;
    font-size: var(--t-13); font-weight: 500; color: var(--color-ink-secondary); text-align: left;
    transition: background var(--d) var(--ease), color var(--d) var(--ease);
  }
  .assistant-sidebar__pick:hover { background: var(--s-spot), var(--s-tint-2); color: var(--color-ink); }
  .assistant-sidebar__row.is-active .assistant-sidebar__pick { color: var(--color-ink); }
  .assistant-sidebar__dot { display: none; } /* no chat status in the list yet */
  .assistant-sidebar__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .assistant-sidebar__meta { flex: none; font: 500 11px var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; color: var(--color-ink-faint); white-space: nowrap; }

  .assistant-sidebar__settings { display: flex; flex: none; flex-direction: column; gap: 1px; margin: 0 8px; padding: 6px 0 8px; box-shadow: inset 0 1px 0 var(--s-edge); }
  .assistant-sidebar__settings-label { padding: 6px 8px 4px; font-size: 11.5px; font-weight: 500; color: var(--color-ink-faint); }
  .assistant-sidebar__setting {
    display: flex; align-items: center; gap: 8px; height: var(--h-md); padding: 0 8px; border-radius: var(--r-md);
    font-size: var(--t-13); color: var(--color-ink-secondary); text-align: left;
    transition: background var(--d) var(--ease), color var(--d) var(--ease);
  }
  .assistant-sidebar__setting svg { width: 15px; height: 15px; color: var(--color-ink-faint); transition: color var(--d) var(--ease); }
  .assistant-sidebar__setting > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .assistant-sidebar__setting:hover { background: var(--s-spot), var(--s-tint-2); color: var(--color-ink); }
  .assistant-sidebar__setting:hover svg { color: var(--color-ink-secondary); }
  .assistant-sidebar__trash { position: relative; margin-top: 9px; }
  .assistant-sidebar__trash::before { content: ""; position: absolute; top: -5px; left: 8px; right: 8px; height: 1px; background: var(--s-edge); }

  /* ---- the Assistant column ---------------------------------------------------------------------- */
  .gx-assist { grid-area: assist; position: relative; display: flex; }
  .gx-assist > .gx-panel { animation: sg-fade var(--d-slow) var(--ease); }
  .gx .gx-panel.os-window {
    display: flex; flex: 1; flex-direction: column;
    /* Its own width while the column eases open or shut around it: cut off, not squeezed. */
    min-width: min(var(--assist-w), calc(100vw - var(--gx-left) - 32px));
  }
  .gx-panel > .gx-head { position: relative; z-index: 1; flex: none; height: 40px; padding: 0 6px; box-shadow: 0 1px 0 var(--s-edge); }
  /* "Assistant" is for screen readers; the chat's title is what shows. */
  .gx-panel .os-window__identity { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .gx-panel .os-window__header-slot { height: 100%; }
  .gx-panel > .os-window__body { flex: 1 1 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); overflow: visible; }
  .chat-history__header { display: flex; align-items: center; height: 100%; min-width: 0; }
  .assistant-header { display: flex; flex: 1; align-items: center; gap: 2px; min-width: 0; }
  .assistant-header__conversation {
    flex: 1; min-width: 0; padding: 0 6px;
    font: var(--w-title) 13.5px / var(--h-md) var(--font-display); letter-spacing: var(--track-display); color: var(--color-ink);
  }
  .assistant-header__title { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .assistant-header__title.is-placeholder { color: var(--color-ink-faint); }
  .os-assistant-window { container: assistant / size; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

  /* The tabs closed: a whole-width Assistant keeps its conversation and its composer to a readable column
     (the scroller stays the full width). */
  .gx.is-stage-closed:not(.is-slideover) .gx-panel :is(.chat-history__content, .assistant-composer) { width: min(100%, 760px); margin-inline: auto; }

  /* Slide-over: the Assistant floats over the tabs beside the left column. */
  .gx.is-slideover .gx-assist {
    left: calc(var(--gx-pad) + var(--gx-left) + env(safe-area-inset-left, 0px)); z-index: calc(var(--z-panel) + 4);
    width: min(var(--assist-w), calc(100vw - var(--gx-left) - 32px));
    animation: sg-slide-l var(--d-panel) var(--ease);
  }
  /* …and with the tabs closed too, it is the screen. */
  .gx.is-slideover.is-stage-closed .gx-assist {
    right: calc(var(--gx-pad) + env(safe-area-inset-right, 0px)); width: auto;
    background: var(--s-glass); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: var(--e-flat); animation: none;
  }

  /* ---- the divider: the gutter between the Assistant and the tabs ----------------------------- */
  .gx-divider { grid-area: divider; position: relative; z-index: 3; cursor: col-resize; touch-action: none; outline: none; }
  .gx-divider::before { content: ""; position: absolute; inset: 0 -3px; }
  .gx-divider::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 3px; height: 36px; translate: -50% -50%;
    border-radius: var(--r-round); background: transparent; transition: background var(--d) var(--ease), height var(--d) var(--ease);
  }
  .gx-divider:hover::after { background: var(--s-edge-2); }
  .gx-divider:focus-visible::after { background: var(--color-focus-outline); }
  .gx.is-resizing .gx-divider::after { height: 56px; background: var(--color-accent-fill); }

  /* ---- the scrim under a slide-over -------------------------------------------------------------- */
  .gx-scrim { position: fixed; inset: 0; z-index: calc(var(--z-panel) + 3); background: var(--color-scrim); cursor: default; animation: sg-fade var(--d) var(--ease); }
  /* A slide-over and its scrim stack over a docked app; the left column stays above both. */
  .gx:is(.is-slideover, .is-hl-over) .gx-rail, .gx.is-side-docked:is(.is-slideover, .is-hl-over) .gx-side { position: relative; z-index: calc(var(--z-panel) + 5); }

  /* ---- the tabs area (stage) ------------------------------------------------------------------- */
  .gx-stage {
    grid-area: stage; display: grid; grid-template-rows: 40px minmax(0, 1fr); container-type: inline-size;
    transition: opacity var(--d-panel) var(--ease), visibility 0s linear;
  }
  /* The tabs are where the work is: a firmer glass than the columns around them. */
  .gx > .gx-stage { background: var(--s-glass-strong); }
  .gx.is-stage-closed .gx-stage { visibility: hidden; opacity: 0; transition: opacity var(--d) var(--ease), visibility 0s linear var(--d); }
  .gx.is-slideover .gx-stage-close { display: none; }

  .gx-bar { position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; min-width: 0; padding: 0 6px; box-shadow: 0 1px 0 var(--s-edge); }
  .gx-bar__space { flex: 1; min-width: 8px; }
  .gx-bar__utilities { display: flex; align-items: center; gap: 2px; }
  .gx-bar__utilities:empty { display: none; }

  /* The strip: tabs share it up to 180 px each (at most 8). It scrolls sideways with no bar; the padding
     is room for the active tab's ring, taken back by the margin. */
  .gx-tabs {
    display: flex; flex: 0 1 calc(var(--tab-count, 1) * 182px + 8px); align-items: center; gap: 2px; min-width: 0;
    padding: 4px; margin: -4px; overflow-x: auto; scrollbar-width: none;
    transition: flex-basis var(--d-panel) var(--ease);
  }
  .gx-tabs::-webkit-scrollbar { display: none; }
  /* A tab: the glyph, the name, and × on hover. A narrow one drops its glyph. */
  .gx-tab {
    position: relative; display: flex; flex: 0 1 180px; align-items: center; min-width: 48px; height: var(--h-md);
    container: gx-tab / inline-size;
    border-radius: var(--r-md); color: var(--color-ink-secondary);
    transition: background var(--d) var(--ease), box-shadow var(--d) var(--ease), color var(--d) var(--ease);
  }
  .gx-tab:hover { background: var(--s-tint-2); color: var(--color-ink); }
  .gx-tab.is-shown:not(.is-active) { background: var(--s-tint-2); color: var(--color-ink); }
  .gx-tab.is-active { background: var(--color-surface-raised); box-shadow: var(--e-raise); color: var(--color-ink); }
  .gx-tab__main {
    display: flex; flex: 1; align-items: center; gap: 7px; min-width: 0; height: 100%; padding: 0 8px 0 9px;
    border-radius: inherit; font-size: 12.5px; font-weight: 500; color: inherit; text-align: left;
    transition: background var(--d) var(--ease);
  }
  .gx-tab__main:hover { background: var(--s-spot); }
  .gx-tab__glyph { display: inline-grid; flex: none; place-items: center; }
  .gx-tab__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gx-tab__dot { display: none; }
  @container gx-tab (max-width: 96px) {
    .gx-tab__glyph { display: none; }
  }
  /* × floats over the tab's end; the name fades under it rather than moving. */
  .gx-tab__close {
    position: absolute; top: 50%; right: 4px; translate: 0 -50%;
    display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--r-sm);
    color: var(--color-ink-faint); opacity: 0; pointer-events: none;
    transition: opacity var(--d) var(--ease), background var(--d) var(--ease), color var(--d) var(--ease);
  }
  .gx-tab__close svg { width: 12px; height: 12px; }
  .gx-tab:is(:hover, :focus-within) .gx-tab__close { opacity: 1; pointer-events: auto; }
  .gx-tab__close:hover { background: var(--s-tint-3); color: var(--color-ink); }
  .gx-tab:is(:hover, :focus-within) .gx-tab__label { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent calc(100% - 6px)); mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent calc(100% - 6px)); }
  /* Touch has no hover: the tab in front keeps its ×. */
  @media (hover: none) {
    .gx-tab.is-active .gx-tab__close { opacity: 1; pointer-events: auto; }
  }

  /* Two tabs side by side: one item in a tint well, the split button before them. */
  .gx-pair {
    display: flex; flex: 0 1 380px; align-items: center; gap: 2px; min-width: 120px; padding: 2px;
    border-radius: var(--r-lg); background: var(--s-tint-2);
    transition: background var(--d) var(--ease); animation: sg-fade var(--d) var(--ease);
  }
  .gx-pair.is-active { background: var(--s-tint-3); }
  .gx-pair .gx-tab { height: 24px; border-radius: var(--r-sm); }
  .gx-pair .gx-tab.is-shown:not(.is-active) { background: none; }
  .gx-pair__split {
    display: grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: var(--r-sm);
    color: var(--color-ink-faint); transition: background var(--d) var(--ease), color var(--d) var(--ease);
  }
  .gx-pair__split svg { width: 14px; height: 14px; }
  .gx-pair__split:hover { background: var(--s-spot), var(--s-tint-3); color: var(--color-ink); }

  /* ---- panes ----------------------------------------------------------------------------------- */
  .gx-body { position: relative; display: flex; min-width: 0; min-height: 0; }
  .gx-panes { display: grid; flex: 1; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); min-width: 0; min-height: 0; }
  .gx-empty {
    position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
    font-size: var(--t-13); color: var(--color-ink-faint);
    animation: sg-fade var(--d-slow) var(--ease) var(--d-fast) backwards;
  }
  .gx .gx-pane.os-window { display: flex; flex-direction: column; container-type: inline-size; }
  .gx .gx-pane > .os-window__body { flex: 1 1 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
  /* A surface fills its place as a flex column. */
  .gx .os-window__body > * { min-width: 0; min-height: 0; }
  .gx .gx-pane .os-window__body > .surface-host { display: flex; flex-direction: column; }
  /* One pane shows no head (its tab is its title). Two side by side: each gets a slim head with its name
     and "show alone", a hairline between them, and the one you're in reads in ink. */
  .gx .gx-pane > .gx-head.is-bare { display: none; }
  .gx .gx-pane [data-unsplit] { display: none; }
  .gx-panes[data-count="2"] .gx-pane > .gx-head.is-bare {
    position: relative; z-index: 1; display: flex; flex: none; height: var(--h-lg); padding: 0 4px 0 12px; box-shadow: 0 1px 0 var(--s-edge);
  }
  .gx-panes[data-count="2"] .gx-pane .os-window__identity { flex: 1; }
  .gx-panes[data-count="2"] .gx-pane .os-window__header-slot:empty { display: none; }
  .gx-panes[data-count="2"] .gx-pane .os-window__title { font-size: var(--t-12); font-weight: 500; color: var(--color-ink-faint); transition: color var(--d) var(--ease); }
  .gx-panes[data-count="2"] .gx-pane.is-active .os-window__title { color: var(--color-ink); }
  .gx-panes[data-count="2"] .gx-pane.is-active > .gx-head { background: var(--s-tint-1); }
  .gx-panes[data-count="2"] .gx-pane [data-unsplit] { display: inline-grid; width: 24px; height: 24px; border-radius: var(--r-sm); }
  .gx-panes[data-count="2"] .gx-pane [data-unsplit] svg { width: 14px; height: 14px; }
  .gx-panes[data-count="2"] > .gx-pane:nth-child(2)::before {
    content: ""; position: absolute; inset: 0 auto 0 0; z-index: 2; width: 1px; background: var(--s-edge); pointer-events: none;
  }

  /* ---- the Highlights column (its inside: shells/highlights/highlights.css) --------------------- */
  .gx-hl { grid-area: hl; position: relative; display: flex; }
  /* Its own width while the column eases open or shut: cut off, not squeezed. */
  .gx-hl > * { min-width: min(var(--hl-w), calc(100vw - var(--gx-left) - 32px)); animation: sg-fade var(--d-slow) var(--ease); }
  /* Without room beside the tabs it slides over them from the right. */
  .gx.is-hl-over .gx-hl {
    right: calc(var(--gx-pad) + env(safe-area-inset-right, 0px)); z-index: calc(var(--z-panel) + 4);
    width: min(var(--hl-w), calc(100vw - var(--gx-left) - 32px));
    animation: sg-slide-r var(--d-panel) var(--ease);
  }

  /* ---- the Assistant popover (pop.js): the frame and its halo. The inside: assistant/pop.css ------
     Centred along the foot of the workspace (pop.js sets left, width and bottom), floating over
     everything: the floating surface over a soft, blurred halo. */
  .gx-pop {
    position: fixed; z-index: var(--z-popover); display: flex; flex-direction: column;
    max-height: calc(100vh - 48px); padding: 10px; border-radius: var(--r-2xl);
    background: var(--s-float); -webkit-backdrop-filter: var(--s-blur); backdrop-filter: var(--s-blur); box-shadow: var(--e-pop);
    animation: sg-rise var(--d-slow) var(--ease) both;
  }
  .gx-pop.is-leaving { animation: gx-pop-out var(--d) var(--ease-out) forwards; pointer-events: none; }
  /* Its height easing (assistant/view.js): what doesn't fit is clipped at the top, the chat box stays put. */
  .gx-pop.is-resizing { overflow: clip; justify-content: flex-end; }
  .gx-pop__host { display: flex; flex-direction: column; min-height: 0; }
  .gx-pop-halo {
    --halo-fade: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent),
      linear-gradient(to bottom, transparent, #000 44px, #000 calc(100% - 44px), transparent);
    position: fixed; z-index: var(--z-popover); border-radius: var(--r-2xl); pointer-events: none;
    background: color-mix(in srgb, var(--color-surface) 6%, transparent);
    -webkit-backdrop-filter: blur(10px) saturate(1.15); backdrop-filter: blur(10px) saturate(1.15);
    -webkit-mask-image: var(--halo-fade); -webkit-mask-composite: source-in; mask-image: var(--halo-fade); mask-composite: intersect;
    animation: sg-fade var(--d-slow) var(--ease) both;
  }
  .gx-pop-halo.is-leaving { animation: gx-fade-out var(--d) var(--ease-out) forwards; }
  @keyframes gx-pop-out { to { opacity: 0; transform: translateY(var(--rise)) scale(0.99); } }
  @keyframes gx-fade-out { to { opacity: 0; } }
}
