/* Comentários afixados (js/comentarios.js). Usa os tokens de erp/erp.css. */
#scroll { position: relative; }
#cmt-pins { position: absolute; left: 0; top: 0; width: 100%; height: 0; z-index: 4; pointer-events: none; }

/* ---------- pin ---------- */
.cmt-pin { position: absolute; transform: translate(-4px, calc(-100% + 4px)); pointer-events: auto; border: 2px solid #fff;
  width: 30px; height: 30px; padding: 0; border-radius: 50% 50% 50% 4px; background: var(--navy); color: #fff;
  box-shadow: 0 4px 14px rgba(15, 20, 45, .35); display: grid; place-items: center; transition: transform .15s cubic-bezier(.3,.7,.3,1.4); }
.cmt-pin b { font-size: 12.5px; font-weight: 700; font-family: var(--f-ui); }
.cmt-pin i { position: absolute; right: -8px; top: -8px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--sky); border: 2px solid #fff;
  font-style: normal; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.cmt-pin:hover, .cmt-pin.on { transform: translate(-4px, calc(-100% + 4px)) scale(1.14); }
.cmt-pin.on { background: var(--err); }
.cmt-pin.ok { background: var(--ok); opacity: .75; }
.cmt-pin.novo { background: var(--err); animation: cmt-salta .5s cubic-bezier(.3,.7,.3,1.5); }
@keyframes cmt-salta { from { transform: translate(-4px, calc(-100% - 14px)); opacity: 0; } }

/* ---------- barra flutuante ---------- */
.cmt-bar { position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 50; display: flex; gap: 8px; }
.cmt-fab { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 14px; padding: 11px 15px; font-weight: 600; font-size: 13.5px;
  background: var(--navy); color: #F2F5FC; box-shadow: 0 8px 24px rgba(15, 20, 45, .28); transition: transform .12s, filter .15s; }
.cmt-fab:hover { filter: brightness(1.15); } .cmt-fab:active { transform: scale(.96); }
.cmt-fab .i { width: 17px; height: 17px; }
.cmt-fab kbd { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.2); color: #DDE4F5; }
.cmt-fab.on { background: var(--err); }
.cmt-fab.sec { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.cmt-fab.sec.tem span { color: var(--err); }
.cmt-fab.sec.on { background: var(--info-bg); }
body.cmt-com-painel .cmt-bar { right: calc(min(380px, 100vw) + 18px); }
body.cmt-modo .cmt-bar { z-index: 80; }   /* por cima da mira: carregar outra vez em «Comentar» cancela */

/* ---------- modo de escolher o sítio ---------- */
.cmt-mira { position: fixed; inset: 0; z-index: 75; cursor: crosshair; background: rgba(35, 49, 99, .06); box-shadow: inset 0 0 0 3px var(--sky); }
.cmt-mira[hidden] { display: none; }
.cmt-mira-tip { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #EEF2FA; padding: 9px 14px; border-radius: 12px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap; }
.cmt-mira-tip .i { width: 16px; height: 16px; }
.cmt-mira-tip kbd { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.2); color: #DDE4F5; }

/* ---------- caixa de conversa ---------- */
.cmt-pop { position: fixed; z-index: 76; width: min(360px, calc(100vw - 24px)); max-height: min(560px, calc(100dvh - 24px)); display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: menu-in .16s ease; }
.cmt-pop[hidden] { display: none; }
.cmt-pop-h { display: flex; align-items: center; gap: 2px; padding: 12px 10px 10px 14px; border-bottom: 1px solid var(--line); }
.cmt-pop-h > div { flex: 1; min-width: 0; }
.cmt-pop-h b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt-pop-h small { display: block; font-size: 11.5px; color: var(--muted); }
.cmt-pop > textarea, .cmt-resp textarea { margin: 12px 14px 0; border: 1px solid var(--field); border-radius: 10px; background: var(--surface); padding: 9px 11px; resize: vertical; min-height: 64px; font-size: 13.5px; line-height: 1.45; }
.cmt-pop > textarea:focus, .cmt-resp textarea:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: transparent; }
.cmt-acts { display: flex; align-items: center; gap: 6px; padding: 10px 14px 12px; }
.cmt-acts .hint { margin-right: auto; }
.cmt-shot { margin: 10px 14px 0; }
.cmt-msg .cmt-shot { margin: 8px 0 0; }
.cmt-mini { position: relative; display: block; width: 100%; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; padding: 0; background: var(--soft); cursor: zoom-in; }
.cmt-mini img { display: block; width: 100%; height: 120px; object-fit: cover; object-position: center; }
.cmt-mini .i { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; padding: 3px; border-radius: 6px; background: rgba(15,20,45,.6); color: #fff; }
.cmt-a-tirar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 10px; border: 1px dashed var(--field); border-radius: 10px; }
.cmt-a-tirar i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--sky); animation: gira .8s linear infinite; flex: none; }
.cmt-msgs { overflow-y: auto; padding: 6px 14px; display: flex; flex-direction: column; min-height: 0; }
.cmt-msg { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.cmt-msg:last-child { border-bottom: 0; }
.cmt-msg p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; flex: none;
  background: hsl(var(--h) 55% 88%); color: hsl(var(--h) 55% 26%); }
