/* Right-hand chat panel, rich turns (VISUAL_SPEC §4). Workspace only: every rule is scoped to
   body[data-app] #conversation[data-rich] (or the panel width variables), so /rns-chat/ is untouched.
   Uses only --tf-* tokens (tf-components.css), so the light theme follows automatically. */

/* ---------- widths ---------- */
@media(min-width:1021px) and (max-width:1200px){:root{--chat:320px}}
@media(min-width:1201px){:root{--chat:360px}}
@media(min-width:1600px){:root{--chat:400px}}
@media(min-width:1201px){body[data-app].chat-wide:not(.chat-collapsed){--chat:480px}}
@media(max-width:1200px){body[data-app] #conversation[data-rich] .conversation-actions .chat-widen{display:none}}
@media(min-width:1021px) and (prefers-reduced-motion:no-preference){body[data-app] .next-app{transition:grid-template-columns var(--tf-d3) var(--tf-ease)}}

/* ---------- frame ---------- */
body[data-app] #conversation[data-rich]{background:radial-gradient(120% 40% at 100% 0,var(--tf-wash),transparent 60%),var(--tf-sunken);border-left:1px solid var(--tf-line);color:var(--tf-text)}
body[data-app] #conversation[data-rich] svg{fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
body[data-app] #conversation[data-rich] .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------- header ---------- */
body[data-app] #conversation[data-rich]>.conversation-top{display:flex;align-items:center;gap:12px;height:91px;min-height:0;margin:0;padding:0 12px 0 20px;border-bottom:1px solid var(--tf-line);background:transparent;flex:none}
body[data-app] #conversation[data-rich] .assistant-identity{display:flex;align-items:center;gap:12px;min-width:0;flex:1}
body[data-app] #conversation[data-rich] .assistant-mark{position:relative;display:grid;place-items:center;width:38px;height:38px;flex:none;border-radius:12px;border:1px solid var(--tf-edge);
  background:linear-gradient(145deg,var(--tf-wash-strong),var(--tf-wash));color:var(--tf-accent);box-shadow:inset 0 1px var(--tf-highlight)}
body[data-app] #conversation[data-rich] .assistant-mark>svg{width:19px;height:19px}
body[data-app] #conversation[data-rich] .presence-dot{position:absolute;right:-3px;bottom:-3px;width:11px;height:11px;border-radius:50%;background:var(--tf-accent);box-shadow:0 0 0 2.5px var(--tf-sunken);transition:background var(--tf-d2)}
body[data-app] #conversation[data-rich][data-presence=thinking] .presence-dot{background:var(--tf-think)}
body[data-app] #conversation[data-rich][data-presence=listening] .presence-dot{background:var(--tf-listen)}
body[data-app] #conversation[data-rich][data-presence=speaking] .presence-dot{background:var(--tf-accent)}
body[data-app] #conversation[data-rich][data-presence=error] .presence-dot{background:var(--tf-error)}
body[data-app] #conversation[data-rich] .assistant-identity>div{min-width:0;flex:1 1 auto}
body[data-app] #conversation[data-rich] .assistant-identity strong{display:block;font:600 14.5px/1.2 var(--tf-font-display);letter-spacing:-.2px;color:var(--tf-text)}
body[data-app] #conversation[data-rich] .assistant-identity #conversation-presence{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;margin-top:3px;font:400 11.5px/1.3 var(--tf-font-ui);color:var(--tf-muted);white-space:normal;overflow:hidden;overflow-wrap:break-word}
body[data-app] #conversation[data-rich] .conversation-actions{display:flex;align-items:center;gap:2px;flex:none}
body[data-app] #conversation[data-rich] .conversation-actions .icon-button{display:inline-grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid transparent;border-radius:var(--tf-r-md);background:transparent;color:var(--tf-muted);box-shadow:none}
body[data-app] #conversation[data-rich] .conversation-actions .icon-button:hover{background:var(--tf-raised);border-color:var(--tf-line);color:var(--tf-text)}
body[data-app] #conversation[data-rich] .conversation-actions .icon-button[aria-pressed=true]{color:var(--tf-accent);border-color:var(--tf-edge);background:var(--tf-wash)}
body[data-app] #conversation[data-rich] .conversation-actions svg{width:18px;height:18px}
body[data-app] #conversation[data-rich] .conversation-actions .conversation-close{display:none}
@media(max-width:1020px){
  body[data-app] #conversation[data-rich] .conversation-actions :is(.chat-widen,.chat-collapse){display:none}
  body[data-app] #conversation[data-rich] .conversation-actions .conversation-close{display:inline-grid}
  body[data-app] #conversation[data-rich]>.conversation-top{height:calc(60px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 8px 0 16px}
  body[data-app] #conversation[data-rich] .assistant-mark{width:34px;height:34px;border-radius:11px}
}
@media(pointer:coarse){body[data-app] #conversation[data-rich] .conversation-actions .icon-button{width:44px;height:44px}}

/* context moves into the composer as a chip */
body[data-app] #conversation[data-rich] .conversation-context.composer-context{display:inline-flex;align-items:center;gap:6px;max-width:calc(100% - 20px);height:26px;min-height:0;margin:10px 10px 0;padding:0 9px;
  border:1px solid var(--tf-edge);border-radius:8px;background:var(--tf-wash-strong);color:var(--tf-accent);font:500 11.5px/1 var(--tf-font-ui)}
