:root{--bg: #f4f5f7;--surface: #ffffff;--border: #e2e4e9;--text: #1b1d23;--text-muted: #6b7280;--primary: #2563eb;--primary-hover: #1d4ed8;--danger: #dc2626;--success: #16a34a;--accent: #79C043;font-family:Noto Sans Thai,Sarabun,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--bg);color:var(--text)}button{font-family:inherit;cursor:pointer}input,select,textarea{font-family:inherit;font-size:14px}.app-loading{display:flex;align-items:center;justify-content:center;height:100vh;color:var(--text-muted)}.login-page{height:100vh;display:flex;align-items:center;justify-content:center;padding:16px}.login-card{background:var(--surface);border-radius:16px;padding:32px;width:100%;max-width:380px;box-shadow:0 4px 24px #0000000f;display:flex;flex-direction:column;gap:4px}.login-card h1{margin:0 0 4px;font-size:22px}.login-subtitle{color:var(--text-muted);font-size:13px;margin:0 0 16px}.field{display:flex;flex-direction:column;gap:6px;margin-bottom:14px;font-size:13px;color:var(--text-muted)}.field input,.field select,.field textarea{padding:10px 12px;border:1px solid var(--border);border-radius:8px;color:var(--text)}.field textarea{resize:vertical;font:inherit}.field input:focus,.field select:focus,.field textarea:focus{outline:2px solid var(--primary);outline-offset:-1px}.field-hint{font-size:12px;color:var(--text-muted);margin:-6px 0 12px}.field-checkbox{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:14px}.btn-primary{background:var(--primary);color:#fff;border:none;border-radius:8px;padding:11px 16px;font-size:14px;font-weight:600}.btn-primary:hover:not(:disabled){background:var(--primary-hover)}.btn-primary:disabled{opacity:.6;cursor:not-allowed}.btn-link{background:none;border:none;color:var(--primary);font-size:13px;padding:4px}.error-text{color:var(--danger);font-size:13px;margin-bottom:10px}.success-text{color:var(--success);font-size:13px;margin-bottom:10px}.app-shell{height:100vh;display:flex;flex-direction:column}.topbar{display:flex;align-items:center;gap:16px;padding:10px 16px;background:var(--surface);border-bottom:1px solid var(--border);flex-shrink:0}.topbar-brand{font-weight:700;font-size:16px}.topbar-nav{display:flex;gap:4px;flex:1}.nav-btn{background:none;border:none;padding:8px 12px;border-radius:8px;font-size:14px;color:var(--text-muted)}.nav-btn.active{background:var(--bg);color:var(--text);font-weight:600}.topbar-user{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--text-muted)}.app-main{flex:1;min-height:0}.inbox{display:grid;grid-template-columns:340px 1fr;height:100%}.conversation-list-pane{border-right:1px solid var(--border);background:var(--surface);display:flex;flex-direction:column;min-height:0}.filters{display:flex;gap:8px;padding:10px;border-bottom:1px solid var(--border)}.filters select{flex:1;min-width:0;padding:8px 4px;border:1px solid var(--border);border-radius:8px}.btn-broadcast{border:1px solid var(--border);background:var(--surface);border-radius:8px;padding:8px 10px;font-size:14px;line-height:1;flex-shrink:0}.btn-broadcast:hover{background:var(--bg)}.modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;padding:16px;z-index:50}.modal-card{background:var(--surface);border-radius:14px;padding:20px;width:100%;max-width:440px;box-shadow:0 8px 32px #0000002e}.modal-card h3{margin:0 0 6px;font-size:16px}.modal-sub{font-size:12px;color:var(--text-muted);margin:0 0 12px;line-height:1.5}.modal-card textarea{width:100%;resize:vertical;padding:10px 12px;border:1px solid var(--border);border-radius:10px;min-height:90px}.modal-attach-row{display:flex;align-items:center;gap:10px;margin-top:10px;flex-wrap:wrap}.modal-attach-row .btn-attach{font-size:13px}.modal-attach-name{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text-muted);word-break:break-all}.modal-attach-thumb{max-height:48px;max-width:80px;border-radius:6px;border:1px solid var(--border)}.modal-result{margin-top:10px;font-size:13px;color:var(--success)}.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:14px}.conversation-list{overflow-y:auto;flex:1}.empty-state{padding:24px;text-align:center;color:var(--text-muted);font-size:13px}.conversation-item{display:flex;align-items:center;gap:10px;width:100%;padding:12px;border:none;background:none;border-bottom:1px solid var(--border);text-align:left}.conversation-item:hover{background:var(--bg)}.conversation-item.selected{background:#eaf1ff}.channel-dot{width:32px;height:32px;border-radius:50%;color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex-shrink:0}.conversation-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}.conversation-top{display:flex;justify-content:space-between;gap:8px}.conversation-name{font-weight:600;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.conversation-time{font-size:11px;color:var(--text-muted);flex-shrink:0}.conversation-bottom{display:flex;justify-content:space-between;align-items:center}.conversation-channel{font-size:12px;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.label-chip{display:inline-block;color:#fff;font-size:10px;font-weight:600;padding:1px 7px;border-radius:8px;margin-right:6px;vertical-align:middle;white-space:nowrap}.unread-badge{background:var(--primary);color:#fff;font-size:11px;min-width:18px;height:18px;border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0 5px;flex-shrink:0}.chat-pane-wrapper{min-height:0;display:flex;flex-direction:column}.chat-placeholder{flex:1;display:flex;align-items:center;justify-content:center;color:var(--text-muted);font-size:14px}.chat-pane{display:flex;flex-direction:column;height:100%;min-height:0}.chat-header{display:flex;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--border);background:var(--surface)}.btn-back{display:none;background:none;border:none;font-size:18px;padding:4px 8px}.chat-header-info{flex:1;min-width:0}.chat-header-name{font-weight:600;font-size:14px;display:flex;align-items:center;gap:8px;min-width:0}.label-select{border:1px solid var(--border);background:var(--surface);border-radius:999px;padding:2px 8px;font-size:11px;font-weight:600;color:var(--text-muted);max-width:140px;cursor:pointer}.chat-header-channel{font-size:12px;color:var(--text-muted)}.btn-status{border:1px solid var(--border);background:var(--surface);border-radius:8px;padding:6px 12px;font-size:12px;font-weight:600;color:var(--text-muted)}.btn-status.done{border-color:var(--success);color:var(--success)}.chat-messages{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px}.bubble-row{display:flex;align-items:center;gap:4px}.bubble-row.out{justify-content:flex-end}.bubble-row.in{justify-content:flex-start}.btn-reply{flex-shrink:0;background:none;border:none;border-radius:50%;width:26px;height:26px;font-size:14px;line-height:1;color:var(--text-muted);opacity:.35;cursor:pointer;transition:opacity .15s,background .15s}.bubble-row:hover .btn-reply{opacity:.85}.btn-reply:hover{opacity:1;background:var(--surface)}@media(hover:none){.btn-reply{opacity:.55}}.bubble{max-width:72%;padding:8px 12px;border-radius:14px;font-size:14px;line-height:1.4}.bubble.in{background:var(--surface);border:1px solid var(--border);border-bottom-left-radius:4px}.bubble.out{background:var(--primary);color:#fff;border-bottom-right-radius:4px}.bubble-body{white-space:pre-wrap;word-break:break-word}.bubble-quote{border-left:3px solid var(--primary);background:#0000000a;border-radius:6px;padding:4px 8px;margin-bottom:6px;cursor:pointer;overflow:hidden}.bubble.out .bubble-quote{border-left-color:#fff;background:#ffffff29}.bubble-quote-author{font-size:11px;font-weight:600;opacity:.8;margin-bottom:2px}.bubble-quote-text{font-size:12px;opacity:.85;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}@keyframes highlight-flash{0%{background-color:#ffd60a8c}to{background-color:transparent}}.bubble.highlight-flash{animation:highlight-flash 1.2s ease-out}.bubble-meta{display:flex;gap:8px;justify-content:flex-end;font-size:10px;opacity:.75;margin-top:4px}.msg-status.failed{color:#fecaca;font-weight:700}.btn-retry{border:1px solid rgba(255,255,255,.6);background:#ffffff26;color:#fff;border-radius:6px;font-size:10px;padding:1px 6px;cursor:pointer}.btn-retry:hover{background:#ffffff4d}.btn-retry:disabled{opacity:.5;cursor:default}.msg-image{max-width:240px;border-radius:8px;display:block;margin-bottom:4px}.msg-file-link{display:flex;align-items:center;gap:6px;padding:8px 10px;margin-bottom:4px;border-radius:8px;background:#0000000a;color:inherit;text-decoration:none;font-size:13px;word-break:break-all}.bubble.out .msg-file-link{background:#ffffff29;color:#fff}.upload-status{padding:6px 14px;font-size:12px;color:var(--text-muted);background:var(--surface);border-top:1px solid var(--border)}.reply-preview-bar{display:flex;align-items:center;gap:8px;padding:6px 12px;border-top:1px solid var(--border);background:var(--surface)}.reply-preview-content{flex:1;min-width:0;border-left:3px solid var(--primary);padding:2px 8px;overflow:hidden}.reply-preview-author{font-size:11px;font-weight:600;color:var(--primary)}.reply-preview-text{font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.btn-reply-cancel{flex-shrink:0;background:none;border:none;font-size:14px;color:var(--text-muted);padding:4px 6px;cursor:pointer}.btn-reply-cancel:hover{color:var(--text)}.autoreply-status{display:flex;align-items:center;gap:10px;padding:12px 14px;border-radius:10px;border:1px solid var(--border);margin-bottom:8px}.autoreply-status.on{background:#ecfdf5;border-color:#16a34a;color:#166534}.autoreply-status.off{background:var(--bg);color:var(--text-muted, #6b7280)}.autoreply-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;background:#9ca3af}.autoreply-status.on .autoreply-dot{background:#16a34a}.autoreply-status strong{flex:1;font-size:14px}.spam-banner{display:flex;align-items:center;gap:12px;padding:10px 14px;background:#fef2f2;border-bottom:2px solid #dc2626;color:#991b1b;font-size:13px;line-height:1.5}.spam-banner .btn-link{flex-shrink:0;color:#991b1b;text-decoration:underline}.spam-chip{margin-right:4px}.chat-composer{display:flex;align-items:flex-end;gap:8px;padding:10px;border-top:1px solid var(--border);background:var(--surface)}.btn-attach{background:none;border:1px solid var(--border);border-radius:10px;font-size:16px;padding:8px 10px;line-height:1;flex-shrink:0}.btn-attach:hover:not(:disabled){background:var(--bg)}.btn-attach:disabled{opacity:.6;cursor:not-allowed}.chat-composer textarea{flex:1;resize:none;padding:10px 12px;border:1px solid var(--border);border-radius:10px;min-height:64px;max-height:160px;line-height:1.5}.settings-page{height:100%;overflow-y:auto;padding:20px;display:grid;grid-template-columns:1fr 1fr;gap:20px;align-content:start}.settings-list,.settings-form{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:18px}.settings-list h2,.settings-form h2{margin-top:0;font-size:16px}.channel-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.channel-row{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--border);border-radius:10px}.channel-row-info{flex:1;min-width:0}.channel-row-name{font-weight:600;font-size:14px}.channel-row-sub{font-size:12px;color:var(--text-muted)}.settings-form-actions{display:flex;align-items:center;gap:12px}@media(max-width:800px){.topbar-user-name{display:none}.inbox{grid-template-columns:1fr;position:relative}.conversation-list-pane{border-right:none}.chat-pane-wrapper{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--bg);transform:translate(100%);transition:transform .2s ease}.inbox.chat-open .chat-pane-wrapper{transform:translate(0)}.inbox.chat-open .conversation-list-pane{display:none}.btn-back{display:inline-block}.settings-page{grid-template-columns:1fr}}.prices-page,.quotes-page{height:100%;overflow-y:auto;padding:20px;max-width:1080px;margin:0 auto;width:100%}.prices-header,.quotes-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:12px}.prices-header h2,.quotes-header h2{margin:0 0 4px;font-size:18px}.prices-add-category{display:flex;gap:8px}.prices-add-category input{padding:9px 12px;border:1px solid var(--border);border-radius:8px;min-width:200px}.prices-category{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:16px}.prices-category h3{margin:0 0 10px;font-size:15px;border-left:4px solid var(--accent, #79C043);padding-left:10px}.prices-table-wrap{overflow-x:auto}.prices-table{width:100%;border-collapse:collapse;font-size:13px}.prices-table th{text-align:left;color:var(--text-muted);font-weight:600;font-size:12px;padding:6px 8px;border-bottom:1px solid var(--border);white-space:nowrap}.prices-table td{padding:4px 8px;border-bottom:1px solid var(--border);vertical-align:middle}.prices-table tr:last-child td{border-bottom:none}.prices-table .col-unit{width:90px}.prices-table .col-price{width:200px}.prices-table .col-qty{width:90px}.prices-table .col-updated{width:190px;font-size:12px;color:var(--text-muted);white-space:nowrap}.prices-table .col-actions{width:48px;text-align:right}.prices-table .col-amount{width:130px;text-align:right}.prices-table .col-pick{width:220px}.row-saving{opacity:.5}.price-cell{display:block;width:100%;text-align:left;background:none;border:none;padding:6px;border-radius:6px;font:inherit;color:inherit}.price-cell:hover{background:var(--bg);outline:1px dashed var(--border)}.price-value{font-weight:600;color:#4c8a22}.price-missing{color:#b45309;background:#fffbeb;border:1px dashed #f59e0b;font-size:12px}.price-missing:hover{background:#fef3c7}.price-empty{color:var(--text-muted)}.price-edit-input{width:100%;padding:5px 6px;border:1px solid var(--accent, #79C043);border-radius:6px;outline:2px solid rgba(121,192,67,.25);font:inherit}.price-updated-by{color:var(--text-muted)}.prices-add-row{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}.prices-add-row input{padding:8px 10px;border:1px solid var(--border);border-radius:8px}.prices-add-name{flex:2;min-width:200px}.prices-add-unit{width:90px}.prices-add-price{width:110px}.btn-danger-link{color:var(--danger)}.btn-secondary{background:var(--surface);border:1px solid var(--border);color:var(--text-muted);border-radius:8px;padding:11px 16px;font-size:14px;font-weight:600}.btn-secondary:disabled{opacity:.6;cursor:not-allowed}.quote-status-chip{display:inline-block;color:#fff;font-size:11px;font-weight:600;padding:2px 10px;border-radius:999px;white-space:nowrap}.quotes-table td{padding:8px}.quote-editor{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:18px;height:auto;min-height:0;max-height:100%}.quote-customer-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:0 14px}.quote-field-wide{grid-column:1 / -1}.quote-items-title{font-size:15px;margin:6px 0 8px;border-left:4px solid var(--accent, #79C043);padding-left:10px}.quote-items-table input,.quote-items-table select{width:100%;padding:7px 8px;border:1px solid var(--border);border-radius:6px}.quote-items-table .col-qty input,.quote-items-table .col-amount input{text-align:right}.quote-line-amount{font-weight:600;white-space:nowrap}.quote-totals{margin:14px 0 14px auto;max-width:320px;display:flex;flex-direction:column;gap:6px;font-size:14px}.quote-totals>div{display:flex;justify-content:space-between;gap:20px}.quote-totals span{color:var(--text-muted)}.quote-grand-total{border-top:2px solid var(--accent, #79C043);padding-top:8px;font-size:16px}.quote-grand-total span{color:var(--text);font-weight:600}.quote-grand-total strong{color:#4c8a22}@media(max-width:800px){.prices-header,.quotes-header{flex-direction:column;align-items:stretch}}.sandbox{display:flex;flex-direction:column;height:100%;max-width:760px;margin:0 auto;width:100%;background:#fff;border:1px solid #e2e4ea;border-radius:12px;overflow:hidden}.sandbox-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid #e2e4ea;background:#fafbfc}.sandbox-title{font-weight:700}.sandbox-sub{font-size:12px;color:#6b7280;margin-top:2px}.sandbox-messages{flex:1}.sandbox-empty{color:#6b7280;text-align:center;padding:24px 12px}.sandbox-suggestions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:8px}.sandbox-chip{border:1px solid #cdd3df;background:#fff;border-radius:999px;padding:6px 12px;cursor:pointer;font-size:13px}.sandbox-chip:hover{background:#f1f5ff}.sandbox-error{color:#b91c1c;background:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:8px 12px;margin:8px 0;font-size:13px}
