:root {
  --bg: #EEF1F7;
  --surface: #fff;
  --border: #E2E6EF;
  --text: #1E293B;
  --muted: #6B7A90;
  --brand: #1F6FEB;
  --op: #E8F0FE;
  font: 14px/1.45 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
.app { height: 100vh; display: grid; grid-template-columns: 280px 1fr; grid-template-rows: 56px 1fr; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: #0F1B33; color: #fff; }
.tb-brand { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.tb-logo { width: 28px; height: 28px; border-radius: 8px; background: #2D7FF9; display: grid; place-items: center; font-weight: 800; }
.tb-tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.12); color: #C8D3E8; }
.tb-center { display: flex; align-items: center; gap: 8px; color: #C8D3E8; font-size: 13px; }
.online { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.tb-user { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: capitalize; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #7C3AED; display: grid; place-items: center; font-weight: 700; font-size: 12px; }

.sessions { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.s-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 8px 4px; }
.sess { display: flex; gap: 10px; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; position: relative; align-items: flex-start; }
.sess:hover { background: #F4F6FB; }
.sess.on { background: #E8F0FE; }
.s-av, .cu-av { width: 34px; height: 34px; border-radius: 50%; background: #DDE6F5; color: #2B4C7E; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.s-main { min-width: 0; display: flex; flex-direction: column; }
.s-main small { color: var(--brand); font-weight: 600; font-size: 11.5px; }
.s-main em { font-style: normal; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.s-dot { position: absolute; right: 12px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: #EF4444; }
.s-help { margin-top: auto; font-size: 12px; color: var(--muted); background: #F6F8FC; border-radius: 12px; padding: 12px; }
.s-help b { display: block; color: var(--text); margin-bottom: 4px; }

.chat { display: flex; flex-direction: column; min-height: 0; padding: 0 430px 0 0; }
.chat-hd { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-hd small { display: block; color: var(--muted); font-size: 12px; }
.c-av { width: 38px; height: 38px; border-radius: 50%; background: #DDE6F5; color: #2B4C7E; display: grid; place-items: center; font-weight: 700; }
.chat-hd-r { margin-left: auto; display: flex; gap: 6px; }
.pill { font-size: 11.5px; padding: 3px 9px; border-radius: 99px; background: #F1F4FA; color: var(--muted); }
.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.msg.op { align-self: flex-end; }
.bubble { padding: 9px 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.msg.op .bubble { background: var(--op); border-color: #D3E1FB; border-bottom-right-radius: 5px; }
.msg.cu .bubble { border-bottom-left-radius: 5px; }
.who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.op-av { width: 28px; height: 28px; border-radius: 50%; background: #7C3AED; color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.typing { padding: 0 20px 8px; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 3px; }
.typing[hidden] { display: none; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: tb 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes tb { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.composer .ql-container { height: auto; }
.composer, .customer-sim, .chat-hd, .typing { flex: none; }
.composer { margin: 0 20px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 4px 14px -8px rgba(15,23,42,.2); }
.composer .ql-editor { min-height: 70px; max-height: 180px; padding: 12px 14px; font-size: 14px; }
.composer .ql-editor.ql-blank::before { color: #9AA6BA; font-style: normal; left: 14px; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px 10px; border-top: 1px solid #F0F2F7; }
.toolbar { display: flex; align-items: center; gap: 4px; }
.tbtn { width: 30px; height: 30px; border-radius: 8px; border: 0; background: #F3F5FA; color: #51607A; font-size: 15px; cursor: pointer; }
.tbtn:hover { background: #E8ECF4; }
.send { border: 0; border-radius: 10px; padding: 8px 14px; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.customer-sim { margin: 0 20px 16px; display: flex; gap: 6px; align-items: center; padding: 8px; border-radius: 12px; border: 1px dashed #C9D2E3; background: rgba(255,255,255,.6); }
.cs-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 6px; white-space: nowrap; }
.customer-sim input { flex: 1; min-width: 0; height: 32px; border-radius: 8px; border: 1px solid var(--border); padding: 0 10px; font: inherit; font-size: 13px; }
.customer-sim button { height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff; padding: 0 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.customer-sim button:disabled { opacity: .4; cursor: default; }
@media (max-width: 1100px) { .chat { padding-right: 0; } .app { grid-template-columns: 1fr; } .sessions { display: none; } }
