/* ==========================================================================
   PAINEL DO ADMINISTRADOR (admin.html) — interno, restrito a role=admin
   ========================================================================== */
body { background: var(--navy); color: var(--white); }

.adm-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 5%; border-bottom: 1px solid rgba(0, 207, 255, 0.12);
  position: sticky; top: 0; z-index: 20; background: rgba(5, 13, 26, 0.92); backdrop-filter: blur(8px);
}
.adm-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--white); }
.adm-logo img { height: 34px; width: auto; }
.adm-logo span { font-family: 'Rajdhani', sans-serif; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: 0.95rem; }
.adm-top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-top-actions .btn-outline { padding: 8px 16px; font-size: 0.78rem; }

.adm-gate { max-width: 560px; margin: 90px auto; text-align: center; padding: 0 20px; }
.adm-gate h1 { font-family: 'Rajdhani', sans-serif; font-size: 2rem; margin-bottom: 10px; }
.adm-gate p { color: var(--gray); margin-bottom: 22px; }

.adm-main { max-width: 1200px; margin: 0 auto; padding: 32px 5% 80px; }

/* Stats */
.adm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.adm-stat {
  background: linear-gradient(180deg, var(--navy-mid), var(--navy));
  border: 1px solid rgba(0, 207, 255, 0.15); border-radius: 14px; padding: 22px 24px;
}
.adm-stat-n { font-family: 'Rajdhani', sans-serif; font-size: 2.4rem; font-weight: 700; color: var(--gold); line-height: 1; }
.adm-stat-k { color: var(--gray); font-size: 0.82rem; margin-top: 6px; text-transform: uppercase; letter-spacing: 1px; }

/* Painel/tabela */
.adm-panel { background: var(--navy-mid); border: 1px solid rgba(0, 207, 255, 0.12); border-radius: 14px; overflow: hidden; }
.adm-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 24px; border-bottom: 1px solid rgba(0, 207, 255, 0.1); }
.adm-panel-head h2 { font-family: 'Rajdhani', sans-serif; font-size: 1.3rem; }
.adm-filter { display: flex; align-items: center; gap: 10px; }
.adm-filter label { color: var(--gray); font-size: 0.8rem; }
.adm-filter select, .adm-status-sel {
  background: var(--navy); color: var(--white); border: 1px solid rgba(0, 207, 255, 0.25);
  border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 0.82rem;
}
.adm-filter .btn-outline { padding: 8px 14px; font-size: 0.76rem; }

.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.adm-table th, .adm-table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: top; }
.adm-table th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gray); font-weight: 600; }
.adm-table td { font-size: 0.86rem; }
.adm-ref { font-family: 'Share Tech Mono', monospace; color: var(--electric); }
.adm-cli-name { font-weight: 600; }
.adm-cli-sub { color: var(--gray); font-size: 0.76rem; }
.adm-cli-sub a { color: var(--gray); }
.adm-empty { text-align: center; color: var(--gray); padding: 40px 16px; }
.adm-view { background: none; border: 1px solid rgba(0, 207, 255, 0.3); color: var(--electric); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 0.78rem; }
.adm-view:hover { background: rgba(0, 207, 255, 0.08); }

/* Modal detalhe */
.adm-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.adm-modal[hidden] { display: none; }   /* o hidden precisa vencer o display:flex acima */
.adm-modal-box { background: var(--navy-mid); border: 1px solid rgba(0, 207, 255, 0.2); border-radius: 16px; max-width: 640px; width: 100%; padding: 28px; position: relative; }
.adm-modal-x { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--gray); font-size: 1.1rem; cursor: pointer; }
.adm-modal-box h3 { font-family: 'Rajdhani', sans-serif; font-size: 1.4rem; margin-bottom: 4px; }
.adm-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin-top: 16px; font-size: 0.88rem; }
.adm-dl dt { color: var(--gray); }
.adm-dl dd { color: var(--white); }
.adm-sec-title { margin-top: 20px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 2px; color: var(--electric); }

/* Toast */
.adm-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy-light); border: 1px solid rgba(0, 207, 255, 0.3); color: var(--white); padding: 12px 20px; border-radius: 10px; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.adm-toast.err { border-color: rgba(255, 77, 106, 0.5); }

.adm-gate-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Modo claro ──────────────────────────────────────────────────────────
   O topo (.adm-top) fica escuro de propósito nos dois temas — o logo é a
   versão clara e some num fundo claro. O CONTEÚDO adapta pelos tokens; aqui
   só corrigimos o que ficaria invisível/baixo contraste no claro. */
body.light-theme .adm-table th,
body.light-theme .adm-table td { border-bottom-color: rgba(0, 0, 0, 0.08); }
body.light-theme .adm-stat,
body.light-theme .adm-panel,
body.light-theme .adm-modal-box { border-color: rgba(0, 0, 0, 0.12); }
body.light-theme .adm-panel-head { border-bottom-color: rgba(0, 0, 0, 0.08); }
body.light-theme .adm-view { color: var(--electric-dim); border-color: rgba(0, 153, 204, 0.45); }
body.light-theme .adm-view:hover { background: rgba(0, 153, 204, 0.08); }
body.light-theme .adm-sec-title { color: var(--electric-dim); }
body.light-theme .adm-stat-n { color: var(--gold-dim); }
body.light-theme .adm-filter select,
body.light-theme .adm-status-sel { border-color: rgba(0, 0, 0, 0.2); background: #fff; }
body.light-theme .adm-toast { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); }

@media (max-width: 640px) {
  .adm-stats { grid-template-columns: 1fr; }
  .adm-logo span { display: none; }
}

/* ── Não-lidas + chat no detalhe ── */
.adm-unread { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px; margin-left:4px; border-radius:999px; background:var(--red); color:#fff; font-size:.72rem; font-weight:700; }
.chat-msgs { max-height:300px; overflow-y:auto; display:flex; flex-direction:column; gap:10px; padding:14px; margin-top:10px; background:var(--navy); border:1px solid rgba(0,207,255,.12); border-radius:12px; }
.chat-empty { color:var(--gray); text-align:center; margin:auto; font-size:.86rem; padding:16px; }
.chat-msg { display:flex; flex-direction:column; max-width:82%; }
.chat-msg.me { align-self:flex-end; align-items:flex-end; }
.chat-msg.them { align-self:flex-start; align-items:flex-start; }
.chat-bubble { padding:9px 13px; border-radius:14px; font-size:.88rem; line-height:1.5; word-break:break-word; }
.chat-msg.me .chat-bubble { background:linear-gradient(135deg,var(--electric),var(--electric-dim)); color:#04121e; border-bottom-right-radius:4px; }
.chat-msg.them .chat-bubble { background:var(--navy-mid); color:var(--white); border:1px solid rgba(0,207,255,.15); border-bottom-left-radius:4px; }
.chat-time { font-size:.64rem; color:var(--gray); margin-top:3px; }
.chat-compose { display:flex; gap:10px; align-items:flex-end; margin-top:12px; }
.chat-compose textarea { flex:1; resize:none; max-height:120px; background:var(--navy); color:var(--white); border:1px solid rgba(0,207,255,.25); border-radius:12px; padding:10px 12px; font-family:inherit; font-size:.88rem; }
.adm-compose-side { display:flex; flex-direction:column; gap:6px; align-items:flex-end; }
.adm-notify { display:flex; align-items:center; gap:6px; font-size:.72rem; color:var(--gray); white-space:nowrap; }
.chat-compose .btn-primary { padding:9px 18px; }
body.light-theme .chat-msg.them .chat-bubble { background:#eef4fb; }
