.chat-page { --chat-line:#efdfd5; --chat-muted:#8b766b; max-width:1280px; margin:0 auto; color:#372c27; }
.chat-page-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:6px 0 8px; font-size:24px; font-weight:800; }
.chat-page-heading h1 { margin:0; font-size:inherit; }
.chat-intro { margin:0 0 14px; color:var(--chat-muted); font-size:12px; line-height:1.7; }
.chat-reception { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:12px; padding:12px 16px; border:1px solid #f6d9b7; border-radius:13px; background:#fff3e3; }
.chat-reception small { color:var(--chat-muted); flex:1; }
.chat-reception[hidden] { display:none; }
.chat-layout { display:grid; grid-template-columns:260px minmax(0,1fr); height:min(730px,75dvh); min-height:420px; overflow:hidden; border:1px solid var(--chat-line); border-radius:17px; background:#fffdfa; box-shadow:0 7px 24px #70442b08; }
.chat-conversations { min-width:0; overflow:auto; border-right:1px solid var(--chat-line); background:#fff9f4; }
.chat-conversation { position:relative; display:grid; gap:7px; width:100%; padding:17px 34px 17px 15px; border:0; border-bottom:1px solid var(--chat-line); text-align:left; color:inherit; background:transparent; cursor:pointer; }
.chat-conversation.current { background:#ffebe1; box-shadow:inset 3px 0 #e44450; }
.chat-conversation strong { display:-webkit-box; overflow:hidden; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.5; font-size:13px; }
.chat-conversation small { font-size:11px; color:#a35b3f; }
.chat-conversation-preview { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:var(--chat-muted); font-size:12px; }
.chat-unread,[data-chat-count] { display:inline-flex; align-items:center; justify-content:center; min-width:17px; height:17px; padding:0 4px; border-radius:12px; color:white; background:#e2384d; font-size:10px; font-weight:700; }
.chat-unread { position:absolute; top:15px; right:10px; }
[data-chat-count][hidden] { display:none; }
.chat-room { min-width:0; min-height:0; display:flex; flex-direction:column; overflow:hidden; }
.chat-room-heading { display:flex; align-items:center; gap:9px; padding:15px 18px; border-bottom:1px solid var(--chat-line); }
.chat-room-title { min-width:0; }
.chat-room-title h2 { margin:0; font-size:15px; overflow-wrap:anywhere; }
.chat-members { margin:6px 0 0; color:var(--chat-muted); font-size:11px; line-height:1.7; overflow-wrap:anywhere; }
.chat-back { display:none; flex:none; padding:4px 0; border:0; color:#b34e36; background:transparent; font-size:11px; cursor:pointer; }
.chat-context-card { margin:10px 15px 0; padding:10px 12px; border:1px solid var(--chat-line); border-radius:9px; color:#9e593a; background:#fff8ec; font-size:12px; text-decoration:none; }
.chat-room-status { padding:10px 17px; color:#a36b37; background:#fff6e8; font-size:12px; line-height:1.7; }
.chat-room-status[data-state=active] { color:#317b5d; background:#eff8f1; }
.chat-accept-area { padding:0 15px; }
.chat-accept-area:empty { display:none; }
.chat-messages { flex:1; min-height:100px; overflow:auto; overscroll-behavior:contain; padding:15px 18px; }
.chat-system-message { margin:4px auto 15px; max-width:90%; color:var(--chat-muted); font-size:11px; line-height:1.8; text-align:center; }
.chat-message { width:fit-content; max-width:85%; margin:12px 0; }
.chat-message--self { margin-left:auto; }
.chat-message-author { display:block; margin-bottom:5px; color:var(--chat-muted); font-size:10px; }
.chat-message-text { margin:0; padding:10px 13px; border:1px solid var(--chat-line); border-radius:3px 13px 13px; background:white; font-size:13px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-message--self .chat-message-text { border-color:#ffd5c3; border-radius:13px 3px 13px 13px; background:#ffeadd; }
.chat-message--official .chat-message-text { border-color:#eccb91; background:#fff4d9; }
.chat-message--official .chat-message-author { color:#a2691d; font-weight:700; }
.chat-composer { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; padding:12px 15px 7px; border-top:1px solid var(--chat-line); }
.chat-composer textarea { min-width:0; width:100%; min-height:66px; resize:none; padding:9px 11px; border:1px solid var(--chat-line); border-radius:10px; color:#372c27; background:white; font:inherit; font-size:12px; }
.chat-composer textarea:disabled { background:#f6f2ed; }
.chat-composer .button { align-self:end; }
.chat-error { margin:0; padding:0 15px; font-size:12px; }
.chat-error:empty { display:none; }
.chat-retention { padding:0 15px 10px; color:var(--chat-muted); font-size:10px; line-height:1.7; }
.chat-empty { padding:25px 18px; color:var(--chat-muted); font-size:13px; text-align:center; line-height:1.8; }
.chat-empty img { display:block; width:95px; margin:auto; }
.chat-older { text-align:center; }
.chat-history-button { padding:6px; border:0; color:#9a694b; background:transparent; font-size:11px; cursor:pointer; }
.chat-agent-form { display:grid; gap:15px; max-width:620px; margin-top:20px; padding:20px; }
.chat-agent-form h2 { margin:0; font-size:18px; }
.chat-agent-form label { display:grid; gap:6px; font-size:13px; }
.chat-agent-form select,.chat-agent-form input:not([type=checkbox]) { width:100%; min-width:0; height:40px; padding:8px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--panel); }
.chat-agent-form .chat-agent-enabled { display:flex; align-items:center; gap:8px; }
.chat-agent-form p { margin:0; font-size:12px; line-height:1.8; }
.chat-agent-roster { display:grid; gap:10px; margin-top:18px; }
.chat-agent-row { display:flex; align-items:center; flex-wrap:wrap; gap:16px; padding:16px; }
.chat-agent-row small { margin-left:auto; }
@media(max-width:760px){
  .chat-page { margin:0; padding:4px 0; }
  .chat-page-heading { align-items:flex-start; flex-wrap:wrap; font-size:20px; }
  .chat-page-heading .button { font-size:11px; min-height:30px; padding:5px 8px; }
  .chat-intro { font-size:11px; }
  .chat-layout { display:block; height:max(440px,calc(100dvh - 300px)); min-height:440px; }
  .chat-conversations { height:100%; border-right:0; }
  .chat-room { display:none; height:100%; }
  .chat-page--selected .chat-conversations { display:none; }
  .chat-page--selected .chat-room { display:flex; }
  .chat-back { display:block; }
  .chat-room-heading { flex-wrap:wrap; padding:10px; }
  .chat-room-title { flex:1 1 140px; }
  .chat-room-title h2 { font-size:13px; }
  .chat-room-status { padding:8px 10px; font-size:11px; }
  .chat-messages { padding:10px; }
  .chat-composer { gap:6px; padding:9px; }
  .chat-composer .button { min-width:42px; min-height:36px; padding:6px 8px; font-size:11px; }
  .chat-message { max-width:95%; }
  .chat-message-text { padding:8px 10px; font-size:12px; }
  .chat-reception { padding:10px; font-size:12px; }
  .chat-agent-form { padding:15px; }
}
