[hidden]{display:none!important}*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",Arial,sans-serif;color:#182230;background:#f3f6fa}button,input,textarea{font:inherit}a{color:inherit;text-decoration:none}button{cursor:pointer}.admin-shell{display:flex;min-height:100vh}.sidebar{position:fixed;inset:0 auto 0 0;width:230px;background:#111b2b;color:#dce5f2;display:flex;flex-direction:column;padding:24px 16px;z-index:10}.brand{display:flex;align-items:center;gap:12px;padding:0 8px 26px}.brand-mark,.auth-logo>span{width:42px;height:42px;border-radius:13px;display:grid;place-items:center;background:linear-gradient(135deg,#19b66a,#0a8bff);font-size:22px;font-weight:800;color:#fff;box-shadow:0 10px 25px rgba(10,139,255,.22)}.brand b{display:block;color:#fff;font-size:16px}.brand small{display:block;color:#8493a8;font-size:11px;margin-top:4px}.sidebar nav{display:grid;gap:6px}.nav-item{padding:12px 14px;border-radius:10px;color:#aebbd0;display:flex;align-items:center;gap:10px;font-size:14px}.nav-item:hover,.nav-item.active{background:#1d2b40;color:#fff}.nav-dot{width:7px;height:7px;border-radius:50%;background:#5e6e83}.nav-item.active .nav-dot{background:#21d17d;box-shadow:0 0 0 4px rgba(33,209,125,.12)}.sidebar-foot{margin-top:auto;border-top:1px solid #29364a;padding:18px 8px 0;display:flex;align-items:center;justify-content:space-between}.sidebar-foot>a{font-size:12px;color:#90a1b8}.user-mini b,.user-mini small{display:block}.user-mini small{color:#788aa2;font-size:11px;margin-top:3px}.main-content{margin-left:230px;min-width:0;flex:1}.topbar{height:86px;background:#fff;border-bottom:1px solid #e5eaf1;display:flex;align-items:center;justify-content:space-between;padding:0 28px;position:sticky;top:0;z-index:8}.topbar h1{font-size:22px;margin:0}.topbar p{margin:5px 0 0;color:#8a96a8;font-size:12px}.page-wrap{padding:24px}.button{border:1px solid #d8e0ea;background:#fff;color:#334155;border-radius:9px;padding:10px 16px;display:inline-flex;align-items:center;justify-content:center;gap:6px;font-weight:600;font-size:13px}.button:hover{border-color:#9fb0c4}.button.primary{background:#0d9f63;border-color:#0d9f63;color:#fff}.button.primary:hover{background:#0b8b57}.button.danger{background:#fff4f4;color:#c83232;border-color:#ffd2d2}.button.ghost{background:#f7f9fc}.button.small{padding:7px 11px;font-size:12px}.button.wide{width:100%}.button:disabled{opacity:.55;cursor:not-allowed}.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:18px}.stat-card{background:#fff;border:1px solid #e5eaf1;border-radius:14px;padding:20px;box-shadow:0 8px 26px rgba(32,46,66,.04)}.stat-card span,.stat-card small{display:block;color:#7d8999;font-size:12px}.stat-card strong{display:block;font-size:30px;margin:10px 0 4px}.card{background:#fff;border:1px solid #e5eaf1;border-radius:14px;box-shadow:0 8px 26px rgba(32,46,66,.04);margin-bottom:18px;overflow:hidden}.card-head{padding:18px 20px;border-bottom:1px solid #edf1f5;display:flex;align-items:center;justify-content:space-between}.card-head h2{font-size:16px;margin:0}.card-head p{margin:5px 0 0;color:#8a96a8;font-size:12px}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;font-size:13px}th,td{padding:13px 16px;text-align:left;border-bottom:1px solid #edf1f5;white-space:nowrap}th{color:#6f7b8b;font-size:12px;background:#fafbfd}td{color:#344054}.muted-cell{color:#7c8898;max-width:420px;overflow:hidden;text-overflow:ellipsis}.empty-cell,.empty-panel{text-align:center;color:#8b96a5;padding:34px}.badge{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-size:11px;background:#eef2f7;color:#64748b}.badge.success{background:#e8f8f0;color:#098755}.badge.danger{background:#fff0f0;color:#c63232}.badge.soft{background:#f0f3f7;color:#778396}.alert{padding:12px 14px;border-radius:9px;margin-bottom:16px;background:#e9f8f1;color:#0a7b50;border:1px solid #c5eedb;font-size:13px}.alert.error{background:#fff1f1;color:#b62e2e;border-color:#ffd0d0}.split-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(330px,.7fr);gap:18px;align-items:start}.sticky-card{position:sticky;top:110px}.form-stack{display:grid;gap:14px;padding:20px}.form-stack label,.form-grid label,.auth-card label{display:grid;gap:7px;color:#4b5869;font-size:13px}.form-stack input,.form-stack textarea,.form-grid input,.auth-card input,.chat-search input,.composer textarea,.customer-note textarea{border:1px solid #dce3ec;border-radius:9px;padding:11px 12px;background:#fff;color:#1f2937;outline:none;width:100%}.form-stack input:focus,.form-stack textarea:focus,.form-grid input:focus,.auth-card input:focus,.chat-search input:focus,.composer textarea:focus,.customer-note textarea:focus{border-color:#4caa80;box-shadow:0 0 0 3px rgba(13,159,99,.09)}label small{color:#8b96a4;font-size:11px}.switch-line{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center;gap:8px!important}.switch-line input{width:auto}.channel-list{padding:6px 18px}.channel-item{display:flex;justify-content:space-between;gap:16px;padding:17px 2px;border-bottom:1px solid #edf1f5}.channel-item:last-child{border-bottom:0}.channel-main{min-width:0;flex:1}.channel-title{display:flex;align-items:center;gap:9px;margin-bottom:6px}.channel-main>small{color:#7d8998}.callback-box{display:flex;margin-top:11px;max-width:700px;background:#f6f8fb;border:1px solid #e6ebf2;border-radius:8px;overflow:hidden}.callback-box code{padding:9px 11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;color:#526071}.callback-box button{border:0;border-left:1px solid #e1e7ee;background:#fff;padding:0 12px;color:#0b8f5b}.channel-actions{display:flex;flex-wrap:wrap;gap:7px;align-content:flex-start}.channel-actions form{margin:0}.section-title{grid-column:1/-1;font-weight:700;color:#263445;border-bottom:1px solid #e7ecf2;padding:4px 0 10px}.actions{display:flex;gap:12px}.actions a,.actions button{color:#0b8f5b;background:none;border:0;padding:0;font-size:12px}.error-text{color:#c93636!important}.auth-body{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 15% 20%,rgba(23,183,111,.13),transparent 34%),radial-gradient(circle at 85% 20%,rgba(27,132,255,.12),transparent 32%),#eff4f8}.auth-card,.install-card{width:min(430px,100%);background:#fff;border:1px solid #e1e7ee;border-radius:18px;padding:30px;box-shadow:0 24px 65px rgba(29,47,70,.13)}.install-card{width:min(720px,100%)}.auth-logo{display:flex;align-items:center;gap:13px;margin-bottom:25px}.auth-logo h1{margin:0;font-size:21px}.auth-logo p{margin:5px 0 0;color:#8490a0;font-size:12px}.auth-card form{display:grid;gap:16px}.auth-tip{text-align:center;color:#97a1af;font-size:11px;margin-top:18px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px}.form-grid .full{grid-column:1/-1}.install-success{text-align:center;padding:20px 0}.install-success h2{color:#0c8b58}.chat-shell{height:calc(100vh - 134px);min-height:620px;background:#fff;border:1px solid #e1e7ee;border-radius:14px;display:grid;grid-template-columns:310px minmax(420px,1fr) 270px;overflow:hidden;box-shadow:0 8px 26px rgba(32,46,66,.04)}.chat-list-panel,.customer-panel{background:#fbfcfe}.chat-list-panel{border-right:1px solid #e7ecf2;min-width:0}.chat-search{padding:14px;display:flex;gap:8px;border-bottom:1px solid #e7ecf2}.chat-search button{border:0;background:#edf3f8;border-radius:8px;padding:0 11px;color:#516172}.chat-filters{display:flex;padding:10px 13px;gap:7px;border-bottom:1px solid #e7ecf2}.chat-filters button{border:0;background:transparent;color:#778496;padding:6px 10px;border-radius:7px;font-size:12px}.chat-filters button.active{background:#e8f7f0;color:#078353;font-weight:700}.conversation-list{height:calc(100% - 110px);overflow:auto}.conversation-item{width:100%;border:0;border-bottom:1px solid #edf1f5;background:transparent;display:flex;gap:10px;padding:14px;text-align:left}.conversation-item:hover,.conversation-item.active{background:#eef8f4}.conv-avatar,.customer-avatar{flex:0 0 40px;width:40px;height:40px;border-radius:12px;background:linear-gradient(135deg,#dff7ea,#dcecff);color:#087d51;display:grid;place-items:center;font-weight:800}.conv-avatar img,.customer-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.conv-body{min-width:0;flex:1}.conv-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.conv-row b{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.conv-row time{font-size:10px;color:#9ba5b1}.conv-row em{font-style:normal;font-size:12px;color:#778391;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px}.conv-row i{font-style:normal;background:#f04444;color:#fff;min-width:18px;height:18px;border-radius:9px;display:grid;place-items:center;font-size:10px}.conv-body small{display:block;color:#a0a9b4;font-size:10px;margin-top:5px}.chat-center{min-width:0;background:#f2f5f8}.chat-empty{height:100%;display:grid;place-content:center;text-align:center;color:#7f8b99}.chat-empty h2{font-size:18px;color:#495566;margin:14px 0 7px}.chat-empty p{font-size:12px}.empty-icon{width:66px;height:66px;margin:auto;border-radius:22px;display:grid;place-items:center;background:#fff;color:#0c9760;font-size:29px;font-weight:800;box-shadow:0 12px 35px rgba(32,56,80,.08)}.chat-active{height:100%;display:grid;grid-template-rows:68px minmax(0,1fr) auto}.chat-head{background:#fff;border-bottom:1px solid #e4eaf0;padding:12px 18px;display:flex;align-items:center;justify-content:space-between}.chat-head h2{font-size:15px;margin:0}.chat-head p{font-size:11px;color:#8b96a5;margin:5px 0 0}.message-list{padding:20px;overflow:auto}.message-row{display:flex;flex-direction:column;margin-bottom:16px;align-items:flex-start}.message-row.out{align-items:flex-end}.message-meta{font-size:10px;color:#9aa4b0;margin:0 6px 5px}.message-bubble{max-width:72%;border-radius:12px;background:#fff;padding:10px 12px;box-shadow:0 2px 8px rgba(35,52,73,.06);line-height:1.55;font-size:13px;word-break:break-word}.message-row.out .message-bubble{background:#11a667;color:#fff}.system-message{text-align:center;color:#929ca9;font-size:11px;margin:12px}.message-image{max-width:280px;max-height:300px;border-radius:8px;display:block}.media-link{text-decoration:underline}.send-error{display:block;color:#ffd4d4;margin-top:5px}.composer{background:#fff;border-top:1px solid #e2e8ef;padding:10px 14px}.composer-tools,.composer-foot{display:flex;align-items:center;justify-content:space-between;color:#8e99a7;font-size:11px}.composer textarea{border:0;box-shadow:none!important;resize:none;padding:10px 0;min-height:68px}.upload-btn{cursor:pointer;color:#0b8f5b;font-weight:600}.customer-panel{border-left:1px solid #e7ecf2;padding:24px 18px;overflow:auto;text-align:center}.customer-avatar{width:58px;height:58px;margin:5px auto 10px;border-radius:18px;font-size:20px}.customer-panel h3{margin:0;font-size:15px}.customer-panel>p{font-size:10px;color:#97a1ae;word-break:break-all}.detail-list{margin-top:23px;text-align:left;border-top:1px solid #e8edf2}.detail-list div{padding:12px 0;border-bottom:1px solid #e8edf2}.detail-list span,.detail-list b{display:block}.detail-list span{color:#98a2ae;font-size:10px}.detail-list b{margin-top:5px;font-size:12px;color:#465365;word-break:break-all}.customer-note{text-align:left;margin-top:20px}.customer-note label{font-size:12px;color:#5d6877}.customer-note textarea{margin:8px 0 10px;resize:vertical}.toast{position:fixed;left:50%;bottom:34px;transform:translate(-50%,20px);background:#182230;color:#fff;padding:10px 16px;border-radius:9px;opacity:0;pointer-events:none;transition:.2s;z-index:99;font-size:13px}.toast.show{opacity:1;transform:translate(-50%,0)}.toast.error{background:#c93939}@media(max-width:1100px){.chat-shell{grid-template-columns:280px minmax(380px,1fr)}.customer-panel{display:none}.stats-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:820px){.sidebar{width:72px;padding:20px 10px}.brand{padding:0 5px 24px}.brand>div,.nav-item:not(.active){font-size:0}.brand-mark{width:40px}.nav-item{justify-content:center;padding:14px}.nav-item.active{font-size:0}.sidebar-foot{display:none}.main-content{margin-left:72px}.topbar{padding:0 16px}.page-wrap{padding:12px}.split-grid{grid-template-columns:1fr}.sticky-card{position:static}.chat-shell{height:calc(100vh - 112px);grid-template-columns:240px minmax(330px,1fr)}.topbar .button{display:none}}@media(max-width:620px){.main-content{margin-left:0}.sidebar{display:none}.topbar{height:64px}.topbar p{display:none}.page-wrap{padding:8px}.stats-grid{grid-template-columns:1fr 1fr;gap:8px}.stat-card{padding:14px}.chat-shell{height:calc(100vh - 80px);min-height:500px;display:block;position:relative}.chat-list-panel{height:100%}.chat-center{position:absolute;inset:0;z-index:2}.chat-center:has(.chat-active:not([hidden])){display:block}.chat-center:has(.chat-active[hidden]){display:none}.chat-head{padding-left:12px}.chat-head:before{content:'‹';font-size:28px;margin-right:9px;cursor:pointer}.message-bubble{max-width:86%}.form-grid{grid-template-columns:1fr}.form-grid .full{grid-column:auto}.install-card,.auth-card{padding:22px}.channel-item{display:block}.channel-actions{margin-top:12px}}

