*{box-sizing:border-box}body{margin:0;background:#111722;color:#e8edf5;font:14px Tahoma,system-ui,sans-serif}button,input,select,textarea{font:inherit}button{cursor:pointer;background:#079b43;color:white;border:0;border-radius:9px;padding:11px 14px}button:hover{filter:brightness(1.13)}input,select,textarea{padding:11px;border:1px solid #465062;border-radius:9px;background:#303947;color:#f5f7fa;width:100%;margin:5px 0}.layout{display:flex;min-height:100vh}aside{width:260px;flex-shrink:0;background:#1b2330;color:#dce6f2;padding:22px 12px;display:flex;flex-direction:column;gap:12px;border-right:1px solid #30394a}aside h2{font-size:20px;color:#fff;padding:5px 10px}aside p{padding:0 10px;color:#aeb9c9}aside button{background:transparent;text-align:left;font-size:15px}aside button:hover{background:#087d39}aside a{color:#b9c9d9;margin-top:auto;padding:12px}.main{display:flex;flex:1;min-width:0;min-height:100vh;background:#151c27;padding:14px;gap:10px}.list{width:340px;flex-shrink:0;background:#202936;border:1px solid #303c4c;border-radius:13px;overflow:auto;padding:15px}.list h2{font-size:20px}.thread{padding:14px;border-bottom:1px solid #394252;cursor:pointer;border-radius:9px}.thread:hover,.thread.selected{background:#174f35}.thread small{color:#a6b8cb}.thread p{margin:7px 0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.conversation{flex:1;min-width:0;display:flex;flex-direction:column;border:1px solid #303c4c;border-radius:13px;overflow:hidden;background:#1b2430}.conversation header{background:#202a38;padding:17px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid #374255;flex-wrap:wrap}.conversation header button{margin:3px;padding:8px;font-size:12px}#messages{flex:1;min-height:350px;overflow:auto;padding:25px;display:flex;flex-direction:column;gap:13px}.bubble{max-width:78%;padding:14px 17px;background:#394352;border-radius:16px;align-self:flex-start;white-space:pre-wrap;overflow-wrap:anywhere}.bubble.agent{align-self:flex-end;background:#57dd80;color:#092314}.bubble small{display:block;opacity:.75;margin-top:7px;font-size:11px}.conversation footer{background:#202a38;padding:15px;border-top:1px solid #394252}.conversation textarea{height:72px;resize:vertical}.panel{padding:25px;overflow:auto;flex:1;min-width:0;background:#151c27}.hidden{display:none!important}.card{background:#202a38;border:1px solid #394456;border-radius:14px;padding:22px;margin:14px 0;max-width:1100px}.card form{display:grid;grid-template-columns:repeat(2,minmax(180px,1fr));gap:14px}.card form button{grid-column:1/-1}.card h3{margin-top:0}.tablewrap{overflow-x:auto}table{width:100%;border-collapse:collapse;text-align:left}th,td{padding:12px;border-bottom:1px solid #3a4657}th{color:#80e2a4;background:#263546}code{overflow-wrap:anywhere;color:#b2dfcf}.login{min-height:100vh;display:grid;place-items:center}.login form{width:min(90vw,400px);background:#202a38;padding:35px;border-radius:18px}.login button{width:100%}#quick button{margin:3px;background:#315e50;color:#e7fff1}@media(max-width:1100px){aside{width:190px}.list{width:290px}}@media(max-width:780px){.layout{flex-direction:column}aside{width:100%;flex-direction:row;flex-wrap:wrap;padding:8px;align-items:center}aside h2{width:100%;margin:0}.main{flex-direction:column}.list{width:100%;max-height:300px}.conversation{min-height:65vh}.card form{grid-template-columns:1fr}}
/* Navigation groups and selected page */
aside .nav-label{font-size:11px;letter-spacing:.07em;text-transform:uppercase;color:#8b9bac;padding:17px 14px 6px;font-weight:700}aside button[data-nav]{display:block;width:100%;text-align:left;margin:2px 0;border-radius:9px;padding:11px 13px}aside button.nav-active{background:#087f44!important;color:#fff!important;font-weight:700}#setupContent>.card.hidden{display:none!important}#setupHeading{margin:0 0 22px}aside{overflow-y:auto;max-height:100vh} 

/* v0.6 explicit page navigation */
aside{position:sticky;top:0;height:100vh;gap:3px;padding:18px 12px}aside h2{margin:0 0 12px;font-size:19px}aside p{margin:0 0 10px}aside .nav-label{padding:14px 12px 4px}aside button[data-nav]{padding:10px 13px;margin:1px 0}aside a{margin-top:14px}.panel{width:100%;min-height:100vh}.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px}.stats .card{margin:0}.stats h1{font-size:36px;color:#5ee18b;margin:15px 0 0}.stats small{color:#aab8c9}#setupContent>.card:not(.hidden){animation:appear .12s ease}@keyframes appear{from{opacity:.7}to{opacity:1}}@media(max-width:780px){aside{position:relative;height:auto;max-height:none;gap:4px}aside .nav-label{width:100%}aside button[data-nav]{width:auto}}

/* v0.8 sidebar visual reference - intentionally scoped to avoid chat styling */
.layout>.oa-sidebar{width:252px;min-width:252px;background:#192331;color:#f5f7fa;padding:17px 9px 14px 19px;gap:0;display:flex;flex-direction:column;height:100vh;max-height:100vh;overflow-y:auto;border-right:1px solid #354052}
.oa-sidebar .oa-brand{display:flex;align-items:center;gap:9px;margin:0 0 12px;padding:0 8px 16px 0;border-bottom:1px solid #354052;font-size:14px;white-space:nowrap}
.oa-sidebar .oa-logo{display:grid;place-items:center;background:#06bc50;border-radius:7px;color:white;width:27px;height:27px;font-size:19px;font-weight:bold}
.oa-sidebar .oa-group{font-size:10px;color:#91a0b3;padding:15px 9px 6px;letter-spacing:0;font-weight:400;text-transform:none}
.layout>.oa-sidebar button[data-nav]{background:transparent;display:flex;align-items:center;gap:12px;width:100%;padding:9px 10px;border-radius:7px;margin:1px 0;color:#f4f6fa;text-align:left;font-size:12px;font-weight:400;min-height:35px}
.oa-sidebar button[data-nav] span,.oa-sidebar .oa-logout span{width:15px;display:inline-block;text-align:center;font-size:15px;flex-shrink:0}
.layout>.oa-sidebar button[data-nav]:hover{background:#263746}
.layout>.oa-sidebar button[data-nav].nav-active{background:#07833d!important;color:white!important;font-weight:700}
.oa-sidebar .oa-logout{margin:1px 0 0;padding:9px 10px;display:flex;align-items:center;gap:12px;font-size:12px;text-decoration:none;color:#f4f6fa}
.oa-sidebar .oa-logout:hover{background:#263746;border-radius:7px}
.oa-sidebar .oa-version{margin-top:auto;padding:12px 10px 0;font-size:10px;color:#708299}
@media(max-width:780px){.layout>.oa-sidebar{position:relative;width:100%;height:auto;max-height:none;flex-direction:column;align-items:stretch}.layout>.oa-sidebar button[data-nav]{width:100%}}

/* v0.9: left sidebar always visible, menu selection clearly marked */
.oa-sidebar .oa-account{color:#aab8ca;font-size:11px;padding:0 8px 10px;overflow-wrap:anywhere}
.layout>.oa-sidebar{position:sticky;top:0;flex-shrink:0}
.layout>.oa-sidebar button[data-nav]{flex-shrink:0}
@media(max-width:780px){.layout>.oa-sidebar{position:relative;top:auto}}

/* v1.0 form usability */
.field{display:flex;flex-direction:column;gap:5px}.field-wide{grid-column:1/-1}.field-wide textarea{min-height:170px;resize:vertical;line-height:1.65}.help{color:#b8c7d8;line-height:1.8}.status-pill{display:inline-block;border-radius:30px;padding:5px 11px;font-weight:bold}.status-pill.enabled{background:#104d30;color:#6af0a1}.status-pill.disabled{background:#572b36;color:#ff9bab}.small-btn{font-size:12px;padding:8px 10px;background:#315b4b}.small-btn.danger{background:#773744}.card form .field select{min-height:42px}.card form .field input{min-height:42px}

[hidden]{display:none!important}

/* Saved quick replies */
.reply-tools{display:flex;gap:10px;margin:12px 0;flex-wrap:wrap}.reply-tools input,.reply-tools select{flex:1;min-width:180px}.reply-body{white-space:pre-wrap;overflow-wrap:anywhere;max-width:480px}.reply-dialog{background:#202b3b;color:#fff;border:1px solid #43516a;border-radius:14px;padding:24px;width:min(620px,95vw);max-height:90vh;overflow:auto}.reply-dialog::backdrop{background:rgba(0,0,0,.7)}.reply-dialog form,.reply-dialog label{display:flex;flex-direction:column;gap:10px}.reply-dialog label{margin:12px 0}.reply-dialog input,.reply-dialog select,.reply-dialog textarea{width:100%;box-sizing:border-box;background:#303c4d;color:white;border:1px solid #4b5970;border-radius:8px;padding:12px;font:inherit}.reply-dialog-actions{display:flex;gap:12px;justify-content:flex-end;margin-top:18px}.reply-dialog-actions button{width:auto;padding:10px 18px}.reply-dialog-actions button[type=submit]{background:#00a54b}

/* Employee editor v2.5 */
.employee-actions{white-space:nowrap}.employee-actions button{margin:2px 3px}.employee-dialog{width:min(650px,95vw)}.employee-dialog form{display:flex;flex-direction:column;gap:5px}.employee-dialog label{display:flex;flex-direction:column;gap:7px}.employee-dialog input[readonly]{opacity:.7}.employee-dialog .secondary{background:#425064}.employee-dialog::backdrop{background:rgba(0,0,0,.78)}

.composer-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:8px}.composer-tools button{background:#334256;color:#e9f4ff;padding:9px 12px}.composer-tools .composer-send{background:#08a346;margin-left:auto}.composer-popup{margin-top:10px;padding:12px;background:#17202b;border:1px solid #465268;border-radius:10px}.composer-popup button{margin:4px;background:#345045}.emoji-grid,.sticker-grid{display:flex;flex-wrap:wrap;gap:4px}.emoji-grid button{font-size:20px}.composer-popup small{color:#9fb3c6}#mediaStatus{font-size:12px;color:#9ddbb3;margin-top:5px}#replyPickerList{display:flex;flex-wrap:wrap;gap:6px;margin-top:9px}#mediaInput[hidden]{display:none}

/* Saved reply picker */
#replyPickerList{max-height:280px;overflow-y:auto;display:grid;gap:7px;margin-top:10px}
#replyPickerList .reply-choice{width:100%;display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:5px;padding:10px 12px;background:#2d3a4d;color:#fff;border:1px solid #46556a;border-radius:8px;cursor:pointer}
#replyPickerList .reply-choice:hover{border-color:#06b547;background:#34465b}
#replyPickerList .reply-choice small{color:#b9c8d8;white-space:normal;overflow-wrap:anywhere}
#replyPickerList .reply-hint{font-size:12px;color:#aab8c9}

.status-pill.pending{background:#40371e;color:#fcd34d}.status-pill.oa-error{background:#4b2027;color:#fda4af}.employee-actions{white-space:nowrap}.employee-actions button{margin:2px}.tablewrap{overflow-x:auto}

/* v2.9: keep the original five toolbar buttons; show pickers as centered modals */
.composer-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.68);z-index:1100}
.composer-popup:not(.hidden){position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:min(580px,calc(100vw - 28px));max-height:min(75vh,700px);overflow:auto;z-index:1101;margin:0;padding:20px;background:#1e2938;border:1px solid #526177;border-radius:14px;box-shadow:0 24px 70px #0009}
.popup-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px;font-size:17px}
.composer-popup .popup-close{background:#344255;color:#fff;font-size:18px;line-height:1;padding:7px 11px;border-radius:8px;margin:0}
#replySearch{width:100%;box-sizing:border-box;margin-bottom:12px}
#replyPickerList{display:block;max-height:48vh;overflow-y:auto;overflow-x:hidden}
#replyPickerList .reply-choice{margin:0 0 8px 0;width:100%;box-sizing:border-box}
#replyPickerList .reply-choice.hidden{display:none}
.composer-popup .sticker-grid button{padding:12px}
.composer-popup .emoji-grid button{min-width:45px;min-height:43px}

/* v3.7: customer profile layout; no schema migration required */
.customer-row,.customer-heading{display:flex;align-items:center;gap:11px;min-width:0}
.customer-row-text,.customer-heading-text{display:flex;flex-direction:column;gap:3px;min-width:0}
.customer-row-text strong,.customer-heading-text strong{overflow-wrap:anywhere}
.customer-row-text small,.customer-heading-text small{display:block;font-weight:normal;color:#aebfd0;font-size:12px}
.customer-avatar{width:42px;height:42px;min-width:42px;border-radius:50%;object-fit:cover;background:#354658}
.avatar-fallback{display:flex;align-items:center;justify-content:center;font-size:21px}
.customer-heading .customer-avatar{width:38px;height:38px;min-width:38px}

/* v3.8: full-viewport chat workspace. Keep scrolling inside the inbox and messages,
   not on the browser page. Other admin pages remain independently scrollable. */
html,body{width:100%;min-height:100%;margin:0}
@media (min-width:781px){
  html,body{height:100%;overflow:hidden}
  .layout{width:100%;height:100dvh;min-height:0;overflow:hidden}
  .layout>.oa-sidebar{height:100dvh;max-height:100dvh;overflow-y:auto}
  .main{height:100dvh;min-height:0;min-width:0;width:100%;padding:8px;gap:8px;overflow:hidden}
  .main>.list{height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain}
  .main>.conversation{height:100%;min-height:0;overflow:hidden}
  .conversation header{flex:0 0 auto}
  #messages{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}
  .conversation footer{flex:0 0 auto}
  .conversation textarea{height:68px;max-height:22vh;resize:vertical}
  .panel{height:100dvh;min-height:0;overflow-y:auto}
}
@media (max-width:780px){
  html,body{overflow-x:hidden}
  .layout{min-height:100dvh}
  .main{width:100%;min-height:0}
  .conversation{min-height:70dvh}
  #messages{min-height:250px}
}

/* v3.9: chat fits the available viewport beside navigation without page scroll */
@media (min-width:781px){
  html,body{height:100%;overflow:hidden!important}
  .layout{display:flex!important;flex-direction:row!important;height:100vh!important;height:100dvh!important;min-height:0!important;max-height:100dvh!important;width:100%!important;overflow:hidden!important}
  .layout>.oa-sidebar{flex:0 0 252px!important;width:252px!important;min-width:0!important;height:100%!important;min-height:0!important;overflow-y:auto!important}
  .layout>.main{flex:1 1 0!important;width:0!important;min-width:0!important;min-height:0!important;height:100%!important;max-height:100%!important;overflow:hidden!important;display:flex!important;flex-direction:row!important}
  .main>.list{flex:0 0 320px!important;width:320px!important;min-width:0!important;height:100%!important;max-height:100%!important;overflow-y:auto!important}
  .main>.conversation{flex:1 1 0!important;width:0!important;min-width:0!important;min-height:0!important;height:100%!important;max-height:100%!important;overflow:hidden!important}
  .conversation>header{flex:0 0 auto!important;min-height:0!important}
  .conversation>#messages{flex:1 1 0!important;min-height:0!important;height:0!important;overflow-y:auto!important}
  .conversation>footer{flex:0 0 auto!important;min-height:0!important;padding:10px!important}
  .conversation>footer textarea{height:60px!important;min-height:0!important;margin:0!important}
  .conversation .composer-tools{margin-top:6px!important}
  .layout>.panel:not(.hidden){flex:1 1 0!important;width:0!important;height:100%!important;min-height:0!important;overflow-y:auto!important}
}
@media (min-width:781px) and (max-width:1100px){.layout>.oa-sidebar{flex-basis:190px!important;width:190px!important}.main>.list{flex-basis:270px!important;width:270px!important}}

/* v4.0 — consistent dark scrollbars across chat, inbox and navigation */
:root{color-scheme:dark}
#messages,.main>.list,.layout>.oa-sidebar,.panel,.composer-popup,#replyPickerList{scrollbar-color:#41546b #1b2532;scrollbar-width:thin}
#messages::-webkit-scrollbar,.main>.list::-webkit-scrollbar,.layout>.oa-sidebar::-webkit-scrollbar,.panel::-webkit-scrollbar,.composer-popup::-webkit-scrollbar,#replyPickerList::-webkit-scrollbar{width:10px;height:10px}
#messages::-webkit-scrollbar-track,.main>.list::-webkit-scrollbar-track,.layout>.oa-sidebar::-webkit-scrollbar-track,.panel::-webkit-scrollbar-track,.composer-popup::-webkit-scrollbar-track,#replyPickerList::-webkit-scrollbar-track{background:#1b2532;border-radius:10px}
#messages::-webkit-scrollbar-thumb,.main>.list::-webkit-scrollbar-thumb,.layout>.oa-sidebar::-webkit-scrollbar-thumb,.panel::-webkit-scrollbar-thumb,.composer-popup::-webkit-scrollbar-thumb,#replyPickerList::-webkit-scrollbar-thumb{background:#41546b;border:2px solid #1b2532;border-radius:10px}
#messages::-webkit-scrollbar-thumb:hover,.main>.list::-webkit-scrollbar-thumb:hover{background:#53718b}

/* v4.1: navigation pages must replace, never sit alongside, chat */
.layout>.main.hidden,.layout>.panel.hidden{display:none!important}
/* Consistent status indicators */
.thread{border-left:4px solid transparent}
.thread.waiting{border-left-color:#e6b94b}
.thread.working{border-left-color:#1abf72}
.thread.done{border-left-color:#71849b}
.thread-state{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-top:6px}
.thread-state small{color:#b5c4d5}
.chat-state{font-size:11px;font-weight:700;padding:3px 7px;border-radius:7px}
.chat-state.waiting{background:#59461f;color:#ffe29a}
.chat-state.working{background:#114b35;color:#9ef2c0}
.chat-state.done{background:#334456;color:#d1dbe7}
/* The inbox and chat remain side by side only on the chat page */
@media(min-width:781px){.layout>.panel:not(.hidden){display:block!important}}

/* v4.2 reporting */
.report-controls{display:flex;align-items:end;flex-wrap:wrap;gap:12px;margin:14px 0 20px}.report-controls label{display:flex;flex-direction:column;gap:6px;min-width:185px}.report-controls select,.report-controls input{background:#2e3a4d;color:#fff;border:1px solid #44536a;border-radius:8px;padding:10px}.report-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:14px}.report-summary>div{border:1px solid #40516a;background:#202c3d;border-radius:12px;padding:16px;display:flex;flex-direction:column;gap:8px}.report-summary small{color:#a7bdd1}.report-summary strong{font-size:18px}.report-table-wrap{overflow-x:auto;border:1px solid #40516a;border-radius:12px}.report-table{width:100%;border-collapse:collapse;min-width:760px}.report-table th,.report-table td{padding:14px 12px;text-align:left;border-bottom:1px solid #3a475a}.report-table th{background:#26384c;color:#8cf0b4}.report-late{color:#ffad7e;font-weight:700}.report-note{color:#a7bdd1;font-size:12px;line-height:1.7;margin-top:16px}@media(max-width:850px){.report-summary{grid-template-columns:1fr}}

/* v4.3: pending customer messages and close attribution */
.unanswered-count{display:inline-block;background:#74451d;color:#ffe1a8!important;border-radius:6px;padding:3px 7px;font-weight:bold;margin:2px 0 6px}
.closed-meta{display:block;color:#a9bed2;font-size:11px;margin-top:6px;line-height:1.5}
#actions>.closed-meta{width:100%;text-align:right;margin-top:3px}

/* v4.4: closure record inside the conversation, centered below the message history */
.chat-close-event{align-self:center;text-align:center;margin:14px auto 8px;max-width:90%;padding:9px 18px;background:#283647;border:1px solid #45586c;border-radius:20px;color:#b9d4e7;font-size:12px}
.chat-close-event .closed-meta{display:inline-block;color:inherit}

/* v4.7: readable, truthful per-message delivery state */
#messages .message-row{display:flex;flex-direction:column;max-width:85%;gap:4px;align-self:flex-start;min-width:0}
#messages .message-row.outgoing{align-self:flex-end;align-items:flex-end}
#messages .message-row.incoming{align-items:flex-start}
#messages .message-row .bubble{align-self:auto;max-width:100%;width:max-content;min-width:65px}
#messages .message-meta{display:flex;flex-wrap:wrap;gap:4px 9px;align-items:center;color:#b8c6d8;font-size:12px;line-height:1.4;max-width:100%}
#messages .outgoing .message-meta{justify-content:flex-end;text-align:right}
#messages .message-status{display:inline-block;border-radius:6px;padding:2px 6px;font-weight:600}
#messages .status-sent{background:#173e2c;color:#a2f4bf}
#messages .status-received{background:#263c51;color:#b8dcff}
#messages .message-meta time{white-space:nowrap;font-variant-numeric:tabular-nums}
#messages .message-agent{opacity:.9}

/* v4.8: compact message metadata, no delivery status labels */
#messages .message-meta{font-variant-numeric:tabular-nums}
#messages .message-status{display:none!important}

/* v5.1 design layer: preserve the v4.9 API, routes and management forms */
:root{--ui-bg:#111823;--ui-panel:#202a38;--ui-line:#354254;--ui-green:#08aa4c}
body{background:var(--ui-bg)}.layout>.oa-sidebar{width:260px;min-width:260px;background:linear-gradient(160deg,#202b3a,#141d29);padding:18px 12px}.oa-sidebar .oa-brand{font-size:18px;padding:3px 7px 18px;gap:13px}.oa-sidebar .oa-logo{width:46px;height:46px;border-radius:12px;font-size:25px;background:#08b64d}.oa-sidebar .oa-account{padding:9px 11px 15px}.layout>.oa-sidebar button[data-nav]{font-size:14px;min-height:44px;padding:11px 13px}.oa-sidebar .oa-group{font-size:11px;padding-top:19px}.layout>.oa-sidebar button[data-nav].nav-active{background:linear-gradient(90deg,#078c40,#08ae4c)!important}.oa-sidebar .oa-logout{margin-top:14px}
#chat.main{display:flex;flex-direction:column;min-height:100vh;height:100vh;padding:14px 12px;gap:12px;overflow:hidden}.chat-overview{flex:none}.welcome{padding:0 12px 13px}.welcome h2{margin:0 0 4px;font-size:23px}.welcome span{color:#a8b5c7}.chat-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.mini-stat{background:#202a38;border:1px solid #364254;border-radius:14px;min-height:88px;display:flex;align-items:center;gap:18px;padding:17px;font-weight:700}.mini-stat>span{display:grid;place-items:center;width:52px;height:52px;border-radius:13px;background:#124f36;font-size:25px;flex:none}.mini-stat strong{display:block;font-size:26px;margin-top:5px}.chat-workspace{display:flex;min-height:0;flex:1;gap:10px}.chat-workspace>.list{width:320px;flex:none;padding:0;background:#202a38}.list-top{display:flex;align-items:center;gap:8px;padding:13px}.list-top h2{font-size:18px;flex:1;margin:0}.list-top select{width:115px;min-width:0;margin:0;padding:9px}.list>input#search{width:calc(100% - 26px);margin:0 13px 10px}.chat-tabs{display:flex;gap:4px;padding:0 9px 12px;flex-wrap:wrap}.chat-tabs button{font-size:11px;background:#303c4d;padding:8px}.chat-tabs button.on{background:#00a84c}.chat-workspace>.conversation{flex:1;min-width:350px}.chat-workspace .conversation header{min-height:72px}.chat-workspace .conversation footer{padding:10px}.chat-workspace .conversation textarea{height:54px;min-height:54px;resize:none}.chat-workspace .composer-tools{display:flex;flex-wrap:wrap;gap:5px}.chat-workspace .composer-tools button{font-size:12px;padding:9px}.chat-workspace .composer-tools .composer-send{margin-left:auto;background:#00ad50}.chat-workspace #messages{min-height:0}.customer-panel{width:265px;flex:none;background:#202a38;border:1px solid #354254;border-radius:13px;overflow:auto}.customer-panel h2{font-size:17px;padding:17px;border-bottom:1px solid #354254;margin:0}.customer-panel h3{font-size:15px;padding:15px 17px;margin:0;border-top:1px solid #354254}.customer-info{padding:17px;color:#cbd7e5}.customer-profile-large{display:flex;flex-direction:column;align-items:center;gap:5px;text-align:center}.customer-profile-large img{width:70px!important;height:70px!important;border-radius:50%}.customer-profile-large strong{font-size:17px}.customer-line-id{text-align:center;color:#a6b6c9;font-size:12px;margin-top:13px}.customer-fact{display:flex;justify-content:space-between;gap:12px;padding:12px 16px;font-size:12px}.customer-fact span{color:#a9b8c9}.customer-fact b{text-align:right;overflow-wrap:anywhere}.thread{margin:0;border-radius:0;padding:13px}.thread.selected{background:#164a34}.thread .customer-row{align-items:center}.bubble.agent{background:#54dc81}.panel{background:#141c28}.card{max-width:none}.report-controls{flex-wrap:wrap}
@media(max-width:1450px){.customer-panel{width:230px}.chat-workspace>.list{width:290px}}@media(max-width:1180px){.customer-panel{display:none}}@media(max-width:850px){#chat.main{height:auto;min-height:100vh;overflow:visible}.chat-stats{grid-template-columns:1fr}.chat-workspace{flex-direction:column}.chat-workspace>.list{width:100%;max-height:360px}.chat-workspace>.conversation{min-height:650px;min-width:0}.layout>.oa-sidebar{width:200px;min-width:200px}}@media(max-width:780px){.layout>.oa-sidebar{width:100%;min-width:0}.chat-workspace>.conversation{min-height:65vh}}

/* v5.2 requested layout: stats exclusively on Dashboard, compact sidebar, customer details */
#chat.main{padding:10px;gap:0}#chat .chat-workspace{height:100%;flex:1}
#dashboard.panel{overflow:auto;padding:20px}#dashboard .chat-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:15px 0 22px}.dashboard-welcome h3{font-size:22px;margin:0}.dashboard-welcome p{color:#a7b7c8;margin:7px 0 0}
#dashboardContent>.stats{display:none}
.oa-sidebar .oa-brand{align-items:center}.oa-sidebar .oa-brand strong{display:block;font-size:17px}.oa-sidebar .oa-brand small{display:block;font-size:10px;color:#a8bad0;margin-top:5px}.oa-sidebar .oa-logo{font-size:11px;font-weight:900;background:#00b94f;border-radius:10px}
.oa-sidebar .oa-account{font-size:12px}.oa-sidebar button[data-nav]{position:relative;display:flex;gap:12px;align-items:center}.oa-sidebar button[data-nav] span{font-size:18px;min-width:20px;text-align:center}.sidebar-badge{margin-left:auto;background:#f43d58;color:#fff;border-radius:20px;padding:2px 8px;font-size:12px}
.oa-sidebar-divider{height:1px;background:#354153;margin:16px 0}.oa-sidebar-oa-title{font-size:13px;font-weight:700;margin:10px 7px}.oa-sidebar-oa-list{display:flex;flex-direction:column;gap:4px;max-height:34vh;overflow:auto}.oa-sidebar .oa-sidebar-oa{display:flex;align-items:center;gap:10px;text-align:left;background:transparent;border:0;border-radius:8px;padding:10px;font-size:12px;min-height:34px;color:#d8e5f4;cursor:pointer}.oa-sidebar .oa-sidebar-oa:hover{background:#304154}.oa-sidebar-dot{display:inline-block;width:11px;height:11px;border-radius:50%;background:#23d879;flex:none}.sidebar-empty{padding:12px;color:#9eacbd}.oa-sidebar .oa-logout{font-size:12px}
.customer-panel{display:block!important}.customer-panel h3{margin-top:14px}.customer-activity{padding:16px;font-size:12px;color:#9fb4c9}.customer-panel .customer-info{min-height:100px}.customer-panel #customerMeta{border-top:1px solid #354254}
@media(max-width:1180px){.customer-panel{width:220px!important}}@media(max-width:1000px){.customer-panel{display:none!important}}@media(max-width:850px){#dashboard .chat-stats{grid-template-columns:1fr}}

/* v5.3: timeline, conditional customer panel, real per-OA pending-customer badges */
#chat .customer-panel.hidden{display:none!important}
#chat .customer-panel:not(.hidden){display:block!important}
#chat .chat-workspace>.conversation{flex:1;min-width:0}
.oa-sidebar-oa .oa-sidebar-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.oa-unread-badge{display:inline-flex;align-items:center;justify-content:center;min-width:23px;height:23px;padding:0 6px;border-radius:14px;background:#f43c56;color:#fff;font-size:12px;font-weight:700}
.oa-sidebar .oa-sidebar-oa.oa-selected{background:#087f3e;color:white}
.activity-timeline{list-style:none;margin:0;padding:0 0 0 18px;border-left:2px solid #39cb79}
.activity-timeline li{position:relative;padding:0 0 17px 15px;line-height:1.5}
.activity-timeline li::before{content:'';position:absolute;left:-25px;top:3px;width:10px;height:10px;border-radius:50%;background:#48db85;border:2px solid #202a38}
.activity-timeline strong{display:block;font-size:12px;color:#e7eff8;font-weight:500}
.activity-timeline time{display:block;color:#aebed0;font-size:11px;margin-top:3px;font-variant-numeric:tabular-nums}
.activity-empty{color:#aebed0}
@media(max-width:1000px){#chat .customer-panel:not(.hidden){display:none!important}}

/* v5.5: agent transfer dropdown */
#actions .transfer-agent{max-width:205px;min-width:145px;background:#0b9e4a;color:#fff;border:1px solid #158b50;border-radius:8px;padding:8px 9px;font:inherit;cursor:pointer}#actions .transfer-agent option{background:#202c3d;color:#fff}#actions .transfer-agent:disabled{opacity:.55;cursor:wait}

/* Customer rename action in the customer panel heading */
.customer-panel-title{display:flex;align-items:center;justify-content:space-between;gap:8px}
.customer-rename-btn{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:500;white-space:nowrap;background:#2b3b4e;color:#d7f9e5;border:1px solid #435568;border-radius:7px;padding:6px 9px;cursor:pointer}
.customer-rename-btn:hover{background:#155e3b;border-color:#19a65a;color:#fff}

/* v5.6: single-row compact chat header, based on the requested third reference */
#chat .conversation>header{display:flex;align-items:center;flex-wrap:nowrap;gap:14px;min-height:70px;padding:10px 16px;background:#202938}
#chat .conversation>header>#title{flex:1 1 180px;min-width:130px;font-weight:400}
#chat .conversation>header .customer-heading{display:flex;align-items:center;gap:10px;min-width:0}
#chat .conversation>header .customer-heading .customer-avatar{width:39px;height:39px;flex:none}
#chat .conversation>header .customer-heading-text{display:flex;flex-direction:column;min-width:0}
#chat .conversation>header .customer-heading-text strong{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#chat .conversation>header .customer-heading-text small{font-size:10px;color:#b2c1d1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#chat #actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex:0 1 auto;min-width:0;flex-wrap:nowrap}
#chat #actions button,#chat #actions select{margin:0!important;flex:none;font-size:12px;border-radius:20px;padding:8px 12px;white-space:nowrap}
#chat #actions .chat-status-pill{display:inline-flex;align-items:center;border-radius:20px;background:#0c5b3d;color:#55ec91;padding:6px 10px;font-size:11px;white-space:nowrap}
#chat #actions .lock-state{font-size:12px;white-space:nowrap;color:#c9d5e3;max-width:200px;overflow:hidden;text-overflow:ellipsis}
#chat #actions .chat-claim-btn{background:transparent;color:#3ce07c;border:1px solid #148b4d}
#chat #actions .transfer-agent{background:transparent;color:#d3deec;border:1px solid #536071;max-width:145px;min-width:125px;border-radius:20px}
#chat #actions .chat-close-btn{background:transparent;color:#d3deec;border:1px solid #536071}
#chat #actions .chat-active-btn{display:none}
@media(max-width:1450px){#chat .conversation>header{gap:7px;padding:9px}#chat #actions{gap:5px}#chat #actions .lock-state{max-width:110px}#chat #actions .transfer-agent{max-width:125px;min-width:110px}}
@media(max-width:1150px){#chat .conversation>header{flex-wrap:wrap}#chat #actions{flex-wrap:wrap;justify-content:flex-start}#chat .conversation>header>#title{flex-basis:100%}}

/* v5.7: make original LINE name and employee nickname visible and readable */
#chat .conversation>header{min-height:88px;padding:12px 20px;gap:16px}
#chat .conversation>header>#title{flex:1 1 240px;min-width:200px}
#chat .conversation>header .customer-heading{gap:14px}
#chat .conversation>header .customer-heading .customer-avatar{width:52px;height:52px}
#chat .conversation>header .customer-heading-text strong{font-size:19px;line-height:1.3;font-weight:750}
#chat .conversation>header .customer-heading-text small{font-size:12px;line-height:1.4}
#chat .customer-row-text strong{font-size:15px}
#chat .customer-row-text small{line-height:1.45}
#chat .customer-profile-large strong{font-size:19px}
#chat .customer-profile-large small{display:block;font-size:13px;color:#a9f3c4;margin-top:4px}
@media(max-width:1450px){#chat .conversation>header{padding:10px 12px;gap:8px}#chat .conversation>header>#title{min-width:175px;flex-basis:175px}#chat .conversation>header .customer-heading .customer-avatar{width:45px;height:45px}#chat .conversation>header .customer-heading-text strong{font-size:17px}}

/* v5.8.1: retain three-column inbox layout when no conversation is selected. */
#chat .customer-panel.chat-empty-customer{display:block!important;}
#chat .customer-panel.chat-empty-customer .customer-panel-title button,
#chat .customer-panel.chat-empty-customer #customerInfo,
#chat .customer-panel.chat-empty-customer #customerMeta,
#chat .customer-panel.chat-empty-customer h3,
#chat .customer-panel.chat-empty-customer #customerActivity{display:none!important;}
#chat.chat-no-selection .conversation footer{visibility:hidden;pointer-events:none;}
@media(max-width:1000px){#chat .customer-panel.chat-empty-customer{display:none!important;}}

/* v5.9.1: mobile-only interface; desktop styles stay intact. */
.mobile-topbar,.mobile-sidebar-shade,.mobile-chat-nav,.mobile-customer-nav{display:none}
@media(max-width:780px){
 html,body{width:100%;overflow-x:hidden}
 .mobile-topbar{height:56px;display:flex;align-items:center;gap:12px;padding:0 14px;background:#202b3a;border-bottom:1px solid #384759;position:fixed;top:0;left:0;right:0;z-index:110}
 .mobile-topbar button{background:#0a9f4d;font-size:20px;padding:7px 12px;min-width:42px}
 .mobile-topbar strong{font-size:14px;white-space:nowrap}
 .mobile-topbar span{font-size:12px;color:#b4c4d6;margin-left:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .layout{display:block!important;padding-top:56px;min-height:100dvh}
 .layout>.oa-sidebar{position:fixed!important;top:56px;bottom:0;left:0;width:min(82vw,300px)!important;min-width:0!important;height:auto;overflow-y:auto;z-index:120;transform:translateX(-105%);transition:transform .2s ease;box-shadow:8px 0 20px #0005}
 .mobile-menu-open .layout>.oa-sidebar{transform:translateX(0)}
 .mobile-sidebar-shade{position:fixed;inset:56px 0 0;background:#0009;z-index:115}
 .mobile-menu-open .mobile-sidebar-shade{display:block}
 .main,.panel{width:100%;min-width:0;max-width:100%;padding:12px!important}
 #chat.main{height:calc(100dvh - 56px)!important;min-height:0!important;overflow:hidden!important;padding:0!important}
 #chat .chat-workspace{height:100%;min-height:0;display:block!important;position:relative}
 #chat .chat-workspace>.list{width:100%!important;max-height:none!important;height:100%;overflow-y:auto;border-radius:0}
 #chat .chat-workspace>.conversation{display:none!important;width:100%;height:100%;min-height:0!important;border-radius:0}
 body.mobile-chat-open #chat .chat-workspace>.list{display:none!important}
 body.mobile-chat-open #chat .chat-workspace>.conversation{display:flex!important}
 .mobile-chat-nav{display:flex;justify-content:space-between;gap:8px;padding:7px 10px;background:#202b3a;border-bottom:1px solid #384759}
 .mobile-chat-nav button,.mobile-customer-nav button{font-size:12px;padding:9px 11px;background:#2c4056}
 #chat .conversation>header{min-height:60px;padding:8px 10px;gap:8px}
 #chat .conversation>header>#title{flex-basis:100%;min-width:0}
 #chat #actions{width:100%;justify-content:flex-start;overflow-x:auto;flex-wrap:nowrap;padding-bottom:4px}
 #chat #actions button,#chat #actions select{flex-shrink:0}
 #chat .conversation footer{padding:8px!important;flex:none}
 #chat .conversation textarea{min-height:44px;height:44px}
 #chat .composer-tools{gap:5px;overflow-x:auto;flex-wrap:nowrap;padding-bottom:4px}
 #chat .composer-tools button{white-space:nowrap;flex:none;padding:9px 10px}
 #chat #messages{flex:1;overflow-y:auto;min-height:0;padding:12px}
 #chat .customer-panel,#chat .customer-panel.hidden,#chat .customer-panel:not(.hidden){display:none!important}
 body.mobile-customer-open #chat .customer-panel:not(.chat-empty-customer){display:block!important;position:fixed;z-index:105;top:56px;right:0;bottom:0;width:min(100vw,360px)!important;max-width:100%;overflow:auto;border-radius:0;box-shadow:-8px 0 25px #0007}
 .mobile-customer-nav{display:block;padding:9px;border-bottom:1px solid #39485a}
 #dashboard .chat-stats,.report-summary{grid-template-columns:1fr!important}
 .report-controls label{min-width:0;flex:1 1 100%}
 .report-controls button{width:100%}
 .report-table-wrap{max-width:calc(100vw - 24px);overflow-x:auto}
 .card,.panel{overflow-wrap:anywhere}
 input,select,textarea{font-size:16px}
}

/* v5.9.3 mobile readability and interaction improvements */
.inbox-heading-button{border:0;background:transparent;color:inherit;font:inherit;font-weight:700;display:flex;align-items:center;gap:5px;padding:0;cursor:pointer;text-align:left}
.inbox-heading-arrow{font-size:22px;line-height:1;opacity:.75}
@media(min-width:781px){.inbox-heading-arrow{display:none}}
@media(max-width:780px){
  /* Only claim and close controls appear in the compact mobile chat header. */
  #chat #actions .chat-status-pill,#chat #actions .lock-state,#chat #actions .transfer-agent,#chat #actions .chat-active-btn{display:none!important}
  #chat #actions{display:flex!important;flex-wrap:nowrap!important;overflow:visible!important;gap:8px;align-items:center;padding:2px 0 5px}
  #chat #actions .chat-claim-btn,#chat #actions .chat-close-btn{min-height:36px;padding:8px 13px!important;font-size:12px;flex:0 0 auto}
  #chat .conversation>header{align-items:center;gap:5px}
  #chat .customer-heading-text strong{font-size:17px;line-height:1.3}
  #chat .composer-tools{overflow:visible!important;display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr)) 48px;gap:5px!important;padding-bottom:0}
  #chat .composer-tools button{display:flex;align-items:center;justify-content:center;min-width:0;min-height:43px;padding:7px 4px!important;border-radius:10px;font-size:19px!important}
  #chat .composer-tools .tool-label{display:none}
  #chat .composer-tools .tool-icon{display:inline}
  #chat .composer-tools .composer-send{font-size:0!important;width:48px;margin-left:0}
  #chat .composer-tools .composer-send span{font-size:20px;line-height:1}
  #chat .conversation footer{padding:9px!important}
  #chat .conversation textarea{height:64px;min-height:64px;max-height:160px;resize:vertical;line-height:1.5}
  /* Management pages: stack form fields, keep actions usable, avoid clipped tables. */
  #setup,#reports,#dashboard{padding:14px 12px!important;width:100%;min-width:0;overflow-x:hidden}
  #setupContent{min-width:0;max-width:100%}
  #setupContent>.card{padding:15px 12px!important;margin:0 0 12px;border-radius:12px;max-width:100%}
  #setupContent form,#setupContent .form-grid,#setupContent .fields{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;max-width:100%}
  #setupContent label,#setupContent input,#setupContent select,#setupContent textarea{min-width:0;max-width:100%;width:100%;box-sizing:border-box}
  #setupContent .tablewrap,.report-table-wrap{overflow-x:auto!important;max-width:100%;-webkit-overflow-scrolling:touch}
  #setupContent table{min-width:650px}
  #setupContent td,#setupContent th{white-space:normal;vertical-align:middle}
  #setupContent td button{margin:2px;min-height:34px}
  .report-summary{grid-template-columns:1fr!important;gap:9px}
  .report-controls{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px}
  .report-controls label,.report-controls input,.report-controls select,.report-controls button{width:100%;min-width:0;box-sizing:border-box}
  .report-table{min-width:700px}
  #setup h2,#reports h2{font-size:20px;line-height:1.4}
}

/* v5.9.4: compact mobile chat action overflow menu */
.mobile-chat-menu{display:none}
@media(max-width:780px){
 #chat .conversation>header{position:relative;display:flex!important;flex-wrap:nowrap!important;align-items:center!important;gap:8px!important;min-height:70px!important;padding:9px 12px!important;overflow:visible!important}
 #chat .conversation>header>#title{flex:1 1 0!important;min-width:0!important;max-width:calc(100% - 55px)!important}
 #chat #actions{display:flex!important;flex:0 0 auto!important;width:42px!important;min-width:42px!important;max-width:42px!important;margin-left:auto!important;overflow:visible!important;justify-content:flex-end!important;padding:0!important}
 #chat #actions>.chat-claim-btn,#chat #actions>.chat-close-btn,#chat #actions>.transfer-agent,#chat #actions>.chat-active-btn,#chat #actions>.chat-status-pill,#chat #actions>.lock-state{display:none!important}
 #chat #actions .mobile-chat-menu{display:block!important;position:relative;z-index:80}
 #chat #actions .mobile-chat-menu-trigger{display:flex!important;align-items:center;justify-content:center;width:40px!important;height:40px!important;min-width:40px!important;padding:0!important;border:1px solid #536477!important;border-radius:12px!important;background:#2c3b4d!important;color:white!important;font-size:28px!important;line-height:1!important;cursor:pointer}
 #chat #actions .mobile-chat-menu-panel{position:absolute;top:calc(100% + 8px);right:0;z-index:100;width:210px;max-width:calc(100vw - 24px);padding:8px;background:#263449;border:1px solid #4a5a6d;border-radius:12px;box-shadow:0 12px 28px #0009;display:flex;flex-direction:column;gap:6px}
 #chat #actions .mobile-chat-menu-panel[hidden]{display:none!important}
 #chat #actions .mobile-chat-menu-panel button{width:100%;border-radius:8px!important;text-align:left!important;white-space:normal!important;min-height:40px;padding:9px 12px!important;background:#344459;color:#fff;border:1px solid #45566b;font-size:14px!important}
 #chat #actions .mobile-chat-menu-panel button:first-child{color:#4af296}
 #chat #actions .mobile-chat-menu-panel button:last-child{color:#ffb7b7}
 #chat #actions .mobile-transfer-label{font-size:13px;color:#dbe6f4;padding:5px 4px 0}
 #chat #actions .mobile-chat-menu-panel select{width:100%;max-width:100%;min-width:0;box-sizing:border-box;border-radius:8px!important;background:#344459!important;color:#fff!important;border:1px solid #536477!important;min-height:42px;padding:8px!important;font-size:13px!important}
}

/* Desktop send button label; mobile remains icon-only */
@media(min-width:781px){#chat .composer-tools .composer-send{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:125px;white-space:nowrap;font-size:13px!important;font-weight:700;padding:9px 13px}}
@media(max-width:780px){#chat .composer-tools .composer-send .send-label{display:none!important}}

/* Rich media in chat; scoped to messages and sticker picker. */
#messages .chat-image{display:block;max-width:min(320px,72vw);max-height:320px;width:auto;height:auto;object-fit:contain;border-radius:12px}
#messages .chat-sticker{display:block;width:140px;max-width:45vw;height:auto;object-fit:contain}
#messages .chat-file{display:inline-flex;align-items:center;max-width:100%;overflow-wrap:anywhere;word-break:break-word;color:inherit;text-decoration:underline}
#messages .bubble:has(.chat-image),#messages .bubble:has(.chat-sticker){background:transparent;padding:0;box-shadow:none}
.sticker-grid .sticker-option{width:72px;height:72px;object-fit:contain;display:block}
.sticker-grid button{display:flex;justify-content:center;align-items:center;min-width:88px;min-height:88px}

/* v5.9.9: more LINE sticker choices; other UI unchanged */
#lineStickerGrid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;max-height:340px;overflow-y:auto;overscroll-behavior:contain;padding:4px;align-content:start}
#lineStickerGrid button{margin:0;min-width:0;min-height:0;aspect-ratio:1;padding:6px;border-radius:10px}
#lineStickerGrid .sticker-option{width:100%;height:100%;max-height:84px;object-fit:contain}
@media(max-width:780px){#lineStickerGrid{grid-template-columns:repeat(4,minmax(0,1fr));max-height:55vh;gap:6px}#lineStickerGrid button{padding:4px}}

/* Customer name/avatar opens LINE OA Manager without navigating away from inbox */
.line-oa-customer-link{display:flex;align-items:center;flex-direction:column;gap:5px;border:0;background:transparent;color:inherit;padding:0;cursor:pointer;font:inherit;max-width:100%;text-align:center}
.line-oa-customer-link:hover strong{text-decoration:underline;text-decoration-color:#28d678}
.line-oa-customer-link:focus-visible{outline:2px solid #28d678;outline-offset:4px;border-radius:8px}
.line-oa-header-link{flex-direction:row;text-align:left;gap:14px;min-width:0}
.line-oa-header-link .customer-heading-text{align-items:flex-start}
