/* Live layer: the AI agents, real documents and the "thinking" motion. Extends app.css tokens. */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); }

/* ---------- AI thinking (state indication while a 5-20 s request is in flight) ---------- */
.think { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 16px; align-items: center; }
.think-art { position: relative; width: 76px; height: 76px; }
.think-art { border-radius: 18px; background: color-mix(in oklab, var(--accent) 7%, var(--surface-2)); }
.think.advisor .think-art { background: color-mix(in oklab, var(--gold) 9%, var(--surface-2)); }
.think-art .tk-sheet { position: absolute; inset: 12px 17px 10px 17px; border-radius: 6px; background: var(--surface-solid);
  border: 1px solid color-mix(in oklab, var(--ink) 12%, transparent); box-shadow: 0 2px 6px rgba(11, 16, 32, .08); }
.think-art .tk-sheet:nth-child(1) { transform: rotate(-9deg) translate(-4px, 3px); opacity: .55; }
.think-art .tk-sheet:nth-child(2) { transform: rotate(6deg) translate(4px, 1px); opacity: .8; }
.think-art .tk-sheet.tk-top { overflow: hidden; animation: think-float 2.4s var(--ease-in-out) infinite alternate; }
.think-art .tk-sheet.tk-top i { position: absolute; inset-inline-start: 7px; height: 4px; border-radius: 2px; background: color-mix(in oklab, var(--ink) 13%, transparent);
  animation: think-line 2.4s ease infinite; }
.think-art .tk-sheet.tk-top i:nth-child(1) { top: 10px; width: 60%; }
.think-art .tk-sheet.tk-top i:nth-child(2) { top: 20px; width: 72%; animation-delay: .3s; }
.think-art .tk-sheet.tk-top i:nth-child(3) { top: 30px; width: 48%; animation-delay: .6s; }
.think-art .tk-sheet.tk-top i:nth-child(4) { top: 40px; width: 66%; animation-delay: .9s; }
.think-art .tk-scan { position: absolute; inset-inline: 0; top: 0; height: 14px;
  background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--accent) 30%, transparent), transparent);
  animation: think-scan 1.6s linear infinite; }
.think.advisor .think-art .tk-scan { background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--gold) 38%, transparent), transparent); }
.think.advisor .think-art .tk-sheet.tk-top::after { content: "Σ"; position: absolute; inset-inline-end: 7px; bottom: 4px; font-weight: 700;
  font-size: 15px; color: var(--gold); animation: think-pulse 1.2s ease infinite alternate; }

.think-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.think-steps li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-4);
  opacity: .55; transform: translateX(0); transition: opacity 220ms var(--ease-out), color 220ms ease, transform 220ms var(--ease-out); }
.think-steps li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line);
  transition: background-color 220ms ease, transform 220ms var(--ease-out); }