/* v1.0.7: force chat panel visibility and keep composer inside the viewport */
#chatEmpty.is-hidden{display:none!important}
#chatEmpty.is-visible{display:grid!important}
#chatActive.is-hidden,#chatActive[hidden]{display:none!important}
#chatActive.is-visible{display:grid!important}
.chat-center{overflow:hidden}
.chat-active{min-height:0;overflow:hidden}
.message-list{min-height:0}
.composer{display:block!important;position:relative;z-index:2;min-height:132px}


/* v1.0.8: lock the conversation area to the viewport so the composer cannot be pushed below the page */
.chat-shell,
.chat-list-panel,
.chat-center,
.customer-panel{
  min-height:0;
}
.chat-list-panel,
.chat-center,
.customer-panel{
  height:100%;
  max-height:100%;
}
.chat-center{
  position:relative;
  overflow:hidden!important;
}
#chatEmpty{
  position:absolute;
  inset:0;
  height:auto!important;
}
#chatActive{
  position:absolute;
  inset:0;
  width:100%;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow:hidden!important;
  grid-template-rows:68px minmax(0,1fr) 156px!important;
}
#chatActive .chat-head{
  min-height:0;
  overflow:hidden;
}
#chatActive .message-list{
  min-height:0!important;
  height:auto!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
}
#chatActive .composer{
  display:flex!important;
  flex-direction:column;
  height:156px!important;
  min-height:156px!important;
  max-height:156px!important;
  overflow:hidden!important;
  flex:none;
}
#chatActive .composer textarea{
  flex:1 1 auto;
  min-height:52px!important;
  max-height:82px;
  overflow-y:auto;
}
@media(max-width:620px){
  #chatActive{grid-template-rows:60px minmax(0,1fr) 150px!important}
  #chatActive .composer{height:150px!important;min-height:150px!important;max-height:150px!important}
}

/* v1.1.1: voice message playback */
.voice-player{min-width:260px;max-width:100%;display:grid;gap:7px}
.voice-title{display:flex;align-items:center;gap:7px;font-size:12px;font-weight:700}
.voice-icon{width:22px;height:22px;border-radius:50%;display:inline-grid;place-items:center;background:#e8f7f0;color:#078353;font-size:9px;padding-left:1px}
.voice-audio{display:block;width:260px;max-width:100%;height:38px}
.voice-error{font-size:11px;color:#d03b3b;background:#fff1f1;border-radius:6px;padding:6px 8px}
.voice-download{font-size:11px;text-decoration:underline;opacity:.78;width:max-content}
.message-row.out .voice-icon{background:rgba(255,255,255,.22);color:#fff}
.message-row.out .voice-error{color:#9f2222;background:#fff}
@media(max-width:620px){.voice-player{min-width:220px}.voice-audio{width:220px}}
