*{box-sizing:border-box}html,body{height:100%}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;background:#f3f5f7;color:#17212b}.app-shell{height:100vh;display:grid;grid-template-columns:360px 1fr;background:#fff}.sidebar{border-right:1px solid #e7ebef;display:flex;flex-direction:column;min-width:0;background:#fbfcfd}.sidebar-head{height:74px;padding:0 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #edf0f2}.eyebrow{font-size:10px;letter-spacing:.12em;color:#98a2ad;font-weight:800}.logo-title{font-size:18px;font-weight:850}.online-dot{width:10px;height:10px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 4px #dcfce7}.search-wrap{padding:15px 16px 10px}.search-wrap input{width:100%;border:1px solid #e3e8ed;background:#fff;border-radius:12px;padding:11px 13px;outline:none}.filter-row{display:flex;gap:8px;padding:0 16px 12px}.filter{border:0;background:#eef1f4;color:#66717d;border-radius:999px;padding:7px 11px;font-size:12px;font-weight:750;cursor:pointer}.filter.active{background:#17212b;color:#fff}.chat-list{overflow:auto;padding:0 8px 10px}.chat-item{padding:13px 12px;border-radius:14px;display:grid;grid-template-columns:44px 1fr auto;gap:11px;align-items:center;cursor:pointer;margin:2px 0}.chat-item:hover{background:#f0f3f5}.chat-item.active{background:#e9f4ff}.avatar{width:44px;height:44px;border-radius:13px;background:linear-gradient(135deg,#e5e7eb,#cbd5e1);display:grid;place-items:center;font-weight:900;color:#334155}.chat-info{min-width:0}.chat-name{font-size:14px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-preview{font-size:12px;color:#7a8591;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:4px}.chat-side{text-align:right}.chat-time{font-size:10px;color:#9aa3ac}.badge{display:inline-grid;place-items:center;background:#0f8cff;color:white;border-radius:99px;min-width:20px;height:20px;padding:0 6px;font-size:10px;font-weight:850;margin-top:6px}.conversation{display:flex;flex-direction:column;min-width:0;background:#fff}.topbar{height:74px;border-bottom:1px solid #e7ebef;display:flex;align-items:center;justify-content:space-between;padding:0 22px}.chat-heading{display:flex;gap:10px;align-items:center}.chat-heading h2{font-size:16px;margin:0}.chat-meta{font-size:11px;color:#8b95a1;margin-top:3px}.top-actions{display:flex;align-items:center;gap:10px}.ghost-btn,.logout,.icon-btn{border:1px solid #dfe4e8;background:#fff;color:#42505c;border-radius:10px;padding:8px 10px;font-size:12px;font-weight:750;text-decoration:none;cursor:pointer}.staff-chip{padding:7px 11px;border-radius:11px;background:#f5f7f9;display:flex;flex-direction:column}.staff-chip span{font-size:12px;font-weight:800}.staff-chip small{font-size:9px;color:#8e98a3;text-transform:uppercase}.empty-state{flex:1;display:grid;place-content:center;text-align:center;color:#7f8a96}.empty-icon{width:56px;height:56px;border-radius:18px;background:#f0f3f6;margin:0 auto 12px;display:grid;place-items:center;font-size:25px;color:#111827}.empty-state h3{margin:0 0 4px;color:#26313c}.empty-state p{margin:0;font-size:13px}.chat-pane{display:flex;flex-direction:column;flex:1;min-height:0}.hidden{display:none!important}.messages{flex:1;overflow:auto;padding:24px 30px;background:linear-gradient(#fafbfc,#f7f9fa)}.message-row{display:flex;margin:9px 0}.message-row.outgoing{justify-content:flex-end}.bubble{max-width:min(680px,75%);background:#fff;border:1px solid #e7eaee;border-radius:16px 16px 16px 5px;padding:10px 12px;box-shadow:0 1px 1px rgba(0,0,0,.02)}.outgoing .bubble{background:#17212b;color:#fff;border-color:#17212b;border-radius:16px 16px 5px 16px}.msg-name{font-size:10px;font-weight:850;color:#5581a8;margin-bottom:4px}.outgoing .msg-name{color:#b9c7d4}.msg-text{font-size:14px;line-height:1.45;white-space:pre-wrap;word-break:break-word}.msg-meta{display:flex;gap:8px;align-items:center;justify-content:flex-end;margin-top:5px;font-size:9px;color:#9aa4ad}.outgoing .msg-meta{color:#aeb9c3}.reply-btn{border:0;background:transparent;color:inherit;opacity:.55;cursor:pointer;font-size:10px;padding:0}.reply-bar{border-top:1px solid #e6eaee;padding:8px 18px;background:#f8fafb;display:flex;justify-content:space-between;align-items:center;font-size:11px}.reply-bar b{margin-right:8px}.reply-bar span{color:#74808c}.reply-bar button{border:0;background:transparent;font-size:20px;cursor:pointer}.composer{border-top:1px solid #e4e8ec;padding:13px 18px;display:flex;gap:10px;align-items:flex-end}.composer textarea{resize:none;max-height:130px;min-height:42px;flex:1;border:1px solid #dde3e8;border-radius:13px;padding:11px 13px;font:inherit;outline:none}.composer textarea:focus{border-color:#94a3b8;box-shadow:0 0 0 3px rgba(148,163,184,.12)}.send-btn{height:42px;border:0;border-radius:12px;background:#0f8cff;color:#fff;padding:0 20px;font-weight:850;cursor:pointer}.empty-side{padding:30px 16px;text-align:center;color:#9aa3ad;font-size:12px}.login-body{display:grid;place-items:center;min-height:100vh;background:#f3f5f7}.login-card{width:min(420px,calc(100% - 32px));background:#fff;border:1px solid #e5e9ed;border-radius:22px;padding:30px;box-shadow:0 20px 60px rgba(15,23,42,.1)}.brand-mark{width:48px;height:48px;background:#17212b;color:#fff;border-radius:14px;display:grid;place-items:center;font-weight:900;font-size:20px}.login-card h1{margin:18px 0 4px}.login-card p{margin:0 0 22px;color:#7b8792;font-size:13px}.login-card label{display:block;font-size:12px;font-weight:800;margin:12px 0 6px}.login-card input{width:100%;border:1px solid #dfe5ea;border-radius:11px;padding:12px;outline:none}.login-card button{width:100%;margin-top:18px;border:0;background:#17212b;color:#fff;border-radius:11px;padding:12px;font-weight:850}.login-error{background:#fff1f2;color:#9f1239;padding:10px;border-radius:10px;font-size:12px}.mobile-only{display:none}
@media(max-width:800px){.app-shell{display:block}.sidebar{height:100vh}.conversation{display:none;height:100vh}.app-shell.chat-open .sidebar{display:none}.app-shell.chat-open .conversation{display:flex}.mobile-only{display:inline-block}.top-actions .staff-chip,.top-actions .logout{display:none}.messages{padding:18px 12px}.bubble{max-width:86%}.ghost-btn{font-size:10px}.topbar{padding:0 12px}}