.think-steps li.now { opacity: 1; color: var(--ink); font-weight: 600; transform: translateX(3px); }
[dir="rtl"] .think-steps li.now { transform: translateX(-3px); }
.think-steps li.now::before { background: var(--accent); animation: think-dot 1s ease infinite alternate; }
.think.advisor .think-steps li.now::before { background: var(--gold); }
.think-steps li.done { opacity: .9; color: var(--ink-3); }
.think-steps li.done::before { background: var(--ok, #1f9d55); }
.think-time { grid-column: 2; font-size: 12px; color: var(--ink-4); font-variant-numeric: tabular-nums; margin-top: 2px; }

@keyframes think-scan { from { transform: translateY(-14px); } to { transform: translateY(56px); } }
@keyframes think-float { from { transform: translateY(1px); } to { transform: translateY(-3px); } }
@keyframes think-line { 0%, 100% { opacity: .45; } 45% { opacity: 1; background: color-mix(in oklab, var(--accent) 45%, var(--line)); } }
@keyframes think-pulse { from { opacity: .55; } to { opacity: 1; } }
@keyframes think-dot { from { transform: scale(.85); } to { transform: scale(1.15); } }

@media (prefers-reduced-motion: reduce) {
  .think-art .tk-scan, .think-art .tk-sheet.tk-top, .think-art .tk-sheet.tk-top i, .think-steps li.now::before, .think.advisor .think-art .tk-sheet.tk-top::after { animation: none; }
  .think-steps li, .think-steps li.now { transform: none; transition: opacity 200ms ease, color 200ms ease; }
}

/* ---------- live answers ---------- */
.live-tag { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 8px; font: 600 11px/1 ui-monospace, Consolas, monospace;
  letter-spacing: .05em; color: var(--ink-4); }
.live-tag i { font-style: normal; padding: 3px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-3); }
.live-conflict { padding: 9px 12px; border-radius: var(--r-sm); background: color-mix(in oklab, var(--warn, #b7791f) 14%, var(--surface-solid));
  color: color-mix(in oklab, var(--warn, #b7791f) 75%, var(--ink)); font-weight: 600; margin-bottom: 10px; }
.live-e { padding: 2px 0; }
.live-quote { margin: 10px 0 0; padding: 9px 13px; border-inline-start: 3px solid var(--accent); background: var(--surface-2); border-radius: var(--r-sm); }
.live-quote p { margin: 0 0 4px; }
.live-quote cite { font-style: normal; font-size: 12.5px; color: var(--ink-3); }
.live-cards { display: grid; gap: 8px; margin-top: 12px; }
.live-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-solid); }
.live-card .meta { flex: 1; min-width: 0; }
.live-card b { display: block; overflow-wrap: anywhere; }
.live-card small { color: var(--ink-3); overflow-wrap: anywhere; }
.live-card .acts { display: flex; gap: 6px; flex: none; }
.ftype { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font: 700 10.5px ui-monospace, Consolas, monospace; color: #fff; }
.ftype.pdf { background: #b4462c; } .ftype.docx { background: #2f5d9e; } .ftype.xlsx { background: #237a4b; }
.live-notice { margin-top: 12px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--ink-3); }
.live-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.live-opts button { min-height: 40px; padding: 7px 13px; border-radius: var(--r-sm); border: 1px solid var(--accent); background: var(--surface-solid);
  color: inherit; text-align: start; cursor: pointer; transition: background-color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .live-opts button:hover { background: var(--accent-soft); } }
.live-opts button.custom { border-style: dashed; border-color: var(--ink-4); color: var(--ink-3); }
.live-result { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); margin-bottom: 10px; }
.live-result .v { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.live-result .v small { font-size: 15px; color: var(--ink-3); font-weight: 500; }
.live-formula { direction: ltr; text-align: left; font: 13px/1.55 ui-monospace, Consolas, monospace; background: var(--surface-2); border-radius: var(--r-sm);
  padding: 9px 12px; margin: 10px 0; overflow-x: auto; }
.live-formula b { font-family: var(--f); color: var(--gold); font-size: 12px; }
.live-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--ink-4); }
.live-foot .btn { min-height: 34px; }
.live-foot .on { border-color: var(--accent); background: var(--accent-soft); }
.memory-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; font-size: 12.5px; color: var(--ink-3); }
.conv-pick { height: 36px; max-width: 320px; font-size: 13px; }
.composer textarea { flex: 1; border: 0; background: none; font: 15.5px/1.45 var(--f); color: var(--ink); min-width: 0; resize: none; padding: 9px 0; max-height: 160px; }
.composer textarea:focus { outline: none; }
.composer .btn[disabled] { opacity: .45; cursor: not-allowed; }
.composer-hint { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-4); padding: 6px 12px 0; }
.composer-hint .over { color: #b3261e; font-weight: 600; }
.fb-text { height: 34px; max-width: 280px; font-size: 13px; }
.pdf-frame { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: var(--r-sm); margin: 8px 0; background: #fff; }

/* ---------- sample-data chip on screens that are not wired to the backend ---------- */
.sample-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); vertical-align: middle; margin-inline-start: 8px; }
.sample-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.live-chip { background: color-mix(in oklab, #1f9d55 12%, var(--surface-solid)); color: #1f7a45; border-color: color-mix(in oklab, #1f9d55 30%, transparent); }
.live-chip::before { background: #1f9d55; }

/* ---------- document viewer ---------- */
.viewer-body { display: grid; gap: 12px; max-height: 65vh; overflow: auto; }
.viewer-body section { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 13px; }
.viewer-body section.here { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.viewer-body h4 { margin: 0 0 6px; font: 600 12px ui-monospace, Consolas, monospace; color: var(--ink-3); }
.viewer-body pre { margin: 0; white-space: pre-wrap; font: inherit; }
.viewer-body mark { background: #ffe58a; color: #111; border-radius: 2px; padding: 0 2px; }
.offline-bar { position: fixed; inset: 0 0 auto 0; z-index: 9999; background: #b3261e; color: #fff; text-align: center; padding: 9px 14px; font-weight: 600; }

.lg-copy { all: unset; cursor: pointer; margin-inline-start: 8px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.lg-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Roles come from the server session: the demo-only role switch is not offered. */
.role-switch { display: none !important; }


/* ===================== Chat workspace: history rail, one reading column, provenance ===================== */
.cw { --agent: var(--accent); --agent-ink: var(--accent);
  display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 24px; align-items: start; min-height: calc(100dvh - 110px); }
.cw.advisor { --agent: var(--gold); --agent-ink: color-mix(in oklab, var(--gold) 72%, var(--ink)); }
[data-theme="dark"] .cw.ask { --agent-ink: color-mix(in oklab, var(--accent) 62%, #fff); }
.cw .sigma { font-weight: 700; font-size: 1.05em; line-height: 1; }

/* rail */
.cw-rail { position: sticky; top: 84px; height: calc(100dvh - 180px); min-height: 360px;        /* clears the top bar and the page's bottom padding */
  display: flex; flex-direction: column; padding: 12px;
  background: var(--surface); backdrop-filter: var(--glass); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-1); }
.cw-new { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 12px; cursor: pointer;
  border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink);
  transition: border-color 160ms ease, background-color 160ms ease; }
.cw-new svg { width: 17px; height: 17px; color: var(--agent-ink); }
.cw-rail-h { margin: 18px 10px 6px; font-size: 12px; font-weight: 600; color: var(--ink-4); }
.cw-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-inline: -4px; padding-inline: 4px; scrollbar-width: thin; }
.cw-none { margin: 4px 10px; font-size: 13px; color: var(--ink-4); }
.cw-item { all: unset; box-sizing: border-box; position: relative; display: grid; gap: 2px; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  transition: background-color 140ms ease; }
.cw-item-t { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-item-m { font-size: 11.5px; color: var(--ink-4); }
.cw-item.on { background: color-mix(in oklab, var(--agent) 11%, var(--surface-solid)); }
.cw-item.on::before { content: ""; position: absolute; inset-block: 10px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--agent); }
.cw-item.on .cw-item-t { color: var(--ink); font-weight: 600; }
.cw-rail-foot { border-top: 1px solid var(--line-2); padding: 12px 6px 2px; display: grid; gap: 8px; }
.cw-rail-foot p { margin: 0; font-size: 12px; line-height: 1.45; color: var(--ink-4); }
.cw-wipe { all: unset; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; border-radius: 6px; padding: 2px 0; }
.cw-wipe svg { width: 15px; height: 15px; }
.cw-new:focus-visible, .cw-item:focus-visible, .cw-wipe:focus-visible, .cw-starter:focus-visible, .ex-act:focus-visible, .lr-chip:focus-visible { outline: 2.5px solid var(--agent); outline-offset: 2px; }

/* main column */
.cw-main { min-width: 0; }
.cw-head { display: flex; align-items: center; gap: 14px; min-height: 52px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.cw-who { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.cw-who b { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.cw-who .sample-chip { margin-inline-start: 2px; }
.cw-title { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: end; }
.cw-tools { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.cw-tools .conv-pick, .cw-tools .cw-new-sm { display: none; }
.cw-col { width: min(760px, 100%); margin-inline: auto; }

/* empty state */
.cw-empty { text-align: center; padding: clamp(36px, 10vh, 104px) 0 28px; }
.cw-emblem { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; color: #fff; font-size: 26px;
  background: linear-gradient(150deg, color-mix(in oklab, var(--agent) 82%, #fff), color-mix(in oklab, var(--agent) 70%, #000));
  box-shadow: 0 14px 30px -12px color-mix(in oklab, var(--agent) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.25); }
.cw-emblem svg { width: 24px; height: 24px; }
.cw-empty h1 { margin: 20px 0 10px; font-size: clamp(26px, 2.5vw, 34px); font-weight: 650; letter-spacing: -.028em; line-height: 1.15; }
[dir="rtl"] .cw-empty h1 { letter-spacing: 0; line-height: 1.35; }
.cw-empty p { margin: 0 auto; max-width: 56ch; font-size: 15px; line-height: 1.6; color: var(--ink-3); }
.cw-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 30px; text-align: start; }
.cw-starter { all: unset; box-sizing: border-box; display: grid; gap: 6px; align-content: start; padding: 14px 16px; cursor: pointer;
  border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--line);
  transition: border-color 160ms ease, transform 160ms var(--ease-out), box-shadow 160ms ease; }
.cw-starter small { font-size: 12px; font-weight: 600; color: var(--agent-ink); }
.cw-starter span { font-size: 14px; line-height: 1.45; color: var(--ink-2); }

/* an exchange: your question, then the answer beside the agent mark */
.cw .chat-log { gap: 38px; padding: 26px 0 8px; }
.cw .ex.msg-a { display: block; max-width: none; }
.ex-user { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.ex-user p { margin: 0; max-width: min(560px, 86%); padding: 11px 16px; border-radius: 20px; border-end-end-radius: 6px;
  background: color-mix(in oklab, var(--agent) 9%, var(--surface-2)); color: var(--ink); font-size: 15.5px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.ex-ai { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; align-items: start; }
.ex-mark { flex: none; width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; color: #fff; font-size: 15px;
  background: linear-gradient(150deg, color-mix(in oklab, var(--agent) 82%, #fff), color-mix(in oklab, var(--agent) 72%, #000)); }
.ex-mark svg { width: 15px; height: 15px; }
.ex-body { min-width: 0; }
.ex .ex-main.msg-body { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 3px 0 0; }
.ex-main > p, .ex-answer { font-size: 15.5px; line-height: 1.7; margin: 0 0 6px; max-width: 68ch; }
.ex-main ul { margin: 6px 0; padding-inline-start: 20px; line-height: 1.65; }
.ex .live-tag { margin-bottom: 8px; font: 600 11px/1 var(--f); letter-spacing: 0; }
.ex .live-tag i { padding: 4px 8px; border-radius: 999px; }
.ex .live-cards { margin-top: 14px; }
.ex .live-card { border-radius: 14px; border-color: var(--line-2); transition: border-color 160ms ease; }
.ex .live-notice { margin-top: 14px; border-top: 0; padding-top: 0; }

/* provenance: verified quotes as source slips, edged by file type */
.ex-margin { margin-top: 18px; padding: 14px 16px 16px; border-radius: 16px; border: 1px solid color-mix(in oklab, var(--agent) 18%, var(--line));
  background: color-mix(in oklab, var(--agent) 4%, var(--surface-solid)); }
.ex-margin header { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.ex-margin header svg { flex: none; width: 19px; height: 19px; color: var(--agent-ink); }
.ex-margin header b { color: var(--ink); font-weight: 650; }
.ex-slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 12px; }
.ex-margin .live-quote { --qt: var(--ink-4); margin: 0; padding: 12px 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  background: var(--surface-solid); border: 1px solid var(--line-2); border-inline-start: 3px solid var(--qt); border-radius: 12px; }
.ex-margin .live-quote[data-type="pdf"] { --qt: #b4462c; }
.ex-margin .live-quote[data-type="docx"] { --qt: #2f5d9e; }
.ex-margin .live-quote[data-type="xlsx"] { --qt: #237a4b; }
.ex-margin .live-quote p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink); }
.ex-margin .live-quote cite { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; font-style: normal; font-size: 11.5px; line-height: 1.4; color: var(--ink-4); }
.q-type { padding: 2px 6px; border-radius: 5px; background: var(--qt); color: #fff; font-size: 10px; font-weight: 700; }
.q-title { color: var(--ink-2); font-weight: 600; overflow-wrap: anywhere; }
.q-ref { flex-basis: 100%; overflow-wrap: anywhere; }

/* advisor: the calculation as a receipt */
.calc { border: 1px solid var(--line); border-radius: 16px; background: var(--surface-solid); overflow: hidden; }
.calc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 16px 18px 14px; }
.calc-top span { font-size: 13.5px; color: var(--ink-3); }
.calc-top b { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-top b small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.calc-formula { padding: 12px 18px; border-top: 1px dashed var(--line); background: color-mix(in oklab, var(--agent) 5%, var(--surface-solid)); }
.calc-formula span { display: block; font-size: 12px; font-weight: 600; color: var(--agent-ink); margin-bottom: 4px; }
.calc-formula code { display: block; direction: ltr; text-align: left; font: 13.5px/1.55 ui-monospace, 'Cascadia Mono', Consolas, monospace; color: var(--ink-2); overflow-x: auto; white-space: pre-wrap; }
.calc-lines { list-style: none; margin: 0; padding: 4px 18px 10px; border-top: 1px dashed var(--line); }
.calc-lines li { display: grid; grid-template-columns: auto minmax(16px, 1fr) auto; column-gap: 8px; align-items: baseline; padding: 9px 0; }
.calc-lines li + li { border-top: 1px solid var(--line-2); }
.calc-name { font-size: 14px; color: var(--ink-2); }
.calc-lines i { border-bottom: 1.5px dotted color-mix(in oklab, var(--ink-4) 70%, transparent); transform: translateY(-4px); }
.calc-val { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-lines small { grid-column: 1 / -1; margin-top: 2px; font-size: 11.5px; color: var(--ink-4); overflow-wrap: anywhere; }
.calc-notes { margin: 0; padding: 10px 18px 14px; padding-inline-start: 34px; border-top: 1px dashed var(--line); font-size: 13px; line-height: 1.55; color: var(--ink-3); }

/* actions under an answer */
.ex .live-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 10px; padding: 0; border: 0; }
.ex-act { all: unset; box-sizing: border-box; width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; cursor: pointer;
  color: var(--ink-4); transition: background-color 140ms ease, color 140ms ease; }
.ex-act svg { width: 16px; height: 16px; }
.ex-act[hidden] { display: none; }
.ex-act:active { transform: scale(.94); }
.ex .live-reasons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex-basis: 100%; margin-top: 6px; }
.ex .live-reasons[hidden] { display: none; }
.lr-q { font-size: 12.5px; color: var(--ink-3); margin-inline-end: 2px; }
.lr-chip { all: unset; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease; }

/* thinking, inside the answer slot */
.ex .think { grid-template-columns: 56px minmax(0, 1fr); gap: 14px; padding-top: 2px; }
.ex .think-art { zoom: .737; }                         /* the 76px animation, drawn at 56px */
.ex .think-steps li { font-size: 13.5px; }
.ex .think.advisor .think-art { background: color-mix(in oklab, var(--gold) 9%, var(--surface-2)); }

/* composer: one floating field, pinned to the bottom of the column */
.cw .cw-compose { width: min(760px, 100%); margin-inline: auto; padding: 14px 0 6px; background: linear-gradient(transparent, var(--bg) 38%); }
.cw .composer .dock { position: relative; display: flex; align-items: flex-end; gap: 8px; padding: 8px; padding-inline-start: 18px;
  border-radius: 24px; background: var(--surface-solid); border: 1px solid var(--line); box-shadow: var(--sh-2); overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease; }
.cw .composer .dock:focus-within { border-color: color-mix(in oklab, var(--agent) 45%, var(--line)); box-shadow: 0 0 0 4px color-mix(in oklab, var(--agent) 12%, transparent), var(--sh-2); }
.cw .composer textarea { padding: 10px 0; font-size: 15.5px; }
.cw .dock-send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--agent); color: #fff; transition: transform 140ms var(--ease-out), background-color 160ms ease; }
.cw .dock-send svg { width: 17px; height: 17px; }
.cw .dock-send:active:not([disabled]) { transform: scale(.94); }
.cw .dock-send[disabled] { cursor: not-allowed; }
.cw .dock-len { position: absolute; inset-inline: 0; bottom: 0; height: 2px; opacity: .7; transform: scaleX(0); transform-origin: left; transition: transform 160ms var(--ease-out); }
[dir="rtl"] .cw .dock-len { transform-origin: right; }
.cw .dock-len.over { background: #b3261e; opacity: 1; }
.composer-hint #chat-count { opacity: 0; transition: opacity 160ms ease; }
.composer-hint #chat-count.over { opacity: 1; }
.cw.advisor .dock-send { background: color-mix(in oklab, var(--gold) 80%, #000); }
.cw .dock-send[disabled] { background: var(--surface-2); color: var(--ink-4); opacity: 1; }
.cw .dock-len { background: var(--agent); }
.cw .composer-hint { padding: 7px 16px 0; font-size: 11.5px; }

/* the one reveal: an answer that has just arrived */
.ex.fresh .ex-ai { animation: ex-in 320ms var(--ease-out) both; }
@keyframes ex-in { from { opacity: 0; transform: translateY(6px); } }

@media (hover: hover) and (pointer: fine) {
  .cw-new:hover { border-color: color-mix(in oklab, var(--agent) 40%, var(--line)); background: color-mix(in oklab, var(--agent) 5%, var(--surface-solid)); }
  .cw-item:not(.on):hover { background: var(--surface-2); }
  .cw-wipe:hover { color: #b3261e; }
  .cw-starter:hover { border-color: color-mix(in oklab, var(--agent) 40%, var(--line)); transform: translateY(-1px); box-shadow: var(--sh-1); }
  .ex-act:hover { background: var(--surface-2); color: var(--ink); }
  .lr-chip:hover { border-color: var(--agent); background: color-mix(in oklab, var(--agent) 8%, var(--surface-solid)); }
  .ex .live-card:hover { border-color: color-mix(in oklab, var(--agent) 30%, var(--line)); }
}
@media (max-width: 1080px) {
  .cw { grid-template-columns: minmax(0, 1fr); }
  .cw-rail { display: none; }
  .cw-tools .conv-pick, .cw-tools .cw-new-sm { display: inline-grid; }
  .cw-tools .conv-pick { display: block; height: 34px; max-width: 220px; font-size: 13px; }
  .cw-title { display: none; }
}
@media (max-width: 640px) {
  .cw-head { flex-wrap: wrap; }
  .cw-tools { margin-inline-start: auto; }
  .cw-tools .conv-pick { max-width: 150px; }
  .cw-starters { grid-template-columns: minmax(0, 1fr); }
  .ex-ai { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ex-ai > .ex-mark { width: 26px; height: 26px; }
  .calc-top b { font-size: 28px; }
  .ex .live-card { flex-wrap: wrap; }
  .ex .live-card .meta { flex-basis: calc(100% - 56px); }
  .ex .live-card .acts { flex-basis: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .ex.fresh .ex-ai { animation: ex-fade 200ms ease both; }
  .cw-starter, .dock-len, .dock-send { transition: none; }
}
@keyframes ex-fade { from { opacity: 0; } }

/* Every generated sheet (reports, contracts, letters, PDFs) is marked as a demo draft. */
.sheet::after { content: "DEMO · DRAFT"; position: absolute; top: 66%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg);
  font: 800 92px/1 'Geist', system-ui, sans-serif; letter-spacing: .06em; white-space: nowrap; color: rgba(214, 69, 69, .075);
  pointer-events: none; z-index: 5; }
.sheet[dir="rtl"]::after { content: "نسخة تجريبية · مسودة"; font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; letter-spacing: 0; }
