/* Rede Confiança: tela de leitura de mensagens (quadro de visualização e janela cheia) */

body.action-preview,
body.action-show #layout-content { --rc-l-fundo: #f6f4fa; --rc-l-cartao: #fff; --rc-l-texto: #1a1a2e; --rc-l-t2: #5d5d7a; --rc-l-t3: #8f8fab; --rc-l-borda: rgba(26,26,46,.08); }
html.dark-mode body.action-preview,
html.dark-mode body.action-show #layout-content { --rc-l-fundo: #161627; --rc-l-cartao: #1f1f36; --rc-l-texto: #f1f0f7; --rc-l-t2: #b3b2cc; --rc-l-t3: #7d7c9a; --rc-l-borda: rgba(255,255,255,.08); }

body.action-preview { background: var(--rc-l-fundo); }
body.action-preview #layout-content,
body.action-preview #layout-content .content,
body.action-preview .frame-content,
body.action-preview #message-content { background: transparent !important; }

/* ---------- Cabeçalho em cartão ---------- */
#message-header {
  position: relative;
  margin: 14px 14px 12px !important;
  padding: 20px 22px 16px !important;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0, rgba(255,122,0,.10) 0, transparent 45%),
    radial-gradient(circle at 0 100%, rgba(214,33,133,.07) 0, transparent 45%),
    var(--rc-l-cartao);
  box-shadow: 0 12px 30px -16px rgba(26,26,46,.28), 0 1px 3px rgba(26,26,46,.05);
  border: 0 !important;
  overflow: hidden;
}
#message-header::before {                         /* filete da marca no topo do cartão */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, #d62185, #ff7a00);
}
#message-header h2.subject {
  font-size: 1.45rem !important;
  font-weight: 800 !important;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--rc-l-texto) !important;
  margin: 2px 0 14px !important;
  padding: 0 !important;
  display: flex; align-items: flex-start; gap: 10px;
}
#message-header h2.subject a.extwin {
  flex: none; width: 30px; height: 30px; border-radius: 10px; margin-top: 2px;
  display: inline-grid; place-items: center; background: rgba(255,122,0,.10); color: #e66e00 !important;
  transition: transform .2s, background .2s;
}
#message-header h2.subject a.extwin:hover { background: #ff7a00; color: #fff !important; transform: translateY(-1px); }
#message-header h2.subject a.extwin::before { margin: 0 !important; }

#message-header .header { display: flex; align-items: center; gap: 14px; }
#message-header .contactphoto { width: 48px !important; height: 48px !important; border-radius: 16px !important; object-fit: cover; flex: none; box-shadow: 0 6px 14px -6px rgba(26,26,46,.35); }
.rc-avatar-msg {
  width: 48px; height: 48px; border-radius: 16px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #d62185, #ff7a00); color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .02em;
  box-shadow: 0 8px 18px -8px rgba(214,33,133,.7);
  animation: rcPop .45s cubic-bezier(.22,.9,.3,1) both;
}
#message-header .header-content { min-width: 0; flex: 1; }
#message-header .header-summary { color: var(--rc-l-t3) !important; font-size: .9rem; }
#message-header .header-summary .adr a.rcmContactAddress { color: var(--rc-l-texto) !important; font-weight: 700; font-size: 1rem; }
#message-header .header-summary .text-nowrap { color: var(--rc-l-t2); font-weight: 500; }
#message-header table.header-headers td.header-title { color: var(--rc-l-t3); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
#message-header table.header-headers td.header a.rcmContactAddress { color: var(--rc-l-texto) !important; font-weight: 600; }

/* Links Detalhes / Cabeçalhos / Texto simples como pílulas */
#message-header .header-links { margin-top: 10px !important; display: flex; flex-wrap: wrap; gap: 6px; }
#message-header .header-links a {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 !important;
  padding: 5px 11px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: rgba(26,26,46,.05); color: var(--rc-l-t2) !important; text-decoration: none !important;
  transition: background .2s, color .2s, transform .2s;
}
#message-header .header-links a:hover { background: rgba(255,122,0,.12); color: #e66e00 !important; transform: translateY(-1px); }
#message-header .header-links a:before { color: inherit !important; }
html.dark-mode #message-header .header-links a { background: rgba(255,255,255,.06); }

