/* [ai] The floating Astra pill + conversation card (app/client/chat/pill.js; specs 2026-09-13-floating-astra-chat-design.md,
   2026-09-13-astra-pill-polish.md). One fixed column at the bottom of every page: [card] [tabs] [row]. Collapsed = the row
   alone (a white pill, 1 px line); `open` = the card grows above it up to the bar. Folder tabs (status · context) sit on the
   row's top line. Tokens only. z: with the menu (under the folders card, sheets, toasts). */
body.at-astra-on { --at-dock-b: 64px; --at-astra-row: 48px; --at-astra-gap: 7px; padding-bottom: calc(env(safe-area-inset-bottom) + var(--at-dock-b)); }   /* the reserve every page keeps above the pill (the drop, toasts, body padding read it); pill.js refines it after measuring; injected static docs end above it too */
.at-astra { position: fixed; z-index: var(--ds-z-menu); left: 50%; bottom: calc(env(safe-area-inset-bottom) + var(--at-astra-gap) + var(--at-astra-kb, 0px)); transform: translateX(-50%); width: min(720px, 100vw - 24px); display: flex; flex-direction: column; --at-astra-below: 44px; }   /* --at-astra-below = the measured row + tabs (pill.js reserve()): the card and the history sidebar stop above it */
.at-astra-row, .at-astra-side { box-shadow: 0 10px 30px rgba(28, 24, 18, .10), 0 1px 2px rgba(28, 24, 18, .06); }
/* ---- open: card + tabs + row are ONE sheet (one line, one radius, one shadow); inside it the row keeps a hairline above itself and nothing else */
.at-astra.open { background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-radius); box-shadow: 0 18px 50px rgba(28, 24, 18, .13), 0 2px 6px rgba(28, 24, 18, .05); }
.at-astra.open .at-astra-row { border: 0; border-top: 1px solid var(--ds-line); border-radius: 0 0 calc(var(--ds-radius) - 1px) calc(var(--ds-radius) - 1px); box-shadow: none; }
html.at-kb .at-astra { bottom: calc(8px + var(--at-astra-kb, 0px)); }   /* the iOS keyboard: ride its top edge, no safe inset below it */
html.at-kb .at-astra.open .at-astra-card { height: calc(var(--at-astra-vv-h) - max(0px, var(--at-bar-h) - var(--at-astra-vv-top)) - 8px - var(--at-astra-below) - 2px); }   /* keyboard up: the card fits the VISUAL viewport (100dvh does not shrink on iOS) under whatever part of the bar is still on screen once the page scrolled under it */

