/* ================================
   DASH HUB — Visual Prototype
   Identidade fiel ao mockup
   =============================== */

:root {
  --bg: #ebebeb;
  --bg-panel: #ffffff;
  --bg-soft: #f5f5f5;
  --border: #e6e6e6;
  --border-strong: #d6d6d6;
  --text: #1f2024;
  --text-dim: #6b6f76;
  --text-mute: #9aa0a6;

  --brand: #0c0d10;
  --brand-text: #ffffff;

  --green: #1faa5e;
  --green-soft: #d6f1e0;
  --green-dim: #2fb56a;
  --red: #e63946;
  --red-soft: #f7d4d7;
  --gray-bar: #d9d9d9;
  --gray-bar-strong: #b8b8b8;

  --yellow-circle: #f6c344;
  --pink-circle: #ef88a8;
  --cyan-circle: #57c8e6;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.03);
  --shadow-md: 0 6px 18px rgba(0,0,0,.06);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

a { color: inherit; }

/* ================================
   LOGO PILL
   =============================== */
.logo-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: var(--brand-text);
  border-radius: 18px;
  padding: 8px 14px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 11px;
  min-width: 56px;
}
.logo-pill span:first-child { letter-spacing: 2px; }
.logo-pill span:last-child {
  background: var(--green);
  color: #fff;
  border-radius: 4px;
  padding: 1px 4px;
  margin-top: 3px;
  font-size: 10px;
}
.logo-pill.big {
  padding: 10px 16px;
  font-size: 12px;
  min-width: 64px;
}

/* ================================
   AUTH PAGES
   =============================== */
.auth-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f4f0 0%, #e7eee9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-wrapper {
  width: 100%;
  max-width: 1040px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.auth-card {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
}
.auth-brand { margin-bottom: 28px; }
.auth-title {
  font-size: 26px;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.auth-subtitle {
  color: var(--text-dim);
  margin: 0 0 28px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.field input {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31,170,94,.15);
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-dim);
}
.checkbox {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.checkbox.terms { font-size: 12.5px; }
.checkbox input { accent-color: var(--green); }

.auth-link {
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
}
.auth-link:hover { text-decoration: underline; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s, opacity .2s;
}
.btn-primary:hover { opacity: .92; }
.btn-primary:active { transform: translateY(1px); }

.auth-error {
  background: var(--red-soft);
  color: #8a1c25;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.auth-footer {
  margin: 14px 0 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}
.auth-demo {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-mute);
  background: var(--bg-soft);
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
}

.auth-side {
  background: linear-gradient(180deg, #0c0d10 0%, #1a2a1f 100%);
  color: #e9efe9;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-side h2 {
  font-size: 26px;
  margin: 0 0 14px;
  line-height: 1.15;
  letter-spacing: -.3px;
}
.auth-side p {
  color: #c0c8c2;
  margin: 0 0 24px;
  line-height: 1.5;
}
.auth-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.auth-bullets li {
  padding-left: 24px;
  position: relative;
  color: #d6dcd7;
  line-height: 1.4;
  font-size: 13.5px;
}
.auth-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 14px;
  height: 14px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #0c0d10;
}

@media (max-width: 860px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ================================
   DASHBOARD LAYOUT
   =============================== */
.dash-body { background: var(--bg); }

.app {
  display: grid;
  grid-template-columns: 56px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 6px;
  border-right: 1px solid transparent;
}
.side-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #2c2f34;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.side-btn:hover { background: rgba(0,0,0,.05); }
.side-btn.round {
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.side-spacer { flex: 1; }

/* ---------- Main ---------- */
.main {
  padding: 14px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  border-radius: var(--radius-pill);
  padding: 8px 10px 8px 10px;
  box-shadow: var(--shadow-sm);
}
.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.2px;
  padding: 0 6px 0 4px;
  white-space: nowrap;
}
.topbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: nowrap;
  overflow: hidden;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px 6px 8px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
}
.filter-pill:hover { border-color: var(--border-strong); }
.filter-pill .filter-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
}
.filter-top {
  font-size: 10px;
  color: var(--text-mute);
  font-weight: 600;
}
.filter-pill.double { padding-right: 14px; }
.caret { color: var(--text-mute); font-size: 10px; margin-left: 2px; }

