/* The final mockups of #3867: B's home, A's conversation with a panel that folds away, B's plan card. */
:root {
  --ease: cubic-bezier(.16, 1, .3, 1); /* fast out, long soft landing */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --panel-width: 360px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-page-default); color: var(--text-neutral-default); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: var(--text-brand-default); }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--color-primary-400); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1 1 auto; }
.muted { color: var(--text-neutral-muted); }
.small { font-size: 13px; }
.display { font-family: var(--font-display); font-weight: 400; }
.eyebrow { font-size: 13px; font-weight: 500; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-neutral-muted); }
.pulse { background: url("ds/assets/pulse.jpg") 0% 100% / 320% auto; flex: 0 0 auto; }

/* ---------- Motion */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@keyframes settle { from { opacity: 0; transform: translateX(6px) scale(.92); } }
@keyframes spin { to { transform: rotate(360deg); } }

.page { animation: fade .45s var(--ease) both; }
.from-user, .agent { animation: rise .6s var(--ease) both; }
.home > :not(.home-orb) { animation: rise .8s var(--ease) both; } /* the logo stays still */
.home > :nth-child(2) { animation-delay: .06s; }
.home > :nth-child(3) { animation-delay: .12s; }
.home > :nth-child(4) { animation-delay: .18s; }
.library > * { animation: rise .7s var(--ease) both; }

/* Every control answers the pointer: a soft lift, a colour that fades in */
.cg-btn, .cg-toggle, .railbtn, .iconbtn, .example, .chat-row, .artifact, .file, .handle, .step, .composer {
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease),
    box-shadow .45s var(--ease), transform .45s var(--ease), opacity .3s var(--ease);
}
.cg-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cg-btn--ghost:hover:not(:disabled), .cg-btn--outline:hover:not(:disabled) { box-shadow: var(--shadow-xs); }
.cg-btn:active:not(:disabled), .iconbtn:active, .railbtn:active, .example:active, .handle:active { transform: scale(.97); transition-duration: .12s; }
.cg-btn svg, .railbtn svg, .iconbtn svg, .example svg { transition: transform .45s var(--ease); }
.cg-btn[aria-label="Send"]:hover:not(:disabled) svg { transform: translateY(-2px); }
.cg-toggle:hover:not([data-pressed="true"]) { background: rgba(255, 255, 255, .6); }

/* A light that follows the pointer over cards (app.js sets --mx and --my) */
.glow { position: relative; isolation: isolate; }
.glow::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(41, 98, 255, .10), transparent 65%);
  opacity: 0; transition: opacity .5s var(--ease); }
.glow:hover::after { opacity: 1; }