/* ---- the row: the white pill itself */
.at-astra-row { display: flex; align-items: flex-end; gap: 4px; min-height: var(--at-astra-row); padding: 3px 5px; margin: 0; background: var(--ds-card); border: 1px solid var(--ds-line); border-top: 1px solid var(--ds-line); border-radius: 26px; transition: border-radius .25s var(--ds-ease); }
.at-astra-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; height: 38px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--ds-muted); font: 600 13px/1 var(--ds-font); cursor: pointer; transition: background .15s, color .15s, transform .15s var(--ds-ease); }
.at-astra-btn:hover { background: var(--ds-soft); color: var(--ds-fg); } .at-astra-btn[aria-expanded="true"] { background: var(--ds-soft); color: var(--ds-fg); }
.at-astra-plus { font: 300 22px/1 var(--ds-font); } .at-astra-plus span { display: block; margin-top: -2px; }
.at-astra-persona { padding: 0 10px 0 8px; } .at-astra-persona-e { font-size: 15px; } .at-astra-persona-t { font: 600 13px/1 var(--ds-font); } .at-astra-persona::after { content: "▾"; font-size: 10px; opacity: .7; margin-left: -1px; }
.at-astra-model { padding: 0; min-width: 38px; }   /* the model + effort live in the menu; the button is the sparkle alone (its title names the choice) */
.at-astra-model-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.at-astra-mic.rec { color: var(--ds-danger); background: var(--ds-danger-soft); animation: at-astra-pulse 1.4s ease-in-out infinite; } .at-astra-mic.busy { color: var(--ds-muted); opacity: .6; }
@keyframes at-astra-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--ds-danger-soft); } 50% { box-shadow: 0 0 0 6px var(--ds-danger-soft); } }
.at-astra-send { background: var(--ds-fg); color: var(--ds-bg); font: 700 17px/1 var(--ds-font); width: 38px; min-width: 38px; padding: 0; transform: scale(.001); opacity: 0; transition: transform .18s var(--ds-ease), opacity .12s; }
.at-astra.has-text .at-astra-send, .at-astra.streaming .at-astra-send { transform: none; opacity: 1; }   /* ↑ only with text; ■ while the answer streams */
.at-astra-send:hover { background: var(--ds-fg); color: var(--ds-bg); opacity: .88; } .at-astra.streaming .at-astra-send { font-size: 13px; }
.at-astra:not(.has-text):not(.streaming) .at-astra-send { width: 0; min-width: 0; margin-left: -4px; }
.at-astra-field { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; padding: 0 4px 0 6px; }
.at-astra-in { flex: 1 1 60px; min-width: 0; box-sizing: border-box; height: 38px; max-height: 40vh; margin: 0; padding: 9px 0 8px; border: 0; background: transparent; color: var(--ds-fg); font-family: var(--ds-font); font-size: 16px; line-height: 1.3; resize: none; outline: none; }   /* border-box: pill.js sets the height from scrollHeight, and "" (empty) is one line again */
.at-astra-in::placeholder { color: var(--ds-muted); opacity: .8; font-style: italic; font-family: var(--ds-serif); font-size: 17px; letter-spacing: .005em; }   /* the inspirational line reads in the brand serif */