.filter-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.filter-icon.traffic { background: #2c2f34; color: #fff; }
.filter-icon.meta { background: #e9f1fb; color: #1877F2; }
.filter-icon.google { background: #fff; border: 1px solid var(--border); }

.circle-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.circle-btn.yellow { background: var(--yellow-circle); }
.circle-btn.pink   { background: var(--pink-circle); }
.circle-btn.cyan   { background: var(--cyan-circle); }
.circle-btn:hover  { filter: brightness(1.05); }

.date-range {
  margin-left: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

/* ---------- Content layout ---------- */
.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.platform-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.platform-row.tables {
  grid-template-columns: 1.1fr .9fr 1.1fr .9fr;
}

.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.col-narrow { min-width: 0; }

/* ---------- Card ---------- */
.card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.card-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dim);
}
.title-icon { color: var(--text-mute); font-size: 14px; }

.card-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-mute);
}
.card-tools button {
  background: transparent;
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card-tools button:hover { background: var(--bg-soft); }
.card-tools .divider {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 2px;
}

/* ---------- Platform card (metrics) ---------- */
.platform-card { padding: 14px 16px; }
.platform-head { margin-bottom: 10px; }
.platform-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.platform-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.platform-logo.meta-logo { background: #e9f1fb; border-color: #d9e6f8; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  padding-top: 6px;
}
.metric { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.metric-label {
  font-size: 12px;
  color: var(--text-dim);
}
.metric-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text);
}
.metric-pct {
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 2px;
}
.metric-pct.green { color: var(--green); }
.metric-pct.red   { color: var(--red); }

.progress {
  margin-top: 6px;
  background: var(--gray-bar);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-bar.green {
  background: linear-gradient(180deg, #2cbe72 0%, #1f9d5d 100%);
}
.progress-bar.red {
  background: linear-gradient(180deg, #ee5664 0%, #d62a3a 100%);
}
.progress-target {
  font-size: 10.5px;
  color: var(--text-mute);
  margin-top: 2px;
  text-align: right;
}

/* ---------- Data table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.data-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-dim);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.data-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px dashed var(--border);
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}
.data-table .num { text-align: right; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--bg-soft); }

.table-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
  font-size: 11.5px;
  color: var(--text-mute);
}
.pager button {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text-mute);
  padding: 0 4px;
  font-size: 14px;
}

/* ---------- Chart ---------- */
.chart-wrap {
  width: 100%;
  height: 220px;
  position: relative;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; display: block; }

.chart-legend {
  display: flex;
  gap: 14px;
  padding: 6px 4px 0;
  font-size: 11px;
  color: var(--text-mute);
}
.lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lg::before {
  content: "";
  width: 10px;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-bar-strong);
}
.lg.lg-cost::before { background: var(--green); }
.lg.lg-impr::before { background: var(--gray-bar-strong); }
.lg.lg-conv::before { background: var(--green); }
.lg.lg-cost-gray::before { background: var(--gray-bar-strong); }

/* ---------- Creatives ---------- */
.creatives { padding-bottom: 8px; }
.creatives-head {
  display: flex;
  justify-content: space-between;
  padding: 4px 4px 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
}
.creatives-list { display: flex; flex-direction: column; }
.creative-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border);
}
.creative-row:last-child { border-bottom: 0; }
.creative-thumb {
  width: 92px;
  height: 92px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: #d2e8d4;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.creative-thumb.thumb-1 {
  background: linear-gradient(135deg, #2cbe72 0%, #15883e 100%);
}
.creative-thumb.thumb-1::after {
  content: "OFERTAS";
  position: absolute;
  top: 14px;
  left: 8px;
  right: 8px;
  text-align: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
}
.creative-thumb.thumb-1::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: #fff;
}
.creative-thumb.thumb-2 {
  background: linear-gradient(160deg, #444 0%, #777 50%, #b9c7b9 100%);
}
.creative-thumb.thumb-2::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 6px;
  background:
    radial-gradient(circle at 30% 40%, rgba(255,255,255,.4) 0 6px, transparent 7px),
    linear-gradient(135deg, #6c7e6f 0%, #4d5e51 60%);
}
.creative-thumb.thumb-3 {
  background: linear-gradient(135deg, #c9b89a 0%, #8a7659 100%);
}
.creative-thumb.thumb-3::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, #8d6e63 0%, #5d4037 100%);
}
.creative-cost {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.thumb-tag { display: none; }

/* ---------- User menu ---------- */
.user-menu {
  position: fixed;
  left: 64px;
  bottom: 18px;
  width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  padding: 12px;
  z-index: 50;
}
.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-email { color: var(--text-mute); font-size: 11px; }
.user-menu a {
  display: block;
  padding: 7px 6px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
}
.user-menu a:hover { background: var(--bg-soft); }
.user-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* ================================
   RESPONSIVE
   =============================== */
@media (max-width: 1280px) {
  .platform-row.tables {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 980px) {
  .platform-row, .platform-row.tables { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .date-range { margin-left: 0; }
}
@media (max-width: 640px) {
  .metric-grid { grid-template-columns: 1fr; gap: 14px; }
  .app { grid-template-columns: 48px 1fr; }
}
