:root { color-scheme:dark; --bg:#0a0a0a; --panel:#121212; --panel2:#191919; --line:#ffffff18; --red:#D40004; --muted:#96969e; }
* { box-sizing:border-box; }
body { margin:0; height:100dvh; overflow:hidden; background:var(--bg); color:#f4f4f4; font:15px -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
.topbar { height:64px; display:flex; align-items:center; justify-content:space-between; padding:0 20px; border-bottom:1px solid var(--line); background:#101010; }
.topbar div { display:flex; align-items:center; gap:13px; }
.topbar strong { color:var(--red); font-size:20px; letter-spacing:.03em; }
.topbar span { color:#777; font-size:10px; font-weight:700; letter-spacing:.2em; }
.topbar button { width:38px; height:38px; border:1px solid var(--line); border-radius:11px; background:#1c1c1c; color:#ddd; font-size:24px; cursor:pointer; }
.layout { display:grid; height:calc(100dvh - 64px); grid-template-columns:minmax(280px,360px) minmax(0,1fr); }
.sidebar { display:flex; min-height:0; flex-direction:column; border-right:1px solid var(--line); background:#0f0f0f; }
.list-head { display:flex; align-items:center; justify-content:space-between; padding:18px 16px 12px; }
.list-head h1 { margin:0; font-size:18px; }
.list-head select { padding:8px 10px; border:1px solid var(--line); border-radius:9px; background:#1b1b1b; color:#ddd; }
.chat-list { flex:1; overflow:auto; padding:6px 10px 16px; }
.chat-row { display:block; width:100%; margin:4px 0; padding:13px; border:1px solid transparent; border-radius:13px; background:transparent; color:inherit; text-align:left; cursor:pointer; }
.chat-row:hover,.chat-row.active { border-color:#d400044d; background:#1b1111; }
.chat-row-top,.chat-row-bottom { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.chat-row-top strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-row time,.chat-row-bottom { color:var(--muted); font-size:12px; }
.chat-row-bottom { margin-top:7px; }
.chip { padding:3px 7px; border-radius:99px; background:#242424; color:#ccc; font-size:10px; white-space:nowrap; }
.chip.waiting { background:#3b2b08; color:#f7d279; }
.chip.mine { background:#0f3526; color:#72e0ad; }
.muted { padding:14px; color:var(--muted); line-height:1.5; }
.conversation { display:flex; min-width:0; min-height:0; flex-direction:column; background:radial-gradient(ellipse at 60% 10%,#171111 0%,#0c0c0c 60%); }
.empty-state { margin:auto; padding:24px; color:var(--muted); text-align:center; }
.empty-mark { display:grid; width:64px; height:64px; margin:0 auto 16px; place-items:center; border:1px solid #d4000455; border-radius:20px; color:var(--red); font-size:32px; font-weight:800; }
.empty-state h2 { margin:0 0 7px; color:#eee; font-size:20px; }
.empty-state p { margin:0; }
.conversation-head { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:17px 22px; border-bottom:1px solid var(--line); background:#121212; }
.customer h2 { margin:0; font-size:17px; }
.customer p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.head-actions { display:flex; align-items:center; gap:9px; }
.head-actions button { padding:9px 13px; border:1px solid var(--line); border-radius:10px; background:#202020; color:#fff; font-weight:700; cursor:pointer; }
.head-actions button.primary { border-color:var(--red); background:var(--red); color:#100; }
.head-actions button:disabled { opacity:.45; cursor:not-allowed; }
.message-list { display:flex; flex:1; flex-direction:column; gap:10px; overflow:auto; padding:20px clamp(15px,4vw,44px); }
.message { max-width:min(76%,680px); padding:11px 14px; border:1px solid var(--line); border-radius:14px; background:#1b1b1b; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.45; }
.message.visitor { align-self:flex-start; border-bottom-left-radius:4px; }
.message.agent { align-self:flex-end; border-color:#7e000033; border-bottom-right-radius:4px; background:#331314; }
.message small { display:block; margin-top:5px; color:#888; font-size:10px; }
.profile { display:flex; flex-wrap:wrap; gap:8px; padding:12px 20px; border-top:1px solid var(--line); background:#101010; }
.profile span { padding:6px 9px; border:1px solid var(--line); border-radius:8px; color:#bbb; font-size:12px; }
.profile span.invite-status.pending { border-color:#d4000455; color:#ff8d8d; }
.profile span.invite-status.verified { border-color:#218a58; color:#218a58; }
.composer { display:flex; gap:10px; padding:14px 20px 20px; border-top:1px solid var(--line); background:#111; }
.composer textarea { min-height:48px; max-height:130px; flex:1; resize:vertical; padding:13px; border:1px solid #ffffff22; border-radius:12px; background:#090909; color:#fff; font:inherit; }
.composer textarea:focus { border-color:var(--red); outline:none; }
.composer button { min-width:94px; border:0; border-radius:12px; background:var(--red); color:#090909; font-weight:800; cursor:pointer; }
.composer button:disabled { opacity:.45; cursor:not-allowed; }
.toast { position:fixed; right:18px; bottom:18px; max-width:min(440px,calc(100vw - 36px)); padding:12px 16px; border:1px solid #ffffff24; border-radius:12px; background:#222; box-shadow:0 8px 28px #0009; opacity:0; pointer-events:none; transform:translateY(8px); transition:.2s; }
.toast.show { opacity:1; transform:translateY(0); }
.top-actions { display:flex; align-items:center; gap:8px; }
.topbar .local-mode { padding:4px 7px; border:1px solid #d4000455; border-radius:99px; color:#ff7777; letter-spacing:.08em; }
.top-actions #logout { width:auto; height:38px; padding:0 12px; border:1px solid var(--line); border-radius:10px; background:#1c1c1c; color:#ddd; font-size:13px; }
.login-screen { position:fixed; z-index:10; inset:0; display:grid; place-items:center; padding:20px; background:#080808; }
.login-screen[hidden] { display:none; }
.login-card { width:min(100%,390px); padding:30px; border:1px solid #ffffff18; border-radius:20px; background:#141414; box-shadow:0 25px 80px #000b; }
.login-mark { display:grid; width:54px; height:54px; margin-bottom:18px; place-items:center; border:1px solid #d4000466; border-radius:17px; color:var(--red); font-size:28px; font-weight:800; }
.login-card h1 { margin:0; color:#eee; font-size:23px; }
.login-card p { color:var(--muted); }
.login-card label { display:block; margin:22px 0 7px; color:#ccc; font-size:13px; }
.login-card input { width:100%; padding:13px; border:1px solid #ffffff24; border-radius:11px; background:#090909; color:#fff; font:inherit; }
.login-card input:focus { border-color:var(--red); outline:none; }
.login-card .login-error { min-height:1.4em; margin:8px 0; color:#ff7575; font-size:13px; }
.login-submit { width:100%; padding:13px; border:0; border-radius:11px; background:var(--red); color:#100; font-weight:800; cursor:pointer; }
.login-submit:disabled { opacity:.5; cursor:wait; }
@media(max-width:760px) {
  .topbar { height:56px; padding:0 14px; }
  .layout { height:calc(100dvh - 56px); grid-template-columns:1fr; }
  .sidebar { border-right:0; }
  .conversation { display:none; }
  body.chat-open .sidebar { display:none; }
  body.chat-open .conversation { display:flex; }
  .conversation-head { padding:12px; }
  .profile { padding:9px 12px; }
  .composer { padding:10px 12px 12px; }
  .composer button { min-width:68px; }
  .message-list { padding:14px 12px; }
}