/* ---- the tabs on the row's top line (folder tabs: top radius, no bottom line, 1 px over the row's border) */
.at-astra-tabs { display: flex; align-items: flex-end; gap: 6px; padding: 0 18px; position: relative; z-index: 1; pointer-events: none; }
.at-astra-tab { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 12px; margin-bottom: -1px; border: 1px solid var(--ds-line); border-bottom: 0; border-radius: 12px 12px 0 0; background: color-mix(in srgb, var(--ds-soft) 45%, var(--ds-card)); color: var(--ds-muted); font: 500 12px/1 var(--ds-font); white-space: nowrap; max-width: 60%; cursor: default; }
.at-astra-tab[hidden] { display: none; }
.at-astra-status { padding-right: 12px; cursor: pointer; transition: color .15s; } .at-astra-status:hover { color: var(--ds-fg); }
.at-astra-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--ds-accent2); flex: none; } .at-astra-status.live .at-astra-dot { background: var(--ds-fg); animation: at-astra-breathe 1.6s ease-in-out infinite; }
@keyframes at-astra-breathe { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
.at-astra-chip-t { overflow: hidden; text-overflow: ellipsis; } .at-astra-chip-x { width: 20px; height: 20px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: 500 14px/1 var(--ds-font); cursor: pointer; opacity: 0; transition: opacity .12s; padding: 0; }
.at-astra-chip:hover .at-astra-chip-x, .at-astra-chip-x:focus-visible { opacity: 1; } @media (pointer: coarse) { .at-astra-chip-x { opacity: 1; } }
.at-astra-chip.files { color: var(--ds-fg); }

/* ---- the card above the row: same white surface, the frame edge to edge under a thin head */
.at-astra-card { position: relative; display: flex; flex-direction: column; height: 0; overflow: hidden; background: var(--ds-card); transition: height .32s var(--ds-ease); }
.at-astra-card[hidden] { display: none; }
.at-astra.open .at-astra-card { border: 0; border-radius: calc(var(--ds-radius) - 1px) calc(var(--ds-radius) - 1px) 0 0; box-shadow: none; height: calc(100dvh - var(--at-bar-h) - var(--at-astra-gap) - env(safe-area-inset-bottom) - var(--at-astra-below) - 2px); }   /* the keyboard case is the html.at-kb rule above; the pill's own offset never resizes the card */   /* the top edge on the bar's line (2px = the sheet's own borders), whatever the row + tabs measure */
.at-astra-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 18px; min-height: 44px; border-bottom: 1px solid var(--ds-line); }
.at-astra-who { font: italic 17px/1 var(--ds-serif); color: var(--ds-fg); margin-right: 6px; } .at-astra-state { flex: 1 1 auto; font: 500 12px/1 var(--ds-font); color: var(--ds-muted); }
.at-astra-up { min-width: 38px; padding: 0; } .at-astra.open .at-astra-up { display: none; }   /* the card's own chevron takes over once open */
.at-astra-hist { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: 0 6px 0 -8px; border: 0; border-radius: 999px; background: transparent; color: var(--ds-muted); cursor: pointer; transition: background .15s, color .15s; }
.at-astra-hist:hover, .at-astra-hist[aria-expanded="true"] { background: var(--ds-soft); color: var(--ds-fg); }
.at-astra-full, .at-astra-fold { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 999px; background: transparent; color: var(--ds-muted); cursor: pointer; text-decoration: none; transition: background .15s, color .15s; }
.at-astra-full:hover, .at-astra-fold:hover { background: var(--ds-soft); color: var(--ds-fg); } .at-astra-fold svg { display: block; }
.at-astra-body { position: relative; flex: 1 1 auto; min-height: 0; margin: 0; background: var(--ds-card); overflow: hidden; }
.at-astra-frame-host { position: absolute; inset: 0; } .at-astra-frame { display: block; width: 100%; height: 100%; border: 0; background: transparent; color-scheme: normal; }
.at-astra-bubble { position: absolute; right: 14px; bottom: 12px; max-width: 78%; padding: 9px 14px; border-radius: 18px 18px 6px 18px; background: var(--ds-soft); color: var(--ds-fg); font: 400 15px/1.4 var(--ds-font); white-space: pre-wrap; word-break: break-word; }   /* the user's turn, drawn at once; the frame takes over */
.at-astra-off { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 14px 18px; font: 400 13px/1.45 var(--ds-font); color: var(--ds-muted); } .at-astra-off code { font: 12px var(--ds-mono); }
.at-astra-drop { position: absolute; inset: 0; display: grid; place-items: center; background: var(--ds-glass); color: var(--ds-fg); font: 600 14px var(--ds-font); pointer-events: none; }

