/* The Suyo theme color: a wall of sky and warm ground that changes with
   the hour, with glass over it. Paper shares all of it (paper.css changes
   only its wall, its cards, and the chips on its hills). Every rule is in
   the last layer, so it wins over the app's own without raising
   specificity, and every rule but the reset at the end and the clock's
   crossfade sits under the Suyo or Paper palette, so Classic is
   tokens.css's palette as it is.

   theme-boot.ts sets the base tokens on the root: the wall's six colors
   and its bloom, the text, the surfaces, and the accents, blended through
   the day in Auto. The rest derive from them here.

   The wall is a soft gradient on the root: deeper at the top left, warm at
   the bottom right, with a luminous bloom that crosses the window with the
   day. On it, messages and cards are near-white and nearly opaque, the
   side panels lighter glass with a strong blur, primary actions dark
   pills, corners 20 to 28px, and no borders.

   --suyo-bubble    a message or card on the wall
   --suyo-glass     a panel on the wall (side panel, Settings)
   --suyo-composer  the chat's composer: the glass by day, lighter at night
   --suyo-float     a menu or sheet over content (nearly opaque)
   --suyo-solid     a menu inside glass, which cannot blur through it
   --suyo-card      a group of rows inside a glass panel
   --suyo-hi        the chosen tab, the chosen page
   --suyo-wood      a primary action; --suyo-on-wood its text, --focus
                    the focus ring */

