/* Mensageiro da Roda (/mensagens): status, conversas, grupos, fotos/vídeos/áudios, gravação e o "chamar atenção".
   Mesmo sistema visual de app.css (vidro, cinco cores). Tudo daqui é desenho próprio da Roda. */

/* ---------- status (bolinha no avatar) ---------- */
.pav{position:relative;display:inline-block;flex:none;width:var(--s,40px);height:var(--s,40px);line-height:0}
.pav>.av{width:100%;height:100%}
.pdot{--d:clamp(10px,calc(var(--s,40px) * .3),15px);position:absolute;right:-1px;bottom:-1px;width:var(--d);height:var(--d);border-radius:999px;border:2.5px solid var(--surface-solid);background:var(--ink-2);box-sizing:border-box}
.pdot.s-online{background:#16A35B}
.pdot.s-busy{background:var(--bad)}
.pdot.s-busy::after{content:"";position:absolute;left:22%;right:22%;top:50%;height:2px;margin-top:-1px;border-radius:2px;background:#fff}
.pdot.s-away{background:#E8A400}
.pdot.s-away::after{content:"";position:absolute;left:50%;top:22%;width:1.5px;height:32%;background:#fff;border-radius:2px;box-shadow:1.5px 4px 0 -.2px transparent}
.pdot.s-invisible{background:var(--surface-solid);box-shadow:inset 0 0 0 2px var(--ink-2)}
.pdot.s-offline{background:var(--surface-3)}
.pdot.sm{position:relative;right:auto;bottom:auto;display:inline-block;--d:9px;border-width:0;vertical-align:0;margin-right:5px}
.pdot.lg{position:relative;right:auto;bottom:auto;--d:16px;border-width:0;flex:none}
:root[data-theme="dark"] .pdot.s-online,:root:not([data-theme="light"]) .pdot.s-online{background:#2FC27A}
@media (prefers-color-scheme:light){:root:not([data-theme="dark"]) .pdot.s-online{background:#16A35B}}
.pline{display:inline-flex;align-items:center;gap:0;font-size:12.5px;color:var(--ink-2);white-space:nowrap}
.pline.s-online{color:var(--good)}
.pline.s-busy{color:var(--bad)}
.pline.s-away{color:var(--warn)}

/* ---------- moldura: lista à esquerda, conversa à direita ---------- */
.chat.msgr{grid-template-columns:320px minmax(0,1fr);height:min(760px,calc(100vh - 210px));height:min(760px,calc(100dvh - 210px))}
.msgr-side{display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--line);background:var(--surface)}
.msgr-side .convs{border-right:0;flex:1;min-height:0}
.msgr-me{display:flex;align-items:center;gap:10px;padding:12px 10px 12px 14px;border-bottom:1px solid var(--line)}
.mk-status-btn{display:flex;flex-direction:column;align-items:flex-start;gap:1px;background:none;border:0;padding:4px 8px;margin-left:-4px;border-radius:12px;cursor:pointer;color:inherit;font:inherit;text-align:left;min-width:0}
.mk-status-btn:hover{background:var(--surface-2)}
.mk-status-btn b{font-size:14.5px;max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mk-status-btn .pline .i{width:14px;height:14px;margin-left:2px}
.msgr-me .iconbtn .i{width:21px;height:21px}
.msgr-online{padding:10px 0 8px;border-bottom:1px solid var(--line);background:linear-gradient(180deg,var(--primary-soft),transparent 80%)}
.mk-online-h{font-size:12px;font-weight:600;letter-spacing:.02em;text-transform:uppercase;color:var(--primary-ink);padding:0 14px 6px;display:flex;gap:6px;align-items:center}
.mk-online-h .meta{font-weight:500;text-transform:none}
.mk-online-row{display:flex;gap:4px;overflow-x:auto;padding:2px 10px 4px;scrollbar-width:none}
.mk-online-row::-webkit-scrollbar{display:none}
.mk-online-p{display:flex;flex-direction:column;align-items:center;gap:5px;background:none;border:0;padding:4px 6px;border-radius:14px;cursor:pointer;color:var(--ink);font:inherit;font-size:11.5px;width:64px;flex:none}
.mk-online-p:hover{background:var(--surface-2)}
.mk-online-p>span:last-child{max-width:58px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conv{position:relative}
.conv[aria-current="true"]{background:var(--primary-soft)}
.conv .preview .i{width:14px;height:14px;vertical-align:-2px}
.conv .ctx .i{width:12px;height:12px;vertical-align:-1px}
.conv .ctx.g{color:var(--ink-2)}
.conv.left{opacity:.72}
.mk-count{min-width:22px;height:22px;padding:0 7px;border-radius:999px;background:var(--pink);color:var(--on-pink);font-size:12px;font-weight:600;display:inline-grid;place-items:center;flex:none;font-variant-numeric:tabular-nums}
.mk-gface{width:var(--s);height:var(--s);border-radius:999px;display:inline-grid;place-items:center;flex:none;background:linear-gradient(135deg,var(--blue-soft),var(--pink-soft));color:var(--blue-ink);position:relative}
.mk-gface .i{width:46%;height:46%}
.mk-gface.stack2{background:none}
.mk-gface.stack2 .av{position:absolute;box-shadow:0 0 0 2px var(--surface-solid)}
.mk-gface.stack2 .av:first-child{left:0;top:0}
.mk-gface.stack2 .av:nth-child(2){right:0;bottom:0}
.mk-gface.stack2 .av:only-child{position:static}
.mk-noconv{height:auto;padding:28px 18px}

/* ---------- conversa ---------- */
.thread-head{min-height:66px}
.thread-head .grow{min-width:0}
.thread-head .name{display:flex;align-items:center;gap:6px;min-width:0}
.thread-head .name b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.thread-head .ctx .pdot.sm{margin-right:5px}
.mk-back{display:none}
.mk-headbtn{display:flex;align-items:center;gap:12px;flex:1;min-width:0;background:none;border:0;padding:0;text-align:left;color:inherit;font:inherit;cursor:pointer}
.mk-headbtn .ctx{font-size:13px;color:var(--ink-2);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mk-nudgebtn{color:var(--accent-ink);background:var(--accent-soft)}
.mk-nudgebtn:hover{background:var(--accent);color:var(--on-accent)}
.mk-nudgebtn .i{width:22px;height:22px}
.mk-nudgebtn.wait{opacity:.5}
.mk-nudgebtn[disabled]{opacity:.35;cursor:not-allowed}
.msgs>*{flex-shrink:0}
.msgs{background-color:var(--surface-2);background-image:radial-gradient(circle at 1px 1px,var(--line) 1px,transparent 0);background-size:20px 20px;gap:6px}
.mk-day{align-self:center;margin:10px 0 4px;font-size:12px;color:var(--ink-2)}
.mk-day span{display:inline-block;padding:3px 12px;border-radius:999px;background:var(--surface-solid);border:1px solid var(--line);text-transform:capitalize}
.mk-sys{align-self:center;display:flex;align-items:center;gap:7px;max-width:min(88%,460px);padding:4px 12px 4px 10px;border-radius:999px;background:var(--surface);border:1px solid var(--line);font-size:12.5px;color:var(--ink-2);text-align:center;line-height:1.35;position:relative}
.mk-sys .i{width:15px;height:15px;flex:none;color:var(--blue-ink)}
.mk-sys time{font-size:10.5px;opacity:.65;margin-left:2px;flex:none}
.mk-sys span{text-wrap:balance}
.mk-nudgeline{background:var(--accent-soft);border-color:transparent;color:var(--ink);font-weight:500}
.mk-nudgeline .i{color:var(--accent-ink);animation:mkWiggle .7s ease 2}
.mk-nudgeline.mine{background:var(--surface)}
.mk-nudgeline .mrep{position:absolute;right:-36px;top:50%;margin-top:-15px;opacity:0}
.mk-nudgeline:hover .mrep,.mk-nudgeline:focus-within .mrep{opacity:1}
@keyframes mkWiggle{0%,100%{transform:none}20%{transform:rotate(-14deg)}40%{transform:rotate(12deg)}60%{transform:rotate(-8deg)}80%{transform:rotate(5deg)}}
.msg{max-width:min(78%,520px)}
.msg.first{margin-top:6px}
.msender{display:block;font-size:12px;font-weight:600;color:var(--blue-ink);margin-bottom:2px}
.msg.has-media{padding:5px;white-space:normal}
.msg.has-media .mtext{display:block;padding:6px 8px 0;white-space:pre-wrap}
.msg.has-media time{padding:0 8px 2px}
.msg.has-media .msender{padding:3px 8px 2px}
.mk-photo{display:block;padding:0;border:0;background:none;cursor:zoom-in;border-radius:16px;overflow:hidden;line-height:0}
.mk-photo img{display:block;max-width:min(280px,62vw);max-height:340px;width:auto;height:auto;object-fit:cover;border-radius:16px}
.mk-video{display:block;max-width:min(300px,64vw);max-height:360px;border-radius:16px;background:#000}
.msg.k-audio{min-width:min(250px,70vw)}
.mk-audio{display:flex;align-items:center;gap:10px;padding:4px 6px 0 4px}
.mk-play{width:40px;height:40px;border-radius:999px;border:0;display:grid;place-items:center;cursor:pointer;background:var(--primary);color:var(--on-primary);flex:none}
.mk-play .i{width:18px;height:18px;fill:currentColor;stroke:none}
.msg.me .mk-play{background:var(--on-primary);color:var(--primary)}
.mk-abar{flex:1;height:6px;border-radius:999px;background:var(--surface-3);position:relative;cursor:pointer;min-width:80px}
.msg.me .mk-abar{background:rgb(255 255 255 / .32)}
.mk-afill{position:absolute;left:0;top:0;bottom:0;width:0;border-radius:999px;background:var(--primary);transition:width .2s linear}
.msg.me .mk-afill{background:var(--on-primary)}
.mk-audio.playing .mk-abar{height:8px}
.mk-atime{font-size:12px;font-variant-numeric:tabular-nums;min-width:34px;text-align:right}
.mk-gone{display:flex;align-items:center;gap:6px;padding:8px 10px;font-size:13px;font-style:italic;opacity:.8}
.mk-gone .i{width:15px;height:15px}
.mk-pending{opacity:.85;display:flex;flex-direction:column;gap:6px;min-width:180px}
.mk-pending .mk-prev{max-width:180px;max-height:180px;border-radius:12px;object-fit:cover}
.mk-uplabel{font-size:13px}
.mk-prog{display:block;height:4px;border-radius:999px;background:rgb(255 255 255 / .3);overflow:hidden}
.mk-prog span{display:block;height:100%;width:0;background:var(--on-primary);transition:width .2s}
.mk-hiddenmsg{align-self:flex-start;display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:18px;border:1px dashed var(--line);font-size:13px;color:var(--ink-2);background:var(--surface)}
.mk-hiddenmsg .i{width:16px;height:16px}
.mk-blocknote .i{width:18px;height:18px}
.mk-more{align-self:center}
.chat-empty .mk-hello{max-width:360px}
.mk-hello-art{display:inline-grid;place-items:center;width:72px;height:72px;border-radius:24px;background:var(--accent-soft);color:var(--accent-ink);margin-bottom:10px;animation:mkWiggle 1.4s ease 1 .4s}
.mk-hello-art .i{width:38px;height:38px}
.mk-hello-acts{justify-content:center;margin-top:12px}
.mk-hello-acts .i{width:18px;height:18px}

/* ---------- escrever, anexar, gravar ---------- */
.msgr-compose{position:relative;align-items:center;gap:6px;padding:10px 12px;background:var(--surface)}
.msgr-compose .iconbtn{width:42px;height:42px;color:var(--ink-2)}
.msgr-compose .iconbtn .i{width:22px;height:22px}
.msgr-compose .mk-mic{color:var(--primary-ink)}
.msgr-compose.recording>:not(.mk-recbar){visibility:hidden}
.mk-recbar{position:absolute;inset:0;display:flex;align-items:center;gap:10px;padding:0 12px;background:var(--surface-solid);border-top:1px solid var(--line)}
.mk-recdot{width:12px;height:12px;border-radius:999px;background:var(--bad);animation:mkPulse 1s ease-in-out infinite}
.mk-rectime{font-size:14.5px}
.mk-rectime b{font-variant-numeric:tabular-nums}
.mk-recmax{font-size:12px;color:var(--ink-2)}
.mk-recsend{width:46px;height:46px;padding:0}
@keyframes mkPulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.45;transform:scale(.8)}}
.mk-leftfoot{display:flex;align-items:center;gap:12px;padding:12px 14px;border-top:1px solid var(--line);background:var(--surface);font-size:13.5px}
.mk-leftfoot>.i{width:22px;height:22px;color:var(--ink-2);flex:none}
.mk-leftfoot p{margin-bottom:6px;line-height:1.45}

/* ---------- chamar atenção ---------- */
@keyframes mkShake{0%,100%{transform:none}8%{transform:translate3d(-9px,3px,0) rotate(-.6deg)}16%{transform:translate3d(8px,-3px,0) rotate(.6deg)}24%{transform:translate3d(-7px,2px,0) rotate(-.4deg)}32%{transform:translate3d(7px,-2px,0) rotate(.4deg)}44%{transform:translate3d(-5px,1px,0)}56%{transform:translate3d(4px,-1px,0)}70%{transform:translate3d(-2px,0,0)}84%{transform:translate3d(1px,0,0)}}
@keyframes mkShakeSoft{0%,100%{transform:none}25%{transform:translate3d(-3px,0,0)}50%{transform:translate3d(3px,0,0)}75%{transform:translate3d(-2px,0,0)}}
@keyframes mkFlash{0%,100%{box-shadow:var(--shadow)}30%,70%{box-shadow:0 0 0 4px var(--accent),0 0 40px 6px var(--accent-soft)}}
.mk-shake{animation:mkShake .75s cubic-bezier(.36,.07,.19,.97) both}
.mk-shake-soft{animation:mkShakeSoft .4s ease both}
.mk-flash{animation:mkFlash 1s ease both}
#app.mk-flash{animation:none}
#app.mk-flash .topbar{animation:mkFlash 1s ease both}
@media (prefers-reduced-motion:reduce){.mk-shake,.mk-shake-soft{animation:mkFlash 1s ease both}.mk-nudgeline .i,.mk-hello-art,.mk-recdot{animation:none}}
html[data-motion="reduce"] :is(.mk-shake,.mk-shake-soft){animation:mkFlash 1s ease both}
html[data-motion="reduce"] :is(.mk-nudgeline .i,.mk-hello-art,.mk-recdot){animation:none}
.thread{position:relative}
.mk-burst{position:absolute;left:50%;top:42%;z-index:4;display:flex;flex-direction:column;align-items:center;gap:10px;padding:18px 24px;border-radius:24px;background:var(--accent);color:var(--on-accent);box-shadow:0 24px 60px -20px rgb(0 0 0 / .55);text-align:center;max-width:min(80%,320px);pointer-events:none;transform:translate(-50%,-50%);animation:mkBurst 2.2s cubic-bezier(.2,.9,.3,1.2) both}
.mk-burst b{font-size:16px;line-height:1.3}
.mk-burst-ic{width:56px;height:56px;border-radius:18px;display:grid;place-items:center;background:rgb(255 255 255 / .45)}
.mk-burst-ic .i{width:34px;height:34px;animation:mkWiggle .5s ease 3}
@keyframes mkBurst{0%{opacity:0;transform:translate(-50%,-50%) scale(.6)}12%{opacity:1;transform:translate(-50%,-50%) scale(1.06)}20%{transform:translate(-50%,-50%) scale(1)}80%{opacity:1;transform:translate(-50%,-50%) scale(1)}100%{opacity:0;transform:translate(-50%,-50%) scale(.96)}}
@keyframes mkBurstFade{0%,100%{opacity:0}12%,80%{opacity:1}}
@media (prefers-reduced-motion:reduce){.mk-burst{animation:mkBurstFade 2.2s ease both}.mk-burst-ic .i{animation:none}}
html[data-motion="reduce"] .mk-burst{animation:mkBurstFade 2.2s ease both}
html[data-motion="reduce"] .mk-burst-ic .i{animation:none}
.mk-nudge-toast{display:flex;align-items:center;gap:10px;background:var(--accent);color:var(--on-accent);font-weight:500}
.mk-nudge-toast .i{width:22px;height:22px;animation:mkWiggle .7s ease 2}

/* ---------- janelas (status, configurações, grupos) ---------- */
.mk-status-list{display:flex;flex-direction:column;gap:6px;margin:6px 0 12px}
.mk-status-opt{display:flex;align-items:center;gap:14px;padding:12px 14px;border-radius:16px;border:1px solid var(--line);background:var(--surface);cursor:pointer;text-align:left;color:inherit;font:inherit}
.mk-status-opt[aria-checked="true"]{border-color:var(--primary);background:var(--primary-soft)}
.mk-status-opt small{display:block;color:var(--ink-2);font-size:12.5px;line-height:1.4;margin-top:2px}
.mk-status-opt>.i{color:var(--primary-ink);width:20px;height:20px}
.mk-settings .set-row p{font-size:13px;color:var(--ink-2);line-height:1.45;margin-top:2px}
.mk-pick-h{display:flex;justify-content:space-between;align-items:baseline;margin:6px 0 8px}
.mk-pick-search{margin-bottom:8px}
.mk-pick{display:flex;flex-direction:column;max-height:min(46vh,380px);overflow-y:auto;border:1px solid var(--line);border-radius:16px;background:var(--surface)}
.mk-pick-row{display:flex;align-items:center;gap:12px;padding:9px 12px;cursor:pointer;border-bottom:1px solid var(--line)}
.mk-pick-row:last-child{border-bottom:0}
.mk-pick-row input{position:absolute;opacity:0;pointer-events:none}
.mk-pick-row small{display:block;color:var(--ink-2);font-size:12px}
.mk-tick{width:26px;height:26px;border-radius:999px;border:2px solid var(--line);display:grid;place-items:center;color:transparent;flex:none}
.mk-tick .i{width:16px;height:16px;stroke-width:3}
.mk-pick-row:has(input:checked){background:var(--primary-soft)}
.mk-pick-row input:checked~.mk-tick{background:var(--primary);border-color:var(--primary);color:var(--on-primary)}
.mk-pick-row input:focus-visible~.mk-tick{outline:2px solid var(--primary);outline-offset:2px}
.mk-pick-row input:disabled~.mk-tick{opacity:.4}
.mk-gtitle{display:flex;align-items:center;gap:10px;justify-content:space-between;flex-wrap:wrap}
.mk-addbtn{margin:4px 0 10px}
.mk-mems{display:flex;flex-direction:column;margin:6px 0 12px;border-top:1px solid var(--line)}
.mk-mem{display:flex;align-items:center;gap:12px;padding:10px 2px;border-bottom:1px solid var(--line)}
.mk-mem b a{color:inherit;text-decoration:none}
.mk-mem small{display:block;color:var(--ink-2);font-size:12px}
.mk-admin{margin-left:8px;background:var(--accent-soft);color:var(--accent-ink)}
.mk-admin .i{width:13px;height:13px}
.mk-gprivacy{font-size:13px}
.mk-gpanel .dropdown-menu,.mk-gpanel .dropdown{position:relative}
.mk-gpanel .dropdown-menu{position:absolute;right:0;top:44px;z-index:3}
.dropdown-menu .i{width:18px;height:18px}

/* ---------- celular: a conversa ocupa a tela, como um app de mensagens ---------- */
@media (max-width:760px){
  .chat.msgr{grid-template-columns:minmax(0,1fr)}
  .chat.msgr:not(.has-active){height:auto;min-height:0}
  .chat.msgr:not(.has-active) .convs{overflow:visible}
  .chat.msgr.has-active .msgr-side{display:none}
  .chat.msgr.has-active{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);z-index:45;border:0;border-radius:0;box-shadow:none;background:var(--surface-solid);min-height:0}
  .chat.msgr.has-active .thread{height:100%}
  .chat.msgr.has-active .thread-head{padding:calc(env(safe-area-inset-top,0px) + 8px) max(10px,env(safe-area-inset-right,0px)) 8px max(6px,env(safe-area-inset-left,0px));gap:8px;background:var(--glass);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}
  .chat.msgr.has-active .msgr-compose{padding:8px max(8px,env(safe-area-inset-right,0px)) calc(env(safe-area-inset-bottom,0px) + 8px) max(8px,env(safe-area-inset-left,0px))}
  .chat.msgr.has-active .mk-leftfoot{padding-bottom:calc(env(safe-area-inset-bottom,0px) + 12px)}
  .mk-back{display:inline-grid}
  .mk-leftfoot{flex-wrap:wrap}
  .mk-leftfoot .grow{flex:1 1 calc(100% - 40px)}
  .mk-leftfoot>.btn{margin-left:auto}
  html.mk-in-thread .dock{display:none}
  html.mk-in-thread body{overflow:hidden}
  .msgr-compose .iconbtn{width:38px;height:38px}
  .msgr .msg .mrep{left:auto;right:-36px}
}
/* Telas de toque (sem passar o mouse): a bandeira de "Denunciar mensagem" fica sempre à vista, discreta. */
@media (hover:none){.msgr .msg .mrep,.msgr .mk-nudgeline .mrep{opacity:.5}}
/* App: sem a margem da barra de status duplicada (o app já desenha a faixa) e teclado aberto sem a borda de baixo. */
html.app .chat.msgr.has-active{top:0;height:100%;height:100dvh}
html.app.kb-open .chat.msgr.has-active .msgr-compose{padding-bottom:8px}
html.app .chat.msgr:not(.has-active){border-radius:var(--r)}
html.app .msgr-online{background:linear-gradient(180deg,var(--primary-soft),transparent 85%)}
