/* «Modmail» — the partner cabinet's dashboard of the personal Modmail bot (pmodmail.js). Builds on
   partner.css, theme-allan.css and pbot.css (pb-bar, pb-panel, pb-f, pb-check, pb-seg, pb-chip,
   pb-callout, pb-modal, pb-embed …), the same way as the DMALL tab. */
#app[data-pane="modmail"] #p-cards,#app[data-pane="modmail"] #xp-edit,#app[data-pane="modmail"] #xp-dm{display:none}
#mm-root{display:flex;flex-direction:column;gap:16px;min-width:0}
#mm-root .pb-bar,#mm-root .pb-cards,#mm-root .pb-panel,#mm-root .pb-callout{margin-bottom:0}
.mm-head-act{display:flex;gap:8px;flex-wrap:wrap}
.mm-head-act a.btn{text-decoration:none}
.pb-chip.r{background:rgba(248,113,113,.15);color:#fca5a5}

/* avatars */
.mm-av{width:40px;height:40px;flex:none;border-radius:50%;background:#334155;color:#e2e8f0;display:grid;place-items:center;overflow:hidden;font-weight:700;font-size:16px}
.mm-av img{width:100%;height:100%;object-fit:cover}
.mm-av.sm{width:24px;height:24px;font-size:11px}
.mm-av.md{width:56px;height:56px;font-size:20px}
.mm-av.lg{width:48px;height:48px;font-size:18px}
.mm-av.xl{width:84px;height:84px;font-size:30px;border:6px solid #111214;box-sizing:content-box}

/* bot bar + server switch */
.mm-botbar{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;padding:12px 16px}
.mm-bot{display:flex;align-items:center;gap:12px;min-width:0}
.mm-bot-av{position:relative;flex:none}
.mm-dot{position:absolute;right:-1px;bottom:-1px;width:12px;height:12px;border-radius:50%;border:3px solid var(--panel);background:#64748b}
.mm-dot.on{background:#23a55a}.mm-dot.idle{background:#f0b232}.mm-dot.dnd{background:#f23f43}
.mm-bot-t{display:flex;flex-direction:column;min-width:0}
.mm-bot-t b{font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mm-srvs{display:flex;gap:6px;flex-wrap:wrap;min-width:0}
.mm-srv{display:inline-flex;align-items:center;gap:8px;max-width:240px;background:var(--panel-2);border:1px solid var(--stroke-2);border-radius:10px;padding:6px 10px;color:var(--muted);font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.mm-srv span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.mm-srv:hover{color:var(--text);border-color:rgba(129,140,248,.5)}
.mm-srv.on{color:var(--text);border-color:rgba(129,140,248,.8);background:rgba(79,70,229,.18)}
.mm-srv em{font-style:normal;font-size:11.5px;font-weight:700;background:#f59e0b;color:#111827;border-radius:999px;padding:0 6px}
.mm-sdot{width:8px;height:8px;border-radius:50%;flex:none}
.mm-sdot.g{background:#34d399}.mm-sdot.a{background:#f59e0b}
.mm-one{display:inline-flex;align-items:center;gap:8px;min-width:0}
.mm-one b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.mm-warn{border-color:rgba(245,158,11,.45);background:rgba(245,158,11,.08)}
.mm-setup{display:flex;flex-direction:column;gap:12px}
.mm-setup h3,.mm-setup p{margin:0}
.mm-left{justify-content:flex-start}
.mm-tabs{display:flex;min-width:0;overflow-x:auto;scrollbar-width:none}
.mm-tabs::-webkit-scrollbar{display:none}
.mm-tabs .pb-seg{flex:none}
.mm-tabs .pb-seg-b{font-size:14px;padding:8px 14px;white-space:nowrap}

/* role chips */
.mm-roles{display:flex;flex-wrap:wrap;gap:6px}
.mm-role{display:inline-flex;align-items:center;gap:7px;background:var(--panel-2);border:1px solid var(--stroke-2);border-radius:999px;padding:5px 12px;color:var(--muted);font:inherit;font-size:13.5px;font-weight:600;cursor:pointer}
.mm-role i{width:10px;height:10px;border-radius:50%;flex:none}
.mm-role:hover{color:var(--text)}
.mm-role.on{color:var(--text);border-color:rgba(129,140,248,.8);background:rgba(79,70,229,.2)}

/* tickets: list + conversation */
.mm-tk{display:grid;grid-template-columns:minmax(280px,360px) minmax(0,1fr);gap:16px;align-items:start}
.mm-lcol{display:flex;flex-direction:column;gap:10px;min-width:0;background:var(--panel);border:1px solid var(--glass-bd,var(--stroke));border-radius:12px;padding:12px}
.mm-lhead{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.mm-search{position:relative;display:flex;align-items:center;min-width:0}
.mm-search svg{position:absolute;left:12px;width:16px;height:16px;color:var(--muted);pointer-events:none}
.mm-search input{width:100%;box-sizing:border-box;padding-left:36px;min-height:40px}
.mm-list{display:flex;flex-direction:column;gap:4px;max-height:640px;overflow-y:auto;margin:0 -4px;padding:0 4px}
.mm-it{display:flex;gap:10px;align-items:flex-start;width:100%;text-align:left;background:transparent;border:1px solid transparent;border-radius:10px;padding:10px;color:var(--text);font:inherit;cursor:pointer;min-width:0}
.mm-it:hover{background:#1e293b}
.mm-it.on{background:rgba(79,70,229,.18);border-color:rgba(129,140,248,.5)}
.mm-it-b{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.mm-it-h{display:flex;align-items:baseline;gap:6px;min-width:0}
.mm-it-h b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.mm-it-t{margin-left:auto;font-size:12px;color:var(--muted);white-space:nowrap;flex:none}
.mm-it-x{font-size:13.5px;color:#cbd5e1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.mm-it-c{display:flex;gap:4px;flex-wrap:wrap}
.mm-it-c:empty{display:none}
.mm-pager{display:flex;align-items:center;justify-content:center;gap:10px}
.mm-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;text-align:center;padding:28px 12px;color:var(--muted)}
.mm-empty svg{width:34px;height:34px;opacity:.7}
.mm-empty b{color:var(--text)}

.mm-conv{display:flex;flex-direction:column;min-width:0;background:var(--panel);border:1px solid var(--glass-bd,var(--stroke));border-radius:12px;overflow:hidden}
.mm-conv-empty{align-items:center;justify-content:center;gap:8px;min-height:360px;text-align:center;padding:20px;color:var(--muted)}
.mm-conv-empty svg{width:44px;height:44px;opacity:.6}
.mm-conv-empty b{color:var(--text);font-size:16px}
.mm-ch{display:flex;align-items:flex-start;gap:12px;padding:14px 16px;border-bottom:1px solid var(--stroke);flex-wrap:wrap}
.mm-backbtn{display:none;width:36px;height:36px;flex:none;border-radius:8px;border:1px solid var(--stroke-2);background:transparent;color:var(--text);place-items:center;cursor:pointer;padding:0}
.mm-backbtn svg{width:18px;height:18px}
.mm-ch-t{flex:1;min-width:200px;display:flex;flex-direction:column;gap:4px}
.mm-ch-n{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.mm-ch-n b{font-size:16.5px}
.mm-ch-m{display:flex;flex-wrap:wrap;gap:4px 14px}
.mm-copy{background:none;border:0;padding:0;color:#a5b4fc;font:inherit;cursor:pointer}
.mm-copy:hover{text-decoration:underline}
.mm-ch-a{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.mm-ch-a a.btn{text-decoration:none;display:inline-flex;align-items:center;gap:6px}
.mm-ch-a svg{width:14px;height:14px}
.mm-msgs{background:#313338;padding:12px 16px;display:flex;flex-direction:column;gap:2px;max-height:520px;min-height:240px;overflow-y:auto}
.mm-m{display:flex;gap:12px;padding:6px 8px;border-radius:6px;color:#dbdee1;min-width:0}
.mm-m:hover{background:rgba(0,0,0,.08)}
.mm-m .mm-av{width:38px;height:38px;font-size:15px}
.mm-m.note{background:rgba(240,178,50,.08);border-left:3px solid #f0b232}
.mm-m-b{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.mm-m-h{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:13px}
.mm-m-h b{color:#f2f3f5;font-size:15px}
.mm-m.staff .mm-m-h b{color:#a5b4fc}
.mm-m-t{color:#949ba4;font-size:12px}
.mm-tag{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.02em;background:#4e5058;color:#fff;border-radius:3px;padding:1px 5px}
.mm-tag.u{background:#248046}
.mm-tag.n{background:#a16207}
.mm-m-x{font-size:15px;line-height:1.45;overflow-wrap:anywhere}
.mm-files{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.mm-img img{display:block;max-width:min(320px,100%);max-height:260px;border-radius:6px}
.mm-vid{max-width:min(360px,100%);max-height:260px;border-radius:6px}
.mm-file{display:inline-flex;align-items:center;gap:8px;background:#2b2d31;border:1px solid #1e1f22;border-radius:8px;padding:8px 12px;color:#00a8fc;text-decoration:none;font-size:14px;max-width:100%}
.mm-file svg{width:18px;height:18px;flex:none}
.mm-file span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mm-sys{align-self:center;font-size:12.5px;color:#949ba4;padding:6px 0;text-align:center}
.mm-reply{display:flex;flex-direction:column;gap:10px;padding:12px 16px;border-top:1px solid var(--stroke)}
.mm-reply.note .mm-ta{border-color:rgba(240,178,50,.55)}
.mm-reply-top{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.mm-snip{min-height:36px;max-width:240px}
.mm-ta{width:100%;box-sizing:border-box;resize:vertical;min-height:70px;line-height:1.45;font-weight:500}
.mm-reply-bot{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.mm-attach{display:inline-flex;align-items:center;gap:6px;cursor:pointer}
.mm-attach svg{width:16px;height:16px}
.mm-anon{align-items:center}
.mm-anon input{margin-top:0}
.mm-send{margin-left:auto;display:inline-flex;align-items:center;gap:8px;min-height:40px}
.mm-send svg{width:16px;height:16px}
.mm-att{display:flex;flex-wrap:wrap;gap:6px}
.mm-attf{display:inline-flex;align-items:center;gap:6px;background:var(--panel-2);border:1px solid var(--stroke-2);border-radius:8px;padding:4px 6px 4px 10px;font-size:13px;max-width:100%}
.mm-attf svg{width:14px;height:14px;flex:none}
.mm-attf span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mm-attf button{background:none;border:0;color:var(--muted);cursor:pointer;font-size:13px;padding:2px 4px}
.mm-attf button:hover{color:#fca5a5}
.mm-closed{padding:14px 16px;border-top:1px solid var(--stroke);display:flex;flex-direction:column;gap:4px;color:#cbd5e1}
.mm-past{border-top:1px solid var(--stroke);padding:10px 16px}
.mm-past summary{cursor:pointer;color:var(--blue-2,#818cf8);font-size:14px}
.mm-pastit{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:transparent;border:0;border-radius:8px;padding:8px;color:var(--text);font:inherit;cursor:pointer;min-width:0}
.mm-pastit:hover{background:#1e293b}
.mm-pastit .mm-it-x{flex:1}

/* settings */
.mm-set{display:flex;flex-direction:column;gap:14px;min-width:0}
.mm-set .pb-panel{display:flex;flex-direction:column;gap:12px}
.mm-set .pb-panel h3{margin:0}
.mm-set .pb-panel>p{margin:0}
.mm-grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px}
.mm-grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 16px}
.mm-set .plog-inp,.mm-set .plog-sel,.mm-prof .plog-inp,.mm-prof .plog-sel,.mm-modal .plog-inp,.mm-modal .plog-sel,.mm-sn .plog-inp,.mm-bl .plog-inp{width:100%;box-sizing:border-box;min-width:0;min-height:40px;font-weight:500}
.mm-seg{flex-wrap:wrap;align-self:flex-start}
.mm-mt{margin-top:4px}
.mm-cols{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start}
.mm-col{display:flex;flex-direction:column;gap:12px;min-width:0}
.mm-prevlbl{margin-bottom:-4px}
.mm-prev{max-width:440px}
.mm-dbtn{display:inline-flex;align-items:center;gap:4px;background:#4e5058;color:#fff;border-radius:4px;padding:5px 12px;font-size:13.5px;font-weight:600;margin:4px 6px 0 0;align-self:flex-start}
.mm-stars{display:flex;flex-wrap:wrap}
.mm-color{display:flex;gap:8px;align-items:center}
.mm-color input[type=color]{width:42px;height:40px;flex:none;padding:2px;border:1px solid #334155;border-radius:8px;background:#0f172a;cursor:pointer}
.mm-guard{display:flex;flex-wrap:wrap;align-items:center;gap:6px;line-height:1.5}
.mm-bot-t+.pb-chip{align-self:center}
.mm-savebar{position:sticky;bottom:14px;z-index:20;display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:#1e293b;border:1px solid rgba(129,140,248,.5);border-radius:12px;padding:10px 14px;box-shadow:0 18px 40px -18px rgba(0,0,0,.9)}
.mm-savebar span{flex:1;min-width:160px;font-weight:600}

/* snippets / blocked */
.mm-sn,.mm-bl{display:flex;flex-direction:column;gap:12px;min-width:0}
.mm-subbar{align-items:center}
.mm-subbar p{margin:0;max-width:720px}
.mm-snform{display:flex;flex-direction:column;gap:12px}
.mm-snform h3{margin:0}
.mm-snlist{display:flex;flex-direction:column;gap:10px}
.mm-snit{display:flex;flex-direction:column;gap:8px}
.mm-snit-h{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.mm-snit-h code{background:#0f172a;border:1px solid #1e293b;border-radius:6px;padding:2px 8px;color:#c7d2fe;font-size:14px}
.mm-snit-a{display:flex;gap:6px}
.mm-snit-x{font-size:14.5px;line-height:1.5;color:#cbd5e1;overflow-wrap:anywhere}
.mm-bl .pb-panel{display:flex;flex-direction:column;gap:10px}
.mm-bl .pb-panel h3,.mm-bl .pb-panel p{margin:0}
.mm-blform{display:grid;grid-template-columns:minmax(0,220px) minmax(0,1fr) auto;gap:8px}
.mm-bllist{display:flex;flex-direction:column;gap:8px}
.mm-blit{display:flex;align-items:center;gap:12px;background:var(--panel);border:1px solid var(--glass-bd,var(--stroke));border-radius:12px;padding:10px 14px;min-width:0}
.mm-blit-t{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.mm-blit-t b,.mm-blit-t span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* bot profile */
.mm-prof{display:grid;grid-template-columns:minmax(0,340px) minmax(0,1fr);gap:16px;align-items:start}
.mm-pcard{background:#111214;border-radius:12px;overflow:hidden;position:sticky;top:80px}
.mm-pbanner{height:120px;background:#5865f2 center/cover no-repeat}
.mm-pbody{padding:0 16px 16px;display:flex;flex-direction:column;gap:8px}
.mm-pav{position:relative;display:inline-block;margin-top:-48px;align-self:flex-start}
.mm-pav .mm-dot{width:16px;height:16px;border-width:4px;border-color:#111214;right:4px;bottom:4px}
.mm-pname{display:flex;align-items:center;gap:6px}
.mm-pname b{font-size:20px;color:#f2f3f5}
.mm-app{background:#5865f2;color:#fff;font-size:10px;font-weight:700;border-radius:3px;padding:1px 4px}
.mm-pact{font-size:14px;color:#dbdee1}
.mm-pabout{background:#1e1f22;border-radius:8px;padding:10px 12px;font-size:14px;color:#dbdee1}
.mm-pabout span{display:block;font-size:12px;font-weight:700;text-transform:uppercase;color:#b5bac1;margin-bottom:4px}
.mm-pmode{display:flex;min-width:0}
.mm-pmode .pb-seg{flex-wrap:wrap}
.mm-pwhere{margin-top:2px}
.mm-warnline{color:#fcd34d}
.mm-pform{display:flex;flex-direction:column;gap:12px}
.mm-pform h3{margin:0}
.mm-picrow{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.mm-picrow label.btn{cursor:pointer}
.mm-bnprev{width:96px;height:40px;border-radius:6px;background:#5865f2 center/cover no-repeat;flex:none}
.mm-cnt{font-style:normal;float:right;font-weight:600;letter-spacing:0;text-transform:none}
.mm-res{font-size:14px;line-height:1.45;border-radius:10px;padding:9px 12px;background:#0f172a;border:1px solid #334155;overflow-wrap:anywhere}
.mm-res.ok{border-color:rgba(52,211,153,.4);color:#6ee7b7}
.mm-res.err{border-color:rgba(248,113,113,.4);color:#fca5a5}

/* dialogs */
.mm-modal .pb-modal-box.mm-wide{width:min(640px,100%)}
.mm-who{display:flex;align-items:center;gap:8px}
.mm-faq{display:flex;flex-direction:column;gap:8px}
.mm-qa{background:#0f172a;border:1px solid #334155;border-radius:10px;padding:0 14px}
.mm-qa summary{cursor:pointer;font-weight:600;padding:12px 0;list-style:none;display:flex;justify-content:space-between;gap:10px}
.mm-qa summary::-webkit-details-marker{display:none}
.mm-qa summary::after{content:'+';color:#818cf8;font-weight:700;flex:none}
.mm-qa[open] summary::after{content:'−'}
.mm-qa p{margin:0 0 12px;font-size:14.5px;line-height:1.55;color:#cbd5e1}

@media (max-width:1100px){
  .mm-cols{grid-template-columns:1fr}
  .mm-prof{grid-template-columns:1fr}
  .mm-pcard{position:static;max-width:420px}
}
@media (max-width:900px){
  .mm-tk{grid-template-columns:1fr}
  .mm-tk.has-sel .mm-lcol{display:none}
  .mm-tk:not(.has-sel) .mm-conv-empty{display:none}
  .mm-backbtn{display:grid}
  .mm-msgs{max-height:60vh}
  .mm-list{max-height:none}
  .mm-savebar{bottom:calc(80px + env(safe-area-inset-bottom,0px))}
}
@media (max-width:600px){
  #mm-root{gap:14px}
  .mm-head-act{width:100%}
  .mm-head-act .btn{flex:1;min-height:42px;justify-content:center;text-align:center}
  .mm-srvs{flex-wrap:nowrap;overflow-x:auto;width:100%;scrollbar-width:none}
  .mm-srvs::-webkit-scrollbar{display:none}
  .mm-srv{flex:none;max-width:200px}
  .mm-grid2,.mm-grid3{grid-template-columns:1fr}
  .mm-blform{grid-template-columns:1fr}
  .mm-ch{padding:12px}
  .mm-ch-a{width:100%}
  .mm-ch-a .btn{flex:1 1 auto;justify-content:center}
  .mm-msgs{padding:10px 8px}
  .mm-m{gap:10px;padding:6px 4px}
  .mm-m .mm-av{width:32px;height:32px}
  .mm-reply{padding:12px}
  .mm-snip{max-width:none;flex:1 1 100%}
  .mm-send{flex:1 1 100%;justify-content:center;margin-left:0}
  .mm-lhead .btn{flex:1 1 100%}
  .mm-lhead .pb-seg{flex:1 1 100%}
  .mm-lhead .pb-seg-b{flex:1}
  .mm-snit-a{width:100%}
  .mm-snit-a .btn{flex:1}
  .mm-savebar .btn{flex:1}
  .mm-tabs{overflow:visible}
  .mm-tabs .pb-seg{display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box}
  .mm-tabs .pb-seg-b{flex:1 1 auto;padding:8px 10px;font-size:13.5px}
}
.btn.mm-danger{background:rgba(248,113,113,.12);border:1px solid rgba(248,113,113,.35);color:#fca5a5}
.btn.mm-danger:hover{background:rgba(248,113,113,.22);color:#fff}
