/* Companion chrome is independent of Today’s card layout. */
/* Monochrome: the companion maps the brand accent tokens to neutrals. */
.gs-companion { --gs-coral-glow:#f1efeb;--gs-coral-deep:#2f2a25;--gs-coral-light:#cfc9c1; }
.dark .gs-companion { --gs-coral-glow:#4a4542;--gs-coral-deep:#f2efec;--gs-coral-light:#a39a92; }
.gs-companion-header-row { display:grid; grid-template-columns:92px minmax(0,1fr) 92px; align-items:center; }
/* A pushed screen with one 40px button a side (a conversation: Back and More), so its title gets 262px instead of
   168px at 390px and wraps to two lines rather than cutting off (plans/024). A screen opts in with
   content_for(:gs_header_compact) and puts its one right-hand button in content_for(:gs_header_action);
   layouts/shared/_gs_header.html.erb then leaves out the companion and the bell. */
.gs-companion-header-row--compact { grid-template-columns:40px minmax(0,1fr) 40px; }
.gs-app-header .gs-companion-header-row--compact .gs-app-header-title { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; padding-inline:8px; font-size:var(--guided-size-body); font-weight:650; line-height:var(--guided-leading-heading); letter-spacing:0; overflow-wrap:break-word; text-wrap:balance; }
.gs-companion { position:static; flex-shrink:0; width:44px; }
.gs-companion [hidden] { display:none !important; }
.gs-companion button { cursor:pointer; font-family:inherit; }
.gs-companion button:disabled { cursor:default; }
.gs-companion button:focus-visible,.gs-companion a:focus-visible { outline:2px solid var(--gs-text-primary); outline-offset:2px; }
.gs-companion-launch { display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent; }
.gs-companion-launch:hover,.gs-companion-launch[aria-expanded=true] { background:var(--gs-coral-glow,#fff0e9); }
/* Keep the full seated mascot within the existing companion icon dimensions. */
.gs-companion-avatar { display:block;flex-shrink:0;width:var(--companion-avatar-size);height:var(--companion-avatar-size); }
.gs-companion-avatar img { display:block;width:100%;height:100%;object-fit:contain; }
.gs-companion-hello { position:absolute;top:calc(100% + 4px);right:12px;width:300px;max-width:calc(100% - 24px);display:flex;align-items:flex-start;border:1px solid var(--gs-border,#e9ded3);border-radius:15px 6px 15px 15px;background:var(--gs-warm-cream,#fffaf4);box-shadow:0 5px 22px #543a2020;animation:gs-companion-arrive .3s ease-out; }
.gs-companion-hello::before { content:"";position:absolute;top:-5px;right:calc(var(--gs-page-px,16px) + 54px);width:8px;height:8px;background:inherit;border-left:1px solid var(--gs-border,#e9ded3);border-top:1px solid var(--gs-border,#e9ded3);transform:rotate(45deg); }
.gs-companion-hello>button:first-child { padding:14px 0 14px 16px;flex:1;min-width:0;text-align:left;border:0;background:transparent;color:var(--gs-text-primary,#332d27); }
.gs-companion-hello strong { display:block;font-size:18px;font-weight:700;line-height:24px;letter-spacing:-.3px;margin-bottom:7px;overflow-wrap:anywhere; }
.gs-companion-hello span { display:block;font-size:14px;font-weight:500;line-height:21px;color:var(--gs-text-secondary,#65594f); }
.gs-companion-hello-close { width:44px;height:44px;flex-shrink:0;border:0;background:transparent;color:var(--gs-text-secondary,#94877c);font-size:20px; }
.gs-companion-hello.is-leaving { opacity:0;transition:opacity .25s; }
@keyframes gs-companion-arrive { from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)} }
.gs-companion-header-row .gs-app-heading { min-width:0; }
.gs-companion-header-actions { display:flex;align-items:center;justify-content:flex-end;gap:4px; }
.gs-header-date-short { display:none; }
@media(max-width:359px) {
  .gs-companion-header-row .gs-header-date-full { display:none; }
  .gs-companion-header-row .gs-header-date-short { display:inline; }
}
@media(prefers-reduced-motion:reduce) { .gs-companion-hello { animation:none; }.gs-companion-hello.is-leaving { transition:none; } }
.dark .gs-companion-hello { --gs-card:#3d3431;--gs-border:#756158;--gs-text-primary:#fff4ed;--gs-text-secondary:#d8c8c0;background:var(--gs-card);border-color:#a17b6c;box-shadow:0 24px 64px #0009,0 6px 18px #0006,0 0 0 1px #ffffff14; }

/* iOS draws its tab bar above the web view; keep the field clear of it (the same 90px + safe-area clearance as
   Gs::SheetComponent), measured into --gs-companion-clearance. Zero elsewhere. */
.gs-companion-clearance { position:fixed;bottom:0;left:0;width:0;height:0;visibility:hidden;pointer-events:none; }
.gs-companion[data-native-ios="true"] .gs-companion-clearance { height:calc(env(safe-area-inset-bottom, 0px) + 90px); }

/* The companion's sheet (plans/024, decision 8): Care's sheet frame (Gs::SheetComponent's handle, title row and close,
   the product sheet's card and corners) on the top layer, filling what the keyboard leaves of the screen
   (companion_controller.js#position). Its overlay closes it. Inside, Chat's pieces: Track's rows, the composer's field,
   the ink bubble, answers and pills (gs_product.css), on the guided tokens so larger text grows it. */
.gs-companion-sheet { --gs-product-action:var(--gs-text-primary); --gs-product-on-action:var(--gs-card); position:fixed; inset:0 auto auto 0; width:100%; height:100%; max-width:none; max-height:none; margin:0; padding:0; border:0; background:transparent; color:var(--gs-text-primary); overflow:hidden; font-family:var(--font-body, inherit); }
.gs-companion-sheet:popover-open { display:block; }
html.gs-companion-open body { overflow:hidden; }
.gs-companion-sheet::backdrop { background:transparent; }
.gs-companion-sheet:focus { outline:none; }
.gs-companion-overlay { position:absolute; inset:0; background:var(--gs-overlay); backdrop-filter:blur(2px); }
.gs-companion-panel { position:absolute; left:50%; bottom:0; display:flex; flex-direction:column; width:100%; max-width:var(--gs-max-width); max-height:85%; transform:translateX(-50%); border:1px solid var(--gs-border); border-bottom:0; border-radius:28px 28px 0 0; background:var(--gs-card); box-shadow:0 -12px 40px #00000012; overflow:hidden; }
.gs-companion-panel > * { flex:none; }
.gs-companion-sheet .gs-companion-panel .gs-sheet-header { align-items:flex-start; min-height:0; padding:var(--guided-space-1) var(--gs-page-px) var(--guided-space-3); }
.gs-companion-identity { flex:1; min-width:0; padding-top:4px; }
.gs-companion-sheet .gs-companion-panel .gs-sheet-title { padding:0; font-size:var(--guided-size-card); line-height:var(--guided-leading-heading); letter-spacing:-.4px; overflow-wrap:anywhere; }
.gs-companion-identity-line { margin:2px 0 0; color:var(--gs-text-secondary); font-size:var(--guided-size-small); line-height:var(--guided-leading-small); }
.gs-companion-tools { display:flex; flex:none; gap:var(--guided-space-2); }
.gs-companion-panel .gs-sheet-close { width:44px; height:44px; border-radius:50%; }
@media (prefers-reduced-motion:no-preference) {
  .gs-companion-sheet:popover-open .gs-companion-panel { animation:gs-companion-rise .35s cubic-bezier(.32, .72, 0, 1); }
  .gs-companion-sheet:popover-open .gs-companion-overlay { animation:gs-companion-fade .25s ease-out; }
}
@keyframes gs-companion-rise { from { transform:translateX(-50%) translateY(100%); } to { transform:translateX(-50%) translateY(0); } }
@keyframes gs-companion-fade { from { opacity:0; } to { opacity:1; } }

/* What's said, scrolling between the title and the field: Continue and the quick jobs first, then the exchange. */
.gs-companion-content { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; gap:var(--guided-space-4); padding:var(--guided-space-1) var(--gs-page-px) var(--guided-space-4); overflow-y:auto; overscroll-behavior:contain; }
.gs-companion-content > * { flex-shrink:0; }
.gs-companion-intro { display:flex; flex-direction:column; }
.gs-companion-intro > .gs-companion-welcome { margin:var(--guided-space-1) var(--guided-space-4) var(--guided-space-2); }
.gs-companion-intro > .gs-track-list + .gs-companion-welcome { margin-top:var(--guided-space-5); }
.gs-companion-content .gs-chat-user { align-self:flex-end; max-width:82%; }
.gs-companion-content .gs-chat-answer { margin:0; text-wrap:pretty; outline:none; }
.gs-companion-actions { display:flex; flex-direction:column; align-items:flex-start; gap:var(--guided-space-3); }
.gs-companion-actions > .gs-track-list, .gs-companion-actions > .gs-chat-lock { align-self:stretch; }
.gs-companion-actions > .gs-chat-lock { box-shadow:none; }
.gs-companion-actions .gs-chat-guide-actions { margin-top:0; }
.gs-companion-chips { display:flex; flex-wrap:wrap; gap:8px; }
.gs-companion-chips:empty { display:none; }
.gs-companion-related-label { margin:0 0 calc(-1 * var(--guided-space-1)); color:var(--gs-text-secondary); font-size:var(--guided-size-small); line-height:var(--guided-leading-small); }
.gs-companion-reset { position:relative; min-height:44px; margin:0; padding:0; border:0; background:none; color:var(--gs-text-secondary); font-size:var(--guided-size-small); font-weight:600; line-height:var(--guided-leading-label); text-decoration:underline; text-underline-offset:3px; }
.gs-companion-note { margin:0; color:var(--gs-text-secondary); font-size:var(--guided-size-small); line-height:var(--guided-leading-small); }
/* A drink draft: Track's rows, the amount at the end, then Save; saved, a quiet line says so. */
.gs-companion-draft { display:flex; flex-direction:column; gap:var(--guided-space-3); }
.gs-companion-draft-row { min-height:52px; }
.gs-companion-draft-row + .gs-companion-draft-row::after { inset-inline-start:4px; }
.gs-companion-draft-row::before { display:none; }
.gs-companion-draft-amount { display:grid; flex:none; justify-items:end; text-align:end; }
.gs-companion-draft-amount b { font-size:var(--guided-size-body); font-weight:650; line-height:var(--guided-leading-label); }
.gs-companion-draft-amount small { color:var(--gs-text-secondary); font-size:var(--guided-size-small); line-height:var(--guided-leading-small); }
.gs-companion-done { margin:0; padding:var(--guided-space-3) var(--guided-space-4); border-radius:var(--guided-radius); background:color-mix(in srgb, var(--gs-text-primary) 6%, transparent); color:var(--gs-text-primary); font-size:var(--guided-size-body); font-weight:600; line-height:var(--guided-leading-body); }
/* While it works: Chat's Thinking dots, and after a while that it's still working. */
.gs-companion-loading { display:flex; flex-wrap:wrap; }
.gs-companion-loading-note { flex-basis:100%; }

/* Matches while typing, as Track's rows right above the field; they shrink and scroll when the keyboard leaves little
   room, so the field stays in view. */
.gs-companion-matches { flex:0 1 auto; min-height:52px; margin:0 var(--gs-page-px) var(--guided-space-2); overflow-y:auto; overscroll-behavior:contain; }
.gs-companion-match { min-height:52px; }

/* The field: Chat's composer (.gs-chat-field), at the sheet's foot, clear of iOS's tab bar and the home indicator. */
.gs-companion-form { margin:0; padding:var(--guided-space-2) var(--gs-page-px) max(var(--gs-companion-clearance, 0px), calc(var(--guided-space-3) + env(safe-area-inset-bottom, 0px))); border-top:1px solid var(--gs-border); background:var(--gs-card); }
.gs-companion-form .gs-chat-field { box-shadow:none; }
.gs-companion-form .gs-chat-field:focus-within { box-shadow:0 0 0 1px var(--gs-text-primary); }
.gs-companion-form .gs-chat-field textarea { padding-inline:10px; }
.gs-companion-status { margin:0 var(--guided-space-2) var(--guided-space-2); color:var(--gs-text-secondary); font-size:var(--guided-size-small); line-height:var(--guided-leading-small); }

/* Every control answers the press (Chat's pills and buttons already do, gs_product.css; the close and Start over shrink
   to 0.96 over 150ms when motion is allowed and Start over tints), small ones reach 44px, and none selects its text or
   opens a callout on a long press. What's said stays selectable. */
.gs-companion-reset::after { content:""; position:absolute; inset:0 -8px; }
.gs-companion-sheet :is(button, a.gs-track-row, a.gs-chat-action) { -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
@media (prefers-reduced-motion:no-preference) {
  .gs-companion-sheet :is(.gs-companion-reset, .gs-sheet-close) { transition:transform var(--guided-press) var(--guided-ease-out); }
  .gs-companion-sheet :is(.gs-companion-reset, .gs-sheet-close):active { transform:scale(.96); }
}
.gs-companion-reset:active { color:var(--gs-text-primary); }

/* A new chat the companion handed on (companions/_continuation) is a new chat's intro; who supports it sits on its own
   line above the disclaimer. */
.gs-companion-continuation-guide { display:block; margin-bottom:2px; }