/* ---------- Anexos como cartões ---------- */
#message-header + .message-partheaders,
#message-objects, #attachment-list { margin-left: 14px; margin-right: 14px; }
.attachmentslist {
  display: flex !important; flex-wrap: wrap; gap: 10px; padding: 0 !important; margin: 0 14px 12px !important; border: 0 !important; background: transparent !important;
}
.attachmentslist li {
  position: relative; float: none !important; margin: 0 !important; min-width: 210px; max-width: 320px; flex: 0 1 auto;
  border-radius: 16px !important; background: var(--rc-l-cartao) !important; border: 1px solid var(--rc-l-borda) !important;
  box-shadow: 0 8px 20px -14px rgba(26,26,46,.35); overflow: hidden;
  transition: transform .25s cubic-bezier(.22,.9,.3,1), box-shadow .25s;
  animation: rcSobe .4s cubic-bezier(.22,.9,.3,1) both;
}
.attachmentslist li::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, #d62185, #ff7a00); }
.attachmentslist li:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -16px rgba(26,26,46,.45); }
.attachmentslist li { display: flex !important; align-items: center; height: auto !important; line-height: 1.35 !important; padding: 8px 8px 8px 14px !important; gap: 12px; }
.attachmentslist li::before {
  position: static !important; flex: none; width: 36px !important; height: 36px !important; line-height: 36px !important; text-align: center;
  border-radius: 11px; background: rgba(255,122,0,.12); color: #e66e00 !important; font-size: 16px !important; margin: 0 !important;
}
.attachmentslist li a.filename { flex: 1; min-width: 0; height: auto !important; line-height: 1.35 !important; padding: 2px 30px 2px 0 !important; display: block; color: var(--rc-l-texto) !important; text-decoration: none !important; }
.attachmentslist li .attachment-name { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachmentslist li .attachment-size { display: block; color: var(--rc-l-t3) !important; font-size: .78rem; padding: 0 !important; margin: 0 !important; }
.attachmentslist li a.dropdown { position: absolute !important; right: 8px !important; top: 50% !important; transform: translateY(-50%); border-radius: 10px; }
.attachmentslist li a.dropdown:hover { background: rgba(255,122,0,.12); color: #e66e00; }
/* cor do ícone por tipo de arquivo */
.attachmentslist li.pdf::before { background: rgba(229,72,77,.12); color: #e5484d !important; }
.attachmentslist li.xlsx::before, .attachmentslist li.xls::before, .attachmentslist li.csv::before, .attachmentslist li.ods::before { background: rgba(23,166,115,.12); color: #17a673 !important; }
.attachmentslist li.docx::before, .attachmentslist li.doc::before, .attachmentslist li.odt::before { background: rgba(59,130,246,.12); color: #3b82f6 !important; }
.attachmentslist li.image::before { background: rgba(87,19,129,.12); color: #571381 !important; }
html.dark-mode .attachmentslist li.image::before { color: #c58af0 !important; }

/* ---------- Aviso de conteúdo remoto ---------- */
#remote-objects-message, .boxwarning, #message-objects .notice, #message-objects .alert {
  border-radius: 14px !important; border: 0 !important; margin: 0 14px 12px !important;
  background: rgba(255,122,0,.10) !important; color: var(--rc-l-texto) !important; box-shadow: inset 4px 0 0 #ff7a00;
}
#remote-objects-message a, #message-objects .alert a { color: #e66e00 !important; font-weight: 700; }

/* ---------- Corpo da mensagem em cartão ---------- */
#messagebody {
  margin: 0 14px 18px !important;
  padding: 22px 24px !important;
  border-radius: 20px;
  background: var(--rc-l-cartao) !important;
  box-shadow: 0 12px 30px -18px rgba(26,26,46,.25), 0 1px 3px rgba(26,26,46,.04);
  overflow-x: auto;
}
#messagebody .message-part, #messagebody .message-htmlpart { padding: 0 !important; border: 0 !important; }
#messagebody .message-part + .message-part, #messagebody .message-htmlpart + .message-part { margin-top: 16px; padding-top: 16px !important; border-top: 1px dashed var(--rc-l-borda) !important; }
#messagebody img { max-width: 100%; height: auto; border-radius: 6px; }
#messagebody div.pre, #messagebody pre { font-family: inherit; line-height: 1.6; }
#messagebody a { color: #e66e00; }

/* Citações (respostas anteriores) */
#messagebody blockquote {
  margin: 12px 0 !important; padding: 8px 14px !important;
  border-left: 3px solid #ff7a00 !important; border-radius: 0 12px 12px 0;
  background: rgba(255,122,0,.05); color: var(--rc-l-t2);
}
#messagebody blockquote blockquote { border-left-color: #d62185 !important; background: rgba(214,33,133,.04); }
#messagebody blockquote blockquote blockquote { border-left-color: #571381 !important; background: rgba(87,19,129,.04); }

/* Anexos de imagem mostrados no fim da mensagem */
#messagebody .image-attachment, #messagebody p.image-attachment {
  display: inline-block; margin: 10px 10px 0 0; padding: 10px; border-radius: 16px; background: var(--rc-l-fundo); border: 1px solid var(--rc-l-borda);
}
#messagebody .image-attachment img { border-radius: 10px; }

/* ---------- Janela cheia (ação "show") ---------- */
body.action-show #layout-content > .content { background: var(--rc-l-fundo) !important; }
body.action-show #layout-content > .header { border-radius: 0; }

/* ---------- Entrada ---------- */
body.action-preview #message-header,
body.action-show #message-header { animation: rcSobe .45s cubic-bezier(.22,.9,.3,1) both; }
body.action-preview #messagebody,
body.action-show #messagebody { animation: rcSobe .5s cubic-bezier(.22,.9,.3,1) .08s both; }
