/* Painel Admin — Central de Acessos (estilo do brand kit GV) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #E05E3B;
  --red-dark: #C04E2D;
  --navy: #074866;
  --cream: #F0E6D6;
  --bg: #F4F5F7;
  --card-bg: #FFFFFF;
  --text: #074866;
  --muted: #6B7A8D;
  --line: rgba(7,72,102,.12);
  --radius: 14px;
  --shadow: 0 2px 24px rgba(7,72,102,.08);
  --ok: #2e9e6b;
  --warn: #E0A23B;
  --danger: #d6453c;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ── Botões ── */
.btn {
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: .82rem;
  background: var(--red);
  color: #fff;
  transition: background .2s ease, transform .12s ease, opacity .2s ease;
}
.btn:hover { background: var(--red-dark); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn--ghost:hover { background: rgba(7,72,102,.06); }
.btn--navy { background: var(--navy); }
.btn--navy:hover { background: #0a5f84; }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #b8362e; }
.btn--sm { padding: 7px 14px; font-size: .74rem; }
.btn--block { width: 100%; display: block; }

/* ── LOGIN ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  background: var(--card-bg);
  border-radius: 22px;
  box-shadow: var(--shadow);
  width: min(420px, 100%);
  padding: 40px 36px;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.login-logo img { height: 34px; }
.login-card h1 {
  font-weight: 300;
  font-size: 1.5rem;
  text-align: center;
  margin: 14px 0 4px;
}
.login-card h1 strong { font-weight: 800; }
.login-sub { text-align: center; color: var(--muted); font-size: .82rem; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .74rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: .03em; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .9rem;
  color: var(--text);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(224,94,59,.12); }

.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 8px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--red); }

/* Grupo de checkboxes (ex.: sub-abas de um card) — uma ou mais marcações. */
.check-group { display: flex; flex-wrap: wrap; gap: 8px 18px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.check-group .subtab-check { color: var(--text); font-weight: 500; }
.check-group .empty { width: 100%; border: none; padding: 0; text-align: left; }

/* Dica explicativa em painéis (ex.: edição da página inicial). */
.panel-hint { font-size: .8rem; color: var(--muted); line-height: 1.6; margin: -4px 0 14px; }
.panel-hint code { background: rgba(7,72,102,.08); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.link { background: none; border: none; color: var(--red); font-size: .78rem; font-weight: 600; padding: 0; }
.link:hover { text-decoration: underline; }

.form-msg { font-size: .8rem; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; display: none; }
.form-msg.show { display: block; }
.form-msg.error { background: rgba(214,69,60,.1); color: var(--danger); }
.form-msg.success { background: rgba(46,158,107,.12); color: var(--ok); }

/* ── HEADER do painel ── */
.admin-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--line);
  padding: 12px 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-header .brand { display: flex; align-items: center; gap: 12px; }
.admin-header .brand img { height: 30px; }
.admin-header .brand .sep { width: 1px; height: 28px; background: var(--line); }
.admin-header .brand .tag { font-size: .7rem; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

/* ── Perfil ── */
.profile { position: relative; }
.profile-circle {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
}
.profile-circle:hover { background: #0a5f84; }
.profile-menu {
  position: absolute;
  right: 0; top: 52px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(7,72,102,.16);
  width: 250px;
  padding: 16px;
  display: none;
}
.profile-menu.open { display: block; }
.profile-menu .pm-name { font-weight: 700; font-size: .95rem; }
.profile-menu .pm-email { color: var(--muted); font-size: .78rem; margin: 2px 0 10px; word-break: break-all; }
.profile-menu .pm-badge {
  display: inline-block; background: rgba(7,72,102,.1); color: var(--navy);
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 20px; margin-bottom: 14px;
}
.profile-menu hr { border: none; border-top: 1px solid var(--line); margin: 10px 0; }
.pm-action { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 8px; border-radius: 8px; font-size: .82rem; font-weight: 600; color: var(--text); }
.pm-action:hover { background: rgba(7,72,102,.06); }
.pm-action.danger { color: var(--danger); }

/* ── Layout do conteúdo ── */
.admin-main { max-width: 1080px; margin: 0 auto; padding: 28px 4vw 60px; }
.admin-nav { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-nav button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 50px;
  padding: 9px 20px;
  font-weight: 600;
  font-size: .82rem;
}
.admin-nav button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.section { display: none; }
.section.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.1rem; font-weight: 700; }
.section-head p { color: var(--muted); font-size: .8rem; margin-top: 2px; }

/* ── Cartões/painéis de listas ── */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.panel-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }

/* ── Itens reordenáveis (drag-and-drop) ── */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  transition: box-shadow .2s ease, border-color .2s ease, opacity .2s ease;
}
.item.dragging { opacity: .5; border-style: dashed; }
.item.drag-over { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224,94,59,.12); }
.item.inactive { opacity: .6; }
.item .pos {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: rgba(7,72,102,.08);
  color: var(--navy);
  font-weight: 700; font-size: .76rem;
  display: flex; align-items: center; justify-content: center;
}
.item .handle { cursor: grab; color: var(--muted); flex-shrink: 0; display: flex; align-items: center; }
.item .handle:active { cursor: grabbing; }
.item .item-icon { width: 34px; height: 34px; border-radius: 8px; background: rgba(7,72,102,.06); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--navy); }
.item .item-icon svg { width: 18px; height: 18px; }
.item .item-body { flex: 1; min-width: 0; }
.item .item-title { font-weight: 700; font-size: .88rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item .item-sub { color: var(--muted); font-size: .72rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chip { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 20px; background: rgba(7,72,102,.08); color: var(--navy); }
.chip.soon { background: rgba(224,94,59,.14); color: var(--red); }
.chip.theme { background: rgba(7,72,102,.06); }
.chip.you { background: var(--navy); color: #fff; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--navy); border-color: rgba(7,72,102,.3); }
/* Excluir: fundo vermelho para deixar a ação destrutiva evidente. */
.icon-btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.icon-btn.danger:hover { background: #b8362e; color: #fff; border-color: #b8362e; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.handle svg { width: 18px; height: 18px; }

/* Linha de auditoria (datas + autoria) nas listas */
.item .item-meta { color: var(--muted); font-size: .66rem; margin-top: 3px; opacity: .9; }

/* Radio (laranja) + destaque da aba selecionada para edição */
.radio-dot { flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); background: #fff; position: relative; transition: border-color .15s ease; }
.radio-dot.on { border-color: var(--red); }
.radio-dot.on::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--red); }
.item.selected { border-color: var(--red); box-shadow: 0 0 0 2px rgba(224,94,59,.18); }
.chip.selected { background: var(--red); color: #fff; }

/* Campo de senha com olhinho */
.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-right: 44px !important; }
.pass-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 32px; height: 32px; border: none; background: none; color: var(--muted); display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.pass-toggle:hover { color: var(--navy); background: rgba(7,72,102,.06); }
.pass-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Banner de alerta dentro do modal de confirmação (ações de impacto) */
.modal-title-danger { color: var(--danger); }
.modal-warning { display: flex; align-items: center; gap: 10px; background: rgba(214,69,60,.1); border: 1px solid rgba(214,69,60,.3); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-size: .82rem; font-weight: 600; margin-bottom: 14px; }
.modal-warning-ico { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }

/* Botão "Voltar ao início" no cabeçalho (esquerda) */
.back-home { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--navy); font-size: .78rem; font-weight: 600; border: 1px solid var(--line); border-radius: 50px; padding: 7px 14px; transition: background .2s ease, border-color .2s ease; }
.back-home:hover { background: rgba(7,72,102,.06); border-color: rgba(7,72,102,.3); }
.back-home svg { width: 16px; height: 16px; }
@media (max-width: 560px) { .back-home span { display: none; } }

/* Switch ativo/inativo */
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cfd6dd; border-radius: 22px; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Sub-listas (cards dentro da aba, agrupados por sub-aba) */
.group-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }

