/* ============================================================
   Painel MFMC — estilos
   Cores da marca: vermelho #ed1c24, fundo #ece5dd, cartão #f6f1eb
   ============================================================ */

:root {
  --vermelho: #ed1c24;
  --vermelho-escuro: #c4141b;
  --fundo: #ece5dd;
  --cartao: #f6f1eb;
  --texto: #111111;
  --texto-suave: #555555;
  --borda: rgba(0, 0, 0, .16);
  --sombra: 0 12px 34px rgba(60, 40, 20, .14);
  --raio: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--texto);
  background: var(--fundo);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Marca / logótipo ---------- */
.marca {
  display: flex;
  align-items: center;
  gap: 12px;
}
.marca .estrela {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--vermelho);
  border-radius: 50%;
  color: #fff;
}
.marca .estrela svg { width: 24px; height: 24px; }
.marca .nome {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1.05;
}
.marca .nome b { display: block; font-size: 19px; }
.marca .nome span {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--texto-suave);
  font-weight: 600;
}

/* ============================================================
   LOGIN
   ============================================================ */
body.login-body { overflow: hidden; }
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  overflow: hidden;
}
.login-card .topo {
  background: linear-gradient(135deg, var(--vermelho), var(--vermelho-escuro));
  color: #fff;
  padding: 26px 24px 20px;
  text-align: center;
}
.login-cadeado { display: inline-flex; }
.login-cadeado svg { width: 40px; height: 40px; }
.login-marca {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px; font-weight: 800; letter-spacing: 3px;
  margin-top: 6px; line-height: 1;
}
.login-sub { display: block; font-size: 12.5px; opacity: .9; margin-top: 6px; letter-spacing: .3px; }
.login-card .corpo { padding: 26px 30px 26px; }

.login-card .marca {
  justify-content: center;
  margin-bottom: 8px;
}
.login-card .titulo {
  text-align: center;
  margin: 18px 0 26px;
  font-size: 14px;
  color: var(--texto-suave);
}

.campo { margin-bottom: 16px; }
.campo label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--texto);
}
.campo input {
  width: 100%;
  padding: 13px 15px;
  font-size: 16.5px;
  font-weight: 500;
  border: 1px solid var(--borda);
  border-radius: 10px;
  background: #fff;
  color: var(--texto);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.campo input:focus {
  border-color: var(--vermelho);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, .14);
}
.campo.recaptcha { display: flex; justify-content: center; }

.btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 16.5px;
  font-weight: 800;
  color: #fff;
  background: var(--vermelho);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--vermelho-escuro); }
.btn:active { transform: translateY(1px); }

.alerta {
  background: #fdecec;
  border: 1px solid #f5b5b8;
  color: #a51219;
  font-size: 13.5px;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  text-align: center;
}

.rodape-login {
  text-align: center;
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--texto-suave);
}

/* ============================================================
   PAINEL
   ============================================================ */
.barra {
  background: var(--vermelho);
  color: #fff;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .16);
}
.barra-titulo {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 25px;
  letter-spacing: .3px;
  color: #fff;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .3);
  text-decoration: none;
  display: inline-block;
  transition: opacity .12s;
}
.barra-titulo:hover { opacity: .88; }

