/* =========================================================
   Painel Meta Ads — estilos (mobile first, tema claro/escuro)
   ========================================================= */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --radius-sm: 9px;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Tema claro — neutro, um único destaque (laranja) */
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-hover: #f0f0f1;
  --border: #e4e4e7;
  --text: #0a0a0a;
  --text-2: #3f3f46;
  --text-muted: #71717a;
  --primary: #ea580c;
  --primary-soft: rgba(234, 88, 12, .09);
  --on-primary: #ffffff;
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, .10);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .09);
  --warning: #ca8a04;
  --warning-soft: rgba(202, 138, 4, .12);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, .09);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .16);

  /* Séries de gráficos: c2 = Mensagem (destaque), c1 = Reconhecimento */
  --c1: #3b82f6;
  --c2: #ea580c;
  --c3: #a1a1aa;
  --c4: #10b981;
  --c5: #8b5cf6;
  --c6: #eab308;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1a1a1a;
  --surface-hover: #1f1f1f;
  --border: #262626;
  --text: #fafafa;
  --text-2: #d4d4d4;
  --text-muted: #a3a3a3;
  --primary: #f97316;
  --primary-soft: rgba(249, 115, 22, .12);
  --on-primary: #ffffff;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .12);
  --warning: #facc15;
  --warning-soft: rgba(250, 204, 21, .12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, .12);
  --shadow: none;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);

  --c1: #60a5fa;
  --c2: #f97316;
  --c3: #737373;
  --c4: #34d399;
  --c5: #a78bfa;
  --c6: #facc15;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background .25s var(--ease), color .25s var(--ease);
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--primary); }
svg.i { width: 20px; height: 20px; flex: none; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.view {
  padding: 16px 14px calc(32px + env(safe-area-inset-bottom));
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  outline: none;
  animation: fadeIn .3s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: min(86vw, var(--sidebar-w));
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .28s var(--ease);
  z-index: 50;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.sidebar__brand strong { display: block; font-size: 16px; }
.sidebar__brand small { color: var(--text-muted); font-size: 12px; }
.sidebar__close { margin-left: auto; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c1), var(--c4));
  color: #fff;
}
.brand-logo svg { width: 20px; height: 20px; }
.sidebar__nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-hover); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.nav-link .count { margin-left: auto; font-size: 12px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); padding: 0 8px; border-radius: 99px; }
.sidebar__footer { padding: 14px; }
.connect-card { border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); font-size: 13px; }
.connect-card strong { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }

.backdrop {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .5);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 40;
  backdrop-filter: blur(2px);
}
.backdrop.show { opacity: 1; pointer-events: auto; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__row { display: flex; align-items: center; gap: 10px; min-height: var(--topbar-h); padding: 8px 14px; }
.topbar__title { min-width: 0; flex: 1; }

/* Abas de empresas (menu superior) */
.company-tabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 0 10px; border-top: 1px solid var(--border);
}
.company-tabs::-webkit-scrollbar { display: none; }
.company-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 11px 12px; font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--text-muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.company-tab:hover { color: var(--text); }
.company-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.company-tab .avatar { width: 22px; height: 22px; font-size: 10px; border-radius: 6px; }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 11px; color: #fff; font-weight: 800; font-size: 14px;
  letter-spacing: .02em;
}
.topbar__title h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__updated { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }
.hide-sm { display: none; }
@media (min-width: 560px) { .hide-sm { display: inline; } }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); flex: none; }

/* ---------- Botões / inputs ---------- */
.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer; color: var(--text-2);
  transition: background .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: scale(.98); }
a.btn { text-decoration: none; color: inherit; }
a.btn.btn--link { color: var(--primary); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary); opacity: .9; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg.i { width: 18px; height: 18px; }

