/* Vepo Dashboard — identidade: navy #01071A + azul #008AFC */
:root {
  color-scheme: light;
  --brand-navy: #01071A;
  --brand-blue: #008AFC;
  --brand-blue-dark: #0072d6;

  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  --series-1: #008afc;
  --series-2: #1baf7a;
  --series-3: #eda100;
  --series-4: #4a3aa7;

  --good: #006300;
  --warn-bg: #fff7e8;
  --warn-border: #eda100;
  --good-bg: #eef7ee;
  --good-border: #0ca30c;
  --neutral-bg: #f2f6fc;
  --neutral-border: #008afc;
  --danger: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #12141c;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #199e70;
    --series-3: #c98500;
    --series-4: #9085e9;
    --good: #0ca30c;
    --warn-bg: #2a2005;
    --good-bg: #0d2410;
    --neutral-bg: #101c2c;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

/* ---------- login ---------- */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand-navy) 0%, #041a3d 60%, #052a5e 100%);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.logo { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.logo .mark { font-size: 26px; font-weight: 800; letter-spacing: 1px; color: var(--ink); }
.logo .mark b { color: var(--brand-blue); }
.login-card p.sub { color: var(--ink-2); font-size: 13.5px; margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand-blue); outline-offset: 0; border-color: transparent; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand-blue); color: #fff; border: none;
  padding: 10px 18px; border-radius: 8px; font-weight: 600;
}
.btn:hover { background: var(--brand-blue-dark); }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--neutral-bg); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.error-msg { color: var(--danger); font-size: 13.5px; margin-top: 12px; min-height: 20px; }

/* ---------- shell ---------- */
.topbar {
  background: var(--brand-navy);
  color: #fff;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 58px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .logo .mark { color: #fff; font-size: 19px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav button {
  background: none; border: none; color: rgba(255, 255, 255, 0.65);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.topbar nav button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.topbar nav button.active { color: #fff; background: var(--brand-blue); }
.topbar .who { font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.topbar .who b { color: #fff; }

main { max-width: 1200px; margin: 0 auto; padding: 26px 24px 60px; }

/* ---------- dashboard ---------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 18px; }
.dash-head h1 { font-size: 21px; font-weight: 700; }
.dash-head .spacer { flex: 1; }
.updated { font-size: 12.5px; color: var(--muted); }
.updated .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good-border); margin-right: 5px; animation: pulse 2.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 20px;
}
.filters .preset {
  background: none; border: 1px solid transparent; border-radius: 7px;
  padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.filters .preset:hover { background: var(--neutral-bg); color: var(--ink); }
.filters .preset.active { background: var(--brand-blue); color: #fff; }
.filters .custom { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--ink-2); }
.filters input[type="date"] {
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px;
  background: var(--page); color: var(--ink); font-size: 13px;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px;
}
.kpi .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.kpi .value { font-size: 22px; font-weight: 700; margin: 3px 0 2px; color: var(--ink); }
.kpi .delta { font-size: 12.5px; font-weight: 600; }
.kpi .delta.up { color: var(--good); }
.kpi .delta.down { color: var(--danger); }
.kpi .delta.flat { color: var(--muted); }

.charts { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 22px; }
@media (min-width: 900px) { .charts { grid-template-columns: 1fr 1fr; } .charts .wide { grid-column: 1 / -1; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; overflow: hidden;
}
.card h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 2px; }
.card .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--ink); color: var(--page);
  border-radius: 7px; padding: 7px 10px; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
  display: none;
}
.tooltip b { font-weight: 700; }

.insights { display: grid; gap: 10px; margin-bottom: 22px; }
.insight {
  border-radius: 10px; padding: 12px 16px; font-size: 14px;
  border: 1px solid var(--neutral-border); background: var(--neutral-bg);
  display: flex; gap: 10px; align-items: flex-start;
}
.insight.good { border-color: var(--good-border); background: var(--good-bg); }
.insight.warn { border-color: var(--warn-border); background: var(--warn-bg); }
.insight .ico { flex-shrink: 0; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
table.data th {
  text-align: right; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--axis);
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--grid); color: var(--ink); }
table.data tr:hover td { background: var(--neutral-bg); }

/* ---------- rankings de campanhas / conjuntos / anúncios ---------- */
.ent-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.ent-wins { display: flex; gap: 4px; }
.ent-wins .preset { border: 1px solid var(--border); }
.rgroups { margin-bottom: 14px; }
.kpi.rg { background: var(--neutral-bg); border-color: var(--neutral-border); }
.kpi.rg.dim { background: var(--surface); border-color: var(--border); }
.kpi.rg.dim .value { color: var(--muted); }
.growth-title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 4px 0 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-bottom: 4px; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }
table.data.ent td.name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data.ent td.st { white-space: nowrap; }
table.data.ent .rt { display: block; font-size: 11px; color: var(--muted); }
table.data.ent tr.best td { background: var(--good-bg); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.on { background: var(--good-border); }
.status-dot.off { background: var(--muted); }
.status-dot.warn { background: var(--warn-border); }
.crown { font-size: 13px; }

/* ---------- admin ---------- */
.admin-grid { display: grid; gap: 18px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.admin-head h2 { font-size: 18px; }
.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--axis); }
.list-table td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.chip {
  display: inline-block; background: var(--neutral-bg); border: 1px solid var(--border);
  color: var(--ink-2); border-radius: 20px; padding: 2px 10px; font-size: 12px; margin: 1px 3px 1px 0;
}
.chip.role-admin { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(1, 7, 26, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 12px; padding: 26px;
  width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 18px; font-size: 17px; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.checklist { display: grid; gap: 6px; max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.checklist label { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 400; color: var(--ink); }

.note { font-size: 13px; color: var(--ink-2); }
.hidden { display: none !important; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 0; }

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; }
  main { padding: 18px 14px 40px; }
  .filters .custom { margin-left: 0; }
}