@layer theme {
  :root:is([data-palette="suyo"], [data-palette="paper"]) {
    --radius-card: 20px;
    --radius-entry: 12px;
    --suyo-radius: 24px;
    --suyo-blur: blur(44px) saturate(1.35);
    --suyo-blur-float: blur(32px) saturate(1.3);
    --suyo-card: color-mix(in srgb, var(--suyo-hi) 72%, transparent);
    --suyo-shadow: 0 8px 40px color-mix(in srgb, var(--suyo-shade) 9%, transparent), 0 16px 80px color-mix(in srgb, var(--suyo-shade) 10%, transparent);
    --suyo-shadow-small: 0 1px 2px color-mix(in srgb, var(--suyo-shade) 6%, transparent), 0 6px 20px color-mix(in srgb, var(--suyo-shade) 7%, transparent);
    --suyo-veil: color-mix(in srgb, var(--suyo-shade) 12%, transparent);
    --focus: var(--suyo-wood);
    --paper: var(--suyo-bubble);
    --side: var(--suyo-glass);
    --line: color-mix(in srgb, var(--ink) 9%, transparent);
    --rule: color-mix(in srgb, var(--ink) 15%, transparent);
    --hover-tint: color-mix(in srgb, var(--ink) 5%, transparent);
    --selected-tint: color-mix(in srgb, var(--ink) 8%, transparent);
    --shadow-tint: color-mix(in srgb, var(--suyo-shade) 8%, transparent);
    --border-faint: color-mix(in srgb, var(--ink) 6%, transparent);
    --shadow-pop: color-mix(in srgb, var(--suyo-shade) 13%, transparent);
    --shadow-sheet: color-mix(in srgb, var(--suyo-shade) 17%, transparent);
    --green-bg: color-mix(in srgb, var(--green) 11%, transparent);
    --amber-bg: color-mix(in srgb, var(--amber) 15%, transparent);
    --red-bg: color-mix(in srgb, var(--red) 11%, transparent);
    --on-accent: #ffffff;
    --badge-0: #b9603f;
    --badge-1: #2f4a7a;
    --badge-2: #5b5e3a;
    --badge-3: #9e3b2a;
    --badge-4: #8f6e48;
    --badge-5: #6a4733;
    --surface-page: transparent;
    --surface-rail: transparent;
    --surface-column: transparent;
    --bubble-assistant: var(--suyo-bubble);
    --bubble-assistant-border: transparent;
    --bubble-user-code: color-mix(in srgb, var(--bubble-user-ink) 14%, transparent);
    --composer: var(--suyo-glass);
    --raised: var(--suyo-card);
    --raised-line: color-mix(in srgb, var(--ink) 8%, transparent);
    --field-inset: var(--suyo-field);
    --field-line: transparent;
    --float: var(--suyo-float);
    --float-line: transparent;
    --button-tint: color-mix(in srgb, var(--ink) 7%, transparent);
    --button-tint-hover: color-mix(in srgb, var(--ink) 11%, transparent);
    --switch-off: color-mix(in srgb, var(--ink) 20%, transparent);
    /* What a page an agent built gets for its own tokens (core/page-frame.ts):
       no background of its own, so it sits on the wall as a view does; its
       cards the views' cards; and faint text, which no view sets on the
       wall, as muted. */
    --frame-bg: transparent;
    --frame-paper: var(--suyo-bubble);
    --frame-faint: var(--muted);

    /* The wall. The document never scrolls (the shell is the window and
       the views scroll inside it), so the root's gradient stays put. */
    background-color: var(--suyo-base);
    background-image:
      radial-gradient(ellipse 58% 52% at var(--suyo-bloom-x, 60%) var(--suyo-bloom-y, 60%), var(--suyo-glow) 0%, color-mix(in srgb, var(--suyo-glow) 55%, transparent) 40%, transparent 74%),
      radial-gradient(ellipse 78% 68% at 0% 0%, var(--suyo-deep) 0%, color-mix(in srgb, var(--suyo-deep) 45%, transparent) 42%, transparent 76%),
      radial-gradient(ellipse 66% 72% at 100% 100%, var(--suyo-warm) 0%, color-mix(in srgb, var(--suyo-warm) 40%, transparent) 40%, transparent 74%),
      linear-gradient(172deg in oklab, var(--suyo-top) 0%, var(--suyo-base) 52%, var(--suyo-bottom) 100%);

    &[data-theme="dark"] {
      --on-accent: #2a1c15;
      --badge-0: #c9714f;
      --badge-1: #5a78a8;
      --badge-2: #7f8452;
      --badge-3: #b2513d;
      --badge-4: #a8865c;
      --badge-5: #8a6550;
      --suyo-shadow: 0 8px 40px rgb(0 0 0 / 0.22), 0 16px 80px rgb(0 0 0 / 0.26);
      --suyo-shadow-small: 0 1px 2px rgb(0 0 0 / 0.2), 0 6px 20px rgb(0 0 0 / 0.18);
      --suyo-veil: rgb(8 4 3 / 0.32);
    }

    /* The root alone paints the wall: a body background would cover it. */
    & body { background: transparent; }

    /* No scroll bars on the chat and the main panes; the wheel, the
       trackpad, and touch still scroll them, and the chat's messages take
       the keyboard's focus (chat.css). */
    :is(.chat-messages, .panel, .nav, .view, .todo-page, .feed-page, .ideas-page, .settings-pages, .settings-page, .brief-sheet) {
      scrollbar-width: none;
      &::-webkit-scrollbar { display: none; }
    }

    .view-title {
      font-size: 32px;
      font-weight: 500;
      letter-spacing: -0.03em;
      line-height: 1.1;
    }
    :is(.feed-run-header h2, .feed-day) { font-weight: 500; }
    .view-head.is-compact .view-title { font-size: 20px; letter-spacing: -0.01em; }

    /* The rail: icons on the wall, the current one on a light round. */
    .nav { background: transparent; border-right: 0; }
    .nav a, .nav .nav-more { border-radius: 16px; color: var(--ink-soft); }
    .nav a:hover, .nav .nav-more:hover { background: var(--hover-tint); }
    .nav a[aria-current="page"] {
      background: var(--suyo-hi);
      color: var(--ink);
      box-shadow: var(--suyo-shadow-small);
    }
    .nav-indicator { border-color: var(--suyo-base); }

    /* The side panel: lighter glass standing off the rail and the
       window's edges, on a desk. */
    @media (min-width: 720px) {
      .panel {
        margin: 10px 0;
        padding: 18px 16px 20px;
        border-right: 0;
        border-radius: var(--suyo-radius);
        background: var(--suyo-glass);
        box-shadow: var(--suyo-shadow);
        -webkit-backdrop-filter: var(--suyo-blur);
        backdrop-filter: var(--suyo-blur);
      }
      .panel-resize::after { display: none; }
    }
    .panel-row { border-radius: 14px; }
    .panel-row[aria-current="true"] { background: var(--suyo-hi); box-shadow: var(--suyo-shadow-small); }
    #agents-groups :is(.agent-row, .agents-row, [aria-current]) { border-radius: 16px; }

    /* The floating controls: bare icons on the wall; on a phone, glass
       rounds. */
    .stage-control,
    .stage-controls > .panel-toggle { border-radius: 999px; }
    @media (max-width: 719.98px) {
      --float-fill: var(--suyo-glass);
      .stage-control,
      .stage-controls > .panel-toggle {
        background: var(--suyo-glass);
        box-shadow: var(--suyo-shadow-small);
        -webkit-backdrop-filter: var(--suyo-blur);
        backdrop-filter: var(--suyo-blur);
      }
      .stage-control:hover,
      .stage-control:focus-visible,
      .stage-controls > .panel-toggle:hover,
      .stage-controls > .panel-toggle:focus-visible { background: var(--suyo-float); }
      #app-menu-toggle .control-dot { border-color: var(--suyo-base); }

      /* The tab bar: a glass band along the bottom. With no top border,
         5px stands in for the base bar's 1px border and 4px padding, so the
         band is as tall as the base bar and meets the drawer. */
      .nav {
        padding-top: 5px;
        border-top: 0;
        background: var(--suyo-glass);
        box-shadow: 0 -8px 40px color-mix(in srgb, var(--suyo-shade) 6%, transparent);
        -webkit-backdrop-filter: var(--suyo-blur);
        backdrop-filter: var(--suyo-blur);
      }
      .nav a, .nav .nav-more { color: var(--muted); }
      .nav a[aria-current="page"] { background: transparent; box-shadow: none; color: var(--ink); }

      /* The drawer: one sheet over the view. */
      .panel {
        background: var(--suyo-float);
        -webkit-backdrop-filter: var(--suyo-blur);
        backdrop-filter: var(--suyo-blur);
      }
    }

    /* A heading row once the view scrolls: no bar. The title and its
       buttons sit on the wall, and what scrolls under them blurs into it,
       as the chat's messages do under its pill (the row's own band,
       theme-suyo.ts, under its text). */
    .view-head.is-compact {
      border-bottom: 0;
      background-color: transparent;
      box-shadow: none;
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }
    .view-head > .suyo-edge-head {
      top: 0;
      right: 0;
      z-index: -1;
      display: none;
      height: calc(100% + 12px);
      --edge-to: to bottom;
    }
    .view-head.is-compact > .suyo-edge-head { display: block; }
    .ideas-page:has(> #ideas-instructions:not([hidden])) > .view-head.is-compact {
      background-color: var(--suyo-solid);
      & > .suyo-edge-head { display: none; }
    }
    /* The blur covers the row, at most 10px behind the title, and eases off
       in the last few pixels below it, so what follows the row stays
       sharp. */
    .view-head > .suyo-edge-head {
      & > i:nth-child(1) { --edge-blur: 1px; --edge-reach: 100%; }
      & > i:nth-child(2) { --edge-blur: 3px; --edge-reach: 88%; }
      & > i:nth-child(3) { --edge-blur: 6px; --edge-reach: 76%; }
      & > i:nth-child(4) { --edge-blur: 10px; --edge-reach: 62%; }
      & > i { mask-image: linear-gradient(to bottom, #000 0, #000 calc(var(--edge-reach) - 26%), transparent var(--edge-reach)); -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(var(--edge-reach) - 26%), transparent var(--edge-reach)); }
    }

    /* Buttons: full pills; the primary one dark. */
    :is(.button, .ghost-button, .refresh-button, .settings-toggle, .icon-button, .settings-list-button, .link-button.button) { border-radius: 999px; }
    .button-primary { background: var(--suyo-wood); color: var(--suyo-on-wood); }
    .button-primary:hover { background: var(--suyo-wood-hover); }
    .button-primary:disabled,
    .button-primary:disabled:hover { background: var(--button-tint); color: var(--faint); }
    .notice button { border-radius: 999px; background: var(--suyo-wood); color: var(--suyo-on-wood); }
    .notice button:hover { background: var(--suyo-wood-hover); }
    .notice { border-bottom: 0; }
    .round-button { background-color: var(--suyo-wood); color: var(--suyo-on-wood); }
    .round-button:hover { background-color: var(--suyo-wood-hover); }
    .round-button:disabled { background-color: var(--button-tint-hover); color: var(--faint); }
    input[type="checkbox"][role="switch"]:checked { background: var(--suyo-wood); }
    .form-check input:not([role="switch"]) { accent-color: var(--suyo-wood); }

    /* Fields: soft rounded wells, ringed in the focus color. */
    :is(.form-input, .settings-select, .composer:not(.chat-composer) .composer-input, .collection-search input, .quick-chat-search) {
      border: 0;
      border-radius: 14px;
    }
    :is(.form-input, .settings-select, .composer:not(.chat-composer) .composer-input):focus-visible {
      border-color: transparent;
      box-shadow: none;
      outline: 2px solid var(--focus);
      outline-offset: 2px;
    }
    /* The composer's hint is muted, not faint: it sits on glass. */
    .composer-box .composer-input::placeholder { color: var(--muted); }

    /* Menus and popovers: floating glass, nearly opaque. */
    .menu-surface {
      border: 0;
      border-radius: 20px;
      background: var(--suyo-float);
      box-shadow: var(--suyo-shadow);
      -webkit-backdrop-filter: var(--suyo-blur-float);
      backdrop-filter: var(--suyo-blur-float);
    }
    /* A menu inside another glass surface can blur only that surface (it
       is the menu's backdrop root), so it is solid instead. */
    :is(.composer-box, .panel, .chat-details, .settings-sheet, .brief-sheet, .quick-chat) .menu-surface { background: var(--suyo-solid); }
    .theme-options { background: var(--button-tint); }
    .theme-options label:has(input:checked) { background: var(--suyo-hi); box-shadow: var(--suyo-shadow-small); }
    &[data-theme="dark"] .theme-options label:has(input:checked) { background: var(--suyo-hi); }

    /* Tabs: a segmented pill, the chosen one raised. */
    .pane-tabs:not(#agent-pane-tabs) {
      display: inline-flex;
      gap: 2px;
      align-self: flex-start;
      max-width: 100%;
      padding: 4px;
      border-bottom: 0;
      border-radius: 999px;
      background: var(--suyo-glass);
      box-shadow: var(--suyo-shadow-small);
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }
    .pane-tabs:not(#agent-pane-tabs) .pane-tab {
      min-height: 36px;
      padding: 0 16px;
      border-bottom: 0;
      border-radius: 999px;
    }
    .pane-tabs:not(#agent-pane-tabs) .pane-tab[aria-selected="true"] {
      background: var(--suyo-wood);
      color: var(--suyo-on-wood);
    }
    .todo-tabs-row { border-bottom: 0; }
    .todo-tabs-row .todo-tabs { flex: none; }
    .pane-tab-icon { border-radius: 14px; }
    .pane-tab-icon[aria-selected="true"] { background: var(--suyo-hi); color: var(--ink); box-shadow: var(--suyo-shadow-small); }

    /* Cards on the wall: near-white, no edge. */
    :is(.card, .todo-card, .text-card, .settings-list-empty, .artifact-card) {
      border: 0;
      border-radius: var(--radius-card);
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow-small);
    }

    /* The chat. Messages scroll under the agent's pill and under the
       composer, which floats over them. At the window's top and bottom
       edges they blur progressively into the wall (theme-suyo.ts adds each
       column's bands): four layers, blurring 1, 2, 3, and 6px, each
       masked to a shorter band at the edge, the whole column wide and
       with no tint, so the wall itself shows through. The messages dissolve
       in the last few pixels, under the strongest blur. */
    .chat-fade::before { display: none; }
    .chat-floating > .chat-messages {
      padding-bottom: calc(var(--suyo-composer-h, 80px) + 14px);
      -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 calc(100% - 14px), transparent 100%);
      mask-image: linear-gradient(to bottom, transparent 0, #000 20px, #000 calc(100% - 14px), transparent 100%);
    }
    .suyo-edge {
      position: absolute;
      right: var(--chat-scrollbar, 0px);
      left: 0;
      z-index: 2;
      display: block;
      pointer-events: none;
      & > i {
        position: absolute;
        inset: 0;
        -webkit-backdrop-filter: blur(var(--edge-blur));
        backdrop-filter: blur(var(--edge-blur));
        -webkit-mask-image: linear-gradient(var(--edge-to), #000 0, transparent var(--edge-reach));
        mask-image: linear-gradient(var(--edge-to), #000 0, transparent var(--edge-reach));
      }
      & > i:nth-child(1) { --edge-blur: 1px; --edge-reach: 100%; }
      & > i:nth-child(2) { --edge-blur: 2px; --edge-reach: 72%; }
      & > i:nth-child(3) { --edge-blur: 3px; --edge-reach: 48%; }
      & > i:nth-child(4) { --edge-blur: 6px; --edge-reach: 26%; }
    }
    .suyo-edge-top { top: 0; height: calc(var(--chat-row) + 4px); --edge-to: to bottom; }
    .suyo-edge-bottom { bottom: 0; height: calc(var(--suyo-composer-h, 80px) * 0.5 + 8px); --edge-to: to top; }
    /* The lists' bottom band, under every view but the chat, which has its
       own. On a phone it is hidden: the tab bar already ends the view. */
    .stage > .suyo-edge-bottom { right: 0; height: 48px; }
    &:has(#view-agents:not([hidden])) .stage > .suyo-edge { display: none; }
    /* On a phone the pill fills the row, so what passes under it is gone
       by the time it reaches the window's edge. */
    @media (max-width: 719.98px) {
      .stage > .suyo-edge-bottom { display: none; }
      .suyo-edge-top { height: calc(var(--chat-row) + 28px); }
      .chat-floating > .chat-messages {
        -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--chat-row) - 12px), #000 calc(var(--chat-row) + 12px), #000 calc(100% - 14px), transparent 100%);
        mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--chat-row) - 12px), #000 calc(var(--chat-row) + 12px), #000 calc(100% - 14px), transparent 100%);
      }
    }
    .chat-floating > .composer.chat-composer {
      position: absolute;
      right: var(--chat-scrollbar, 0px);
      bottom: 0;
      left: 0;
      z-index: 3;
      background: none;
      pointer-events: none;
      & > * { pointer-events: auto; }
    }
    /* While a question or approval card, or a failure line, stands between
       the messages and the composer, the composer keeps its place under
       them. */
    .chat-floating:has(> .chat-request:not([hidden]), > .chat-failure:not([hidden])) {
      & > .composer.chat-composer { position: relative; right: auto; bottom: auto; left: auto; }
      & > .chat-messages { padding-bottom: 16px; }
      & > .suyo-edge-bottom { display: none; }
    }
    .chat-message-text {
      padding: 11px 16px;
      border-radius: 20px;
      line-height: 1.55;
    }
    .chat-message-assistant .chat-message-text {
      border: 0;
      box-shadow: var(--suyo-shadow-small);
    }
    /* The brief's card takes a reply's corners and shadow. */
    .chat-brief-card {
      padding: 14px 16px;
      border: 0;
      border-radius: 20px;
      box-shadow: var(--suyo-shadow-small);
    }
    /* The person's own messages: frosted glass with a bright edge and a
       soft shadow, so it holds its shape on the palest wall. */
    .chat-message-user .chat-message-text {
      box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.7), 0 1px 2px color-mix(in srgb, var(--suyo-shade) 5%, transparent), 0 6px 18px color-mix(in srgb, var(--suyo-shade) 7%, transparent);
    }
    &[data-theme="dark"] .chat-message-user .chat-message-text {
      box-shadow: inset 0 0 0 1px rgb(255 240 228 / 0.1), var(--suyo-shadow-small);
    }
    .chat-message-meta { padding: 0 8px; }
    .chat-day { color: var(--muted); font-weight: 500; }
    .chat-pill {
      background: var(--suyo-glass);
      box-shadow: var(--suyo-shadow-small);
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }
    @media (hover: hover) {
      button.chat-pill-name:not(:disabled):hover { background: var(--hover-tint); }
    }
    button.chat-pill-name[aria-expanded="true"] { background: var(--selected-tint); }
    .agent-chat { background: transparent; }

    /* The composer: a glass pill. On a desk the input and its buttons
       share one row; on a phone the buttons sit under the input. The glass
       is the box's own layer under its content: a blur on the box itself
       would hold the phone's model sheet (fixed to the window) inside the
       box. */
    .chat-composer .composer-box {
      z-index: 0;
      border: 0;
      border-radius: 28px;
      background: transparent;
      box-shadow: var(--suyo-shadow);
      &::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        border-radius: inherit;
        background: var(--suyo-composer);
        -webkit-backdrop-filter: blur(24px) saturate(1.4);
        backdrop-filter: blur(24px) saturate(1.4);
        pointer-events: none;
      }
    }
    &[data-theme="dark"] .chat-composer .composer-box {
      box-shadow: inset 0 0 0 1px rgb(255 240 228 / 0.08), var(--suyo-shadow);
    }
    .chat-composer .composer-box:focus-within { border-color: transparent; box-shadow: 0 0 0 2px var(--focus), var(--suyo-shadow); }
    .chat-composer .composer-box:has(.composer-input:disabled) { box-shadow: var(--suyo-shadow-small); }
    @media (min-width: 720px) {
      .chat-composer .composer-box {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        padding: 6px;
      }
      .chat-composer .composer-bar { display: contents; }
      .chat-composer .composer-box > :not(.composer-input, .composer-bar) { flex-basis: 100%; }
      .chat-composer .composer-box > :is(.model-menu, .menu-surface) { flex-basis: auto; }
      .chat-composer .composer-box > .composer-reply { flex-basis: calc(100% - 4px); margin: 2px 2px 4px; }
      .chat-composer .composer-attach { order: 1; margin-right: 0; }
      .chat-composer .composer-box .composer-input {
        order: 2;
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 10px 8px;
        line-height: 24px;
        border-radius: 0;
      }
      .chat-composer .composer-tools { order: 3; }
      .chat-composer .mic-button { order: 4; }
      .chat-composer .composer-send { order: 5; }
      .chat-composer .composer-attach:not(:has(.attach-button:not([hidden]))) + * { margin-left: 10px; }
    }
    .model-button { border-radius: 999px; }
    .attach-button { border-radius: 999px; }

    /* The agent's settings beside the chat: a glass card on a desk;
       on a phone they cover the chat, nearly opaque. */
    @media (min-width: 720px) {
      .chat-details {
        margin: 10px 10px 10px 0;
        padding-top: calc(var(--controls-h) - 10px);
        border-left: 0;
        border-radius: var(--suyo-radius);
        background: var(--suyo-glass);
        box-shadow: var(--suyo-shadow);
        -webkit-backdrop-filter: var(--suyo-blur);
        backdrop-filter: var(--suyo-blur);
      }
    }
    @media (max-width: 719.98px) {
      .chat-details {
        background: var(--suyo-float);
        -webkit-backdrop-filter: var(--suyo-blur);
        backdrop-filter: var(--suyo-blur);
      }
    }

    /* The Filter panel sticks under the heading row: it blurs what
       scrolls under it and is clear at rest. */
    .filter-panel {
      background: transparent;
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }
    .collection-search input { background: var(--field-inset); }

    /* Settings: one glass sheet over the wall, its groups lighter cards.
       Under the sheet the view is veiled and blurred, so nothing behind it
       reads around its edges. The blur is on a layer under the sheet, not
       on the overlay, which would be the sheet's backdrop root and leave
       the sheet nothing to blur. */
    .settings-overlay {
      background: none;
      &::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: var(--suyo-veil);
        -webkit-backdrop-filter: blur(14px) saturate(1.1);
        backdrop-filter: blur(14px) saturate(1.1);
      }
    }
    .settings-sheet {
      border: 0;
      border-radius: 28px;
      background: var(--suyo-glass);
      box-shadow: var(--suyo-shadow);
      -webkit-backdrop-filter: blur(50px) saturate(1.35);
      backdrop-filter: blur(50px) saturate(1.35);
    }
    .settings-pages {
      padding: 22px 12px;
      border-right: 0;
      background: transparent;
    }
    .settings-title { margin: 4px 12px 18px; font-size: 26px; font-weight: 500; letter-spacing: -0.02em; }
    .settings-page-link { height: 40px; border-radius: 999px; font-weight: 500; }
    .settings-page-link[aria-current="page"] { background: var(--suyo-hi); box-shadow: var(--suyo-shadow-small); }
    .settings-page { --sheet-top: 22px; --sheet-side: 36px; }
    /* A page's title sits on the sheet with its content and scrolls with
       it; nothing fades at the sheet's edges. */
    .settings-page-head { position: static; background: transparent; }
    .settings-page-title { font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
    :is(.settings-list, .settings-rows, .form-switch) { border-radius: var(--radius-card); background: var(--suyo-card); }
    .settings-list-heading { margin-bottom: 8px; }
    .settings-list-block + .settings-list-block:not(.feed-source-results > *) { margin-top: 28px; }
    .settings-list-button { border-radius: 0; }
    &:not([data-theme="dark"]) .settings-page-group { background: transparent; }
    /* On a phone the sheet is the whole screen: square and opaque. */
    @media (max-width: 719.98px) {
      .settings-sheet { border-radius: 0; background: var(--suyo-solid); }
      .settings-pages { background: transparent; }
      &:not([data-theme="dark"]) .settings-page-group { background: var(--suyo-card); }
      /* The title and its back button stay at the top, on the sheet's own
         color. */
      :is(.settings-page-head, .settings-title) { position: sticky; background: var(--suyo-solid); }
    }

    /* Quick chat: a glass column and a glass round. */
    .quick-chat {
      background: var(--suyo-float);
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }
    .quick-chat-fab.icon-button {
      background: var(--suyo-glass);
      box-shadow: var(--suyo-shadow-small);
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }
    .quick-chat-fab.icon-button:hover { background: var(--suyo-float); }

    /* Todo: each card near-white; the check a dark ring. */
    .todo-card { padding-block: 14px; }
    .todo-check { border-color: var(--faint); }
    .todo-check[aria-pressed="true"] { border-color: var(--suyo-wood); background: var(--suyo-wood); }
    .drawer { border-top-color: var(--line); }
    /* An open fold's rows in a list (Todo's Later, Recently cleared, and
       Considered; Goals' Done and dropped) sit on a glass sheet, as a
       Settings page's groups do. Precedent: the Settings sheet. */
    section.view .drawer .drawer-rows:not(:empty) {
      gap: 0;
      padding: 4px 16px;
      border-radius: var(--radius-card);
      background: var(--suyo-glass);
      box-shadow: var(--suyo-shadow-small);
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }

    /* Goals: each goal a card, and an open goal the same card. Precedent:
       the Todo card. */
    .goal-row {
      margin: 0;
      padding: 14px 8px 14px 16px;
      border-radius: var(--radius-card);
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow-small);
    }
    .goal-row + .goal-row { margin-top: 8px; }
    .goal-open {
      padding: 18px 20px 20px;
      border-radius: var(--radius-card);
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow-small);
    }

    /* Ideas: each idea a card, 12px apart. Precedent: the Feed post. */
    .ideas-item {
      margin: 0 0 12px;
      padding: 16px 18px;
      border-radius: var(--radius-card);
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow-small);
    }
    .ideas-item + .ideas-item { margin-top: 0; }

    /* An open document or artifact reads on a card. Precedent: the brief's
       reading sheet. */
    .artifact-open {
      padding: 18px 20px 20px;
      border-radius: var(--radius-card);
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow-small);
    }
    .artifact-entries { border-top-color: var(--line); }

    /* The notifications: their rows in one card on the panel, reaching
       almost as far as the plain look's rows so a sentence keeps its line.
       Precedent: a Settings page's groups. */
    .notifications-list:not(:empty) {
      margin: 0 -8px;
      border-radius: 16px;
      background: var(--suyo-card);
    }

    /* First run and sign-in: one card on the wall, with the large shadow.
       Precedent: the chat's reply card. */
    .signin-form {
      padding: 28px;
      border-radius: 28px;
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow);
    }
    @media (max-width: 719.98px) {
      .signin-form { padding: 24px 20px; }
    }

    /* Feed: each post a near-white card. */
    .feed-item {
      padding: 18px 20px 12px 16px;
      border-radius: var(--radius-card);
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow-small);
    }
    .feed-item:not([hidden]) ~ .feed-item { margin-top: 12px; }
    .feed-item[data-feed-target] { background: var(--suyo-hi); box-shadow: var(--suyo-shadow-small); }
    .feed-icon-button { border-radius: 999px; }
    .feed-insights { border-radius: 16px; }
    .collection-new { border: 0; background: var(--suyo-float); box-shadow: var(--suyo-shadow-small); -webkit-backdrop-filter: var(--suyo-blur); backdrop-filter: var(--suyo-blur); }

    /* A page an agent built sits on the wall like a view: its frame is
       clear, and so is the page (--frame-bg above). Precedent: the views. */
    .page-frame { background: transparent; }

    /* The brief: a reading sheet of floating glass. */
    .brief-overlay { background: var(--suyo-veil); }
    .brief-sheet {
      border: 0;
      border-radius: 28px;
      background: var(--suyo-float);
      box-shadow: var(--suyo-shadow);
      -webkit-backdrop-filter: blur(50px) saturate(1.3);
      backdrop-filter: blur(50px) saturate(1.3);
    }
    .brief-bar {
      border-bottom: 0;
      background: transparent;
      -webkit-backdrop-filter: blur(24px);
      backdrop-filter: blur(24px);
    }
    /* An open idea's foot mirrors the bar. */
    .ideas-detail-foot {
      border-top: 0;
      background: transparent;
      -webkit-backdrop-filter: blur(24px);
      backdrop-filter: blur(24px);
    }
    @media (max-width: 719.98px) {
      .brief-sheet { border-radius: 0; }
    }

    /* The shared pages site (shared.css), always in Suyo. Its header is a
       view's compact heading row on the wall, with no bar; each shared page
       a card (precedent: the Library's cards); the chat and its round
       button quick chat's. */
    .shared-head { border-bottom: 0; }
    .shared-head h1 { font-weight: 500; letter-spacing: -0.01em; }
    .shared-page-row {
      padding: 14px 16px;
      border-bottom: 0;
      border-radius: var(--radius-card);
      background: var(--suyo-bubble);
      box-shadow: var(--suyo-shadow-small);
    }
    .shared-page-row + .shared-page-row { margin-top: 8px; }
    .shared-page-row:hover { background: var(--suyo-hi); }
    .shared-chat-button {
      background: var(--suyo-glass);
      box-shadow: var(--suyo-shadow-small);
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }
    .shared-chat-button:hover { background: var(--suyo-float); }
    .shared-chat {
      border-left: 0;
      background: var(--suyo-float);
      -webkit-backdrop-filter: var(--suyo-blur);
      backdrop-filter: var(--suyo-blur);
    }

    /* Reduced transparency: theme-boot.ts paints every glass surface
       opaque, and nothing blurs. The messages' masks stay: they fade, they
       do not blur. */
    @media (prefers-reduced-transparency: reduce) {
      .panel, .stage-control, .stage-controls > .panel-toggle, .nav, .menu-surface, .pane-tabs:not(#agent-pane-tabs), .chat-pill,
      .chat-composer .composer-box::before, .chat-details, .filter-panel, .settings-overlay::before, .settings-sheet,
      .quick-chat, .quick-chat-fab.icon-button, .collection-new, .brief-sheet, .brief-bar, .ideas-detail-foot, .shared-chat-button, .shared-chat {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
      }
      .suyo-edge > i {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
      }
    }
  }

  /* The edges and heading bands (theme-suyo.ts) belong to the Suyo and
     Paper looks. */
  .suyo-edge { display: none; }

  /* The clock's crossfade into dark or light (theme-boot.ts). */
  :root.theme-fading::view-transition-old(root),
  :root.theme-fading::view-transition-new(root) { animation-duration: 1.6s; }
}
