/*
 Tiên Giới Truyện 3D · CSKH LIVE CHAT V2 · 2026-11-15
 Pure presentation layer. No changes to Auth / RLS / RPC / storage / content.
 Primary text font: Times New Roman (available on Windows).
 Fallback for simplified Chinese avoids missing characters.
*/
:root{
 --bg:#080f1d;
 --panel:#101b2d;
 --card:#17263c;
 --card2:#1c3048;
 --gold:#eac27b;
 --gold2:#be904b;
 --line:#30435b;
 --text:#f7eddf;
 --muted:#a5b3c5;
 --green:#77deb0;
 --red:#eb9b9a;
 --blue:#99c1f4;
 --cskh-font:'Times New Roman','Noto Serif SC','Songti SC','SimSun',serif;
 font-family:var(--cskh-font);
}
html,body,#app,button,input,textarea,select,.btn,.pill,.badge{font-family:var(--cskh-font)!important}
html,body,#app{background:#08111f;color:var(--text)}
button,input,select,textarea{font-size:14px}
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid #f1cb83;outline-offset:3px}
::selection{background:#ad8042;color:#fff}
.app-shell{height:100dvh;min-height:600px;overflow:hidden;grid-template-columns:186px minmax(0,1fr);background:radial-gradient(ellipse at 75% 5%,#19304844,transparent 49%),#08111e}
.sidebar{padding:21px 13px 18px;border-right:1px solid #42506680;gap:15px;background:radial-gradient(ellipse at 0 95%,#9e773a1b,transparent 48%),linear-gradient(175deg,#101e32,#0a1322 75%);position:relative}
.sidebar:after{content:'✦';position:absolute;bottom:105px;left:24px;font-size:84px;font-weight:normal;color:#d0a66011;pointer-events:none}
.sidebar .brand{display:flex;flex-direction:column;align-items:center;gap:10px;padding:4px 2px 14px;border-bottom:1px solid #735b3555;text-align:center}
.sidebar .crest{font-size:28px;border:1px solid #cda25b;border-radius:50%;height:53px;min-width:53px;background:radial-gradient(circle at 40% 35%,#b58c4d55,#192738 64%);box-shadow:0 0 18px #c69a4830;color:#edcc8c}
.sidebar .brand-title{font-size:16px;line-height:1.2;color:#f3cf90;letter-spacing:.065em}
.sidebar .brand-sub{font-size:9px;letter-spacing:.16em;color:#a9bacd;margin-top:6px}
.sidebar .nav-note{font-size:9px;color:#96abc1;letter-spacing:.18em;margin-top:9px}
.sidebar .nav-button{padding:13px 12px;border-radius:12px;font-size:14px;line-height:1.25;white-space:normal}
.sidebar .nav-button.active{background:linear-gradient(105deg,#554023,#26374b);box-shadow:inset 0 1px #d8ae6444,0 3px 16px #0005;color:#ffdfa1;border:1px solid #b7884f}
.sidebar .side-bottom{position:relative;z-index:1;margin-top:auto}
.sidebar .side-small{font-size:11px;line-height:1.6;color:#a1b2c2}
.sidebar .side-bottom a{padding:10px 9px;font-size:12px}
.work{min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column}
.header{height:auto;min-height:78px;flex:0 0 auto;padding:12px 18px;background:linear-gradient(100deg,#0d1828,#101f31 60%,#131e30);border-bottom:1px solid #344963;gap:16px;box-shadow:0 2px 12px #0003}
.header small{color:#abb8c8;font-size:11px;letter-spacing:.03em;margin-bottom:3px}
.header h1{font-size:25px;line-height:1.08;color:#f5cf89;text-shadow:0 1px 14px #b5884836;white-space:nowrap}
.top-actions{gap:7px;justify-content:flex-end;min-width:0}
.header .pill,.header .language{height:34px;display:inline-flex;align-items:center;max-width:min(240px,24vw);font-size:11px;border-radius:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#17263b;border-color:#40536b;padding:6px 10px;color:#f1e4ce}
.header .pill:nth-child(2){max-width:175px;display:block;line-height:20px;text-overflow:ellipsis;white-space:nowrap}
.header .pill:nth-child(1){border-color:#49745e;color:#c9ead5}
.header .dot{vertical-align:middle;margin-right:4px}
.header .language{min-width:98px;max-width:130px;cursor:pointer}
.header .btn{min-height:34px;border-radius:11px;padding:8px 10px;font-size:12px}
.btn{border-color:#6a583f;background:linear-gradient(180deg,#1b2b41,#172438);color:#f7d498;border-radius:10px;transition:background .15s,border-color .15s,transform .15s}
.btn:hover:not(:disabled){background:#2a3a4d;border-color:#d4a760}
.btn.primary{background:linear-gradient(115deg,#ba8c47,#f1cf88);color:#291a0b;border:1px solid #f3cf83;box-shadow:0 2px 8px #0004}
.btn.danger:not(:disabled){border-color:#9c6656;color:#ffd0bd}
.main{padding:12px 14px 8px;min-height:0;flex:1;display:flex;flex-direction:column;overflow:hidden}
.kpis{gap:11px;margin-bottom:12px;flex:0 0 auto}
.kpi{border:1px solid #3f536a;border-radius:13px;min-height:81px;padding:14px 12px 12px 61px;position:relative;background:linear-gradient(145deg,#1b3048,#132139 78%);box-shadow:inset 0 1px #faf0d60a,0 6px 18px #0002;overflow:hidden}
.kpi:after{content:' ';position:absolute;width:95px;height:95px;right:-45px;bottom:-57px;transform:rotate(40deg);border:1px solid #c5a36e2b;border-radius:28px;pointer-events:none}
.kpi:before{position:absolute;left:14px;top:18px;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;font-size:20px;color:#f6cd84;border:1px solid #b78e4d77;background:radial-gradient(circle at 30% 20%,#7d60334d,#112135);box-shadow:0 0 16px #c99c5420}
.kpi:nth-child(1):before{content:'☏'}
.kpi:nth-child(2):before{content:'♧'}
.kpi:nth-child(3):before{content:'✉'}
.kpi:nth-child(4):before{content:'✓'}
.kpi small{font-size:12px;color:#d4dbe4;letter-spacing:.01em}
.kpi strong{font-size:26px;margin-top:4px;line-height:1.1;color:#f7ce82}
.dashboard{flex:1;min-height:0;height:auto;grid-template-columns:minmax(225px,255px) minmax(0,1fr) minmax(206px,230px);grid-auto-rows:minmax(0,1fr);gap:11px;align-items:stretch}
.panel{min-height:0;border:1px solid #3d5167;background:linear-gradient(180deg,#101e31,#0d1929);border-radius:14px;box-shadow:inset 0 1px #ffffff07,0 3px 12px #0002}
.panel-head{padding:13px 15px;min-height:55px;border-bottom:1px solid #34465d}
.panel-head h2{font-size:17px;color:#f1ca86}
.search-wrap{padding:11px 12px 9px;gap:8px}
.input,select,textarea{background:#0e1a2b;border:1px solid #405873;color:#f5eadd;border-radius:10px;padding:10px 12px}
.input::placeholder,textarea::placeholder{color:#9aa9bb;opacity:1}
.search-wrap #search{padding-left:34px;background-image:url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="%23acb8c8" stroke-width="2" stroke-linecap="round"%3E%3Ccircle cx="11" cy="11" r="7"/%3E%3Cpath d="m20 20-4-4"/%3E%3C/svg%3E');background-position:11px center;background-repeat:no-repeat;background-size:15px}
.search-wrap .input,.search-wrap select{height:39px;font-size:13px}
.thread-list{min-height:0;max-height:none;flex:1;scrollbar-color:#5e7790 #132034;scrollbar-width:thin}
.thread{position:relative;border-bottom:1px solid #2b3c51;gap:10px;padding:13px 12px;min-height:80px;transition:background .15s;align-items:center}
.thread:hover{background:#23364c}
.thread.selected{background:linear-gradient(100deg,#4d412d,#23364a 85%);box-shadow:inset 0 0 0 1px #bb924e7e;border-left:3px solid #e4b76a;padding-left:9px}
.avatar{width:38px;min-width:38px;height:38px;border-radius:50%;font-size:17px;background:linear-gradient(145deg,#6c5939,#28394a);border-color:#c39b5e;color:#ffde9f}
.thread-info strong{font-size:15px;color:#f5e4c5}
.thread-info small{font-size:11px;line-height:1.35;margin-top:4px;color:#a9b8c9}
.thread-info small:last-child{color:#c2b6a0}
.unread{align-self:flex-start;background:#e5b567;box-shadow:0 2px 8px #d59a453d;color:#26190a;min-width:20px;text-align:center}
.chat-panel{position:relative;background:#0e1a2b}
.conv-head{padding:11px 13px;min-height:65px;background:linear-gradient(115deg,#17283d,#101c2f);border-bottom:1px solid #3d5268;flex:0 0 auto}
.conv-title{font-size:19px;color:#f8d392}
.conv-title:before{content:'●';display:inline-grid;place-items:center;color:#ffe6ac;background:#534c3b;border:1px solid #b49460;border-radius:50%;font-size:10px;width:28px;height:28px;margin-right:8px;vertical-align:2px}
.conv-head small{margin-top:5px;font-size:11px}
.toolbar{justify-content:flex-end}.toolbar .btn{font-size:12px;padding:8px 10px}
.messages{flex:1;min-height:0;max-height:none;overflow:auto;padding:16px 32px 18px;gap:12px;scrollbar-width:thin;scrollbar-color:#8a704a #142237;background:radial-gradient(ellipse at 70% 20%,#1a2f494a,transparent 58%),radial-gradient(ellipse at 20% 92%,#1d35514a,transparent 56%),#0d192a}
.bubble{position:relative;max-width:80%;min-width:118px;background:linear-gradient(155deg,#2a405c,#223750);border:1px solid #49607a;border-radius:15px 15px 15px 5px;padding:9px 11px;line-height:1.45;font-size:13px;box-shadow:0 4px 12px #0003}
.bubble.staff{background:linear-gradient(155deg,#5b492e,#473923);border:1px solid #a27d41;border-radius:15px 15px 5px 15px}
.bubble:before{content:'•';position:absolute;left:-27px;top:3px;display:grid;place-items:center;width:21px;height:21px;border:1px solid #8f9fba;color:#f4d99c;background:#273b51;border-radius:50%;font-size:19px;line-height:1}
.bubble.staff:before{content:'✦';left:auto;right:-27px;font-size:12px;border-color:#c6a460;color:#ffe6aa;background:#51402c}
.bubble-head{margin-bottom:4px;font-size:11px;align-items:center;gap:10px;color:#edcf9c}
.bubble time{font-size:10px;white-space:nowrap;color:#bac4d1}
.bubble.staff time{color:#e2d0b3}
.bubble p{font-size:13px;line-height:1.47;color:#fff7e9;white-space:pre-wrap}
.bubble .manage{gap:10px;margin-top:5px}
.bubble .manage button{font-size:11px;color:#f2c67a;padding:1px 0}
.bubble .manage button:hover{text-decoration:underline}
.composer{flex:0 0 auto;padding:10px 12px 11px;display:grid;grid-template-columns:minmax(0,1fr) 88px;gap:8px 8px;background:linear-gradient(180deg,#122238,#102032);border-top:1px solid #42526b}
.composer .shortcuts{grid-column:1/-1;grid-row:1;gap:5px;padding:0 0 2px;min-width:0;max-height:34px;overflow:hidden;flex-wrap:nowrap}
.shortcut{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;border:1px solid #40556a;background:#1d2c41;color:#d9c9ad;border-radius:999px;padding:6px 9px}
.shortcut:hover:not(:disabled){background:#39485b;border-color:#b89458}
.composer textarea{grid-column:1;grid-row:2;margin:0;min-height:55px;height:55px;resize:vertical;font-size:13px;padding:14px 12px;background:#101c2d;border-color:#9d7c4a;border-radius:11px}
.composer-actions{grid-column:2;grid-row:2;margin:0;display:flex;justify-content:flex-end;align-items:stretch;min-width:0}
.composer-actions small{display:none}
.composer-actions .btn{width:100%;padding:7px;border-radius:10px;font-size:13px}
.customer-panel{background:linear-gradient(170deg,#101f32,#101a2a 85%)}
.customer{padding:18px 15px;gap:0;align-content:start}
.customer-avatar{width:58px;height:58px;border-radius:50%;font-size:25px;background:linear-gradient(145deg,#5f4a29,#273e4f);border:1px solid #e2b56c;box-shadow:0 0 0 5px #bd985018;margin:0 auto 12px}
.customer h3{text-align:center;padding:0 0 14px;font-size:18px;line-height:1.2;border-bottom:1px solid #34475d}
.info-row{border-bottom:1px solid #314257;padding:13px 0 12px}
.info-row small{font-size:12px;line-height:1.4;color:#afc0d3}
.info-row div{font-size:12px;line-height:1.5;color:#f2dec0;word-break:break-word}
.badge{border-radius:99px;padding:4px 9px;font-size:10px}
.footer-note{display:none}
.toast{font-size:13px;background:#1b3047;border-color:#bd9253;max-width:min(360px,90vw)}
.login-page{background:radial-gradient(ellipse at 45% 12%,#2a4263 0,transparent 57%),#09101d}
.login-card{border-color:#b38c51;box-shadow:0 18px 70px #0008;background:linear-gradient(160deg,#192a3f,#111c2c);font-family:var(--cskh-font)}
.login-card h1{font-size:29px}
.login-card .crest{border-radius:50%}
@media(max-width:1380px){.app-shell{grid-template-columns:168px minmax(0,1fr)}.dashboard{grid-template-columns:235px minmax(0,1fr) 205px}.header{padding:10px 14px}.header h1{font-size:23px}.top-actions{gap:5px}.kpi{padding-left:53px}.kpi:before{left:11px}}
@media(max-width:1120px){.dashboard{grid-template-columns:255px minmax(0,1fr)}.customer-panel{display:none}.top-actions .pill:nth-child(2){max-width:120px}}
@media(max-width:880px){
 .app-shell{display:block;height:auto;min-height:100dvh;overflow:visible}
 .sidebar{display:none}
 .work{min-height:100dvh;overflow:visible}
 .header{padding:13px 14px 11px;min-height:0;gap:11px;align-items:stretch;flex-direction:column}
 .header h1{font-size:23px}
 .top-actions{justify-content:flex-start;width:100%;gap:5px}
 .top-actions .pill:nth-child(2){max-width:170px}
 .main{overflow:visible;flex:1;padding:10px}
 .kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:10px}
 .kpi{padding:10px 8px 9px 50px;min-height:72px}
 .kpi:before{left:10px;top:17px;width:30px;height:30px;font-size:18px}
 .kpi small{font-size:11px}.kpi strong{font-size:23px}
 .dashboard{display:grid;grid-template-columns:minmax(0,1fr);height:auto;min-height:55dvh;gap:0}
 .list-panel{min-height:58dvh}
 .dashboard.show-detail .list-panel{display:none}
 .dashboard:not(.show-detail) .chat-panel{display:none}
 .dashboard.show-detail .chat-panel{min-height:67dvh;max-height:calc(100dvh - 175px)}
 .thread-list{max-height:none}
 .messages{min-height:39dvh;max-height:none;padding:13px 32px}
 .bubble{max-width:82%}
 .composer{padding:9px;grid-template-columns:minmax(0,1fr) 70px}
 .composer textarea{min-height:52px;height:52px}
 .mobile-back{display:inline-flex}
 .conv-head{min-height:62px}
 .toolbar{gap:4px}.toolbar .btn{font-size:11px;padding:7px 8px}
}
@media(max-width:430px){
 .header h1{font-size:21px}
 .header .pill{font-size:10px;max-width:155px}
 .header .pill:nth-child(2){max-width:140px}
 .header .btn{padding:7px 9px}
 .kpi{padding-left:42px}.kpi:before{left:7px;width:27px;height:27px}
 .kpi strong{font-size:21px}
 .conv-title{font-size:16px}.conv-title:before{width:22px;height:22px}
 .messages{padding:12px 28px}.bubble{max-width:87%;font-size:12px}
 .composer .shortcuts{max-height:32px}
}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important;animation:none!important}}
/* Final compact composer + mobile chat viewport refinements */
.composer{grid-template-columns:minmax(0,1fr) 112px}
.composer-actions .btn{white-space:normal;line-height:1.18;font-size:12px}
.demo-banner + .app-shell{height:calc(100dvh - 40px);min-height:560px}
@media(max-width:880px){
 .demo-banner + .app-shell{height:auto;min-height:calc(100dvh - 40px)}
 .main:has(.dashboard.show-detail) .kpis{display:none}
 .dashboard.show-detail .chat-panel{height:calc(100dvh - 205px);min-height:430px;max-height:none}
 .dashboard.show-detail .messages{min-height:0;max-height:none;flex:1}
 .dashboard.show-detail .composer{grid-template-columns:minmax(0,1fr) 87px}
}
@media(max-width:430px){
 .conv-head{flex-wrap:wrap;gap:6px;padding:10px}
 .conv-head > div:first-child{flex:1 1 185px;min-width:0}
 .conv-head .mobile-back{display:inline-flex;margin-bottom:5px;margin-right:4px!important}
 .conv-head .conv-title{font-size:16px;word-break:break-word}
 .conv-head .toolbar{flex:0 1 auto}
 .dashboard.show-detail .chat-panel{height:calc(100dvh - 220px)}
 .dashboard.show-detail .composer{grid-template-columns:minmax(0,1fr) 82px}
}
@media(max-width:430px){
 .conv-head .mobile-back{font-size:0;min-width:34px;width:34px;height:30px;display:inline-flex;align-items:center;justify-content:center;padding:0;margin:0 8px 0 0!important;vertical-align:middle}
 .conv-head .mobile-back:after{content:'‹';font-size:24px;font-weight:700;line-height:1;color:#f5d398}
}