.select, .input {
  height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  padding: 0 12px; outline: none; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.select:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.select--sm { height: 40px; padding: 0 8px; font-size: 14px; }
.search { position: relative; flex: 1; min-width: 180px; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.search .input { width: 100%; padding-left: 38px; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--text-2);
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.switch { position: relative; width: 42px; height: 24px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 99px; background: var(--border); cursor: pointer;
  transition: background .2s;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s var(--ease);
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(18px); }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-muted); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h2 { font-size: 22px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .select { flex: 0 1 auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; min-width: 0;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card__head h3 { font-size: 15px; }
.card__head small { color: var(--text-muted); font-size: 12px; }
.chart-box { position: relative; height: 240px; }
.chart-box--sm { height: 200px; }

.grid { display: grid; gap: 12px; }
.kpi-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
.mini-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
.dash-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }

.kpi { position: relative; overflow: hidden; padding: 14px; }
.kpi__label { font-size: 12px; color: var(--text-muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi__label svg.i { width: 15px; height: 15px; }
.kpi__value { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi__foot small { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .spark { width: 64px; height: 24px; flex: none; }

.mini { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.mini span { font-size: 12px; color: var(--text-muted); }
.mini strong { font-size: 17px; font-variant-numeric: tabular-nums; }

.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.delta svg.i { width: 12px; height: 12px; }
.delta--up { color: var(--success); background: var(--success-soft); }
.delta--down { color: var(--danger); background: var(--danger-soft); }
.delta--flat { color: var(--text-muted); background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--active { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge--paused { color: var(--text-muted); }
.badge--good { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge--mid { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.badge--bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge--primary { color: var(--primary); background: var(--primary-soft); border-color: transparent; }

/* ---------- Funil ---------- */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel__row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.funnel__bar { height: 28px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.funnel__bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--c1), var(--c4)); min-width: 6px; transition: width .6s var(--ease); }
.funnel__row strong { font-variant-numeric: tabular-nums; }
.funnel__rate { font-size: 12px; color: var(--text-muted); text-align: right; }

/* ---------- Listas / tabelas ---------- */
.rank-list { display: flex; flex-direction: column; }
.rank-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.rank-item:first-child { border-top: 0; }
.rank-item__pos { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-muted); }
.rank-item__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-item__sub { font-size: 12px; color: var(--text-muted); }
.rank-item__val { text-align: right; font-variant-numeric: tabular-nums; }
.rank-item__val strong { display: block; font-size: 14px; }
.rank-item__val small { font-size: 12px; color: var(--text-muted); }

.table-wrap { display: none; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .name-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.table .name-cell small { display: block; font-weight: 400; color: var(--text-muted); font-size: 12px; }
.card--flush { padding: 0; overflow: hidden; }

.cards-list { display: grid; gap: 10px; }
.item-card { cursor: pointer; transition: transform .12s, border-color .15s; }
.item-card:active { transform: scale(.99); }
.item-card__top { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.item-card__title { font-weight: 700; font-size: 15px; word-break: break-word; }
.item-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.metrics div span { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.metrics div strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.metrics--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }

.summary-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }

/* ---------- Anúncios ---------- */
.ads-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.ad-card { padding: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.ad-preview {
  position: relative; aspect-ratio: 16 / 10; display: flex; align-items: flex-end;
  padding: 14px; color: #fff; overflow: hidden;
}
.ad-preview::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 10%, rgba(255,255,255,.35), transparent 40%), linear-gradient(180deg, transparent 40%, rgba(0,0,0,.55));
}
.ad-preview__format { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.35); backdrop-filter: blur(6px); padding: 4px 10px; border-radius: 99px; }
.ad-preview__format svg.i { width: 14px; height: 14px; }
.ad-preview__headline { position: relative; font-weight: 800; font-size: 18px; line-height: 1.2; text-shadow: 0 1px 8px rgba(0,0,0,.3); }
.ad-preview__cta { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; background: #fff; color: #111; padding: 4px 10px; border-radius: 6px; }
.ad-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ad-body .item-card__title { font-size: 14px; }
.ad-body .metrics { margin-top: auto; }

/* ---------- Modal (bottom sheet no mobile) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeBg .2s var(--ease);
  backdrop-filter: blur(3px);
}
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); width: 100%; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp .3s var(--ease);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal__grabber { width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 4px auto 10px; }
.modal__head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; margin-bottom: 14px; position: sticky; top: -8px; background: var(--surface); padding-top: 8px; z-index: 1; }
.modal__head h3 { font-size: 18px; word-break: break-word; }
.modal__head p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.modal section { margin-top: 16px; }
.modal section h4 { font-size: 14px; margin-bottom: 10px; }

/* ---------- Configurações ---------- */
.settings { display: grid; gap: 12px; max-width: 820px; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: 0; padding-top: 0; }
.setting-row h4 { font-size: 14px; }
.setting-row p { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); max-width: 460px; }
.schedule { display: flex; flex-wrap: wrap; gap: 6px; }
.schedule .tag.done { color: var(--success); background: var(--success-soft); border-color: transparent; }
.schedule .tag.next { color: var(--primary); background: var(--primary-soft); border-color: transparent; font-weight: 700; }
.source { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.source + .source { margin-top: 8px; }
.source__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.source__info { flex: 1; min-width: 0; }
.source__info strong { display: block; font-size: 14px; }
.source__info small { color: var(--text-muted); font-size: 12px; }

/* ---------- Diversos ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty svg.i { width: 36px; height: 36px; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-hover), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast-root { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .25s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Seções do relatório ---------- */
.section-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.section-title h3 { font-size: 16px; }
.section-title .pill { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px; border-radius: 99px; }
.pill--msg { background: var(--success-soft); color: var(--success); }
.pill--rec { background: var(--primary-soft); color: var(--primary); }
.section-title small { color: var(--text-muted); font-size: 12px; margin-left: auto; }

.hero {
  background: linear-gradient(135deg, var(--c1), var(--c4));
  color: #fff; border: 0; padding: 18px; margin-bottom: 12px;
}
.hero__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: baseline; }
.hero__top span { font-size: 13px; opacity: .85; font-weight: 600; }
.hero__top span::first-letter { text-transform: uppercase; }
.hero__value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.hero__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero__grid div { background: rgba(255,255,255,.14); border-radius: 10px; padding: 10px 12px; }
.hero__grid span { display: block; font-size: 11px; opacity: .85; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.hero__grid strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.split-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; margin-top: 12px; background: rgba(255,255,255,.2); }
.split-bar i { display: block; height: 100%; }
.split-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; opacity: .95; }
.split-legend span { display: inline-flex; align-items: center; gap: 6px; }
.split-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- Rankings ---------- */
.rank-cards { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.rank-row {
  display: grid; grid-template-columns: 34px 48px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.rank-row:first-child { border-top: 0; }
.rank-row__pos { font-size: 20px; text-align: center; font-weight: 800; color: var(--text-muted); }
.rank-row__pos.num { font-size: 14px; width: 30px; height: 30px; display: grid; place-items: center; background: var(--surface-2); border-radius: 8px; justify-self: center; }
.rank-row__name { font-weight: 700; font-size: 14px; word-break: break-word; }
.rank-row__sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.rank-row__stats { font-size: 13px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-2); }
.rank-row__stats b { font-variant-numeric: tabular-nums; color: var(--text); }
.rank-row__stats .hl { color: var(--primary); }
.rank-row__action { grid-column: 3; margin-top: 8px; }
.thumb {
  width: 48px; height: 48px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.thumb svg.i { width: 20px; height: 20px; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--link { color: var(--primary); }
.rank-empty { padding: 18px 0; color: var(--text-muted); font-size: 14px; text-align: center; }

.grid-2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
body.presenting .company-tabs { display: none; }
.tabs-bar { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.tabs-bar::-webkit-scrollbar { display: none; }

/* ---------- Tabelas financeiras ---------- */
.table tr.total-row td { background: var(--surface-2); font-weight: 800; border-top: 2px solid var(--border); }
.table tr.total-row { cursor: default; }
.share { display: inline-flex; align-items: center; gap: 8px; }
.share__bar { width: 60px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.share__bar i { display: block; height: 100%; background: var(--primary); }
.type-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type-split .card { padding: 14px; }
.type-split .card span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.type-split .card strong { display: block; font-size: 20px; margin: 4px 0; font-variant-numeric: tabular-nums; }

/* ---------- Modo apresentação ---------- */
body.presenting .sidebar,
body.presenting .topbar__menu,
body.presenting .topbar__actions select,
body.presenting .period-btn,
body.presenting #refreshBtn { display: none; }
body.presenting .view { max-width: 1600px; }
body.presenting .kpi__value { font-size: 26px; }

/* =========================================================
   Breakpoints
   ========================================================= */
@media (min-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ads-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metrics--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi__value { font-size: 22px; }
}

@media (min-width: 768px) {
  .view { padding: 24px 24px 40px; }
  .topbar__row { padding-left: 24px; padding-right: 24px; }
  .company-tabs { padding: 0 18px; }
  .hero__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rank-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .type-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
  .chart-box { height: 280px; }
  .table-wrap { display: block; }
  .cards-list.cards-list--responsive { display: none; }
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { max-width: 860px; border-radius: 20px; padding: 20px 24px 24px; max-height: 88vh; }
  .modal__grabber { display: none; }
  .page-head h2 { font-size: 24px; }
}

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; width: var(--sidebar-w); box-shadow: none !important; }
  .sidebar__close, .topbar__menu, .backdrop { display: none; }
  .topbar__title h1 { font-size: 19px; }
  .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: span 3; }
  .ads-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.presenting .app { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1400px) {
  .ads-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   Visual empresarial (v3): neutro, cards lisos, um destaque
   ========================================================= */
body { font-feature-settings: "cv11", "ss01"; letter-spacing: -.005em; }
.kpi__value, .hero__value, .mini strong, .metrics strong, .table td.num { font-variant-numeric: tabular-nums; }
.card { box-shadow: var(--shadow); }
h2, h3 { font-weight: 600; }
.page-head h2 { font-size: 24px; letter-spacing: -.02em; }

/* Menu lateral */
.brand-logo { background: var(--primary) !important; color: #fff; font-weight: 700; }
.nav-link { position: relative; color: var(--text-muted); font-weight: 500; }
.nav-link:hover { color: var(--text); background: var(--surface-hover); }
.nav-link.active { background: var(--primary-soft); color: var(--text); }
.nav-link.active svg.i { color: var(--primary); }
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.connect-card { border-style: solid; background: var(--surface); }

/* Barra superior */
.topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); }
.topbar__title h1 { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar__title h1::before { content: ""; width: 3px; height: 18px; border-radius: 2px; background: var(--primary); flex: none; }
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap svg.i { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--primary); pointer-events: none; }
.select-wrap .select { padding-left: 32px; }
.icon-btn { background: transparent; }

/* Abas de empresas, mais sóbrias */
.company-tab .avatar { background: var(--surface-2) !important; color: var(--text-muted); border: 1px solid var(--border); }
.company-tab.active .avatar { background: var(--primary) !important; color: #fff; border-color: var(--primary); }
.company-tab.active { color: var(--text); }

/* Cards de KPI: rótulo à esquerda, ícone à direita, nota com a fórmula */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; }
.kpi__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi__head svg.i { width: 17px; height: 17px; color: var(--text-muted); }
.kpi__value { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 10px 0 2px; }
.kpi__note { font-size: 12px; color: var(--text-muted); min-height: 16px; }
.kpi__foot { margin-top: 10px; justify-content: flex-start; gap: 6px; }
.kpi__foot small { font-size: 11px; }
.delta { font-weight: 600; padding: 1px 6px; border-radius: 6px; }

/* Seções */
.section-title { margin: 28px 0 12px; }
.section-title h3 { font-size: 15px; }
.section-title .pill { font-size: 10px; border-radius: 6px; padding: 3px 8px; }
.pill--msg { background: var(--primary-soft); color: var(--primary); }
.pill--rec { background: var(--info-soft); color: var(--info); }
.badge--msg { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.badge--rec { color: var(--info); background: var(--info-soft); border-color: transparent; }

/* Realizado do mês: card liso, como "Investimento total" do exemplo */
.hero { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 20px 22px; }
.hero__top { align-items: center; }
.hero__title { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.hero__title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.hero__tag { font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 99px; }
.hero__tag::first-letter { text-transform: uppercase; }
.hero__value { font-size: 34px; font-weight: 600; margin: 10px 0 16px; }
.hero__grid { grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--border); padding-top: 4px; }
.hero__grid div { background: none; border-radius: 0; padding: 10px 0; }
.hero__grid div + div { border-top: 1px solid var(--border); }
.hero__grid span { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--text-muted); opacity: 1; font-weight: 500; }
.hero__grid strong { font-size: 16px; font-weight: 600; }
.split-bar { background: var(--surface-2); height: 6px; margin-top: 14px; }
.split-legend { color: var(--text-2); opacity: 1; }

/* Rankings: posições numeradas no lugar das medalhas */
.rank-row__pos.num, .rank-pos {
  width: 30px; height: 30px; display: grid; place-items: center; justify-self: center;
  border-radius: 8px; font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.rank-pos.top { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.card__head h3 { display: inline-flex; align-items: center; gap: 8px; }
.card__head h3 svg.i { width: 17px; height: 17px; color: var(--primary); }
.type-split .card span { display: inline-flex; align-items: center; gap: 6px; }

/* Botão principal / chips no tom de destaque */
.chip.active { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

@media (min-width: 768px) {
  .hero__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .hero__grid div + div { border-top: 0; }
  .kpi__value { font-size: 24px; }
}

@media (max-width: 559px) {
  .select-wrap svg.i { display: none; }
  .select-wrap .select { padding-left: 8px; }
  .topbar__title h1 { font-size: 15px; gap: 7px; }
  .topbar__title h1::before { height: 15px; }
  .topbar__row { gap: 8px; }
}

/* Logos das empresas */
.avatar--logo { object-fit: cover; border-radius: 50% !important; background: #000 !important; border: 1px solid var(--border); padding: 0; }
.company-tab .avatar--logo { border-color: var(--border) !important; opacity: .85; }
.company-tab.active .avatar--logo { opacity: 1; box-shadow: 0 0 0 2px var(--primary); border-color: transparent !important; }
.company-tab .avatar:not(.avatar--logo) { border-radius: 50%; }
.brand-logo.has-logo { background: transparent !important; padding: 0; overflow: hidden; border-radius: 50%; }
.brand-logo.has-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.source__icon .avatar--logo { width: 40px !important; height: 40px !important; }
.fin-avatar { margin-right: 8px; vertical-align: middle; }
.table .name-cell .avatar { vertical-align: middle; }
.avatar--logo { overflow: hidden; display: inline-grid; }
.avatar--logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.company-tab { gap: 10px; }
.avatar, .brand-logo { border-radius: 50% !important; }
.table--compact th, .table--compact td { padding: 10px 9px; font-size: 13px; }
.table--compact th { font-size: 11px; }
.table--compact .share__bar { width: 40px; }

/* Tabelas com rolagem lateral (marca e produto): aparecem em todas as telas, com barra visível */
.table-scroll { display: block !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll::-webkit-scrollbar { height: 10px; }
.table-scroll::-webkit-scrollbar-track { background: var(--surface-2); border-top: 1px solid var(--border); }
.table-scroll::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 99px; border: 2px solid var(--surface-2); }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-2); }
.table-scroll .table { min-width: 720px; }
/* Primeira coluna (nome) fixa ao rolar */
.table-scroll th:first-child, .table-scroll td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.table-scroll th:first-child { background: var(--surface-2); }
.table-scroll tbody tr:hover td:first-child { background: var(--surface-hover); }
.type-count { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 6px; }
.type-count--msg { color: var(--primary); background: var(--primary-soft); }
.type-count--rec { color: var(--info); background: var(--info-soft); }
.table-scroll .table { border-collapse: separate; border-spacing: 0; }
.table-scroll th:first-child, .table-scroll td:first-child { left: -1px; box-shadow: 1px 0 0 var(--border), -6px 0 0 var(--surface); }
.table-scroll th:first-child { box-shadow: 1px 0 0 var(--border), -6px 0 0 var(--surface-2); }
.table-scroll tbody tr:hover td:first-child { box-shadow: 1px 0 0 var(--border), -6px 0 0 var(--surface-hover); }

/* ---------- Olho do administrador (esconder quadros do cliente) ---------- */
.card-vis { position: relative; }
.card-eye {
  position: absolute; z-index: 2; top: 8px; right: 8px;
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  box-shadow: var(--shadow);
}
.card-eye:hover { color: var(--text); background: var(--surface-hover); }
.card-eye svg.i { width: 16px; height: 16px; }
/* Espaço para o olho não cobrir o cabeçalho do quadro */
.card-vis.card > :first-child { padding-right: 36px; }
/* Quadros com título de seção (tabelas): o olho fica na linha do título */
.card-vis:not(.card) > .card-eye { top: -3px; right: 0; }
.card-vis:not(.card) > .section-title { padding-right: 40px; }
/* Oculto para o cliente: apagado e com borda tracejada */
.card-vis--off { outline: 2px dashed var(--warning); outline-offset: 3px; }
.card-vis--off > :not(.card-eye) { opacity: .35; }
.card-vis--off > .card-eye { color: var(--warning); border-color: var(--warning); }
.admin-hint { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-muted); margin: -4px 0 14px; }
.admin-hint svg.i { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* ---------- Login do administrador ---------- */
.account-btn { width: 100%; margin-top: 10px; justify-content: center; }
.account { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.account__info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.account__info strong { font-size: 13px; }
.account__info small { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.login-form { display: grid; gap: 12px; }
.login-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.login-form .input { width: 100%; background: var(--surface-2); }
.login-error { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; }

/* ---------- Configurações: empresas e contas do Meta ---------- */
.conn-token { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.conn-row { align-items: flex-start; }
.conn-row .btn { flex: none; }
.source__info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.conn-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 12px; }
.conn-links span { display: inline-flex; align-items: center; gap: 5px; }
.conn-links svg.i { width: 14px; height: 14px; }
.conn-links small { color: var(--text-muted); }
.conn-ok { color: var(--success); }
.conn-missing { color: var(--text-muted); }
.conn-note { font-size: 12px; margin: 12px 0 0; }
.conn-hint { font-weight: 400; font-size: 12px; color: var(--warning); }
.login-form .select { width: 100%; }

/* ---------- Páginas trancadas pelo administrador ---------- */
/* Administrador: cadeado ao lado de cada item do menu que pode ser trancado */
.nav-item { position: relative; }
.nav-item > .nav-link { padding-right: 44px; }
.nav-lock {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--text-muted); cursor: pointer; opacity: .55;
  transition: opacity .15s, background .15s, color .15s;
}
.nav-lock svg.i { width: 15px; height: 15px; }
.nav-item:hover .nav-lock, .nav-lock:focus-visible { opacity: 1; }
.nav-lock:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.nav-lock:disabled { cursor: wait; opacity: .4; }
/* Trancada: cadeado sempre visível, em destaque */
.nav-item--locked .nav-lock { opacity: 1; color: var(--warning); border-color: var(--warning); }
.nav-item--locked > .nav-link > span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--warning) 60%, transparent); }
/* Cliente: item trancado, apagado e sem clique */
.nav-link--locked { cursor: not-allowed; opacity: .5; }
.nav-link--locked:hover { background: transparent; color: var(--text-muted); }
.nav-link--locked .nav-link__lock { margin-left: auto; width: 15px; height: 15px; }
/* Cliente que abriu uma página trancada por link */
.locked-page { text-align: center; padding: 48px 20px; display: grid; justify-items: center; gap: 10px; }
.locked-page > svg.i { width: 40px; height: 40px; color: var(--text-muted); }
.locked-page p { margin: 0 0 8px; }
.admin-hint--locked { color: var(--warning); margin: 0 0 14px; }

/* ---------- Seletor de período (formato do Gerenciador de Anúncios do Meta) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Botão na barra superior */
.period-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  max-width: 150px; transition: background .15s, border-color .15s;
}
.period-btn:hover { background: var(--surface-hover); }
.period-btn:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.period-btn > svg.i { width: 16px; height: 16px; flex: none; color: var(--primary); }
.period-btn > svg.period-btn__chev { color: var(--text-muted); }
.period-btn > span { overflow: hidden; text-overflow: ellipsis; }
.period-btn__range { display: none; font-weight: 500; color: var(--text-muted); }
@media (min-width: 560px) { .period-btn { max-width: none; } }
@media (min-width: 900px) { .period-btn__range { display: inline; } .period-btn__range::before { content: ": "; } }

/* Janela */
.pp { display: grid; gap: 16px; }
.pp__presets { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.pp__presets::-webkit-scrollbar { display: none; }
.pp__group, .pp__sep { display: none; }
.pp-opt { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; flex: none; }
.pp-opt input { position: absolute; opacity: 0; pointer-events: none; }
/* Celular: períodos como "chips" */
.pp-opt span {
  display: inline-block; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface); white-space: nowrap;
}
.pp-opt input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pp-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.pp__presets input[name="pp-recent"] { display: none; }
.pp__presets label:has(input[name="pp-recent"]) { display: none; }

.pp__main { display: grid; gap: 14px; min-width: 0; }
.pp__cals { display: grid; gap: 24px; }
.pp-cal--left { display: none; }
.pp-cal__head { display: grid; grid-template-columns: 36px 1fr 1fr 36px; align-items: center; gap: 6px; margin-bottom: 8px; }
.pp-cal__head .pp-nav { width: 36px; height: 36px; border: 0; }
.pp-cal__head .pp-nav svg.i { width: 20px; height: 20px; }
.pp-cal__head .pp-nav[disabled] { opacity: .3; cursor: default; }
.pp-nav-space { display: block; width: 36px; }
.pp-only-desktop { display: none; }
.pp-select {
  height: 36px; border: 0; background: transparent; color: var(--text); font-weight: 600; font-size: 16px;
  text-align: center; text-align-last: center; cursor: pointer; border-radius: 8px;
}
.pp-select:hover { background: var(--surface-hover); }
.pp-select:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.pp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 4px; }
.pp-grid--head span { text-align: center; font-size: 12px; color: var(--text-muted); padding-bottom: 4px; }
.pp-day {
  height: 40px; border: 0; background: transparent; color: var(--text); font-size: 15px; font-weight: 500;
  cursor: pointer; font-variant-numeric: tabular-nums; position: relative;
}
.pp-day--blank { cursor: default; }
.pp-day:not(.pp-day--disabled):not(.pp-day--blank):hover { background: var(--surface-hover); border-radius: 8px; }
.pp-day--today { color: var(--primary); font-weight: 700; }
.pp-day--disabled { color: var(--text-muted); opacity: .45; cursor: default; }
/* Faixa escolhida: fundo contínuo por semana, início e fim em destaque */
.pp-day--in, .pp-day--in:not(.pp-day--disabled):hover { background: color-mix(in srgb, var(--primary) 16%, transparent); border-radius: 0; }
.pp-day--row-start, .pp-day--row-start:hover { border-top-left-radius: 8px !important; border-bottom-left-radius: 8px !important; }
.pp-day--row-end, .pp-day--row-end:hover { border-top-right-radius: 8px !important; border-bottom-right-radius: 8px !important; }
.pp-day--start, .pp-day--end, .pp-day--start:hover, .pp-day--end:hover {
  background: var(--primary) !important; color: var(--on-primary); border-radius: 8px !important; font-weight: 700;
}
.pp-day:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 8px; }

.pp__hint { margin: -4px 0 0; font-size: 13px; color: var(--primary); font-weight: 600; }
.pp__compare { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; justify-self: start; }
.pp__compare input { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.pp__compare-info { margin: -6px 0 0 30px; font-size: 13px; color: var(--text-muted); }
.pp__range { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.pp__swatch { width: 14px; height: 14px; flex: none; border-radius: 4px; background: color-mix(in srgb, var(--primary) 35%, transparent); }
.pp__range .select { flex: 1 1 170px; min-width: 0; }
.pp__dates { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.pp__dates .input { width: 100%; min-width: 0; padding: 0 8px; font-variant-numeric: tabular-nums; }
.pp__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.pp__actions { display: flex; gap: 8px; margin-left: auto; }

/* Computador: lista à esquerda e dois meses lado a lado */
@media (min-width: 768px) {
  .modal.modal--period { max-width: 920px; }
  .pp { grid-template-columns: 190px minmax(0, 1fr); gap: 24px; }
  .pp__presets {
    flex-direction: column; gap: 2px; overflow: visible; margin: 0;
    padding: 0 16px 0 0; border-right: 1px solid var(--border); max-height: 62vh; overflow-y: auto;
  }
  .pp__group { display: block; font-weight: 700; font-size: 14px; margin: 2px 0 6px; }
  .pp__sep { display: block; border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
  .pp__presets label:has(input[name="pp-recent"]) { display: flex; }
  .pp-opt { display: flex; padding: 6px 4px; border-radius: 8px; }
  .pp-opt:hover { background: var(--surface-hover); }
  /* Computador: botões redondos de opção, como no Meta */
  .pp-opt span { padding: 0; border: 0; border-radius: 0; background: none; color: var(--text); font-size: 15px; font-weight: 500; }
  .pp-opt::before {
    content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%;
    border: 1.5px solid var(--text-muted); box-sizing: border-box; transition: border .12s;
  }
  .pp-opt:has(input:checked)::before { border: 6px solid var(--primary); }
  .pp-opt input:checked + span { background: none; color: var(--text); }
  .pp-opt:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--primary-soft); }
  .pp__cals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pp-cal--left { display: block; }
  .pp-only-mobile { display: none; }
  .pp-only-desktop { display: block; }
  .pp-day { height: 38px; }
  .pp__range .select { flex: 0 1 190px; }
  .pp__dates { flex: 1 1 300px; grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr); }
}

/* "Comparar" desligado: sem setas de variação no painel */
body.no-compare .kpi__foot,
body.no-compare .delta,
body.no-compare .delta ~ small.muted { display: none; }