.chat-photo{display:block;max-width:min(420px,100%);max-height:460px;width:auto;height:auto;object-fit:contain;border-radius:12px;background:#eef2f5;cursor:zoom-in}.photo-link{display:block;text-decoration:none;line-height:0}.photo-link.media-error{min-width:180px;min-height:80px;background:#f4f6f8;border:1px dashed #cbd5e1;border-radius:12px;position:relative}.photo-link.media-error:after{content:"โหลดรูปไม่สำเร็จ";position:absolute;inset:0;display:grid;place-items:center;color:#7b8792;font-size:12px;line-height:1}.photo-link.media-error .chat-photo{display:none}.media-caption{margin-top:8px}.outgoing .chat-photo{background:#263441}@media(max-width:800px){.chat-photo{max-width:100%;max-height:380px}}

.photo-link{border:0;padding:0;background:transparent;cursor:zoom-in;text-align:left}
.photo-viewer{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;padding:24px}
.photo-viewer-backdrop{position:absolute;inset:0;background:rgba(10,15,20,.88);backdrop-filter:blur(3px)}
.photo-viewer-box{position:relative;z-index:1;max-width:96vw;max-height:94vh;display:grid;place-items:center}
.photo-viewer-img{display:block;max-width:96vw;max-height:92vh;width:auto;height:auto;object-fit:contain;border-radius:12px;box-shadow:0 24px 80px rgba(0,0,0,.45);background:#111}
.photo-viewer-close{position:fixed;top:18px;right:22px;z-index:2;width:42px;height:42px;border:0;border-radius:999px;background:rgba(255,255,255,.14);color:#fff;font-size:30px;line-height:1;cursor:pointer}
.photo-viewer-close:hover{background:rgba(255,255,255,.24)}
@media(max-width:800px){.photo-viewer{padding:10px}.photo-viewer-img{max-width:98vw;max-height:90vh}.photo-viewer-close{top:10px;right:10px}}

.avatar{overflow:hidden}.avatar img{width:100%;height:100%;object-fit:cover;display:block}.staff-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center}.staff-modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.48);backdrop-filter:blur(3px)}.staff-panel{position:relative;width:min(980px,calc(100% - 32px));max-height:86vh;overflow:auto;background:#fff;border-radius:20px;box-shadow:0 24px 80px rgba(0,0,0,.24);padding:20px}.staff-panel-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:14px}.staff-panel-head h3{margin:0;font-size:18px}.staff-panel-head p{margin:3px 0 0;color:#8b95a1;font-size:12px}.staff-close{border:0;background:#eef2f5;width:34px;height:34px;border-radius:10px;font-size:22px;cursor:pointer}.staff-create{display:grid;grid-template-columns:1.2fr 1fr 1.2fr .8fr auto;gap:8px;padding:12px;background:#f7f9fb;border-radius:14px;margin-bottom:12px}.staff-create input,.staff-create select,.staff-row input,.staff-row select{min-width:0;border:1px solid #dfe5ea;background:#fff;border-radius:9px;padding:9px;font:inherit;font-size:12px}.staff-create button,.staff-save{border:0;background:#17212b;color:#fff;border-radius:9px;padding:9px 13px;font-weight:800;cursor:pointer}.staff-list{display:flex;flex-direction:column;gap:7px}.staff-row{display:grid;grid-template-columns:1.1fr 1.2fr .75fr .75fr 1.2fr auto;gap:7px;align-items:center;border:1px solid #e7ebef;border-radius:12px;padding:9px}.staff-main{display:flex;flex-direction:column;min-width:0}.staff-main b{font-size:12px}.staff-main small{font-size:10px;color:#8b95a1}.staff-save{background:#0f8cff}@media(max-width:850px){.staff-create,.staff-row{grid-template-columns:1fr 1fr}.staff-main{grid-column:1/-1}.staff-create button,.staff-save{grid-column:1/-1}}
