:root{--bg:#0f1115;--panel:#161a21;--panel2:#1d222b;--line:#2a303b;--text:#e6e9ef;--muted:#8a93a3;--accent:#52b4f0;--in:#232a35;--out:#1e3a52;--note:#3b3420;--err:#ff6b6b;--ok:#4cd38a}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:14px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.hidden{display:none!important}
a{color:var(--accent);text-decoration:none}
input,select,textarea,button{font:inherit;color:inherit}
input,select,textarea{background:var(--panel2);border:1px solid var(--line);border-radius:8px;padding:7px 9px;outline:none}
input:focus,textarea:focus,select:focus{border-color:var(--accent)}
button{background:var(--accent);color:#06121c;border:0;border-radius:8px;padding:8px 14px;font-weight:600;cursor:pointer}
button:disabled{opacity:.5;cursor:default}
.err{color:var(--err);font-size:13px}
.brand{font-size:16px;color:var(--muted)}.brand b{color:var(--text)}
.login{height:100%;display:flex;align-items:center;justify-content:center}
.login-box{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:28px;width:320px;display:flex;flex-direction:column;gap:10px}
.app{display:grid;grid-template-columns:340px 1fr 300px;height:100%}
.app.no-card{grid-template-columns:340px 1fr}
.list{background:var(--panel);border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}
.list-head{padding:12px;display:flex;flex-direction:column;gap:8px;border-bottom:1px solid var(--line)}
.filters{display:flex;gap:6px;align-items:center}.filters select{flex:1;min-width:0}
.chk{display:flex;gap:4px;align-items:center;color:var(--muted);font-size:13px;white-space:nowrap}
.counts{display:flex;gap:10px;font-size:12px;color:var(--muted)}
.tickets{overflow:auto;flex:1}
.t{padding:10px 12px;border-bottom:1px solid var(--line);cursor:pointer;display:flex;flex-direction:column;gap:3px}
.t:hover{background:var(--panel2)}.t.sel{background:#1b2a38}
.t-top{display:flex;justify-content:space-between;gap:6px}
.t-name{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.t-time{color:var(--muted);font-size:12px;white-space:nowrap}
.t-prev{color:var(--muted);font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.t-meta{display:flex;gap:6px;align-items:center;font-size:11px}
.badge{padding:1px 7px;border-radius:10px;background:var(--panel2);color:var(--muted)}
.st-new{background:#3a2330;color:#ff9fc0}.st-open{background:#3a3120;color:#ffd27a}.st-pending{background:#1f3326;color:#86e0a8}.st-closed{background:#24272d;color:#7c8594}
.unread{background:var(--accent);color:#06121c;font-weight:700}
.list-foot{padding:10px 12px;border-top:1px solid var(--line);font-size:13px;color:var(--muted)}
.chat{display:flex;flex-direction:column;min-height:0;min-width:0}
.empty{margin:auto;color:var(--muted)}
.chat-wrap{display:flex;flex-direction:column;height:100%;min-height:0}
.chat-head{padding:10px 16px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:10px;background:var(--panel)}
.ch-title{font-weight:600;font-size:15px}.ch-sub{color:var(--muted);font-size:12px}
.ch-actions{display:flex;gap:6px}
.msgs{flex:1;overflow:auto;padding:16px;display:flex;flex-direction:column;gap:8px}
.m{max-width:72%;padding:8px 11px;border-radius:12px;white-space:pre-wrap;word-wrap:break-word}
.m.in{background:var(--in);align-self:flex-start;border-bottom-left-radius:4px}
.m.out{background:var(--out);align-self:flex-end;border-bottom-right-radius:4px}
.m.system{background:transparent;border:1px dashed var(--line);align-self:flex-end;color:var(--muted)}
.m.note{background:var(--note);align-self:center;max-width:85%;border:1px solid #5a4c26}
.m-meta{font-size:11px;color:var(--muted);margin-top:4px}
.m.err-msg{outline:1px solid var(--err)}
.m img{max-width:280px;max-height:320px;border-radius:8px;display:block;margin-bottom:4px;cursor:zoom-in}
.m video,.m audio{max-width:300px;display:block;margin-bottom:4px}
.day{align-self:center;color:var(--muted);font-size:12px;margin:6px 0}
.composer{border-top:1px solid var(--line);padding:10px 16px;background:var(--panel);display:flex;flex-direction:column;gap:8px}
.tabs{display:flex;gap:6px;align-items:center}
.tab{background:var(--panel2);color:var(--muted);font-weight:500;padding:5px 10px}
.tab.active{background:var(--accent);color:#06121c}
.tabs select{margin-left:auto;max-width:220px}
.composer textarea{min-height:80px;resize:vertical}
.composer.note-mode textarea{background:#2a2519;border-color:#5a4c26}
.comp-foot{display:flex;gap:10px;align-items:center}
.comp-foot button{margin-left:auto}
.file-btn{cursor:pointer;color:var(--accent);font-size:13px}
.file-name{font-size:12px;color:var(--muted)}
.card{background:var(--panel);border-left:1px solid var(--line);padding:16px;overflow:auto;display:flex;flex-direction:column;gap:12px}
.card h3{margin:0;font-size:15px}
.kv{display:grid;grid-template-columns:100px 1fr;gap:4px 8px;font-size:13px}.kv .k{color:var(--muted)}
.card .sec{border-top:1px solid var(--line);padding-top:10px}
.card .muted{color:var(--muted);font-size:12px}
.modal{position:fixed;inset:0;background:#000a;display:flex;align-items:center;justify-content:center}
.modal-box{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:18px;width:520px;max-height:85vh;overflow:auto;display:flex;flex-direction:column;gap:8px}
.modal-head{display:flex;justify-content:space-between}
.tpl-list{display:flex;flex-direction:column;gap:6px}
.tpl{background:var(--panel2);border-radius:8px;padding:8px;font-size:13px;white-space:pre-wrap}
.tpl b{display:flex;justify-content:space-between}
@media (max-width:1100px){.app{grid-template-columns:300px 1fr}.card{display:none}}