.cmt-quem { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cmt-quem b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt-quem small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cmt-del { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.cmt-resp { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-bottom: 12px; }
.cmt-resp textarea { min-height: 44px; margin-top: 10px; }
.cmt-resp .b { align-self: flex-end; margin-right: 14px; }

/* ---------- painel lateral ---------- */
.cmt-painel { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); z-index: 55; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -18px 0 48px rgba(10,16,40,.14); display: flex; flex-direction: column; animation: dw-in .25s cubic-bezier(.2,.9,.25,1); }
.cmt-painel[hidden] { display: none; }
.cmt-painel-h { display: flex; align-items: center; gap: 8px; padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 12px 18px; border-bottom: 1px solid var(--line); }
.cmt-painel-h > div { flex: 1; min-width: 0; }
.cmt-painel-h b { display: block; font-size: 17px; }
.cmt-painel-h small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmt-tabs { margin: 12px 14px 0; }
.cmt-chk { margin: 10px 18px 6px; font-size: 12.5px; color: var(--muted); }
.cmt-itens { flex: 1; overflow-y: auto; padding: 4px 10px 90px; min-height: 0; }
.cmt-grupo h4 { margin: 14px 8px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 6px; }
.cmt-grupo h4 span { color: var(--err); }
.cmt-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; width: 100%; text-align: left; border: 0; background: none; border-radius: 12px; padding: 10px 8px; color: var(--ink); }
.cmt-item:hover { background: var(--soft); }
.cmt-item.ok { opacity: .62; }
.cmt-item .cmt-txt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.45; margin-top: 2px; overflow-wrap: anywhere; }
.cmt-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cmt-meta:empty { display: none; }
.cmt-meta .i.s { width: 12px; height: 12px; }

/* ---------- imagem em grande ---------- */
.cmt-foto { position: fixed; inset: 0; z-index: 96; background: rgba(8, 12, 30, .82); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.cmt-foto[hidden] { display: none; }
.cmt-foto figure { margin: 0; max-width: min(1400px, 100%); display: flex; flex-direction: column; gap: 10px; }
.cmt-foto img { max-width: 100%; max-height: calc(100dvh - 110px); border-radius: 10px; box-shadow: var(--shadow-lg); object-fit: contain; }
.cmt-foto figcaption { color: #DDE4F5; font-size: 12.5px; text-align: center; }

@media (max-width: 900px) {
  .cmt-fab span, .cmt-fab kbd { display: none; }
  .cmt-fab.sec span { display: inline; }
  body.cmt-com-painel .cmt-bar { display: none; }
}
