.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.mobile-menu a{display:flex;align-items:center;gap:12px}
.drawer-icon{width:25px;height:25px;flex:0 0 25px;display:grid;place-items:center;border-radius:8px;background:rgba(57,169,255,.1);border:1px solid rgba(57,169,255,.15);color:var(--cyan);font-family:Arial,sans-serif;font-size:15px;font-weight:800;line-height:1}
.chat-panel{min-width:0;height:620px;min-height:520px;max-height:calc(100dvh - 140px);display:flex;flex-direction:column}
.chat-toolbar{min-height:66px;padding:10px 16px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:14px;background:rgba(57,169,255,.035)}
.chat-toolbar label{display:flex;align-items:center;gap:10px;min-width:0}
.chat-toolbar select{width:min(260px,45vw);padding-block:8px}
.chat-toolbar>span{display:flex;align-items:center;gap:8px;color:var(--green);font-size:11px}
.chat-toolbar.reconnecting>span{color:var(--amber)}
.chat-toolbar.reconnecting>span:after{content:"در حال اتصال…"}
.message-list{flex:1 1 auto;height:auto;min-height:0;max-height:none;overflow-y:auto;overflow-x:hidden;scroll-behavior:smooth;scrollbar-gutter:stable;overscroll-behavior:contain}
.message-row{width:fit-content;max-width:min(76%,560px);flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-start;align-self:flex-start;gap:4px}
.message-row.mine{align-items:flex-end;align-self:flex-end}
.message-row .message{width:fit-content;max-width:100%;min-width:44px;padding:10px 13px;align-self:auto;border-radius:16px 16px 5px 16px;background:#153254;overflow:visible;overflow-wrap:anywhere;line-height:1.5;text-align:right}
.message-row.mine .message{background:linear-gradient(135deg,#1677ff,#0c63ce);border-radius:16px 16px 16px 5px}
.message-body{width:auto;white-space:pre-wrap}
.message-meta{display:block;padding-inline:4px;color:var(--muted);font-size:9px;line-height:1.35;white-space:nowrap;opacity:.72}
.chat-image{display:block;margin-top:8px;border-radius:11px;overflow:hidden;background:rgba(0,0,0,.18)}
.chat-image img{display:block;width:min(360px,100%);max-height:320px;object-fit:contain}
.chat-document{min-width:210px;margin-top:8px;padding:10px;display:grid;grid-template-columns:42px 1fr;gap:2px 10px;align-items:center;border:1px solid rgba(255,255,255,.15);border-radius:11px;background:rgba(0,0,0,.14);color:inherit}
.chat-document>span{grid-row:1/3;width:42px;height:42px;display:grid;place-items:center;border-radius:9px;background:rgba(255,97,116,.15);color:#ff9aa6;font:700 10px Arial,sans-serif}
.chat-document b{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-document small{margin:0!important;font-size:9px!important}
.chat-file-preview{margin:10px 14px 0;padding:8px 10px;display:flex;align-items:center;gap:9px;border:1px solid rgba(57,169,255,.22);border-radius:11px;background:rgba(57,169,255,.07);font-size:11px}
.chat-file-preview[hidden]{display:none}
.chat-file-preview>span{padding:4px 6px;border-radius:6px;background:var(--blue);color:#fff;font:700 9px Arial,sans-serif}
.chat-file-preview b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-file-preview button{margin-right:auto;border:0;background:none;color:var(--muted);font-size:20px;cursor:pointer}
.chat-compose{align-items:center}
.chat-attach{position:relative;width:42px;height:42px;flex:0 0 42px;display:grid;place-items:center;border:1px solid var(--line);border-radius:11px;background:rgba(255,255,255,.04);color:var(--cyan);cursor:pointer}
.chat-attach input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.chat-attach>span:not(.sr-only){font-size:24px;line-height:1}
.chat-compose>input{min-width:0}
.empty-state.compact{padding:38px 18px;margin:auto;width:min(100%,520px)}
.order-note{grid-column:1/-1;padding:9px 11px;border-radius:9px;background:rgba(57,169,255,.06);color:var(--muted);line-height:1.7}
.order-note.rejected{background:rgba(255,97,116,.08);color:#ff9aa6}
.order-note b{color:inherit}
html[data-theme=light] .chat-toolbar{background:#f5f9fd}
html[data-theme=light] .message-row:not(.mine) .message{background:#dfeaf6;color:#102235}
html[data-theme=light] .chat-attach{background:#f5f9fd}
@media(max-width:620px){
  .drawer-icon{width:27px;height:27px;flex-basis:27px}
  .chat-layout{width:100%;padding-bottom:30px}
  .chat-panel{height:calc(100dvh - 96px);min-height:460px;max-height:680px;border-radius:0;border-inline:0}
  .message-list{flex:1 1 0;height:0;min-height:0;max-height:none;overflow-y:auto;padding:14px;-webkit-overflow-scrolling:touch}
  .message-row{max-width:82%;gap:5px}
  .message-row .message{padding:9px 12px}
  .chat-toolbar{padding:9px 12px}
  .chat-toolbar label{flex:1}
  .chat-toolbar select{width:100%}
  .chat-compose{position:static;flex:0 0 auto;padding:10px;gap:7px;background:var(--surface);padding-bottom:max(10px,env(safe-area-inset-bottom))}
  .chat-compose .button{padding-inline:13px}
  .chat-file-preview{margin-inline:10px}
  .chat-image img{max-height:250px}
  .order-note{grid-column:1/-1}
}