/* ---- the history sidebar: a second white sheet to the LEFT of the card (same radius, line and shadow), never over the transcript */
.at-astra-side { position: absolute; right: calc(100% + 10px); top: 0; bottom: var(--at-astra-below); width: 272px; display: flex; flex-direction: column; background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-radius); overflow: hidden; opacity: 0; transform: translateX(-12px); transition: opacity .2s var(--ds-ease), transform .24s var(--ds-ease); }   /* it lives on the left: in from the left, out to the left */
.at-astra-side[hidden] { display: none; } .at-astra-side.on { opacity: 1; transform: none; }
.at-astra-side-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 18px; font: 600 11px/1 var(--ds-font); letter-spacing: .08em; text-transform: uppercase; color: var(--ds-muted); }
.at-astra-side-hb { display: inline-flex; align-items: center; gap: 2px; }
.at-astra-side-x { width: 30px; height: 30px; margin-right: -4px; border: 0; border-radius: 999px; background: transparent; color: var(--ds-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s; } .at-astra-side-x:hover { background: var(--ds-soft); color: var(--ds-fg); }
.at-astra-side-new { height: 26px; margin-right: 4px; padding: 0 10px; border: 1px solid var(--ds-line2); border-radius: 999px; background: transparent; color: var(--ds-fg); font: 600 12px/1 var(--ds-font); cursor: pointer; } .at-astra-side-new:hover { background: var(--ds-soft); }
.at-astra-side-l { flex: 1 1 auto; min-height: 0; margin: 0; padding: 4px 8px 10px; list-style: none; overflow: auto; overscroll-behavior: contain; }
.at-astra-side-i { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 0 4px 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ds-fg); text-align: left; font: 400 13.5px/1.3 var(--ds-font); cursor: pointer; transition: background .12s; box-sizing: border-box; }   /* the fork's sidebar row: title · age, the age giving way to … on hover */
.at-astra-side-i:hover { background: var(--ds-soft); } .at-astra-side-i.active { background: var(--ds-soft); font-weight: 600; }
.at-astra-side-i .t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .at-astra-side-i .w { flex: none; margin-right: 6px; font: 400 11px/1 var(--ds-font); color: var(--ds-muted); }
.at-astra-side-i .m { flex: none; display: none; align-items: center; justify-content: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--ds-muted); cursor: pointer; padding: 0; } .at-astra-side-i .m:hover { background: var(--ds-line); color: var(--ds-fg); }
.at-astra-side-i:hover .w, .at-astra-side-i:focus-within .w, .at-astra-side-i.menu .w { display: none; } .at-astra-side-i:hover .m, .at-astra-side-i:focus-within .m, .at-astra-side-i.menu .m { display: inline-flex; } @media (pointer: coarse) { .at-astra-side-i .m { display: inline-flex; } .at-astra-side-i .w { display: none; } }
.at-astra-side-ri { flex: 1 1 auto; min-width: 0; height: 26px; padding: 0 6px; border: 1px solid var(--ds-line2); border-radius: 7px; background: var(--ds-card); color: var(--ds-fg); font: 400 13.5px/1 var(--ds-font); outline: none; } .at-astra-side-ri:focus { border-color: var(--ds-fg); }
.ds-menu[data-kind="models-all"] { max-height: min(62vh, 560px); max-width: 440px; overflow: auto; overscroll-behavior: contain; }   /* every provider, six models each + "+N more"; never the whole page */
.at-astra-side-e { padding: 18px 18px 22px; font: italic 14px/1.4 var(--ds-serif); color: var(--ds-muted); }
.at-astra.side-in .at-astra-side { right: auto; left: 0; z-index: 2; border: 0; border-right: 1px solid var(--ds-line); border-bottom: 0; bottom: var(--at-astra-row-h, var(--at-astra-below)); border-radius: calc(var(--ds-radius) - 1px) 0 0 0; box-shadow: 12px 0 32px rgba(28, 24, 18, .10); }   /* inside the sheet: the top-left corner only, its foot flush on the row's hairline even with a tab up (over the tabs, z 2) */
.at-astra.open .at-astra-side { top: -1px; right: calc(100% + 11px); }   /* beside mode measures from the open root's padding box: line up with its top line, keep the 10 px gap */   /* no room beside the card (the rail, a phone): it slides over the card's left edge — pill.js fitSide() measures */

@media (max-width: 640px) {
  .at-astra { left: 8px; right: 8px; width: auto; transform: none; }
  .at-astra-persona-t { display: none; } .at-astra-persona { padding: 0 8px; }
  .at-astra-model { display: none; } .at-astra.open .at-astra-model { display: inline-flex; }   /* the model sparkle lives in the open card's row only on a phone */
  .at-astra-in::placeholder { font-size: 16px; }
  .at-astra-tabs { padding: 0 14px; } .at-astra-tab { max-width: 70%; }
}
@media (prefers-reduced-motion: reduce) { .at-astra-row, .at-astra-card, .at-astra-side, .at-astra-send { transition: none; } .at-astra-mic.rec, .at-astra-status.live .at-astra-dot { animation: none; } }