body[data-app] #conversation[data-rich] .composer-context .status-dot{width:6px;height:6px;flex:none;border-radius:50%;background:var(--tf-accent)}
body[data-app] #conversation[data-rich] .composer-context #conversation-context{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------- log ---------- */
body[data-app] #conversation[data-rich] #conversation-log{position:relative;flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--tf-line) transparent;
  display:flex;flex-direction:column;gap:24px;padding:22px 20px 28px;margin:0;
  -webkit-mask-image:linear-gradient(180deg,transparent 0,#000 18px);mask-image:linear-gradient(180deg,transparent 0,#000 18px)}
@media(max-width:680px){body[data-app] #conversation[data-rich] #conversation-log{padding:18px 16px 24px}}

/* welcome */
body[data-app] #conversation[data-rich] .conversation-welcome{display:flex;flex-direction:column;gap:18px;padding:34px 4px 0;margin:0;text-align:left;align-items:stretch}
body[data-app] #conversation[data-rich] .conversation-welcome .partner-glyph{margin:0}
body[data-app] #conversation[data-rich] .conversation-welcome h2{margin:0;font:550 28px/1.15 var(--tf-font-display);letter-spacing:-1.1px;color:var(--tf-text)}
body[data-app] #conversation[data-rich] .conversation-welcome>p{margin:0;font-size:13px;line-height:1.7;color:var(--tf-muted)}
body[data-app] #conversation[data-rich] .suggestions{display:flex;flex-direction:column;gap:8px;margin:0}
body[data-app] #conversation[data-rich] .suggestions>button{display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:10px 14px;border:1px solid var(--tf-line);border-radius:14px;
  background:linear-gradient(150deg,var(--tf-raised),var(--tf-surface));box-shadow:inset 0 1px var(--tf-highlight);text-align:left;font:500 13px/1.35 var(--tf-font-ui);color:var(--tf-text);transition:border-color var(--tf-d1),background var(--tf-d1)}
body[data-app] #conversation[data-rich] .suggestions>button:hover{border-color:var(--tf-edge);background:var(--tf-wash)}
body[data-app] #conversation[data-rich] .suggestions>button>span{flex:1;min-width:0}
body[data-app] #conversation[data-rich] .suggestions small{display:block;margin-top:2px;font-size:11.5px;font-weight:400;color:var(--tf-quiet)}
body[data-app] #conversation[data-rich] .suggestions .sugg-icon{width:17px;height:17px;color:var(--tf-accent);flex:none}
body[data-app] #conversation[data-rich] .suggestions .sugg-arrow{width:15px;height:15px;margin-left:auto;color:var(--tf-quiet);flex:none}

/* turns */
body[data-app] #conversation[data-rich] .chat-turn{margin:0;padding:0;border:0;background:none;box-shadow:none;max-width:none;min-width:0}
body[data-app] #conversation[data-rich] .chat-turn.user{align-self:flex-end;max-width:86%}
body[data-app] #conversation[data-rich] .chat-turn.user>.chat-copy{margin:0;padding:11px 14px;border:1px solid var(--tf-line);border-radius:18px 18px 6px 18px;background:var(--tf-raised);
  box-shadow:inset 0 1px var(--tf-highlight);font:400 13.5px/1.6 var(--tf-font-ui);color:var(--tf-text);white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:680px){body[data-app] #conversation[data-rich] .chat-turn.user{max-width:88%}}
body[data-app] #conversation[data-rich] .chat-turn.assistant{display:flex;flex-direction:column;gap:10px}
body[data-app] #conversation[data-rich] .turn-meta{display:flex;align-items:center;gap:8px}
body[data-app] #conversation[data-rich] .turn-meta small{display:inline;margin:0;font:600 12px/1 var(--tf-font-ui);letter-spacing:0;text-transform:none;color:var(--tf-text)}
body[data-app] #conversation[data-rich] .turn-meta time{font:400 10px/1 var(--tf-font-mono);color:var(--tf-quiet)}
body[data-app] #conversation[data-rich] .turn-avatar{display:grid;place-items:center;width:22px;height:22px;border-radius:7px;background:var(--tf-wash-strong);color:var(--tf-accent);border:1px solid var(--tf-edge)}
body[data-app] #conversation[data-rich] .turn-avatar svg{width:13px;height:13px}

/* markdown */
body[data-app] #conversation[data-rich] .chat-turn.assistant .chat-copy{white-space:normal;font:400 13.5px/1.72 var(--tf-font-ui);color:var(--tf-text);overflow-wrap:anywhere;min-width:0}
@media(max-width:680px){body[data-app] #conversation[data-rich] .chat-turn.assistant .chat-copy{font-size:14.5px;line-height:1.7}}
body[data-app] #conversation[data-rich] .chat-copy>*{margin:0}
body[data-app] #conversation[data-rich] .chat-copy>*+*{margin-top:10px}
body[data-app] #conversation[data-rich] .chat-copy h3{margin-top:16px;font:650 14px/1.35 var(--tf-font-display);letter-spacing:-.15px;color:var(--tf-text)}
body[data-app] #conversation[data-rich] .chat-copy>h3:first-child{margin-top:0}
body[data-app] #conversation[data-rich] .chat-copy strong{font-weight:650;color:var(--tf-text)}
body[data-app] #conversation[data-rich] .chat-copy :is(ul,ol){list-style:none;display:flex;flex-direction:column;gap:6px;padding:0}
body[data-app] #conversation[data-rich] .chat-copy li{position:relative;padding-left:16px}
body[data-app] #conversation[data-rich] .chat-copy ul>li::before{content:"";position:absolute;left:2px;top:.72em;width:6px;height:1.5px;border-radius:1px;background:var(--tf-accent)}
body[data-app] #conversation[data-rich] .chat-copy ol{counter-reset:md}
body[data-app] #conversation[data-rich] .chat-copy ol>li{counter-increment:md;padding-left:22px}
body[data-app] #conversation[data-rich] .chat-copy ol>li::before{content:counter(md) ".";position:absolute;left:0;top:.2em;font:500 11px/1.6 var(--tf-font-mono);color:var(--tf-accent)}
body[data-app] #conversation[data-rich] .chat-copy blockquote{padding:2px 0 2px 12px;border-left:2px solid var(--tf-edge);color:var(--tf-muted)}
body[data-app] #conversation[data-rich] .chat-copy code{font:500 12px/1.4 var(--tf-font-mono);padding:1px 5px;border-radius:5px;background:var(--tf-raised);border:1px solid var(--tf-line)}
body[data-app] #conversation[data-rich] .chat-copy a{color:var(--tf-accent);text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--tf-accent) 40%,transparent);text-underline-offset:3px}
body[data-app] #conversation[data-rich] .chat-copy a.cite{display:inline-grid;place-items:center;min-width:17px;height:17px;padding:0 4px;margin-left:3px;border-radius:5px;vertical-align:2px;
  background:var(--tf-wash-strong);color:var(--tf-accent);border:1px solid var(--tf-edge);font:600 10px/1 var(--tf-font-mono);text-decoration:none;position:relative}
body[data-app] #conversation[data-rich] .chat-copy a.cite::after{content:"";position:absolute;inset:-6px -3px}
body[data-app] #conversation[data-rich] .chat-copy a.cite:hover{background:var(--tf-accent);color:var(--tf-accent-ink)}
body[data-app] #conversation[data-rich] .chat-copy .cite-plain{font:500 10px var(--tf-font-mono);color:var(--tf-quiet)}
body[data-app] #conversation[data-rich] .md-table{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;border:1px solid var(--tf-line);border-radius:var(--tf-r-lg);background:var(--tf-surface)}
body[data-app] #conversation[data-rich] .md-table table{width:100%;min-width:300px;border-collapse:separate;border-spacing:0;font:400 12px/1.4 var(--tf-font-ui);font-variant-numeric:tabular-nums}
body[data-app] #conversation[data-rich] .md-table :is(th,td){padding:8px 10px;border-bottom:1px solid var(--tf-line);text-align:left;white-space:nowrap}
body[data-app] #conversation[data-rich] .md-table th{font:500 10px/1 var(--tf-font-mono);letter-spacing:.8px;text-transform:uppercase;color:var(--tf-quiet);background:var(--tf-raised)}
body[data-app] #conversation[data-rich] .md-table tr:last-child td{border-bottom:0}
@media(prefers-reduced-motion:no-preference){body[data-app] #conversation[data-rich] .chat-turn.assistant .chat-copy>*{animation:tf-chat-in .32s var(--tf-ease) both;animation-delay:calc(var(--i,0)*45ms)}}
@keyframes tf-chat-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

/* error turns */
body[data-app] #conversation[data-rich] .chat-turn.error .chat-copy{padding:10px 12px;border:1px dashed var(--tf-line);border-radius:var(--tf-r-lg);color:var(--tf-muted)}

/* sources */
body[data-app] #conversation[data-rich] .chat-sources{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;border:0;background:none}
body[data-app] #conversation[data-rich] .sources-label{margin:0;font:600 10px/1 var(--tf-font-mono);letter-spacing:1.2px;text-transform:uppercase;color:var(--tf-quiet)}
/* The card row scrolls inside the turn (no negative margins), so the conversation itself never scrolls sideways. */
body[data-app] #conversation[data-rich] .source-row{gap:8px;padding-block:2px 4px;margin-inline:0;padding-inline:0;max-width:100%;min-width:0;scroll-padding-inline:0}
body[data-app] #conversation[data-rich] .chat-sources,body[data-app] #conversation[data-rich] .chat-turn.assistant{min-width:0;max-width:100%}
body[data-app] #conversation[data-rich] #conversation-log{overflow-x:hidden}
body[data-app] #conversation[data-rich] .source-card{display:flex;flex-direction:column;gap:7px;width:196px;flex:none;padding:10px 12px;border:1px solid var(--tf-line);border-radius:var(--tf-r-lg);background:var(--tf-surface);color:var(--tf-text);text-decoration:none;transition:border-color var(--tf-d1),background var(--tf-d1)}
body[data-app] #conversation[data-rich] .source-card:hover,body[data-app] #conversation[data-rich] .source-card.is-lit{border-color:var(--tf-edge);background:var(--tf-wash)}
body[data-app] #conversation[data-rich] .source-top{display:flex;align-items:center;gap:7px;min-width:0}
body[data-app] #conversation[data-rich] .source-top .cite{display:inline-grid;place-items:center;min-width:17px;height:17px;padding:0 4px;border-radius:5px;background:var(--tf-wash-strong);color:var(--tf-accent);border:1px solid var(--tf-edge);font:600 10px/1 var(--tf-font-mono)}
body[data-app] #conversation[data-rich] .source-badge{display:inline-grid;place-items:center;width:18px;height:18px;flex:none;border-radius:5px;font:600 10px/1 var(--tf-font-mono);background:hsl(var(--h,30) 18% 20%);color:hsl(var(--h,30) 45% 80%)}
html[data-theme=light] body[data-app] #conversation[data-rich] .source-badge{background:hsl(var(--h,30) 35% 92%);color:hsl(var(--h,30) 45% 28%)}
body[data-app] #conversation[data-rich] .source-top small{min-width:0;font:400 11px/1.2 var(--tf-font-ui);color:var(--tf-quiet);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-app] #conversation[data-rich] .source-card strong{font:500 12.5px/1.4 var(--tf-font-ui);color:var(--tf-text);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}

/* turn actions */
body[data-app] #conversation[data-rich] .turn-actions{display:flex;gap:2px;margin-left:-8px;opacity:.85}
body[data-app] #conversation[data-rich] .turn-actions button{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--tf-quiet);font:500 11.5px/1 var(--tf-font-ui)}
body[data-app] #conversation[data-rich] .turn-actions button:hover{background:var(--tf-raised);color:var(--tf-text)}
body[data-app] #conversation[data-rich] .turn-actions button.is-done{color:var(--tf-up)}
body[data-app] #conversation[data-rich] .turn-actions svg{width:15px;height:15px}
@media(pointer:coarse){body[data-app] #conversation[data-rich] .turn-actions button{height:44px}}

/* thinking */
body[data-app] #conversation[data-rich] .chat-thinking{display:flex;align-items:center;gap:10px;font-size:12px;color:var(--tf-muted)}
body[data-app] #conversation[data-rich] .chat-thinking .chat-loader{display:inline-flex;gap:4px;margin:0;padding:0;background:none}
body[data-app] #conversation[data-rich] .chat-thinking .chat-loader i{width:6px;height:6px;border-radius:50%;background:var(--tf-accent);animation:tf-chat-dot 1.2s ease-in-out infinite}
body[data-app] #conversation[data-rich] .chat-thinking .chat-loader i:nth-child(2){animation-delay:.15s}
body[data-app] #conversation[data-rich] .chat-thinking .chat-loader i:nth-child(3){animation-delay:.3s}
@keyframes tf-chat-dot{0%,80%,100%{transform:translateY(0);opacity:.35}40%{transform:translateY(-4px);opacity:1}}
body[data-app] #conversation[data-rich] .pending-label{background:linear-gradient(90deg,var(--tf-muted) 0%,var(--tf-text) 50%,var(--tf-muted) 100%);background-size:200% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:tf-chat-sh 2s linear infinite}
@keyframes tf-chat-sh{to{background-position:-200% 0}}

/* jump to latest */
body[data-app] #conversation[data-rich] .conversation-composer{position:relative}
body[data-app] #conversation[data-rich] .jump-latest{position:absolute;left:50%;bottom:calc(100% + 12px);z-index:3;transform:translateX(-50%);display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 13px 0 10px;border-radius:999px;
  border:1px solid var(--tf-edge);background:color-mix(in srgb,var(--tf-surface) 92%,transparent);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);font:550 12px/1 var(--tf-font-ui);color:var(--tf-accent);box-shadow:var(--tf-shadow-pop);cursor:pointer}
body[data-app] #conversation[data-rich] .jump-latest[hidden]{display:none}
body[data-app] #conversation[data-rich] .jump-latest svg{width:15px;height:15px}

/* ---------- composer ---------- */
body[data-app] #conversation[data-rich] .conversation-composer{flex:none;padding:12px 16px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--tf-line);background:linear-gradient(180deg,var(--tf-surface),var(--tf-sunken))}
body[data-app] #conversation[data-rich] .conversation-mode-action:empty{display:none}
body[data-app] #conversation[data-rich] #conversation-form{margin:0;padding:0;border:1px solid var(--tf-edge);border-radius:var(--tf-r-2xl);background:linear-gradient(155deg,var(--tf-raised),var(--tf-surface));
  box-shadow:inset 0 1px var(--tf-highlight),0 5px 20px rgba(0,0,0,.08);transition:border-color var(--tf-d1),box-shadow var(--tf-d1)}
