/* ===== BUNKER 0.2.0: tela do canal (chat, telona "Entrar na chamada", membros, cartão da pessoa) ===== */

.chan { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.chan-header .chan-lock { color: var(--faint); }
.chan-header .icon-btn[aria-pressed="true"] { color: var(--text); background: var(--active-bg); }
.chan-body { flex: 1; min-height: 0; display: grid; }
.chan-body.text { grid-template-columns: minmax(0, 1fr); }
.chan-body.text.with-members { grid-template-columns: minmax(0, 1fr) 260px; }
.chan-body.voice { grid-template-columns: minmax(0, 1fr) 340px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.members-side { min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg-side); }
.members-pane { overflow-y: auto; }

/* O palco da chamada (vem do call.js) ocupa a área toda */
.call-dock { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Telona preta (canal de voz, fora da chamada) */
.telona {
  flex: 1; min-height: 0; margin: 12px; border-radius: var(--radius); display: flex; overflow-y: auto;
  background: radial-gradient(700px 360px at 50% 40%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--tile-bg);
  color: var(--on-dark); border: 1px solid var(--line);
}
.telona-inner { margin: auto; padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 640px; }
.telona-ico { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .08); color: var(--on-dark); margin-bottom: 4px; }
.telona h2 { font-size: 24px; }
.telona-sub { color: var(--on-dark-muted); }
.telona-note { color: var(--on-dark-muted); font-size: 13px; max-width: 360px; }
.telona-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 8px 0 6px; }
.telona-person {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 84px; padding: 6px 2px;
  border: 0; border-radius: 10px; background: none; color: var(--on-dark); cursor: pointer; font-size: 12.5px;
}
.telona-person:hover { background: rgba(255, 255, 255, .06); }
.telona-person > span:not(.avatar):not(.pill) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.telona-more { align-self: center; color: var(--on-dark-muted); font-weight: 700; }
.btn.join-call { height: 48px; padding: 0 28px; font-size: 15px; border-radius: 24px; margin-top: 8px; background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.btn.join-call:hover:not(:disabled) { background: color-mix(in srgb, var(--ok) 86%, #000); border-color: transparent; }

/* Chat: apagar mensagem e nome clicável */
.msg { position: relative; }
.msg-av, .msg-name { border: 0; padding: 0; background: none; cursor: pointer; font: inherit; text-align: left; }
.msg-av { display: inline-flex; align-self: start; border-radius: 50%; }
.msg-name:hover { text-decoration: underline; }
.msg-del { position: absolute; right: 10px; top: 2px; display: none; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.msg-del:hover { color: var(--bad-text); }
.msg:hover .msg-del { display: inline-flex; }
@media (hover: none) { .msg-del { display: inline-flex; opacity: .6; } }
.composer-off { display: flex; align-items: center; gap: 8px; margin: 10px 12px 12px; padding: 12px; border-radius: 12px; background: var(--panel-2); }

/* Lista de membros */
.members { display: flex; flex-direction: column; gap: 1px; padding: 8px; }
.mem-group { padding: 14px 8px 4px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.mem-row {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 8px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer; text-align: left; width: 100%;
}
.mem-row:hover { background: color-mix(in srgb, var(--panel-3) 60%, transparent); color: var(--text); }
.mem-row.off { opacity: .45; }
.mem-row .bad { color: var(--bad-text); display: inline-flex; }
.mem-av { position: relative; display: inline-flex; }
.mem-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--bg-side); }
.mem-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* Cargos (bolinha colorida) */
.role-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--panel-3); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.role-chip > i { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); }
.role-chip.owner { color: var(--warn); }
.role-chip.muted-chip { color: var(--bad-text); }
.role-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--rc); flex: none; }
.role-check { white-space: normal; color: var(--text); }

/* Cartão da pessoa */
.ucard {
  position: fixed; z-index: 55; width: 300px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
  animation: dev-in .12s ease-out;
}
.ucard .pcard { border: 0; border-radius: 0; background: transparent; }
.ucard .pcard-av { background: var(--panel); top: 46px; }
.ucard .pcard-body { padding-top: 46px; }
.ucard-owner, .ucard-muted { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; margin-top: 4px; }
.ucard-owner { color: var(--warn); }
.ucard-muted { color: var(--bad-text); }
.ucard-rolehead { display: flex; align-items: center; justify-content: space-between; }
.ucard-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.ucard-pick { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 8px; border-radius: 10px; background: var(--panel-2); }
.ucard-actions { display: flex; flex-direction: column; gap: 2px; padding: 6px; border-top: 1px solid var(--line); }