.empty { color: var(--muted); font-size: .82rem; padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(7,72,102,.35);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 26px; box-shadow: 0 20px 60px rgba(7,72,102,.3);
}
.modal h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 18px; }
.modal .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: .88rem; min-height: 64px; resize: vertical; }
.modal .field select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: .9rem; background: #fff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.icon-preview { width: 54px; height: 54px; border-radius: 10px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; }
.icon-preview svg { width: 26px; height: 26px; }
.upload-row { display: flex; align-items: center; gap: 12px; }

/* ── MÉTRICAS ── */
.export-menu { position: relative; }
.export-dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(7,72,102,.16); padding: 6px; min-width: 160px; display: none; z-index: 60; }
.export-dropdown.open { display: block; }
.export-dropdown button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 12px; border-radius: 8px; font-size: .82rem; font-weight: 600; color: var(--text); }
.export-dropdown button:hover { background: rgba(7,72,102,.06); }
.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.presets { display: flex; gap: 6px; }
.presets button { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 50px; padding: 7px 16px; font-weight: 600; font-size: .78rem; }
.presets button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.custom-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.custom-range label { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.custom-range input { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: .82rem; color: var(--text); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.8rem; font-weight: 800; color: var(--navy); }


/* Gráfico de linhas (acessos × usuários por dia). */
.line-chart { width: 100%; }
.line-chart .empty { padding: 24px 0; }
.lc-svg { width: 100%; height: auto; display: block; }
.lc-axis { font-size: 10px; fill: var(--muted); }
.chart-legend { display: flex; gap: 16px; align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 600; color: var(--muted); }
.legend-swatch { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

.metrics-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.metrics-cols--2 { grid-template-columns: repeat(2, 1fr); }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: none; }
.rank-pos { width: 22px; height: 22px; border-radius: 6px; background: rgba(7,72,102,.08); color: var(--navy); font-weight: 700; font-size: .72rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rank-name { flex: 1; font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-weight: 700; color: var(--red); font-size: .84rem; }
.rank-sub { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.rank-bar { height: 5px; border-radius: 4px; background: var(--red); opacity: .25; margin-top: 4px; }
.rank-scroll { overflow-y: auto; padding-right: 6px; }
.rank-scroll::-webkit-scrollbar { width: 6px; }
.rank-scroll::-webkit-scrollbar-thumb { background: rgba(7,72,102,.18); border-radius: 4px; }

@media (max-width: 860px) {
  .kpis { grid-template-columns: 1fr; }
  .metrics-cols { grid-template-columns: 1fr; }
}

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 50px; font-size: .82rem; font-weight: 600; box-shadow: 0 8px 30px rgba(7,72,102,.3); opacity: 0; transition: .3s; z-index: 200; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

@media (max-width: 560px) {
  .modal .grid2 { grid-template-columns: 1fr; }
  .item .item-sub { display: none; }
}