body[data-app] #conversation[data-rich] #conversation-form[hidden]{display:none}
body[data-app] #conversation[data-rich] #conversation-form:focus-within{border-color:color-mix(in srgb,var(--tf-accent) 60%,var(--tf-edge));box-shadow:0 0 0 3px var(--tf-wash-strong),inset 0 1px var(--tf-highlight)}
body[data-app] #conversation[data-rich] #conversation-input{display:block;width:100%;min-height:48px;max-height:168px;resize:none;border:0;outline:0;background:none;box-shadow:none;margin:0;padding:10px 14px 4px;font:400 14px/1.6 var(--tf-font-ui);color:var(--tf-text)}
body[data-app] #conversation[data-rich] #conversation-input::placeholder{color:var(--tf-quiet)}
@media(pointer:coarse),(max-width:1020px){body[data-app] #conversation[data-rich] #conversation-input{font-size:16px}}
body[data-app] #conversation[data-rich] .composer-actions{display:flex;align-items:center;gap:6px;margin:0;padding:4px 8px 8px 10px;border:0}
body[data-app] #conversation[data-rich] .composer-actions>span{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 10px;border-radius:999px;border:1px solid var(--tf-edge);background:var(--tf-wash);font:500 11.5px/1 var(--tf-font-ui);color:var(--tf-accent)}
body[data-app] #conversation[data-rich] .composer-actions>span svg{width:14px;height:14px}
body[data-app] #conversation[data-rich] .composer-buttons{display:flex;align-items:center;gap:6px;margin-left:auto}
body[data-app] #conversation[data-rich] .composer-buttons>button{display:grid;place-items:center;width:40px;height:40px;min-width:0;min-height:0;padding:0;border-radius:50%;flex:none;transition:transform var(--tf-d1),background var(--tf-d1)}
body[data-app] #conversation[data-rich] .composer-buttons>button:active{transform:scale(.94)}
body[data-app] #conversation[data-rich] .composer-buttons svg{width:18px;height:18px}
body[data-app] #conversation[data-rich] .composer-buttons>#conversation-switch{position:static;margin:0;gap:0;border:1px solid var(--tf-edge);background:var(--tf-wash);color:var(--tf-accent);box-shadow:none;font-size:0}
body[data-app] #conversation[data-rich] .composer-buttons>#conversation-switch>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
body[data-app] #conversation[data-rich] .composer-buttons>#conversation-send{background:var(--tf-accent-grad);color:var(--tf-accent-ink);border:1px solid var(--tf-accent-border);box-shadow:inset 0 1px rgba(255,255,255,.4),0 4px 12px rgba(0,0,0,.18)}
body[data-app] #conversation[data-rich] .composer-buttons>#conversation-send svg{stroke-width:2}
body[data-app] #conversation[data-rich] .composer-buttons>#conversation-send:disabled{background:var(--tf-raised);color:var(--tf-quiet);border-color:var(--tf-line);box-shadow:none;cursor:default}
@media(pointer:coarse){body[data-app] #conversation[data-rich] .composer-buttons>button{width:44px;height:44px}body[data-app] #conversation[data-rich] .composer-actions>span{height:34px}}
body[data-app] #conversation[data-rich] #conversation-status{margin:8px 2px 0;font:400 12px/1.5 var(--tf-font-ui);color:var(--tf-muted)}
body[data-app] #conversation[data-rich] #conversation-status:empty{display:none}
body[data-app] #conversation[data-rich] #conversation-status button{min-height:32px;padding:0 10px;border:1px solid var(--tf-edge);border-radius:8px;background:var(--tf-wash);color:var(--tf-accent);font:550 12px var(--tf-font-ui)}
body[data-app] #conversation[data-rich] #credit-note{margin:8px 0 0;padding:0;text-align:center;font:400 11px/1.4 var(--tf-font-ui);color:var(--tf-quiet)}
@media(max-width:680px){body[data-app] #conversation[data-rich] .conversation-composer{padding:10px 12px calc(10px + env(safe-area-inset-bottom))}}

/* ---------- collapsed launcher (desktop) ---------- */
body[data-app] .chat-launcher{display:none}
@media(min-width:1021px){
  body[data-app].chat-collapsed .chat-launcher{position:fixed;right:max(24px,env(safe-area-inset-right));bottom:24px;z-index:60;display:inline-flex;align-items:center;gap:10px;height:52px;padding:0 16px 0 7px;border-radius:999px;border:1px solid var(--tf-edge);
    background:linear-gradient(145deg,var(--tf-raised),var(--tf-surface));box-shadow:var(--tf-shadow-pop),inset 0 1px var(--tf-highlight);font:600 13px/1 var(--tf-font-ui);color:var(--tf-text);cursor:pointer}
  body[data-app].chat-collapsed .chat-launcher:hover{border-color:var(--tf-accent-border)}
  body[data-app] .chat-launcher-orb{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:var(--tf-accent-grad);color:var(--tf-accent-ink)}
  body[data-app] .chat-launcher svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  body[data-app] .chat-launcher kbd{font:500 10px/1 var(--tf-font-mono);padding:3px 6px;border:1px solid var(--tf-line);border-radius:6px;color:var(--tf-quiet)}
}

@media(prefers-reduced-motion:reduce){
  body[data-app] #conversation[data-rich] :is(.chat-thinking .chat-loader i,.pending-label){animation:none}
  body[data-app] #conversation[data-rich] .pending-label{color:var(--tf-muted);background:none}
}
/* A collapsed panel keeps a 0px grid column; drop its 1px border so it cannot add 1px of page overflow. */
@media(min-width:1021px){body[data-app].chat-collapsed #conversation[data-rich]{border-left-width:0;min-width:0;width:0}}