.barra .direita { display: flex; align-items: center; gap: 18px; }
.barra .ola {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.btn-sair {
  color: var(--vermelho);
  background: #fff;
  border: 2.5px solid #ffffff;
  padding: 10px 28px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 3px 0 #a5121a, 0 6px 14px rgba(0, 0, 0, .3);
  transition: transform .06s, box-shadow .12s;
}
.btn-sair:hover { box-shadow: 0 3px 0 #a5121a, 0 8px 20px rgba(0, 0, 0, .38); }
.btn-sair:active { transform: translateY(2px); box-shadow: 0 1px 0 #a5121a, 0 4px 10px rgba(0, 0, 0, .3); }

.conteudo {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 22px 60px;
}
.painel-cartao {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  padding: 30px 32px;
}
.painel-cartao h1 {
  font-family: Georgia, "Times New Roman", serif;
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 700;
  color: #1a1a1a;
}
.painel-cartao p { margin: 0; color: #1a1a1a; font-size: 16.5px; line-height: 1.6; }

.vazio {
  margin-top: 26px;
  border: 2px dashed rgba(0, 0, 0, .12);
  border-radius: var(--raio);
  padding: 40px 24px;
  text-align: center;
  color: var(--texto-suave);
  font-size: 14px;
}

/* ---------- Layout com menu lateral ---------- */
.grelha {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.grelha .painel-cartao { flex: 1; }
.menu-lateral { flex: 0 0 340px; width: 340px; }

@media (max-width: 880px) {
  .grelha { flex-direction: column; }
  .menu-lateral { flex-basis: auto; width: 100%; }
}

.menu-cartao {
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 18px;
  box-shadow: var(--sombra);
  overflow: hidden;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 17px 20px;
  text-decoration: none;
  color: var(--texto);
  border-bottom: 1px solid rgba(0, 0, 0, .11);
  transition: background .12s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: rgba(237, 28, 36, .06); }
.menu-item .ico {
  display: flex;
  color: var(--vermelho);
  flex: 0 0 26px;
}
.menu-item .ico svg { width: 26px; height: 26px; }
.menu-item .txt {
  flex: 1;
  font-weight: 800;
  font-size: 17px;
  color: #111;
}
.menu-item .seta {
  color: #c9c2ba;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Painel: menu lateral (submenus) + feed ---------- */
.layout {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 68px);
}
.lateral {
  width: 268px;
  flex: 0 0 268px;
  background: #fff;
  border-right: 1px solid var(--borda);
}
.feed-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  font-weight: 800;
  font-size: 15px;
  color: #1a1a1a;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
}
.grupo-lbl { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.ico-menu { display: inline-flex; flex: 0 0 20px; }
.ico-menu svg { width: 20px; height: 20px; display: block; }
.feed-link:hover { background: rgba(237, 28, 36, .06); color: var(--vermelho); }
.feed-link.ativo { background: rgba(237, 28, 36, .10); color: var(--vermelho); }
.sino {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--vermelho);
  vertical-align: middle;
  margin-left: 4px;
  box-shadow: 0 0 0 2px #fff;
}

/* ---------- Conversas (fórum) ---------- */
.conversa-nova { padding: 16px 18px; }
.conversa-nova textarea,
.responder textarea,
.edit-area {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borda);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--texto);
  resize: vertical;
}
.conversa-barra { display: flex; gap: 10px; align-items: center; margin-top: 10px; }

.btn-anexo { background: #efe8e0; color: #333; cursor: pointer; }
.btn-anexo:hover { background: #e4dbcd; }

.msg { }
.msg-topo {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: 14px;
  padding: 15px 17px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(60, 40, 20, .05);
}
.msg-resp {
  background: var(--fundo);
  border-radius: 10px;
  padding: 11px 13px;
  margin: 10px 0 0 22px;
}
.msg-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.msg-autor { font-weight: 800; color: #111; font-size: 14.5px; }
.msg-data { font-size: 12px; color: #7a7168; white-space: nowrap; }
.msg-texto { font-size: 15px; color: #1a1a1a; line-height: 1.55; word-break: break-word; }
.msg-acoes { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.anexos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.anexos img {
  max-width: 190px;
  max-height: 190px;
  border-radius: 8px;
  border: 1px solid var(--borda);
  object-fit: cover;
  display: block;
}
.anexo-fich {
  background: #efe8e0;
  color: #333;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.anexo-fich:hover { background: #e4dbcd; }

.responder { display: flex; gap: 8px; align-items: center; margin: 12px 0 0 22px; }
.responder textarea { flex: 1; min-height: 40px; }

.grupo { border-bottom: 1px solid rgba(0, 0, 0, .07); }
.grupo > summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.grupo > summary::-webkit-details-marker { display: none; }
.grupo > summary::after {
  content: '\203A';
  color: #b9b1a8;
  font-size: 20px;
  line-height: 1;
  transition: transform .15s;
}
.grupo[open] > summary { color: var(--vermelho); }
.grupo[open] > summary::after { transform: rotate(90deg); color: var(--vermelho); }
.grupo .sub {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px 10px 26px;
  font-size: 13.5px;
  color: #333;
  text-decoration: none;
  border-top: 1px solid rgba(0, 0, 0, .05);
  background: #faf8f5;
}
.grupo .sub:hover { background: rgba(237, 28, 36, .07); color: var(--vermelho); }
.ico-sub { display: inline-flex; flex: 0 0 17px; }
.ico-sub svg { width: 17px; height: 17px; display: block; }

.feed { flex: 1; padding: 26px 32px; }
.feed h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  margin: 0 0 4px;
  color: #111;
}
.feed .sub-titulo { color: var(--texto-suave); font-size: 14px; margin: 0 0 20px; }
.feed-vazio {
  border: 2px dashed rgba(0, 0, 0, .12);
  border-radius: 14px;
  padding: 44px 24px;
  text-align: center;
  color: var(--texto-suave);
  font-size: 14px;
}

/* ---------- Feed em cards (12, 4 por linha) ---------- */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 6px;
}
.card-atv {
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 12px;
  padding: 13px 15px;
  box-shadow: 0 4px 14px rgba(60, 40, 20, .06);
  display: flex;
  flex-direction: column;
  min-height: 150px;
}
.card-atv .tipo {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.card-atv .tipo.add  { background: #e7f7ec; color: #1c7a34; }
.card-atv .tipo.edit { background: #e7f0fb; color: #1857a6; }
.card-atv .tipo.del  { background: #fdeaea; color: #b3121b; }
.card-atv .item {
  font-weight: 800; font-size: 15px; color: #111; margin: 9px 0 3px;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-atv .meta {
  font-size: 12px; color: #7a7168;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.card-acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; padding-top: 10px; }
.card-acoes form { margin: 0; }
.card-ver { display: inline-block; }

@media (max-width: 1000px) { .feed-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .feed-grid { grid-template-columns: 1fr; } }

/* Botão WhatsApp no topo */
.btn-wa {
  display: inline-flex; align-items: center; gap: 7px;
  background: #25d366; color: #fff;
  border-radius: 22px; padding: 8px 15px;
  font-family: inherit; font-size: 14px; font-weight: 800;
  text-decoration: none; white-space: nowrap;
}
.btn-wa svg { width: 18px; height: 18px; }
.btn-wa:hover { filter: brightness(.94); }
/* WhatsApp por baixo do Sair (só no Chat) — PC e telemóvel */
.wa-barra { display: flex; justify-content: flex-end; margin: -8px 0 10px; }
@media (max-width: 640px) { .wa-barra { margin: -4px 0 10px; } }

/* Cores por autor (Mestre Cruz = vermelho, Lucas = verde) */
.autor-mc, .msg-autor.autor-mc { color: #ed1c24; }
.autor-lu, .msg-autor.autor-lu { color: #12a150; }
.autor-ou, .msg-autor.autor-ou { color: #2563eb; }
.msg-autor.autor-mc, .msg-autor.autor-lu, .msg-autor.autor-ou { font-weight: 800; }

/* Banner "Instalar app" (PWA) */
.pwa-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 400;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--borda); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
  max-width: 460px; margin: 0 auto;
}
.pwa-ic { width: 40px; height: 40px; border-radius: 9px; flex: 0 0 40px; }
.pwa-txt { flex: 1; font-size: 14px; font-weight: 600; color: #111; line-height: 1.3; }
.pwa-inst {
  background: var(--vermelho); color: #fff; border: none; border-radius: 20px;
  padding: 9px 18px; font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.pwa-x { background: none; border: none; font-size: 22px; line-height: 1; color: #b0aaa2; cursor: pointer; padding: 0 2px; }

/* Feed: secções (domínios a expirar / apontamentos / conversas) */
.feed-seccao { margin: 18px 0 8px; }
.feed-seccao-tit { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: #111; margin: 0 0 12px; }
.fs-ic { display: inline-flex; }
.fs-ic svg { width: 20px; height: 20px; display: block; }

/* Resumo de toda a plataforma */
.resumo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 12px;
}
.resumo-tipos, .resumo-areas { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.resumo-areas { margin-left: auto; }
.rz { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #444; }
.rz b { font-weight: 800; color: #000; font-size: 15px; }
.rz-ic { display: inline-flex; }
.rz-ic svg { width: 16px; height: 16px; display: block; }
.rz-mc, .rz-mo, .rz-lu {
  padding: 3px 12px; border-radius: 20px; font-weight: 700; font-size: 12.5px; color: #fff;
}
.rz-mc { background: #ed1c24; } .rz-mc b { color: #fff; }
.rz-mo { background: #2563eb; } .rz-mo b { color: #fff; }
.rz-lu { background: #12a150; } .rz-lu b { color: #fff; }
.feed-chips { margin-bottom: 14px; }

/* ---------- Backups em cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card-bk {
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(60, 40, 20, .05);
}
.card-bk .bk-nome { font-weight: 800; font-size: 16px; color: #111; word-break: break-word; }
.card-bk .bk-data { font-size: 12px; color: #7a7168; margin: 3px 0 8px; }
.card-bk .bk-nota { font-size: 13px; color: #333; margin-bottom: 10px; word-break: break-word; }
.card-bk .bk-acoes { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 1000px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .cards-grid { grid-template-columns: 1fr; } }

/* ---------- Atalhos (cards clicáveis) ---------- */
.atalhos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.atalho {
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(60, 40, 20, .05);
  display: flex;
  flex-direction: column;
  transition: box-shadow .12s, border-color .12s;
}
.atalho:hover { box-shadow: 0 4px 14px rgba(60, 40, 20, .12); }
.atalho-topo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
}
.atalho-fav { flex: 0 0 20px; width: 20px; height: 20px; border-radius: 4px; }
.atalho-nome {
  flex: 1;
  font-weight: 800;
  font-size: 13.5px;
  color: #111;
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.atalho-acoes {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 0 11px 10px;
}
.atalho-acoes form { margin: 0; display: inline; }
/* Botão extra-pequeno */
.btn-xs { font-size: 11px; padding: 3px 9px; }
/* Cores rotativas dos cards */
.atalho.cor-0 { border-top: 3px solid #ed1c24; }
.atalho.cor-1 { border-top: 3px solid #2563eb; }
.atalho.cor-2 { border-top: 3px solid #12a150; }
.atalho.cor-3 { border-top: 3px solid #b8860b; }
.atalho.cor-4 { border-top: 3px solid #7c3aed; }
.atalho.cor-5 { border-top: 3px solid #0891b2; }
.atalho.cor-0 .atalho-nome { color: #b3121b; }
.atalho.cor-1 .atalho-nome { color: #1e50c0; }
.atalho.cor-2 .atalho-nome { color: #0e7a3c; }
.atalho.cor-3 .atalho-nome { color: #8a6608; }
.atalho.cor-4 .atalho-nome { color: #6021c9; }
.atalho.cor-5 .atalho-nome { color: #0a6f88; }

/* Botão hamburguer + overlay (só telemóvel) */
.nav-hamb { display: none; }
.nav-overlay { display: none; }

@media (max-width: 760px) {
  .nav-hamb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    margin-right: 6px;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .18);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
  }
  .nav-hamb:active { background: rgba(255, 255, 255, .30); }
  .nav-hamb svg { width: 26px; height: 26px; display: block; }

  .barra { padding: 0 12px; gap: 8px; }
  .barra-titulo { font-size: 19px; flex: 1 1 auto; min-width: 0; }
  .barra .direita { gap: 10px; }
  .barra .ola { display: none; }
  .btn-sair { padding: 9px 16px; font-size: 14px; }

  .layout { flex-direction: column; }
  .lateral {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 82%;
    max-width: 320px;
    z-index: 60;
    overflow-y: auto;
    border-right: 1px solid var(--borda);
    border-bottom: none;
    box-shadow: 2px 0 22px rgba(0, 0, 0, .28);
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  body.nav-aberto { overflow: hidden; }
  body.nav-aberto .lateral { transform: translateX(0); }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s;
  }
  body.nav-aberto .nav-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}
.grupo .sub.ativo { background: rgba(237, 28, 36, .10); color: var(--vermelho); font-weight: 700; }

/* ---------- Domínios: formulário + tabela ---------- */
.form-dom {
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 24px;
}
.form-titulo { margin: 0 0 14px; font-size: 16px; color: #111; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px 16px; }
.form-grid4 { grid-template-columns: repeat(4, 1fr); }
.form-grid4 .col3 { grid-column: span 3; }
.form-grid4 .col2 { grid-column: span 2; }
.tabela .col-num { font-weight: 800; color: var(--vermelho); text-align: center; }
.form-grid3 { grid-template-columns: repeat(3, 1fr); }
.form-grid3 .col2 { grid-column: span 2; }
@media (max-width: 820px) {
  .form-grid3 { grid-template-columns: repeat(2, 1fr); }
  .form-grid3 .col2 { grid-column: 1 / -1; }
}
@media (max-width: 480px) { .form-grid3 { grid-template-columns: 1fr; } }
.campo2 { display: flex; flex-direction: column; gap: 5px; }
.campo2.full { grid-column: 1 / -1; }
@media (max-width: 820px) {
  .form-grid4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid4 .col3 { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .form-grid4 { grid-template-columns: 1fr; }
}
.campo2 label { font-size: 12.5px; font-weight: 700; color: #333; }
.dica { font-weight: 400; font-size: 11.5px; color: #9a8f83; }
.form-grid input[type=text],
.form-grid input[type=date],
.form-grid input[type=number],
.form-grid input[type=url],
.form-grid select,
.form-grid textarea {
  padding: 9px 11px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--texto);
}
.check-linha { flex-direction: row; gap: 22px; align-items: center; padding-top: 4px; }
.check-linha label { display: flex; gap: 7px; align-items: center; font-weight: 600; font-size: 13.5px; color: #222; }
.form-acoes { margin-top: 15px; display: flex; gap: 10px; }

.tabela {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 12px;
  overflow: hidden;
}
.tabela th, .tabela td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, .11);
  font-size: 14px;
  color: var(--texto);
  vertical-align: top;
}
.tabela th {
  background: #f3ede6;
  font-weight: 700;
  color: #444;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.tabela tr:last-child td { border-bottom: none; }
.tabela .lnk { color: var(--vermelho); font-weight: 700; text-decoration: none; }
.tabela .lnk:hover { text-decoration: underline; }
.nota-lin { font-size: 12px; color: #777; margin-top: 3px; }
.acoes { white-space: nowrap; display: flex; gap: 6px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.ok    { background: #e7f7ec; color: #1c7a34; }
.badge.aviso { background: #fff2df; color: #a5610f; }
.badge.exp   { background: #fdeaea; color: #b3121b; }
.badge.sim   { background: #e7f7ec; color: #1c7a34; }
.badge.nao   { background: #eeeae4; color: #888; }

.btn-mini {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn-guardar { background: var(--vermelho); color: #fff; }
.btn-guardar:hover { background: var(--vermelho-escuro); }
.btn-edit { background: #efe8e0; color: #333; }
.btn-del  { background: #fdeaea; color: #b3121b; }
.btn-ver  { background: #e7f7ec; color: #1c7a34; }
.btn-ver:hover { background: #d6efdd; }
.btn-aceder { background: #e7f0fb; color: #1857a6; }
.btn-aceder:hover { background: #d7e6f8; }
.btn-copiar { background: #efe8e0; color: #444; margin-top: 5px; }
.btn-copiar:hover { background: #e4dbcd; }
.email-txt { font-size: 13px; color: var(--texto); margin-right: 6px; }

/* ---------- Popup ---------- */
.popup-toggle { display: none; }
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.popup-toggle:checked ~ .popup-overlay { display: flex; }
.popup-caixa {
  background: #fff;
  border-radius: 16px;
  max-width: 460px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 26px 26px 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  position: relative;
}
.popup-x {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 26px;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
}
.popup-x:hover { color: #444; }
.popup-titulo { font-family: Georgia, serif; font-size: 20px; margin: 0 0 14px; color: #111; }
.popup-lista + .popup-titulo { margin-top: 16px; }
.popup-lista { margin: 0 0 18px; padding-left: 18px; color: #1a1a1a; font-size: 14.5px; line-height: 1.7; }
.popup-data { color: #7a7168; font-size: 12.5px; }
.popup-ok { cursor: pointer; text-align: center; }

/* ---------- Popups do login (um a um, enchem o ecrã) ---------- */
body.popup-aberto { overflow: hidden; }
.popup-multi {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pcard {
  display: none;
  flex-direction: column;
  width: min(920px, 96vw);
  height: min(88vh, 900px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
  overflow: hidden;
  animation: pcard-in .18s ease;
}
@keyframes pcard-in { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pcard-topo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-top: 6px solid var(--cor, #ed1c24);
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.pcard-ic { display: inline-flex; color: var(--cor, #ed1c24); }
.pcard-ic svg { width: 30px; height: 30px; display: block; }
.pcard-titulo { font-family: Georgia, serif; font-size: 26px; margin: 0; color: #111; flex: 1; }
.pcard-conta { font-size: 14px; font-weight: 800; color: #8a8178; }
.pcard-x {
  background: none; border: none; cursor: pointer;
  font-size: 32px; line-height: 1; color: #b0aaa2; padding: 0 4px;
}
.pcard-x:hover { color: #444; }
.pcard-corpo { flex: 1; overflow-y: auto; padding: 22px 28px; }
.pcard-corpo .popup-lista { font-size: 17px; line-height: 1.9; }
.pcard-corpo .popup-lista li { margin-bottom: 6px; }
.pcard-rodape {
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, .08);
  display: flex;
  justify-content: flex-end;
}
.pcard-ok { cursor: pointer; font-size: 16px; padding: 12px 30px; }

/* ---------- Apontamentos: tarefas vindas dos Sites ---------- */
.sites-fazer { margin: 6px 0 20px; }
.sites-fazer-tit { font-size: 15px; font-weight: 800; color: #111; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.sites-fazer .tabela { background: #fbf7f0; }

/* ---------- Avisos do login (cartões no painel) ---------- */
.avisos-bloco { margin: 4px 0 18px; }
.avisos-tit { font-size: 15px; font-weight: 800; color: #111; margin: 0 0 10px; }
.avisos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.aviso-card {
  background: #fff;
  border: 1px solid var(--borda);
  border-top: 4px solid var(--cor, #ed1c24);
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(60, 40, 20, .06);
  overflow: hidden;
}
.aviso-cab { display: flex; align-items: center; gap: 9px; padding: 12px 14px 6px; }
.aviso-ic { display: inline-flex; color: var(--cor, #ed1c24); }
.aviso-ic svg { width: 20px; height: 20px; display: block; }
.aviso-tit { flex: 1; font-size: 14.5px; font-weight: 800; color: #111; margin: 0; }
.aviso-x { background: none; border: none; font-size: 22px; line-height: 1; color: #b0aaa2; cursor: pointer; padding: 0 2px; }
.aviso-x:hover { color: #444; }
.aviso-card .popup-lista { margin: 0; padding: 4px 16px 14px 32px; font-size: 13.5px; line-height: 1.6; }
.aviso-card .popup-lista li { margin-bottom: 4px; }

/* ---------- Afiliados: popup de detalhes ---------- */
.afil-modal[hidden] { display: none; }
.afil-modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.afil-modal-caixa {
  background: #fff; border-radius: 18px;
  width: min(640px, 96vw); max-height: 88vh; overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
}
.afil-modal-x {
  position: absolute; top: 14px; right: 16px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, .22); border: none;
  font-size: 24px; line-height: 1; color: #fff; cursor: pointer;
}
.afil-modal-x:hover { background: rgba(255, 255, 255, .38); }
.det-cab {
  position: sticky; top: 0; z-index: 1;
  background: linear-gradient(135deg, #ed1c24, #b3121b);
  color: #fff; padding: 22px 24px 18px;
}
.det-titulo { font-family: Georgia, serif; font-size: 26px; margin: 0 0 10px; color: #fff; }
.det-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.det-badges .badge { background: rgba(255, 255, 255, .9); }
.det-corpo { padding: 6px 22px 20px; }
.det-item { display: flex; gap: 14px; align-items: flex-start; padding: 13px 2px; border-bottom: 1px solid rgba(0, 0, 0, .07); }
.det-item:last-child { border-bottom: none; }
.det-ic { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; background: #f4f0ea; display: inline-flex; align-items: center; justify-content: center; }
.det-ic svg { width: 19px; height: 19px; display: block; }
.det-tx { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.det-lbl { font-size: 11.5px; font-weight: 800; color: #9a9088; text-transform: uppercase; letter-spacing: .4px; }
.det-val { font-size: 14.5px; color: #111; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.det-sub { font-size: 12.5px; color: #7a7168; }
.det-corpo .btn-aceder { background: #12813f; color: #fff; border-color: #12813f; }
.det-corpo .btn-copiar { background: #eef1f6; color: #33415c; border-color: #dde3ec; font-weight: 700; }

/* ---------- Assistente IA ---------- */
.ia-fab {
  position: fixed;
  left: 22px; bottom: 22px;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 18px 12px 14px;
  background: var(--vermelho); color: #fff;
  border: none; border-radius: 30px;
  font-family: inherit; font-size: 15px; font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(237, 28, 36, .35);
  z-index: 260;
  transition: transform .12s, box-shadow .12s;
}
.ia-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(237, 28, 36, .45); }
.ia-fab-ic { display: inline-flex; }
.ia-fab-ic svg { width: 26px; height: 26px; display: block; }
.ia-painel[hidden] { display: none; }
.ia-painel {
  position: fixed;
  left: 22px; bottom: 22px;
  width: min(410px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 90px));
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 270;
}
.ia-cab {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  background: var(--vermelho); color: #fff;
}
.ia-cab-nome { font-weight: 800; font-size: 16px; flex: 1; }
.ia-briefing {
  background: rgba(255, 255, 255, .2); color: #fff;
  border: none; border-radius: 16px; padding: 6px 12px;
  font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.ia-briefing:hover { background: rgba(255, 255, 255, .32); }
.ia-limpar {
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 16px; padding: 6px 11px; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.ia-limpar:hover { background: rgba(255, 255, 255, .2); }
.ia-x { background: none; border: none; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 2px; }
.ia-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #faf8f5; }
.ia-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.ia-bot { background: #fff; border: 1px solid var(--borda); color: #1a1a1a; align-self: flex-start; border-bottom-left-radius: 4px; }
.ia-eu { background: var(--vermelho); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ia-carregar { opacity: .7; font-style: italic; }
.ia-entrada { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--borda); background: #fff; }
.ia-entrada textarea {
  flex: 1; resize: none; border: 1px solid var(--borda); border-radius: 10px;
  padding: 10px 12px; font-family: inherit; font-size: 14px; max-height: 120px;
}
@media (max-width: 560px) {
  .ia-painel { left: 8px; bottom: 8px; height: calc(100vh - 70px); }
  .ia-fab-txt { display: none; }
}

/* ---------- Pesquisa + paginação ---------- */
.pesquisa { display: flex; gap: 8px; margin-bottom: 14px; }
.pesquisa input[type=search] {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--texto);
}
.lista-contagem { margin: 0 0 10px; font-size: 13px; color: var(--texto-suave); font-weight: 600; }
.pesquisa input[type=date].filtro-data {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--texto);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--borda);
  font-size: 13px;
  font-weight: 700;
  color: #444;
  text-decoration: none;
}
.chip:hover { background: #f3ede6; }
.chip.atual,
.chip.ativo { background: var(--vermelho); color: #fff; border-color: var(--vermelho); }

/* Linha de contadores + filtros (Domínios) */
.dom-topo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin: -4px 0 14px;
}
.dom-topo .chips { margin-bottom: 0; }
.dom-contadores { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.dc { font-size: 13px; color: #444; }
.dc b { font-weight: 800; color: #000; }
.dc-aviso b { color: #b8860b; }
.dc-exp b { color: var(--vermelho); }
.dc-eur b { color: #12813f; }
.dc-ok b { color: #12813f; }
.mini-acoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.btn-copylink {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 16px;
  border: 1px solid transparent; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 700;
  transition: filter .12s;
}
.btn-copylink svg { width: 13px; height: 13px; }
.btn-copylink:hover { filter: brightness(.96); }
.cl-afil { background: #fff5e6; color: #92610a; border-color: #f0dcb8; }
.cl-sub  { background: #f0ebfb; color: #5a2fb8; border-color: #ddd0f5; }
.badge.mod { background: #eef1f6; color: #33415c; }
.anexo-dica { font-size: 12px; color: var(--texto-suave); align-self: center; }
.afil-fotos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.afil-foto { position: relative; display: inline-flex; }
.afil-foto img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--borda); display: block; }
.afil-foto form { position: absolute; top: -6px; right: -6px; margin: 0; }
.afil-foto-x {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--vermelho); color: #fff; border: 2px solid #fff;
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.fotos-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.fotos-preview:empty { display: none; }
.foto-prev { position: relative; display: inline-flex; }
.foto-prev img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borda); display: block; }
.foto-prev-x {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--vermelho); color: #fff; border: 2px solid #fff;
  font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
tr.linha-feita td { opacity: .55; }
tr.linha-feita td.acoes { opacity: 1; }
/* Conversas: prioridade */
.prio-sel { padding: 8px 10px; border: 1px solid var(--borda); border-radius: 8px; font-family: inherit; font-size: 13px; background: #fff; }
.msg-topo.prio-exp { border-left: 4px solid var(--vermelho); }
.msg-topo.prio-aviso { border-left: 4px solid #b8860b; }
.msg-cab .badge { margin-left: 2px; }

.paginacao { display: flex; gap: 6px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.pg {
  display: inline-block;
  min-width: 36px;
  text-align: center;
  padding: 7px 10px;
  border: 1px solid var(--borda);
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  font-size: 13.5px;
  font-weight: 700;
  background: #fff;
}
.pg:hover { background: #f3ede6; }
.pg.atual { background: var(--vermelho); color: #fff; border-color: var(--vermelho); }
.pg.gap { border: none; background: transparent; font-weight: 400; color: #999; min-width: auto; }

/* ============================================================
   TELEMÓVEL — otimização geral (análise página a página)
   ============================================================ */
html, body { max-width: 100%; overflow-x: hidden; }

/* "Terminar sessão" no fundo do menu drawer — só telemóvel */
.sair-mob { display: none; }
@media (max-width: 760px) {
  .sair-mob {
    display: flex; align-items: center; gap: 10px;
    margin: 16px 14px 22px; padding: 13px 16px;
    background: var(--vermelho); color: #fff;
    font-weight: 800; font-size: 15px;
    border-radius: 12px; text-decoration: none;
    box-shadow: 0 3px 0 #a5121a;
  }
  .sair-mob svg { width: 20px; height: 20px; }
  .sair-mob:active { transform: translateY(1px); }
}

@media (max-width: 640px) {
  .feed { padding: 18px 13px 40px; }
  .feed h1 { font-size: 21px; }
  .feed .sub-titulo { font-size: 13px; }

  /* Pesquisa + filtros empilham */
  .pesquisa { flex-wrap: wrap; }
  .pesquisa input[type=search] { flex: 1 1 100%; }
  .pesquisa input[type=date].filtro-data,
  .pesquisa select,
  .pesquisa .btn,
  .pesquisa button { flex: 1 1 auto; }

  /* Formulários em coluna única */
  .form-grid, .form-grid3, .form-grid4 { grid-template-columns: 1fr; }
  .form-grid4 .col3, .form-grid4 .col2, .form-grid3 .col2 { grid-column: 1 / -1; }

  /* Tabelas: mais compactas, texto quebra, ações empilham */
  .tabela th, .tabela td { padding: 9px 8px; font-size: 13px; overflow-wrap: anywhere; }
  .acoes { flex-wrap: wrap; white-space: normal; gap: 5px; }
  .acoes .btn-mini { padding: 6px 10px; font-size: 12px; }

  /* Esconder colunas secundárias — o botão "Ver" mostra tudo */
  /* Domínios: Nº|Domínio|Expiração|Estado|Hospedagem|Site|Auto|Aviso|Popup|Ações → fica Domínio, Estado, Ações */
  .tbl-dom th:nth-child(1), .tbl-dom td:nth-child(1),
  .tbl-dom th:nth-child(3), .tbl-dom td:nth-child(3),
  .tbl-dom th:nth-child(5), .tbl-dom td:nth-child(5),
  .tbl-dom th:nth-child(6), .tbl-dom td:nth-child(6),
  .tbl-dom th:nth-child(7), .tbl-dom td:nth-child(7),
  .tbl-dom th:nth-child(8), .tbl-dom td:nth-child(8),
  .tbl-dom th:nth-child(9), .tbl-dom td:nth-child(9) { display: none; }

  /* Sites: Nº|Site|Domínio|Estado|O-que-falta|Popup|Ações → fica Site, Estado, Ações */
  .tbl-sites th:nth-child(1), .tbl-sites td:nth-child(1),
  .tbl-sites th:nth-child(3), .tbl-sites td:nth-child(3),
  .tbl-sites th:nth-child(5), .tbl-sites td:nth-child(5),
  .tbl-sites th:nth-child(6), .tbl-sites td:nth-child(6) { display: none; }

  /* Afiliados: Nº|Casa|Username|Conta|Email|Gestor|Apontamentos|Popup|Ações → fica Casa, Ações */
  .tbl-afil th:nth-child(1), .tbl-afil td:nth-child(1),
  .tbl-afil th:nth-child(3), .tbl-afil td:nth-child(3),
  .tbl-afil th:nth-child(4), .tbl-afil td:nth-child(4),
  .tbl-afil th:nth-child(5), .tbl-afil td:nth-child(5),
  .tbl-afil th:nth-child(6), .tbl-afil td:nth-child(6),
  .tbl-afil th:nth-child(7), .tbl-afil td:nth-child(7),
  .tbl-afil th:nth-child(8), .tbl-afil td:nth-child(8) { display: none; }

  /* Apontamentos dos sites: Site|O-que-falta|Estado|Ação → esconde Estado */
  .tbl-apsit th:nth-child(3), .tbl-apsit td:nth-child(3) { display: none; }

  /* Apontamentos: Data|Apontamento|Estado|Popup|Ações → esconde Data, Popup */
  .tbl-ap th:nth-child(1), .tbl-ap td:nth-child(1),
  .tbl-ap th:nth-child(4), .tbl-ap td:nth-child(4) { display: none; }

  /* Notas: Assunto|Apontamento|Referência|Data|Estado|Ações → esconde Referência, Data, Estado */
  .tbl-notas th:nth-child(3), .tbl-notas td:nth-child(3),
  .tbl-notas th:nth-child(4), .tbl-notas td:nth-child(4),
  .tbl-notas th:nth-child(5), .tbl-notas td:nth-child(5) { display: none; }
}

/* Item externo no menu: Painel de Afiliados (cor do destino = teal) */
.ext-afil { justify-content: space-between; }
.ext-afil:hover { background: rgba(0, 92, 98, .08); color: #005c62; }
.ext-seta { color: #005c62; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
