/* hyrise finance · Plan chat (static/finance/chat.js). Builds on app.py's tokens and kit (button.bs, the toasts).
   Docked on the right of the Plan page from 1100 px: a column the height of the screen, the app's columns (the top bar
   and the page) narrowed by its width so nothing hides under it; the side panel (z-index 20) opens over it. Below
   1100 px it is a panel over the page, folded until the Chat button opens it. Not on a phone (chat.js). */
.fin-chat{--fin-chat-w:340px;position:fixed;top:0;right:0;bottom:0;z-index:16;width:var(--fin-chat-w);display:flex;flex-direction:column;
  background:var(--card);border-left:1px solid var(--line)}
.fin-chat[hidden]{display:none}
@media (min-width:1100px){
  body.fin-chat-on .col{margin-right:340px}           /* the top bar and the page make room: the chat covers nothing */
}
@media (max-width:1099px){
  .fin-chat{box-shadow:-16px 0 40px rgba(20,30,45,.16)}
}
.fin-chatb.on{border-color:var(--ink);color:var(--ink);font-weight:600}

/* ---- the header: what it is, which plan it talks to, a new conversation, close ---- */
.fin-chat-head{display:flex;align-items:baseline;gap:8px;padding:14px 8px 12px 16px;border-bottom:1px solid var(--line)}
.fin-chat-head b{font-size:var(--fs-base);font-weight:600;color:var(--ink);white-space:nowrap}
.fin-chat-head small{flex:1;min-width:0;font-size:var(--fs-xs);color:var(--mut);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:right}
.fin-chat-ib{flex-shrink:0;align-self:center;width:28px;height:28px;margin:0;padding:0;border:0;border-radius:var(--radius);background:transparent;
  color:var(--mut);font-size:var(--fs-md);line-height:1;cursor:pointer}
.fin-chat-ib:hover{background:var(--hover);color:var(--ink)}
.fin-chat-ib:focus-visible{outline:0;box-shadow:0 0 0 3px var(--acc-soft)}

/* ---- the conversation ---- */
.fin-chat-log{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:14px 14px 8px;display:flex;flex-direction:column;gap:10px}
.fin-cm{display:flex;flex-direction:column}
.fin-cm.u{align-items:flex-end} .fin-cm.a{align-items:flex-start}
.fin-cb{max-width:94%;padding:9px 11px;border-radius:10px;background:var(--chip);color:var(--ink);font-size:var(--fs-sm);line-height:1.45;overflow-wrap:anywhere}
.fin-cm.u .fin-cb{background:var(--seg-bg)}
.fin-cb b{font-weight:600}
.fin-chat-acts,.fin-chat-not{margin:6px 0 0;padding:0 0 0 16px;font-size:var(--fs-xs);line-height:1.45;color:var(--mut)}
.fin-chat-acts li,.fin-chat-not li{margin:2px 0}
.fin-chat-not{color:#8A5300}
.fin-chat-eff{margin-top:6px;font-size:var(--fs-xs);color:var(--mut);font-variant-numeric:tabular-nums}
.fin-chat-typing{display:inline-flex;align-items:center;gap:4px;padding:12px 13px}
.fin-chat-typing i{width:6px;height:6px;border-radius:50%;background:var(--mut-soft);animation:fin-chat-dot 1.2s infinite ease-in-out}
.fin-chat-typing i:nth-child(2){animation-delay:.15s} .fin-chat-typing i:nth-child(3){animation-delay:.3s}
@keyframes fin-chat-dot{0%,80%,100%{opacity:.35;transform:none}40%{opacity:1;transform:translateY(-3px)}}
.fin-chat-err{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;background:#FDF1F1;color:#8C2F2F}
.fin-chat-err span{flex:1;min-width:0} .fin-chat-err .bs{margin:0;padding:4px 10px;font-size:var(--fs-sm)}
.fin-chat-ex{display:flex;flex-direction:column;gap:6px}
.fin-chat-ex .bs{margin:0;padding:8px 11px;border-radius:10px;text-align:left;white-space:normal;line-height:1.4;font-size:var(--fs-sm);color:var(--txt)}

/* ---- typing: Enter sends, Shift+Enter breaks the line ---- */
.fin-chat-foot{padding:12px 14px;border-top:1px solid var(--line)}
.fin-chat-foot textarea{width:100%;max-height:140px;resize:none;padding:9px 11px;border-radius:8px;font-size:var(--fs-sm);line-height:1.45}
.fin-chat-foot textarea:disabled{background:var(--bg);color:var(--mut)}
@media (max-width:760px){
  .fin-chat{width:100%}
  .fin-chat-foot textarea{font-size:16px}                   /* 16px: iOS does not zoom the page on focus */
}
