/* Workspace visual system. Existing DOM IDs and API contracts are preserved. */
:root{--ink:#182d39;--accent:#087f8c;--line:#dce6e8;--surface:#f1f5f5;--viewport-height:100dvh;color:var(--ink);background:#0c2028}
.mobile-history-close{display:none}
body{height:var(--viewport-height);position:fixed;top:var(--viewport-top,0px);left:0;right:0;min-height:0}
.app-shell,.control-panel{height:100%;min-height:0}
.app-shell{background:var(--surface);--sidebar-width:290px}
.nav-rail{width:84px;background:#0c2028;padding-top:24px}
.nav-brand,.brand-mark,.login-icon,.welcome-mark{background:linear-gradient(135deg,#a4f5da,#6acbd8);color:#123c43;box-shadow:0 8px 26px #042b3915}
.nav-item{min-height:62px;color:#a8c1c7;border:1px solid transparent}
.nav-item.active{background:#153e47;border-color:#28616b;color:#b3f6e6}
.nav-item:hover{background:#17333e}
.sidebar{background:radial-gradient(ellipse at top left,#254854,#122a35 65%);padding:28px 22px 20px;border-right:1px solid #ffffff0c}
.sidebar:after{border-radius:32%;transform:rotate(35deg);opacity:.5}
.brand strong{font-size:18px}.brand span{color:#a2c4ca;letter-spacing:.12em}
.history-panel{margin-top:25px}.history-heading{color:#a9c0c8;letter-spacing:.08em}
.account-filter{background:#112b36;border-color:#38535e;padding:12px;font-size:13px}
.conversation-item{font-size:13px;padding:12px;border-radius:9px;color:#c1d3da}
.conversation-item.active{background:#365c65;box-shadow:inset 3px 0 #8ee6d3;color:#fff}
.sidebar-resizer{background:#e1e9eb}.sidebar-resizer:hover{background:#98c6c8}
.topbar{height:82px;padding:18px 28px;background:#ffffffed;border-color:var(--line)}
.topbar-kicker{color:#527c85;letter-spacing:.16em}.topbar h2{color:var(--ink);font-size:21px}
.ghost-button,.icon-button{border-color:var(--line);color:#37535f;min-height:40px;background:#fff}
.ghost-button:hover,.icon-button:hover{background:#edf7f5;border-color:#87b7b8}
.primary-button,.send-button{background:var(--accent);box-shadow:0 4px 12px #087f8c18}
.primary-button:hover,.send-button:hover{background:#086571}
.chat-view{background:radial-gradient(ellipse at top right,#d6eeed55,transparent 55%),#f6f8f8}
.messages{padding-top:32px;padding-bottom:28px;scrollbar-gutter:stable}
.message{margin-bottom:28px;gap:15px}.message-text{font-size:15px;line-height:1.8;color:#263e49}
.message-label{color:#607c86;font-size:11px;letter-spacing:.025em}
.message-avatar{background:#d5efea;color:#087f8c;border-radius:11px}
.message.user .message-text{background:#e4eeee;border:1px solid #d5e4e5;border-radius:16px 4px 16px 16px;padding:13px 17px}
.message-card{border-color:var(--line);border-radius:16px;box-shadow:0 5px 18px #163a4506}
.composer-wrap{background:linear-gradient(#f6f8f800,#f6f8f8 20%);padding-top:16px}
.composer{border-color:#cadcde;border-radius:20px;padding:13px 14px 13px 18px;box-shadow:0 8px 35px #153c4210}
.composer:focus-within{border-color:#399d9f;box-shadow:0 0 0 3px #1c9e9314,0 8px 35px #153c4210}
.send-button,.attach-button{width:40px;height:40px;border-radius:13px}.composer textarea{font-size:16px}
.welcome{margin-top:clamp(30px,9vh,110px)}.welcome h2{font-size:clamp(28px,3vw,42px);color:#163b44;max-width:560px}
.suggestions button{border-color:var(--line);min-height:96px;border-radius:16px;color:#35545f;font-size:13px}
.login-view{overflow:auto;background:radial-gradient(ellipse at 75% 15%,#ccebe5,transparent 60%),#f3f7f7}
.login-card{border-color:#dce8e8;box-shadow:0 24px 70px #16434b10;border-radius:26px}.login-card h2{color:#173b43}
.control-panel{background:radial-gradient(ellipse at 90% 0,#d9eeeb80,transparent 55%),#f2f6f6;padding:36px clamp(20px,4vw,56px)}
.control-header{margin-bottom:30px}.control-header h2{font-size:30px;color:#173b43;letter-spacing:-.04em}
.stat-grid{gap:18px}.stat-card{padding:24px;border-color:var(--line);border-radius:18px;box-shadow:0 5px 20px #163a4504}
.stat-card .stat-value{font-size:38px;font-variant-numeric:tabular-nums}.stat-card .stat-label{font-size:12px;letter-spacing:0}
.control-card{padding:22px;border-color:var(--line);border-radius:18px;box-shadow:none}.control-card-heading h3{font-size:16px}
.account-table{font-size:13px}.account-table td{padding-top:16px;padding-bottom:16px}.account-table tbody tr:hover{background:#edf7f5}
.control-dialog{max-height:calc(var(--viewport-height) - 32px);overflow:auto;border:1px solid var(--line);border-radius:22px}
.activity-drawer{background:#fbfdfd;border-left:1px solid var(--line)}
button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #149b96;outline-offset:3px}
*{scrollbar-width:thin;scrollbar-color:#b4c8cc transparent}
@media(max-width:850px){
 body{padding-top:env(safe-area-inset-top);flex-direction:column-reverse}
 .app-shell{flex:1;min-height:0;height:auto;position:relative;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
 .sidebar{position:absolute;inset:0 auto 0 0;width:min(300px,85%);height:100%;z-index:12;box-shadow:18px 0 60px #0a202848;padding:22px 18px}
 .mobile-history-close{display:block;position:absolute;right:10px;top:10px;z-index:3;width:36px;height:36px;border:1px solid #53717a;border-radius:10px;background:#15343f;color:#fff;font-size:24px}
 .sidebar-collapsed .sidebar{display:none}.main-panel{grid-column:1;grid-row:1;min-height:0}
 .history-panel{flex:1;min-height:0}.conversation-list{flex-direction:column;overflow:auto;min-height:0}.conversation-item{width:100%;flex:none}
 .nav-rail{width:100%;padding:5px 8px max(5px,env(safe-area-inset-bottom));gap:4px}.nav-item{min-height:48px;padding:7px 2px}.nav-label{font-size:10px}
 .topbar{height:64px;padding:9px 12px;gap:4px}.topbar h2{font-size:16px}.topbar-kicker{font-size:7px}.topbar-actions{gap:4px}.sidebar-toggle{margin-right:5px}
 .topbar .icon-button,.topbar .ghost-button{min-height:36px;width:36px;padding:7px;flex:none}.toolbar-button:after{content:none}
 .topbar-actions .toolbar-button{font-size:0}.topbar-actions .toolbar-button>span:first-child{font-size:16px}
 .messages{padding:22px 14px}.message{gap:9px;margin-bottom:24px}.message-avatar{width:26px;height:26px}.message-text{font-size:14px;line-height:1.75}
 .composer-wrap{padding:8px 10px 10px}.composer{gap:6px;padding:10px;border-radius:17px}.composer-options{margin-top:7px}
 .control-panel{height:auto;min-height:0;padding:24px 14px}.control-header h2{font-size:25px}.control-header{margin-bottom:20px}
 .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.stat-card{padding:17px}.stat-card .stat-value{font-size:30px}.control-grid{grid-template-columns:minmax(0,1fr)}
 .control-header-actions{flex-wrap:wrap}.control-card{padding:16px}.login-card{padding:28px 23px}.login-view{padding:20px 14px}
 input,select,textarea,.control-dialog input,.control-dialog textarea,.account-toolbar input[type=search]{font-size:16px}
 .activity-drawer{top:64px;width:min(420px,100%);bottom:0}.welcome{margin-top:28px}.suggestions button{min-height:60px}
}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}
/* Ô chọn có tìm kiếm (combo.js): bảng nổi dùng chung; máy tính phủ đúng chỗ ô chọn, điện thoại là tấm chọn */
.cbx{position:fixed;z-index:9999;display:flex;flex-direction:column;background:#fff;border:1px solid #9fcfcf;border-radius:12px;box-shadow:0 18px 50px #0f2f3a2e,0 0 0 3px #149b9618;overflow:hidden;font-size:13px;color:#1f3540}
.cbx[hidden],.cbx-backdrop[hidden],.cbx [hidden]{display:none}
.cbx.up{flex-direction:column-reverse}
.cbx-head{flex:none;display:flex;align-items:center;border-bottom:1px solid #e3ecee;background:#f7fbfb}
.cbx.up .cbx-head{border-bottom:0;border-top:1px solid #e3ecee}
.cbx-input{flex:1;min-width:0;width:100%;box-sizing:border-box;padding:0 12px 0 34px;border:0;font:inherit;font-size:13.5px;color:#14303a;outline:none;background:transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23149b96' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 11px center;-webkit-appearance:none;appearance:none}
.cbx-input::-webkit-search-cancel-button{cursor:pointer}
.cbx-close{flex:none;margin:6px 8px 6px 0;padding:8px 14px;border:1px solid #cfe1e2;border-radius:10px;background:#fff;color:#245a63;font:inherit;font-weight:700;cursor:pointer}
.cbx-list{overflow-y:auto;padding:4px;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.cbx-opt{padding:7px 10px;border-radius:8px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.35}
.cbx-opt b{color:#087f8c;font-weight:800}
.cbx-opt.on{background:#e6f4f2}
.cbx-opt.cur{font-weight:700}.cbx-opt.cur:before{content:"✓ ";color:#087f8c}
.cbx-opt.pin{color:#3c5c66}
.cbx-opt.pin+.cbx-opt:not(.pin){margin-top:5px;box-shadow:0 -3px 0 -2px #e3ecee}
.cbx-opt.off{color:#a3b0b8;cursor:default}
.cbx-group{padding:8px 10px 3px;color:#6b8790;font-size:10.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase}
.cbx-empty{padding:12px;color:#7d8f97;text-align:center}
.cbx-foot{flex:none;display:flex;align-items:center;gap:8px;padding:5px 6px 5px 11px;border-top:1px solid #edf2f3;background:#fbfdfd}
.cbx.up .cbx-foot{border-top:0;border-bottom:1px solid #edf2f3}
.cbx-info{flex:1;min-width:0;color:#7d9098;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cbx-sort{flex:none;padding:4px 9px;border:1px solid #d6e6e7;border-radius:8px;background:#fff;color:#2c6670;font:inherit;font-size:11px;font-weight:700;cursor:pointer}
.cbx-sort:hover{background:#eef8f6}
.cbx-backdrop{position:fixed;inset:0;z-index:9998;background:#0c202866;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);touch-action:none}
.cbx.sheet{border-radius:18px;font-size:16px;box-shadow:0 24px 60px #06181f55}
.cbx.sheet .cbx-input{height:52px;font-size:16px;padding-left:40px;background-position:14px center}
.cbx.sheet .cbx-opt{padding:12px 14px;min-height:22px;border-bottom:1px solid #f0f4f5;border-radius:10px;white-space:normal}
.cbx.sheet .cbx-info{font-size:12.5px}
.cbx.sheet .cbx-sort{padding:8px 12px;font-size:12.5px}
/* Màn hình máy tính rộng: dùng hết bề ngang, bớt khoảng trống hai bên */
@media (min-width:1280px){
  .control-panel{padding-left:clamp(24px,2.2vw,40px);padding-right:clamp(24px,2.2vw,40px)}
  .control-view{max-width:1760px}
  .message,.attachment-list{max-width:min(980px,100%)}
  .composer-wrap{padding-left:max(36px,calc((100% - 980px)/2));padding-right:max(36px,calc((100% - 980px)/2))}
}
@media (min-width:1600px){
  .ch-work{grid-template-columns:minmax(0,1fr) 400px}
  .stat-grid{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}
  .message,.attachment-list{max-width:1080px}
  .composer-wrap{padding-left:max(36px,calc((100% - 1080px)/2));padding-right:max(36px,calc((100% - 1080px)/2))}
}