/* Canal de voz no computador: painel da direita (chat/membros) minimizado = palco na largura toda */
@media (min-width: 1001px) {
  .chan-body.voice.panel-min { grid-template-columns: minmax(0, 1fr); }
  .chan-body.voice.panel-min > .panel { display: none; }
}
.panel-head .panel-hide { margin-left: auto; }

/* Mensagens que somem: reloginho no cabeçalho e aviso no começo do chat */
.ttl-pill { background: var(--panel-2); color: var(--muted); letter-spacing: 0; font-weight: 650; cursor: default; }
.ttl-note { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; }

@media (max-width: 1000px) {
  .only-wide { display: none !important; }
  .chan-body.voice { grid-template-columns: minmax(0, 1fr); overflow: clip; position: relative; }
  .chan-body.text.with-members { grid-template-columns: minmax(0, 1fr); }
  .chan-body.text.with-members .members-side {
    position: absolute; z-index: 20; top: 52px; right: 0; bottom: 0; width: min(300px, 100%); box-shadow: var(--shadow-lg);
  }
}
@media (max-width: 760px) {
  .telona { margin: 8px; }
  .telona h2 { font-size: 20px; }
  .chan-body.text.with-members .members-side { width: 100%; }
}

/* Fotos e áudios no chat */
.msg-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.msg-img {
  display: block; max-width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--panel-2); cursor: zoom-in; margin: 2px 0;
}
.msg-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.audio-msg {
  display: flex; align-items: center; gap: 10px; width: 280px; max-width: 100%; margin: 2px 0;
  padding: 7px 12px 7px 7px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel-2);
}
.ap-btn {
  flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
}
.ap-btn:hover { filter: brightness(1.1); }
.ap-bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--line-2); cursor: pointer; overflow: hidden; }
.ap-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-text); border-radius: 3px; }
.ap-time { flex: none; min-width: 34px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(0, 0, 0, .88); display: grid; place-items: center;
}
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: 94vw; max-height: 90vh; object-fit: contain; border-radius: 6px; cursor: zoom-out; }
.lightbox-close { position: fixed; top: 14px; right: 14px; color: #fff; background: rgba(255, 255, 255, .12); }

/* Gravar áudio e mandar foto */
.composer .icon-btn.attach, .composer .icon-btn.rec-btn { color: var(--muted); }
.composer .icon-btn.attach:hover, .composer .icon-btn.rec-btn:hover { color: var(--text); }
.composer { align-items: flex-end; }
.composer.recording > :not(.rec-bar) { display: none; }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 34px; }
.rec-bar[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: rec-blink 1s ease-in-out infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 650; }
.rec-label { flex: 1; }
.rec-cancel:hover { color: var(--bad-text); }
@keyframes rec-blink { 50% { opacity: .25; } }
.upload-note { margin: 0 14px -4px; }
.pane.chat.drop { outline: 2px dashed var(--accent-text); outline-offset: -6px; }
.modal-actions.wrap { flex-wrap: wrap; }
@media (max-width: 600px) {
  .msg-img { max-width: min(100%, 280px); }
  .audio-msg { width: 240px; }
}

/* Arquivos (PDF, documentos...) */
.file-msg {
  display: flex; align-items: center; gap: 10px; width: 340px; max-width: 100%; margin: 2px 0;
  padding: 8px 8px 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.file-ico {
  flex: none; display: grid; place-items: center; width: 38px; height: 44px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 10.5px; font-weight: 750; letter-spacing: .03em;
}
.file-ico.pdf { background: color-mix(in srgb, var(--live) 18%, transparent); color: var(--bad-text); }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name {
  border: 0; padding: 0; background: none; font: inherit; font-weight: 600; color: var(--link); cursor: pointer;
  text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-name:hover { text-decoration: underline; }
@media (max-width: 600px) { .file-msg { width: 260px; } }