/* ---------- Layout: the rail, then the page */
.app { display: flex; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; flex: 0 0 84px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0; border-right: 1px solid var(--border-neutral-default); background: var(--bg-page-default); z-index: 3; }
.rail-logo { width: 44px; height: 44px; border-radius: 13px; margin-bottom: 20px; transition: transform .6s var(--ease); }
.rail-logo:hover { transform: rotate(-6deg) scale(1.06); }
.railbtn { width: 56px; height: 52px; border: 0; border-radius: 14px; background: transparent; color: var(--text-neutral-default); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; font: 500 10px var(--font-sans); }
.railbtn:hover { background: var(--bg-neutral-default); }
.railbtn:hover svg { transform: translateY(-2px); }
.railbtn[aria-current="page"] { background: var(--bg-brand-muted); color: var(--text-brand-default); }
.page { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px 40px; min-height: 69px; }
.top.bordered { border-bottom: 1px solid var(--border-neutral-default); position: sticky; top: 0; z-index: 2; background: rgba(255, 255, 255, .85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { height: 20px; width: auto; }
.brand-name { font-size: 15px; font-weight: 500; }
/* The logo's letters sit above its box's centre (the g's tail is below): the text moves up to their baseline */
.brand > span { margin-top: -3px; }
.brand-title { font-size: 14px; color: var(--text-neutral-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Home */
.home { flex: 1 1 auto; width: 100%; max-width: 940px; margin: 0 auto; padding: 40px 20px 48px; display: flex; flex-direction: column; align-items: center; gap: 40px; }
.home-orb { width: 104px; height: 104px; border-radius: 30px; box-shadow: var(--shadow-lg); }
.home-title { text-align: center; font-size: 52px; line-height: 60px; letter-spacing: -0.5px; }
.home-title i { color: var(--text-brand-default); }
.examples { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.example-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.example { display: flex; flex-direction: column; justify-content: space-between; gap: 28px; text-align: left; min-height: 150px; padding: 20px; border: 0; border-radius: 20px; background: var(--bg-neutral-default); color: var(--text-neutral-default); font: 400 15px/22px var(--font-sans); cursor: pointer; }
.example:hover { background: var(--bg-neutral-hover); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.example:hover svg { transform: translateX(4px); color: var(--text-brand-default); }

/* ---------- Composer */
.composer { width: 100%; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 10px; background: var(--component-input-bg); border: 1px solid var(--border-neutral-default); border-radius: 20px; box-shadow: var(--shadow-sm); }
.composer.big { gap: 28px; padding: 22px 22px 18px; border-radius: 24px; }
.composer textarea { border: 0; outline: 0; resize: none; font: 400 15px/22px var(--font-sans); color: var(--text-neutral-default); background: transparent; padding: 2px 6px; }
.composer.big textarea { font-size: 17px; line-height: 26px; padding: 0 4px; }
.composer:hover { box-shadow: var(--shadow-md); }
.composer:focus-within { border-color: var(--color-primary-300); box-shadow: 0 0 0 4px var(--bg-brand-muted), var(--shadow-md); }
.composer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dock { position: sticky; bottom: 0; padding: 12px 0 20px; margin-top: auto; background: linear-gradient(to bottom, transparent, var(--bg-page-default) 30%); z-index: 1; }

/* ---------- Conversation */
.conv { flex: 1 1 auto; display: flex; gap: 32px; padding: 32px 24px 0 40px; align-items: flex-start; overflow-x: clip; }
.thread { flex: 1 1 560px; min-width: 0; max-width: 860px; margin-inline: auto; /* centred in what the panel leaves */ min-height: calc(100vh - 110px); display: flex; flex-direction: column; gap: 22px; }
.from-user { align-self: flex-end; max-width: min(560px, 85%); white-space: pre-wrap; }
.agent { display: flex; gap: 14px; }
.agent-mark { width: 32px; height: 32px; border-radius: 10px; }
.agent-gap { width: 32px; flex: 0 0 auto; }
.agent-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.working { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--text-neutral-muted); }
.working span { background: linear-gradient(90deg, var(--text-neutral-muted) 0%, var(--text-brand-default) 50%, var(--text-neutral-muted) 100%) 0 0 / 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.error { padding: 14px 18px; border-radius: 16px; background: var(--component-alert-bg-danger); border: 1px solid var(--component-alert-border-danger); color: var(--text-danger-default); font-size: 14px; }

.md { font-size: 16px; line-height: 26px; overflow-wrap: anywhere; }
.md > * + * { margin-top: 12px; }
.md ul, .md ol { padding-left: 22px; }
.md table { border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid var(--border-neutral-default); padding: 6px 12px 6px 0; text-align: left; font-variant-numeric: tabular-nums; }
.md code { font-size: 14px; background: var(--bg-neutral-default); padding: 1px 5px; border-radius: 6px; }
.md pre { overflow-x: auto; background: var(--bg-neutral-default); padding: 12px 14px; border-radius: 12px; }
.md pre code { background: none; padding: 0; }
.md h1, .md h2, .md h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 28px; }

.card { background: var(--component-card-bg); border: 1px solid var(--border-neutral-default); border-radius: 20px; padding: 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { font-size: 24px; line-height: 30px; }
.chart { width: 100%; min-height: 360px; }
.files { display: flex; gap: 10px; flex-wrap: wrap; }
.files-wrap { display: flex; flex-direction: column; gap: 10px; }
.file-pair { display: inline-flex; align-items: stretch; }
.file-pair .file { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.file-peek { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-neutral-default); border-left: 0; border-radius: 0 12px 12px 0; background: var(--bg-page-default); color: var(--text-neutral-muted); cursor: pointer; transition: background-color .3s var(--ease), color .3s var(--ease); }
.file-peek:hover, .file-peek[aria-expanded="true"] { background: var(--bg-brand-subtle); color: var(--text-brand-default); }
.head { overflow-x: auto; border: 1px solid var(--border-neutral-default); border-radius: 14px; padding: 10px 12px; background: var(--bg-page-default); animation: rise .45s var(--ease) both; }
.head table { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.head th, .head td { padding: 5px 14px 5px 0; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border-neutral-subtle); }
.head th { font-weight: 600; color: var(--text-neutral-subtle); }
.head p { margin-top: 6px; }
.head.mini { align-self: stretch; width: 100%; border: 0; border-radius: 0; background: transparent; padding: 14px 16px; overflow: hidden; animation: none; }
.head.mini table { font-size: 11px; }
.ask { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-neutral-subtle); cursor: pointer; user-select: none; }
/* Auto mode: the switch off, a small gradient pill in its place */
.auto-pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px 0 8px; border-radius: 9999px; color: #ffffff; font-size: 12px; font-weight: 600; letter-spacing: .2px;
  background: linear-gradient(120deg, #2962ff 0%, #6a3dc5 55%, #b89efb 100%); box-shadow: 0 2px 10px rgba(41, 98, 255, .28), inset 0 0 0 1px rgba(255, 255, 255, .25);
  animation: settle .5s var(--ease) both; }
.ask.auto .cg-switch { background: var(--color-neutral-300); }
.composer:has(.ask.auto) { border-color: #cdbcfd; box-shadow: 0 0 0 4px rgba(184, 158, 251, .18), var(--shadow-sm); }
.file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border-neutral-default); border-radius: 12px; font-size: 14px; color: var(--text-neutral-default); text-decoration: none; background: var(--bg-page-default); }
a.file:hover { background: var(--bg-brand-subtle); border-color: var(--color-primary-200); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* Approvals: the waiting one is a compact row; the answered ones fold into one line (mockup G-Inline) */
.pending { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 14px; padding: 12px 12px 12px 16px; border-radius: 16px; background: var(--bg-brand-subtle); border: 1px solid var(--border-brand-subtle); animation: rise .5s var(--ease) both; }
.pending-text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.pending-title { font-size: 13px; font-weight: 600; }
.pending-title .muted { font-weight: 400; }
.pending p { font-size: 13px; line-height: 19px; color: var(--text-neutral-subtle); }
.pending p.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pending-actions { display: flex; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.pending dl { margin: 4px 0 0; display: grid; grid-template-columns: max-content 1fr; column-gap: 16px; row-gap: 4px; font-size: 13px; }
.pending dt { color: var(--text-neutral-muted); }
.pending dd { margin: 0; }
.pending pre { align-self: stretch; margin: 4px 0 0; max-height: 240px; overflow: auto; background: var(--bg-page-default); border-radius: 10px; padding: 10px 12px; font-size: 12px; animation: rise .4s var(--ease) both; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--text-brand-default); font: 500 13px var(--font-sans); cursor: pointer; transition: color .3s var(--ease); }
.linkbtn:hover { color: var(--bg-brand-hover); }
.fold-wrap { display: flex; flex-direction: column; gap: 8px; }
.fold { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--bg-neutral-subtle); border: 1px solid var(--border-neutral-subtle); font-size: 13px; animation: rise .5s var(--ease) both; }
.fold-label { font-weight: 500; white-space: nowrap; }
.fold-titles { flex: 1; min-width: 0; color: var(--text-neutral-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipdot { width: 16px; height: 16px; border-radius: 9999px; background: var(--bg-brand-default); color: #ffffff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.fold-list { margin: 0 0 0 20px; padding: 2px 0 2px 14px; list-style: none; border-left: 2px solid var(--bg-brand-muted); display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 19px; }
.fold-list li { animation: rise .45s var(--ease) both; }
.fold-list b { font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.answered .cg-badge { animation: settle .5s var(--ease) both; transform-origin: right center; }

.plan { border: 1px solid var(--border-neutral-default); border-radius: 24px; padding: 28px; display: flex; flex-direction: column; gap: 22px; box-shadow: var(--shadow-sm); background: var(--bg-page-default); }
.plan h2 { font-size: 28px; line-height: 34px; }
.plan ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.plan li { display: flex; align-items: center; gap: 14px; animation: rise .5s var(--ease) both; }
.plan li .cg-textarea { display: block; min-height: 34px; padding: 6px 10px; line-height: 20px; resize: none; field-sizing: content; transition: border-color .3s var(--ease), box-shadow .3s var(--ease); }
.plan li .cg-textarea:hover:not(:disabled) { border-color: var(--border-neutral-medium); }
.num { width: 28px; height: 28px; border-radius: 9999px; background: var(--bg-brand-emphasis); color: var(--text-neutral-inverse); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

/* ---------- The panel on the right: one solid container that folds into the page edge */
.side { position: sticky; top: 100px; flex: 0 0 var(--panel-width); min-width: 0; transition: flex-basis .7s var(--ease), margin .7s var(--ease); }
.side.closed { flex-basis: 0; margin-left: -32px; }
.panel { width: var(--panel-width); max-height: calc(100vh - 120px); overflow-y: auto; border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 10px; background: #d4e0ff; border: 1px solid rgba(255, 255, 255, .9);
  transition: opacity .5s var(--ease), transform .7s var(--ease), visibility 0s; }
.side.closed .panel { opacity: 0; transform: translateX(56px) scale(.98); visibility: hidden; transition: opacity .35s var(--ease), transform .7s var(--ease), visibility 0s .7s; }
.handle { position: absolute; left: -14px; transition: left .7s var(--ease), color .3s var(--ease), border-color .3s var(--ease), box-shadow .45s var(--ease), transform .45s var(--ease); top: 50%; z-index: 2; width: 28px; height: 56px; margin-top: -28px; padding: 0; border: 1px solid var(--border-neutral-default); border-radius: 14px; background: #ffffff; color: var(--text-neutral-default); box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.handle:hover { color: var(--text-brand-default); border-color: var(--color-primary-200); box-shadow: var(--shadow-lg); transform: scale(1.08); }
.handle svg { transition: transform .7s var(--ease); }
.side.closed .handle { left: 6px; }
.side.closed .handle svg { transform: rotate(180deg); }
.panel h2 { font-size: 26px; line-height: 32px; }
.panel h3 { margin: 12px 0 2px; font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-neutral-muted); }
.step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .9); font-size: 13px; line-height: 18px; animation: rise .5s var(--ease) both; }
.step:hover { background: rgba(255, 255, 255, .92); transform: translateX(-2px); }
.step.waiting { background: #ffffff; }
.step-text { font-weight: 500; }
.count { margin-left: auto; padding: 2px 8px; border-radius: 9999px; background: #ffffff; color: var(--text-brand-emphasis); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; animation: pop .45s var(--ease) both; }
.step.pending .step-text, .step.rejected .step-text { color: var(--text-neutral-subtle); font-weight: 400; }
/* The chat's figures: four small tiles, the tokens with their split */
.stats { margin: 0; display: grid; grid-template-columns: repeat(4, auto); gap: 6px; } /* each tile as wide as its figure */
.stats > div { min-width: 0; padding: 8px 9px; border-radius: 14px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .9); }
.stats dt { font-size: 11px; color: var(--text-neutral-muted); }
.stats dt, .stats dd { overflow: hidden; text-overflow: ellipsis; }
.stats dd { margin: 2px 0 0; font-size: 15px; line-height: 20px; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-brand-emphasis); }
.tick, .ring { width: 26px; height: 26px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tick { background: var(--bg-brand-default); color: #ffffff; animation: pop .55s var(--ease) both; }
.tick.no { background: var(--color-neutral-400); }
.ring { border: 1.5px solid var(--color-primary-300); color: var(--text-brand-emphasis); font-size: 12px; font-weight: 600; }
.ring.spin { border: 2px solid var(--bg-brand-default); border-right-color: var(--color-primary-200); animation: spin 1s linear infinite; }

/* ---------- Chats and artifacts */
.library { flex: 1 1 auto; width: 100%; max-width: 1200px; margin: 0 auto; padding: 48px 40px 64px; display: flex; flex-direction: column; gap: 28px; }
.library.narrow { max-width: 880px; }
.library-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.library-head > div:first-child { display: flex; flex-direction: column; gap: 6px; } /* the title, not the filter */
.library h1 { font-size: 40px; line-height: 46px; letter-spacing: -0.5px; }
.day { display: flex; flex-direction: column; gap: 12px; }
.chat-list { display: flex; flex-direction: column; gap: 8px; }
.chat-row { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 18px; border: 1px solid var(--border-neutral-default); border-radius: 18px; background: var(--bg-page-default); text-align: left; cursor: pointer; color: inherit; font: inherit; }
.chat-row:hover { border-color: var(--color-primary-200); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lead { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; transition: transform .45s var(--ease); }
.chat-row:hover .lead { transform: scale(1.06); }
.lead-chart { background: var(--bg-brand-subtle); color: var(--text-brand-default); }
.lead-person { border-radius: 9999px; background: var(--bg-brand-muted); color: var(--text-brand-emphasis); font-size: 13px; font-weight: 600; letter-spacing: .3px; }
.lead-file { background: var(--bg-neutral-default); color: var(--text-brand-emphasis); font-size: 10px; font-weight: 700; letter-spacing: .8px; }
.lead-mode { background: var(--bg-neutral-default); color: var(--text-brand-emphasis); }
.chat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-title, .chat-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title { font-size: 15px; font-weight: 600; }
.chat-sub { font-size: 13px; color: var(--text-neutral-muted); }
.chat-when { font-size: 13px; color: var(--text-neutral-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chat-go { color: var(--text-brand-default); opacity: 0; transform: translateX(-6px); transition: opacity .4s var(--ease), transform .45s var(--ease); display: flex; }
.chat-row:hover .chat-go { opacity: 1; transform: none; }
.chat-item { position: relative; }
.chat-item .chat-row { padding-right: 58px; }
.chat-delete { position: absolute; right: 12px; top: 50%; margin-top: -17px; opacity: 0; }
.chat-item:hover .chat-delete, .chat-delete:focus-visible { opacity: 1; }
.chat-item:hover .chat-go { opacity: 0; }
.iconbtn.danger:hover, .chat-delete:hover { background: var(--bg-danger-subtle); color: var(--text-danger-default); }
.confirm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px 12px 18px; border-radius: 18px; border: 1px solid var(--border-danger-subtle); background: var(--bg-danger-subtle); font-size: 14px; animation: rise .35s var(--ease) both; }
.artifact .confirm { margin: 0 12px 12px; border-radius: 14px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.artifact { display: flex; flex-direction: column; border: 1px solid var(--border-neutral-default); border-radius: 20px; overflow: hidden; background: var(--bg-page-default); }
.artifact:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--color-primary-200); }
.preview { height: 150px; background: var(--bg-neutral-default); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.preview .chart { min-height: 0; height: 150px; transition: transform .7s var(--ease); }
.artifact:hover .preview .chart, .artifact:hover .file-glyph { transform: scale(1.04); }
.file-glyph { font: 600 13px var(--font-sans); letter-spacing: 1px; color: var(--text-brand-emphasis); background: #ffffff; border-radius: 12px; padding: 18px 16px; text-transform: uppercase; transition: transform .7s var(--ease); }
.meta { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.meta h3 { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--text-neutral-default); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn:hover { background: var(--bg-brand-muted); color: var(--text-brand-default); }
.iconbtn:hover svg { transform: translate(1px, -1px); }
.empty { align-self: center; margin-top: 8vh; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; color: var(--text-neutral-muted); font-size: 15px; }
.empty .pulse { width: 64px; height: 64px; border-radius: 19px; box-shadow: var(--shadow-md); }

@media (max-width: 960px) {
  .conv { flex-direction: column; align-items: stretch; }
  .thread { flex-basis: auto; max-width: none; min-height: 0; }
  .side, .side.closed { position: static; flex-basis: auto; margin: 0 0 24px; }
  .panel, .side.closed .panel { width: auto; max-height: none; opacity: 1; transform: none; visibility: visible; }
  .handle { display: none; }
}
@media (max-width: 720px) {
  .rail { flex-basis: 64px; }
  .railbtn { width: 52px; }
  .top, .conv, .library { padding-left: 16px; padding-right: 16px; }
  .home-title { font-size: 34px; line-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Alerts: the rail's bell and its popover (the browser's own: Escape and a click outside close it) */
.railbtn { position: relative; }
.rail-count { position: absolute; top: 4px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9999px; background: var(--bg-danger-default); color: #ffffff; font: 600 10px/16px var(--font-sans); text-align: center; }
.alerts { position: fixed; inset: 96px auto auto 96px; margin: 0; width: min(420px, calc(100vw - 112px)); max-height: calc(100vh - 120px); overflow-y: auto; padding: 18px; border: 1px solid var(--border-neutral-default); border-radius: 20px; background: var(--component-popover-bg); color: var(--text-neutral-default); box-shadow: var(--shadow-xl); flex-direction: column; gap: 14px;
  transform-origin: -40px 170px; /* the bell */ transition: opacity .35s var(--ease), transform .55s var(--ease), filter .45s var(--ease); }
.alerts:popover-open { display: flex; }
@starting-style { .alerts:popover-open { opacity: 0; transform: translateX(-14px) scale(.94); filter: blur(6px); } }
.alerts::backdrop { background: rgba(2, 35, 65, .06); backdrop-filter: blur(2px); transition: opacity .4s var(--ease); }
@starting-style { .alerts:popover-open::backdrop { opacity: 0; } }
.alerts:popover-open .alert { animation: rise .6s var(--ease) both; }
.alerts:popover-open .alert:nth-child(2) { animation-delay: .04s; }
.alerts:popover-open .alert:nth-child(3) { animation-delay: .08s; }
.alerts:popover-open .alert:nth-child(4) { animation-delay: .12s; }
.alerts:popover-open .alert:nth-child(n+5) { animation-delay: .16s; }
.alert { transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
.alert:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); }
.alerts h2 { font-size: 24px; line-height: 30px; }
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--component-alert-bg-warning); border: 1px solid var(--component-alert-border-warning); }
.alert h3 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.alert p { color: var(--text-neutral-subtle); line-height: 20px; }
.alert-note { view-transition-name: alert; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 16px; background: var(--component-alert-bg-warning); border: 1px solid var(--component-alert-border-warning); font-size: 14px; color: var(--text-warning-emphasis); }
.alert-note .grow { color: var(--text-neutral-default); }

/* The card flies into the banner; the rest of the page dissolves around it */
::view-transition-group(alert) { animation-duration: .7s; animation-timing-function: var(--ease); }
::view-transition-old(alert) { animation: .25s var(--ease) both vt-out; }
::view-transition-new(alert) { animation: .45s var(--ease) .2s both vt-in; }
::view-transition-old(root) { animation: .35s var(--ease) both vt-out; }
::view-transition-new(root) { animation: .6s var(--ease) .15s both vt-rise; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
@keyframes vt-rise { from { opacity: 0; transform: translateY(12px); } }
/* The question waits to be sent: the composer breathes once */
.composer.ready { animation: ready 1.6s var(--ease) .5s; }
@keyframes ready { 0% { box-shadow: 0 0 0 0 rgba(41, 98, 255, .35), var(--shadow-sm); } 60% { box-shadow: 0 0 0 10px rgba(41, 98, 255, 0), var(--shadow-md); } 100% { box-shadow: 0 0 0 4px var(--bg-brand-muted), var(--shadow-md); } }
