/* ============================================================
   Nobox Gestão — Design System
   Light mode default | Dark mode via [data-theme="dark"]
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* --- Tokens ------------------------------------------------ */
:root {
  /* Light palette (default) */
  --bg: #f0f2f7;
  --bg-2: #e4e8f0;
  --bg-page: #f8fafc;
  --card: rgba(255,255,255,.82);
  --card-2: rgba(255,255,255,.60);
  --card-solid: #ffffff;
  --border: rgba(15,23,42,.10);
  --border-hover: rgba(15,23,42,.18);
  --text: #0f172a;
  --text-sec: #334155;
  --text-muted: #64748b;
  --accent: #02a1fd;
  --accent-2: #38bdf8;
  --accent-3: #0284c7;
  --accent-glow: rgba(2,161,253,.18);
  --green: #10b981;
  --green-text: #047857;     /* texto AA-safe (delta/healthbar/heatmap) */
  --green-bg: rgba(16,185,129,.10);
  --green-border: rgba(16,185,129,.30);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,.10);
  --yellow-border: rgba(245,158,11,.30);
  --red: #ef4444;
  --red-text: #b91c1c;       /* texto AA-safe (delta/healthbar/highlight) */
  --red-bg: rgba(239,68,68,.08);
  --red-border: rgba(239,68,68,.30);
  --max: 1360px;
  --radius: 18px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --shadow: 0 4px 24px rgba(15,23,42,.06);
  --shadow-lg: 0 12px 48px rgba(15,23,42,.10);
  --shadow-card: 0 1px 3px rgba(15,23,42,.04), 0 8px 32px rgba(15,23,42,.06);
  --transition: .22s cubic-bezier(.4,0,.2,1);
  /* Light-mode lock: evita OS forçar dark mode forcing em inputs/date pickers */
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0a0f1e;
  --bg-2: #0f1629;
  --bg-page: #060b16;
  --card: rgba(255,255,255,.05);
  --card-2: rgba(255,255,255,.03);
  --card-solid: #131a2e;
  --border: rgba(120,180,255,.14);
  --border-hover: rgba(120,180,255,.28);
  --text: #f1f5f9;
  --text-sec: #cbd5e1;
  --text-muted: #7a8fad;
  --accent: #38bdf8;
  --accent-2: #7dd3fc;
  --accent-3: #0ea5e9;
  --accent-glow: rgba(56,189,248,.22);
  --green-bg: rgba(16,185,129,.14);
  --green-border: rgba(16,185,129,.35);
  --yellow-bg: rgba(245,158,11,.14);
  --yellow-border: rgba(245,158,11,.35);
  --red-bg: rgba(239,68,68,.12);
  --red-border: rgba(239,68,68,.35);
  --shadow: 0 4px 24px rgba(0,0,0,.30);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.45);
  --shadow-card: 0 1px 3px rgba(0,0,0,.20), 0 8px 32px rgba(0,0,0,.25);
}

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-page);
  min-height: 100vh;
  min-height: 100dvh;             /* iPhone notch + dynamic viewport (vs 100vh trap) */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* === A11y — skip to content === */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  border-radius: 0 0 var(--radius-xs) 0;
  z-index: 9999;
  text-decoration: none;
}
.skip-link:focus { left: 0; outline: none; }

/* === A11y — global :focus-visible para todos interactive elements === */
button:focus-visible,
a:focus-visible,
.preset:focus-visible,
.sort-pill:focus-visible,
.tab:focus-visible,
.sub-tab:focus-visible,
.chip:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === A11y — respeitar OS reduce-motion (WCAG 2.3.3) === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Subtle background pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 450px at 85% -5%, rgba(2,161,253,.06), transparent 60%),
    radial-gradient(700px 350px at -5% 30%, rgba(2,161,253,.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] body::before,
body[data-theme="dark"]::before {
  background:
    radial-gradient(900px 450px at 85% -5%, rgba(2,161,253,.10), transparent 60%),
    radial-gradient(700px 350px at -5% 30%, rgba(56,189,248,.06), transparent 60%);
}

h1, h2, h3, h4, .kpi .v, .btn, .nav a { font-family: 'Outfit', sans-serif; }
a { color: var(--accent); text-decoration: none; }

/* --- Progress bar ------------------------------------------ */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px var(--accent-glow);
  z-index: 9999;
  transition: width .4s ease;
}

/* --- Topbar ------------------------------------------------ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border var(--transition), backdrop-filter var(--transition);
}

.topbar.scrolled {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: color-mix(in srgb, var(--bg-page) 72%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
}

.brand img {
  height: 42px;
  object-fit: contain;
  max-width: 180px;
}

/* Navigation tabs */
.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.nav a {
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav a:hover {
  color: var(--text);
  background: var(--card-2);
}

.nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- User menu --------------------------------------------- */
.user-menu-wrap { position: relative; }
.user-avatar-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #38b5ff);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: #fff;
  text-decoration: none; border: 2px solid var(--border);
  transition: .2s; flex-shrink: 0;
  background-size: cover; background-position: center;
  cursor: pointer; overflow: hidden;
}
.user-avatar-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-avatar-btn:hover { transform: scale(1.08); box-shadow: 0 0 12px var(--accent-glow); }

.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 240px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.15);
  z-index: 2000; overflow: hidden;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.user-dropdown.open { display: block; animation: tabFadeIn .2s ease; }
@keyframes tabFadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.user-dropdown-header {
  padding: 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.user-dropdown-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #38b5ff);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; color: #fff;
  overflow: hidden; background-size: cover; background-position: center;
}
.user-dropdown-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-dropdown-name { font-weight: 700; font-size: .9rem; font-family: 'Outfit', sans-serif; }
.user-dropdown-role { font-size: .75rem; color: var(--text-muted); }
.user-dropdown-items { padding: 8px; }
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; font-size: .85rem; font-weight: 600;
  color: var(--text-sec); cursor: pointer; text-decoration: none;
  transition: .15s;
}
.user-dropdown-item:hover { background: var(--card); color: var(--text); }
.user-dropdown-item.logout { color: var(--red); }
.user-dropdown-item.logout:hover { background: var(--red-bg); }
.user-dropdown-divider { height: 1px; background: var(--border); margin: 4px 8px; }

/* --- Buttons ----------------------------------------------- */
.btn {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: .82rem;
  font-family: 'Outfit', sans-serif;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 16px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-3);
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--card);
  color: var(--text-sec);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--border-hover);
  background: var(--card-2);
  color: var(--text);
}

#themeToggle {
  background: var(--card);
  color: var(--text-sec);
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 50%;
}
#themeToggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Hero card --------------------------------------------- */
.hero {
  padding: 88px 20px 8px;
  position: relative;
  z-index: 1;
}

.hero-card {
  width: min(var(--max), 100%);
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);  /* token consistency (era 20px hardcoded) */
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-card);
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
  pointer-events: none;
}

.eyebrow {
  font-size: .72rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.hero h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  margin: 0 0 6px;
  line-height: 1.2;
}

.hero p {
  margin: 0;
  color: var(--text-sec);
  font-size: .95rem;
}

/* --- Controls / Filters ------------------------------------ */
.controls {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.select, .input {
  background: var(--card-solid);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 9px 14px;
  font-size: .88rem;
  font-weight: 500;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: border var(--transition);
  outline: none;
}

.select:focus, .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* iOS auto-zoom kill: input font-size deve ser >=16px no mobile pra Safari não zoomar */
@media (max-width: 720px) {
  .select, .input,
  input[type="date"],
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="search"],
  select, textarea {
    font-size: 16px;
  }
}

/* --- Section layout ---------------------------------------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 20px 16px;
  position: relative;
  z-index: 1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.helper {
  font-size: .82rem;
  color: var(--text-muted);
}

/* --- Grid -------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.c2 { grid-column: span 2; }
.c3 { grid-column: span 3; }
.c4 { grid-column: span 4; }
.c5 { grid-column: span 5; }
.c6 { grid-column: span 6; }
.c7 { grid-column: span 7; }
.c8 { grid-column: span 8; }
.c12 { grid-column: span 12; }

/* --- KPI Cards --------------------------------------------- */
.kpi {
  grid-column: span 2;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  will-change: transform;
}

.kpi .v {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi .l {
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.kpi .trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  font-weight: 600;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
}

.kpi .trend.up {
  color: var(--green);
  background: var(--green-bg);
}

.kpi .trend.down {
  color: var(--red);
  background: var(--red-bg);
}

.kpi .trend.neutral {
  color: var(--yellow);
  background: var(--yellow-bg);
}

/* KPI progress bar */
.kpi-progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}

.kpi-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .6s ease;
}

/* --- Cards ------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  height: 100%;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.card h3 {
  margin: 0 0 12px;
  font-size: .95rem;
  font-weight: 700;
}

.card canvas {
  width: 100% !important;
  height: 260px !important;
  max-height: 260px !important;
}

/* --- Link cards (home module nav) -------------------------- */
.link-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}

.link-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px var(--accent-glow);
  transform: translateY(-3px);
  will-change: transform;
}

.link-card .icon {
  font-size: 2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-glow), rgba(2,161,253,.06));
  border-radius: 16px;
}

.link-card .label {
  font-weight: 700;
  font-size: .9rem;
  font-family: 'Outfit', sans-serif;
}

.link-card .desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* --- Tables ------------------------------------------------ */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .88rem;
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:nth-child(even) {
  background: rgba(0,0,0,.015);
}

[data-theme="dark"] tbody tr:nth-child(even) {
  background: rgba(255,255,255,.02);
}

tbody tr:hover {
  background: var(--accent-glow);
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: var(--accent); }

.sort-arrow {
  font-size: .62rem;
  margin-left: 4px;
  opacity: .4;
}
th.sort-asc .sort-arrow,
th.sort-desc .sort-arrow {
  opacity: 1;
  color: var(--accent);
}

/* --- Badges / chips ---------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green,
.badge-saudavel {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
}

.badge-yellow,
.badge-atencao {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  color: var(--yellow);
}

.badge-red,
.badge-critico {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
}

.badge-neutral {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-sec);
}

/* --- Alerts ------------------------------------------------ */
.exec-alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.exec-alert.crit {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}

.exec-alert.warn {
  background: var(--yellow-bg);
  border-color: var(--yellow-border);
  color: var(--yellow);
}

.exec-alert.ok {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

/* --- Modal ------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 540px;
  width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-box h4 {
  margin: 0 0 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover {
  border-color: var(--red);
  color: var(--red);
}

/* --- Toast ------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 6000;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Scroll reveal ----------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s cubic-bezier(.22,1,.36,1), transform .5s cubic-bezier(.22,1,.36,1);
  will-change: transform, opacity;
}

.reveal.show {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delay for cards in the same row */
.grid > .reveal:nth-child(2) { transition-delay: .06s; }
.grid > .reveal:nth-child(3) { transition-delay: .12s; }
.grid > .reveal:nth-child(4) { transition-delay: .18s; }
.grid > .reveal:nth-child(5) { transition-delay: .24s; }
.grid > .reveal:nth-child(6) { transition-delay: .30s; }
.section.reveal .grid > .card:nth-child(2),
.section.reveal .grid > .kpi:nth-child(2) { transition-delay: .06s; }
.section.reveal .grid > .card:nth-child(3),
.section.reveal .grid > .kpi:nth-child(3) { transition-delay: .12s; }
.section.reveal .grid > .card:nth-child(4),
.section.reveal .grid > .kpi:nth-child(4) { transition-delay: .18s; }
.section.reveal .grid > .card:nth-child(5),
.section.reveal .grid > .kpi:nth-child(5) { transition-delay: .24s; }
.section.reveal .grid > .card:nth-child(6),
.section.reveal .grid > .kpi:nth-child(6) { transition-delay: .30s; }

/* --- Utility: positive/negative ---------------------------- */
.pos { color: var(--green); }
.neg { color: var(--red); }

/* --- Footer ------------------------------------------------ */
.footer {
  max-width: var(--max);
  margin: 32px auto 0;
  padding: 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: .8rem;
  position: relative;
  z-index: 1;
}

/* --- Under construction ------------------------------------ */
.construction {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
}

.construction-icon {
  font-size: 4rem;
  opacity: .6;
}

.construction h2 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  margin: 0;
}

.construction p {
  color: var(--text-muted);
  max-width: 400px;
}

/* --- Table scroll wrapper ---------------------------------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 600px;
}

/* --- Responsive -------------------------------------------- */
@media (max-width: 1080px) {
  .kpi { grid-column: span 4; }
  .c5 { grid-column: span 12; }
  .c6 { grid-column: span 12; }
  .c7 { grid-column: span 12; }
  .c3 { grid-column: span 6; }
  .nav { gap: 2px; }
  .nav a { font-size: .8rem; padding: 6px 10px; }
}

@media (max-width: 768px) {
  /* Charts: constrain height */
  .card canvas {
    max-height: 220px !important;
    height: 220px !important;
  }

  /* Controls: stack vertically */
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .controls .select,
  .controls .input {
    width: 100%;
  }

  /* Section spacing tighter */
  .section { padding: 8px 12px 12px; }
  .section-head { margin-bottom: 8px; }

  /* Modals: full-width */
  .modal-box {
    max-width: calc(100vw - 24px);
    padding: 20px 16px;
  }
}

@media (max-width: 720px) {
  .kpi { grid-column: span 6; }
  .c3 { grid-column: span 6; }
  .c4 { grid-column: span 12; }
  .c5 { grid-column: span 12; }
  .c6 { grid-column: span 12; }
  .c7 { grid-column: span 12; }
  .hero { padding: 76px 12px 4px; }
  .hero-card { padding: 18px 14px; }
  .grid { gap: 10px; }

  /* Topbar: scrollable nav instead of hidden */
  .topbar-inner { padding: 8px 12px; flex-wrap: nowrap; gap: 6px; }
  .brand img { height: 36px; max-width: 140px; }
  .nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 50vw;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 2px;
    padding: 3px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { font-size: .78rem; padding: 6px 10px; flex-shrink: 0; }
  .top-actions { width: auto; flex-shrink: 0; }

  /* Tables: smaller text + ensure scroll */
  th, td { padding: 8px 6px; font-size: .78rem; }

  /* Touch targets: minimum 44px */
  .btn { min-height: 44px; padding: 10px 16px; }
  #themeToggle { width: 44px; height: 44px; }
  .user-avatar-btn { width: 40px; height: 40px; }

  /* Footer */
  .footer { flex-direction: column; gap: 8px; text-align: center; }

  /* Link cards: tighter */
  .link-card { padding: 16px 14px; }
  .link-card .icon { font-size: 1.6rem; width: 46px; height: 46px; }
  .link-card .label { font-size: .82rem; }
  .link-card .desc { font-size: .72rem; }

  /* Hero card: reduce padding */
  .hero p { font-size: .88rem; }

  /* KPI cards: smaller values */
  .kpi .v { font-size: 1.25rem; }
  .kpi .l { font-size: .72rem; }
  .kpi { padding: 16px; min-height: 90px; }

  /* Font sizes: denser data */
  .card h3 { font-size: .88rem; }
  .helper { font-size: .76rem; }
  .section-head h3 { font-size: 1rem; }

  /* Badges: touch-friendly */
  .badge { padding: 6px 12px; font-size: .74rem; }
}

@media (max-width: 480px) {
  .kpi { grid-column: span 6; }
  .c3 { grid-column: span 12; }
  .hero h1 { font-size: 1.15rem; }
  .hero { padding-top: 76px; }
  .brand img { height: 32px; max-width: 110px; }

  /* Nav: even smaller */
  .nav { max-width: 40vw; }
  .nav a { font-size: .72rem; padding: 5px 8px; }

  /* Charts: smaller on very small screens */
  .card canvas {
    max-height: 180px !important;
    height: 180px !important;
  }

  /* Eyebrow text */
  .eyebrow { font-size: .66rem; letter-spacing: 2px; }

  /* Hero description */
  .hero p { font-size: .82rem; }

  /* KPI cards: can go single column on very small */
  .kpi .v { font-size: 1.1rem; }
  .kpi { padding: 14px; min-height: 80px; }
}

@media (max-width: 375px) {
  .kpi { grid-column: span 12; }
  .hero-card { padding: 14px 12px; }
  .topbar-inner { padding: 6px 8px; }
  .nav { max-width: 35vw; }
  .card canvas {
    max-height: 160px !important;
    height: 160px !important;
  }
}

/* --- Print ------------------------------------------------- */
@media print {
  .topbar, .nav, .top-actions, .footer, .btn, .alert-resolve, .ver-mais-btn, #themeToggle, .toast, .modal-overlay { display: none !important; }
  .hero { padding-top: 20px !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff !important; color: #111; }
  .kpi { box-shadow: none; border: 1px solid #ddd; background: #fff; }
  .section { padding: 6px 10px; }
}

/* --- Loading skeleton -------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--card-2) 25%, var(--card) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   === Olavo Trafego — dashboard-specific ===
   ============================================================ */

/* Tier 1 hero KPI cards */
.kpi.hero {
  padding: 22px 22px 18px;
  min-height: 168px;
}
.kpi.hero .val {
  font-size: 2.4rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  line-height: 1.1;
  margin-top: 6px;
  color: var(--text);
}
/* Princípio 3: accent reservado pra CTA + verdict hero; KPIs voltam pra var(--text) */
.kpi.hero.hl .val { color: var(--text); }
.kpi.hero .spark {
  height: 48px;
  margin-top: 10px;
  opacity: .9;
}

/* Tier 2 support KPI cards */
.kpi.support {
  min-height: 132px;
}
.kpi.support .val {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  line-height: 1.1;
  margin-top: 6px;
  color: var(--text);
}
.kpi.support .spark {
  height: 28px;
  margin-top: 6px;
}

/* Tier 3 diagnostic KPI cards (in drawer) */
.kpi.diag {
  padding: 12px 14px;
  min-height: auto;
}
.kpi.diag .val {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  margin-top: 2px;
}

/* Diagnostic drawer */
.diag-drawer {
  margin: 8px 0 26px;
}
.diag-drawer summary {
  cursor: pointer;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-sec);
  list-style: none;
  user-select: none;
}
.diag-drawer summary::-webkit-details-marker { display: none; }
.diag-drawer summary::after { content: ' +'; opacity: .55; }
.diag-drawer[open] summary::after { content: ' −'; }
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

/* KPI grids — override do .kpi { grid-column: span 2 } herdado */
.kpi-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.kpi-support-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
/* Override CRÍTICO: cancela o grid-column herdado do .kpi base e dos breakpoints */
.kpi-hero-grid > .kpi,
.kpi-support-grid > .kpi,
.diag-grid > .kpi {
  grid-column: auto !important;
}
.kpi .lbl {
  font-size: .82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Delta badges (period-vs-period) — pill em cima + texto solto embaixo */
.delta-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 8px;
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.delta::before { font-weight: 800; font-size: .85rem; line-height: 1; }
.delta.up-good::before, .delta.up-bad::before { content: '↑'; }
.delta.down-good::before, .delta.down-bad::before { content: '↓'; }
.delta.neutral::before { content: '→'; opacity: .6; }
.delta.up-good { background: var(--green-bg); color: var(--green-text); border: 1px solid var(--green-border); }
.delta.down-good { background: var(--green-bg); color: var(--green-text); border: 1px solid var(--green-border); }
.delta.up-bad { background: var(--red-bg); color: var(--red-text); border: 1px solid var(--red-border); }
.delta.down-bad { background: var(--red-bg); color: var(--red-text); border: 1px solid var(--red-border); }
.delta.neutral { background: rgba(100, 116, 139, .10); color: #475569; border: 1px solid var(--border); }
.delta .arr { display: none; }  /* fallback pra renders antigos — seta primária vem via ::before */
.delta-sub {
  display: block;
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.3;
}

/* Sparkline */
.spark {
  display: block;
  width: 100%;
}
.spark path.line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
}
.spark path.fill {
  fill: rgba(2, 161, 253, .08);
  stroke: none;
}

/* Hint tooltips */
.hint {
  cursor: help;
  opacity: .8;
  margin-left: 6px;
  font-size: .85rem;
  background: var(--card-2);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hint:hover { opacity: 1; }

/* Alert banners */
.alerts-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 24px;
}
.alerts-wrap:empty { margin: 0; display: none; }
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: .88rem;
}
.alert.warning {
  background: var(--yellow-bg);
  border-color: var(--yellow-border);
  color: #92400e;
}
.alert.critical {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: #b91c1c;
}
.alert .icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1.2;
}
.alert .body { flex: 1; }
.alert .ttl {
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 2px;
}
.alert .dismiss {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  opacity: .55;
  font-size: 1.1rem;
  padding: 0 4px;
}
.alert .dismiss:hover { opacity: 1; }

/* Empreendimento tabs */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sec);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  transition: all var(--transition);
}
.tab:hover { background: var(--card); }
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab .count {
  opacity: .7;
  margin-left: 6px;
  font-weight: 500;
}

/* Active filter chips */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  min-height: 24px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent-3);
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid var(--accent-glow);
}
.chip button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  opacity: .65;
}
.chip button:hover { opacity: 1; }

/* Funnel visual */
.funnel {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 18px;
}
.funnel-step {
  text-align: center;
  padding: 14px;
}
.funnel-step .lbl {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.funnel-step .val {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
}
.funnel-arrow {
  text-align: center;
  color: var(--text-muted);
}
.funnel-arrow .rate {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  font-family: 'Outfit', sans-serif;
}
.funnel-arrow .ar {
  font-size: 1.6rem;
  opacity: .4;
}
.funnel-arrow .bench {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
}
@media (max-width: 720px) {
  .funnel { grid-template-columns: 1fr; gap: 4px; }
  .funnel-arrow {
    transform: none;
    padding: 6px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
  }
  .funnel-arrow .ar {
    display: inline-block;
    transform: rotate(90deg);
    font-size: 1.2rem;
  }
  .funnel-arrow .bench { display: inline; }
}

/* Placement table */
.plc-tbl tr.best td { background: var(--green-bg); }
.plc-tbl tr.worst td { background: var(--red-bg); }
.plc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .7rem;
  font-weight: 700;
  background: var(--card-2);
  color: var(--text-sec);
  margin-right: 6px;
}

/* Cache transparency badge */
.cache-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .76rem;
  color: var(--text-muted);
  margin-left: auto;
  flex-wrap: wrap;
}
.cache-badge button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--text-sec);
  cursor: pointer;
  font-family: inherit;
  font-size: .74rem;
  font-weight: 600;
  transition: all var(--transition);
}
.cache-badge button:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.cache-badge button.spinning::before {
  content: '↻';
  display: inline-block;
  animation: spin .8s linear infinite;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading states */
.kpi.loading {
  opacity: .55;
  pointer-events: none;
}
.chart-loading { position: relative; }
.chart-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--card-2);
  animation: pulse 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { opacity: .3; }
  50% { opacity: .7; }
}
.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Campaign mobile cards */
.camp-card {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.camp-card .name {
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 8px;
  font-size: .9rem;
}
.camp-card .mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.camp-card .mini-grid > div {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.camp-card .mini-grid b {
  display: block;
  font-size: .95rem;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
}

/* Mobile-first overrides */
@media (max-width: 720px) {
  .kpi-hero-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: visible;
    scroll-snap-type: none;
    padding-bottom: 0;
  }
  .kpi-hero-grid > * {
    flex: none;
    scroll-snap-align: none;
    width: 100%;
  }
  .kpi.hero { padding: 18px 18px 16px; min-height: auto; }
  .kpi.hero:first-child .val { font-size: 1.9rem; }
  .kpi.hero .val { font-size: 1.5rem; }
  .kpi.hero .spark { display: none; }
  /* Mobile: stack vertical no support tier — espelha o pattern do hero pra evitar
     scroll horizontal sem affordance. Princípio mobile-first. */
  .kpi-support-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
    padding-bottom: 0;
  }
  .kpi-support-grid > * {
    flex: none;
    width: 100%;
  }
  .preset,
  .tab,
  .cache-badge button {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
  }
  .charts { grid-template-columns: 1fr; }
  #tbl { display: none; }
  .camp-cards {
    display: grid;
    gap: 10px;
  }
}
@media (min-width: 721px) {
  .camp-cards { display: none; }
}

/* Print stylesheet (PDF export via window.print) */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  body::before { display: none; }
  .controls-bar,
  .controls-bar-mini,
  .period-chip-strip,
  .cache-badge-wrap,
  .tabs,
  .chips,
  .alerts-wrap,
  .cache-badge,
  .preset,
  .btn,
  button { display: none !important; }
  /* Forçar TODOS os <details> a abrir + esconder summaries no print */
  details > summary { display: none !important; }
  details > *:not(summary) { display: revert !important; }
  .diag-grid { display: grid !important; }
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
    break-inside: avoid;
  }
  .kpi-hero-grid,
  .kpi-support-grid,
  .charts {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    overflow: visible !important;
  }
  @page {
    size: A4 landscape;
    margin: 1.2cm;
  }
  .print-header {
    display: block !important;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #000;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
  }
}
.print-header { display: none; }

/* ============================================================
   Olavo Dashboard — Painéis acionáveis (sprint 2026-06-04)
   Active Campaigns + Top Creatives + Audience
   ============================================================ */

/* --- SECTION SUB (header secundário tipo subtitle) --- */
.section-sub {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 8px;
}

/* === ACTIVE CAMPAIGNS === */
.active-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.sort-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sort-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-sec);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: all var(--transition);
}
.sort-pill:hover { border-color: var(--border-hover); color: var(--text); }
.sort-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-sec);
  cursor: pointer;
  user-select: none;
}
.toggle-pill input { accent-color: var(--accent); }

.active-list { display: flex; flex-direction: column; gap: 10px; }
.active-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-solid);
  transition: all var(--transition);
  align-items: center;
}
.active-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.active-card .status-col {
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.active {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 8px var(--green); }
  50% { box-shadow: 0 0 14px var(--green); }
}
.status-dot.paused { background: var(--text-muted); }
.status-dot.issues {
  background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow);
}
.status-dot.disapproved { background: var(--red); }

.active-card .info-col { min-width: 0; }
.active-card .name {
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  font-size: .92rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
.active-card .meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  font-size: .72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.emp-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent-3);
  font-weight: 600;
  font-size: .68rem;
}
.budget-bar-wrap { margin-top: 8px; }
.budget-bar-cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 4px;
}
.budget-bar-cap .cap-lbl { color: inherit; }
.budget-bar-cap .cap-pct { font-family: 'Outfit', sans-serif; font-weight: 700; color: inherit; }
.budget-bar-cap.warn { color: #b45309; }
.budget-bar-cap.over { color: #b91c1c; }
.budget-bar-cap.muted { color: var(--text-muted); opacity: .65; font-style: italic; font-weight: 500; }
.budget-bar {
  display: block;
  width: 100%;
  height: 8px;
  background: var(--card-2);
  border-radius: 999px;
  overflow: hidden;
}
.budget-bar > span {
  display: block;
  height: 100%;
  background: var(--green);
  transition: width .4s;
}
.budget-bar.warn > span { background: var(--yellow); }
.budget-bar.over > span { background: var(--red); }

.active-mini {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 14px;
  font-variant-numeric: tabular-nums;
  align-items: start;
}
.active-mini > div { text-align: right; min-width: 96px; }
.active-mini b {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  line-height: 1.1;
}
.active-mini span {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
  line-height: 1.2;
}
.active-mini .delta-row { justify-content: flex-end; margin-top: 2px; }
.active-mini .delta {
  font-size: .64rem;
  padding: 1px 5px;
}
.active-mini .delta-sub { display: none; }

@media (max-width: 860px) {
  .active-card { grid-template-columns: auto 1fr; }
  .active-mini {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, 1fr);
  }
  .active-mini > div { text-align: left; }
  .active-mini .delta-row { justify-content: flex-start; }
}

/* === TOP CRIATIVOS === */
.creatives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.creative-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card-solid);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.creative-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.creative-thumb {
  aspect-ratio: 1 / 1;
  background: var(--card-2);
  position: relative;
  overflow: hidden;
}
.creative-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.creative-thumb img.img-fail { display: none; }
.creative-thumb.no-img::before {
  content: '⬡';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  color: var(--text-muted);
  opacity: .25;
  pointer-events: none;
}
.creative-thumb.no-img::after {
  content: 'Sem preview';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
}
.creative-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  z-index: 1;
}
.creative-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.creative-emp { font-size: .68rem; }
.creative-headline {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.creative-copy {
  font-size: .74rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s;
}
.creative-card:hover .creative-copy { max-height: 120px; }
.creative-metrics {
  display: flex;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  font-variant-numeric: tabular-nums;
}
.creative-metrics > div { flex: 1; }
.creative-metrics b {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  color: var(--text);
  line-height: 1.1;
}
.creative-metrics span {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.creative-ext {
  font-size: .72rem;
  color: var(--accent);
  text-decoration: none;
  margin-top: 4px;
  font-weight: 600;
}
.creative-ext:hover { text-decoration: underline; }

/* === FUNIL DE RETENÇÃO DE VÍDEO (card compacto) === */
.video-funnel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vf-head {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.vf-badge, .vf-avg {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.vf-badge b {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
}
.vf-badge.vf-good b { color: #16a34a; }
.vf-badge.vf-neutral b { color: var(--text); }
.vf-badge.vf-bad b { color: #dc2626; }
.vf-avg b {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
}
.vf-badge span, .vf-avg span {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-top: 2px;
}
.vfunnel {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.vfunnel-step {
  display: grid;
  grid-template-columns: 36px 1fr 44px;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
}
.vfunnel-lbl {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.vfunnel-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}
.vfunnel-track {
  background: rgba(2, 161, 253, .08);
  border-radius: 4px;
  overflow: hidden;
}
.vfunnel-bar {
  height: 8px;
  background: #02a1fd;
  border-radius: 4px;
  opacity: .85;
}
.vfunnel-step:last-child .vfunnel-bar { background: #0e7490; opacity: 1; }
.vf-narr {
  font-size: .76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Toggle "Mais conversas / Mais retenção" acima do grid */
.creatives-sort {
  display: flex;
  gap: 4px;
  margin: 4px 0 14px;
}
.creatives-sort button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font: inherit;
  font-size: .72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.creatives-sort button:hover { color: var(--text); border-color: var(--text-muted); }
.creatives-sort button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.creatives-sort button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* === VÍDEO DESTAQUE (#videoTopWrap) — funil grande, lado-a-lado em desktop === */
.vtop-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 22px;
  align-items: start;
  margin-top: 4px;
}
.vtop-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.vtop-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f1f5f9;
  position: relative;
}
.vtop-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.vtop-thumb img.img-fail { display: none; }
.vtop-thumb.no-img::after {
  content: '⬡';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
  opacity: .35;
}
.vtop-meta { display: flex; flex-direction: column; gap: 8px; }
.vtop-emp .emp-chip {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.vtop-headline {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  line-height: 1.3;
}
.vtop-subline {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: -2px;
}
.vtop-kpis {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.vtop-kpis > div { flex: 1; min-width: 80px; }
.vtop-kpis b {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.1;
}
.vtop-kpis span {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.vtop-funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vtop-step { display: flex; flex-direction: column; gap: 4px; }
.vtop-step-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .78rem;
}
.vtop-step-lbl {
  font-weight: 600;
  color: var(--text);
}
.vtop-step-num {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.vtop-step-num b {
  color: var(--text);
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}
.vtop-track {
  background: rgba(2, 161, 253, .08);
  border-radius: 6px;
  overflow: hidden;
  height: 14px;
}
.vtop-bar {
  height: 100%;
  border-radius: 6px;
  transition: width .35s ease;
}
.vtop-narr {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .creatives-grid { grid-template-columns: 1fr; }
  .creative-card { flex-direction: row; align-items: stretch; }
  .creative-thumb { width: 110px; flex-shrink: 0; aspect-ratio: 1 / 1; }
  .creative-body { flex: 1; padding: 10px 12px; }
  .creative-card:hover .creative-copy { max-height: 0; }
  .creative-rank { font-size: .62rem; padding: 2px 6px; }
  /* Funil compacto com tipografia legivel em mobile (>=.7rem ~ 11.2px com root 16px) */
  .vfunnel-step { grid-template-columns: 30px 1fr 40px; font-size: .78rem; }
  .vfunnel-bar { height: 9px; }
  .video-funnel { gap: 8px; }
  .vf-badge b { font-size: 1.05rem; }
  .vf-badge span, .vf-avg span { font-size: .7rem; }
  .vf-avg b { font-size: .9rem; }
  .vf-narr { font-size: .82rem; }
  /* Vídeo destaque empilha em mobile */
  .vtop-grid { grid-template-columns: 1fr; gap: 14px; }
  .vtop-thumb { max-width: 220px; }
  .vtop-step-head { font-size: .82rem; }
  .vtop-track { height: 12px; }
  .vtop-kpis b { font-size: .95rem; }
  .vtop-kpis span { font-size: .7rem; }
  .vtop-subline { font-size: .78rem; }
}

/* === AUDIENCE === */
.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  padding: 8px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .82rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 44px;            /* WCAG touch target em mobile */
  touch-action: manipulation;  /* mata 300ms tap delay no iOS */
}
.sub-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.sub-tab:hover:not(.active) { color: var(--text-sec); }
.aud-panel { min-height: 200px; }
.aud-note {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: .78rem;
  color: var(--text-muted);
}

.heatmap {
  display: grid;
  grid-template-columns: auto repeat(7, 1fr);
  gap: 4px;
  font-size: .78rem;
}
.heatmap .hm-h {
  padding: 8px 4px;
  text-align: center;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
}
.heatmap .hm-row-lbl {
  padding: 8px 6px;
  font-weight: 600;
  color: var(--text-sec);
  display: flex;
  align-items: center;
  font-size: .78rem;
}
.heatmap .hm-cell {
  padding: 10px 6px;
  text-align: center;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  transition: transform var(--transition);
  cursor: default;
  position: relative;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.heatmap .hm-cell:hover { transform: scale(1.04); z-index: 1; }
.heatmap .hm-cell b {
  font-family: 'Outfit', sans-serif;
  font-size: .85rem;
  line-height: 1;
}
.heatmap .hm-cell span {
  font-size: .62rem;
  color: inherit;
  opacity: .7;
}
.heatmap .hm-cell.empty {
  background: var(--card-2);
  color: var(--text-muted);
}
/* Princípio 3: heatmap usa rampa cinza (leitura de dados, não CTA). Pico positivo em verde. */
.heatmap .hm-cell.intensity-1 {
  background: rgba(15, 23, 42, .04);
  color: var(--text-sec);
}
.heatmap .hm-cell.intensity-2 {
  background: rgba(15, 23, 42, .10);
  color: var(--text);
}
.heatmap .hm-cell.intensity-3 {
  background: rgba(15, 23, 42, .22);
  color: var(--text);
}
.heatmap .hm-cell.intensity-4 {
  background: rgba(15, 23, 42, .42);
  color: #fff;
}
.heatmap .hm-cell.intensity-5 {
  background: var(--green-text); /* mesmo token AA-safe usado em delta/healthbar */
  color: #fff;
}

.aud-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.aud-list-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto auto;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card-2);
  border-radius: 8px;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  align-items: center;
}
.aud-list-row .rank { font-weight: 700; color: var(--text-muted); }
.aud-list-row .col-lbl { font-weight: 600; color: var(--text); }
.aud-list-row .col-num { color: var(--text-sec); }
.aud-list-row .col-num b {
  font-family: 'Outfit', sans-serif;
  color: var(--text);
}
.aud-chart-wrap {
  position: relative;
  height: 280px;
  margin-top: 8px;
}

@media (max-width: 860px) {
  .heatmap {
    grid-template-columns: auto repeat(3, 1fr);
    font-size: .7rem;
  }
  .heatmap .hm-cell { padding: 6px 2px; min-height: 48px; }
  .aud-list-row { grid-template-columns: 24px 1fr auto; }
  .aud-list-row .col-spend, .aud-list-row .col-ctr { display: none; }
  .aud-chart-wrap { height: 240px; }
}

/* === SKELETONS extra para os novos painéis === */
.active-skel {
  height: 80px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.creatives-skel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.creatives-skel > div {
  aspect-ratio: .8;
  border-radius: var(--radius-sm);
}
.aud-skel {
  height: 240px;
  border-radius: var(--radius-sm);
}

/* === EMPTY STATES === */
.empty-state {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  line-height: 1.5;
}
.empty-state .icon {
  font-size: 36px;
  opacity: .45;
  display: block;
  margin-bottom: 8px;
  line-height: 1;
}

/* === PRINT: esconder controles, manter conteúdo === */
@media print {
  .sort-pills,
  .toggle-pill,
  .sub-tabs { display: none !important; }
  .creative-card .creative-copy { max-height: 120px !important; }
  .creatives-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .active-card { break-inside: avoid; }
  .creative-card { break-inside: avoid; }
}

/* ============================================================
   Olavo dashboard — R3 NARRATIVA EXECUTIVA
   leitura editorial > leitura tática. Verdict status NÃO é igual
   a .alert (banner crítico) — aqui é status visual editorial.
   ============================================================ */

/* === Verdict card (HERO) === */
.verdict-card {
  padding: 36px 32px;
  border-radius: var(--radius);
  margin: 8px 0 28px;
  background: linear-gradient(135deg, var(--card-solid) 0%, var(--accent-glow) 100%);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent);
  box-shadow: var(--shadow-lg);
  position: relative;
}
.verdict-card.status-green { border-left-color: var(--green); background: linear-gradient(135deg, var(--card-solid) 0%, rgba(16,185,129,.18) 100%); }
/* Tier intermediário: volume forte mas qualidade pendente de validação comercial. */
/* Verde claro acinzentado — não celebratório, mas indica direção positiva neutra. */
.verdict-card.status-green-soft { border-left-color: #b8e2a8; background: linear-gradient(135deg, var(--card-solid) 0%, rgba(184,226,168,.22) 100%); }
.verdict-card.status-yellow { border-left-color: var(--yellow); background: linear-gradient(135deg, var(--card-solid) 0%, rgba(245,158,11,.18) 100%); }
.verdict-card.status-red { border-left-color: var(--red); background: linear-gradient(135deg, var(--card-solid) 0%, rgba(239,68,68,.16) 100%); }
.verdict-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 16px;
  background: var(--accent-glow);
  color: var(--accent-3);
}
.verdict-badge[data-status='green']::before { content: '✓'; margin-right: 6px; }
/* green-soft: glyph neutro (sem ✓ celebratório) — indica direção positiva mas qualidade pendente */
.verdict-badge[data-status='green-soft']::before { content: '↗'; margin-right: 6px; }
.verdict-badge[data-status='yellow']::before { content: '⚠'; margin-right: 6px; }
/* Glyph plano (cross-platform): emoji 🔴 cai pra tofu em Linux/Android sem emoji-color */
.verdict-badge[data-status='red']::before { content: '●'; margin-right: 6px; color: inherit; }
.verdict-card.status-green .verdict-badge { background: var(--green-bg); color: var(--green-text); }
.verdict-card.status-green-soft .verdict-badge { background: #eef7e6; color: #4f7340; }
.verdict-card.status-yellow .verdict-badge { background: var(--yellow-bg); color: #b45309; }
.verdict-card.status-red .verdict-badge { background: var(--red-bg); color: var(--red-text); }
.verdict-text {
  font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.25rem, 4.5vw, 1.6rem);
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  margin: 0;
  max-width: 60ch;
  white-space: pre-wrap;
  letter-spacing: -0.005em;
}

/* === Health Bar (3 segmentos: Conversas / Custo / Investimento) === */
.health-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 28px;
}
.hb-seg {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hb-bar { height: 6px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.hb-bar > span { display: block; height: 100%; width: 100%; background: var(--text-muted); transition: width .4s; }
.hb-seg.level-green      .hb-bar > span { background: var(--green); }
/* Tier intermediário: volume forte sem validação comercial — verde claro acinzentado */
.hb-seg.level-green-soft .hb-bar > span { background: #b8e2a8; }
.hb-seg.level-yellow     .hb-bar > span { background: var(--yellow); }
.hb-seg.level-red        .hb-bar > span { background: var(--red); }
.hb-seg.level-neutral    .hb-bar > span { background: var(--text-muted); opacity: .6; }
.hb-text { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hb-arrow { font-weight: 800; font-size: 1.05rem; }
.hb-seg.level-green .hb-arrow { color: var(--green-text); }
.hb-seg.level-green-soft .hb-arrow { color: #4f7340; }
.hb-seg.level-yellow .hb-arrow { color: #b45309; }
.hb-seg.level-red .hb-arrow { color: var(--red-text); }
.hb-seg.level-neutral .hb-arrow { color: var(--text-muted); }
.hb-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.hb-val { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--text); margin-left: auto; }
@media (max-width: 720px) {
  .health-bar { grid-template-columns: 1fr; gap: 10px; }
  .hb-seg { padding: 12px 14px; }
}

/* === Tech drawer (todo detalhe técnico em <details>) === */
.tech-drawer { margin: 36px 0 0; }
.tech-drawer > summary {
  cursor: pointer;
  padding: 16px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-sec);
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}
.tech-drawer > summary::-webkit-details-marker { display: none; }
.tech-drawer > summary::after { content: ''; }
.tech-drawer .td-label { font-size: .95rem; color: var(--text); }
.tech-drawer .td-hint { font-size: .76rem; color: var(--text-muted); font-weight: 500; }
.tech-drawer[open] > summary { background: var(--card-solid); }
.tech-drawer-body { padding-top: 22px; }

/* === Audit drawer (nested: tabelas técnicas) === */
.audit-drawer { margin: 22px 0; }
.audit-drawer summary {
  cursor: pointer;
  padding: 14px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-sec);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.audit-drawer summary::-webkit-details-marker { display: none; }
.audit-drawer summary::after { content: '+'; opacity: .55; font-weight: 800; }
.audit-drawer[open] summary::after { content: '−'; }
.audit-drawer[open] summary { background: var(--card); border-style: solid; margin-bottom: 14px; }
.audit-drawer-body > * + * { margin-top: 18px; }

/* === Glossário rodapé === */
.glossary-drawer { margin: 36px 0 8px; }
/* AJUSTE 2026-06-05: glossário sempre aberto (sem <details>/<summary>) — owner pediu visível direto */
.glossary-drawer.glossary-open { padding: 0; background: transparent; border: none; }
.glossary-title {
  margin: 0 0 4px;
  padding: 12px 16px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-sec);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  display: flex; align-items: center; gap: 8px;
}
.glossary-drawer.glossary-open .glossary-body { padding: 18px 6px 8px; }
/* AJUSTE 2026-06-05 (review fix): removidas regras .glossary-drawer summary — dead CSS pós-troca de <details> por <section>+<h3>. */
.glossary-body { padding: 18px 6px 8px; }
.glossary-body dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 22px; margin: 0; }
.glossary-body dt { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--text); font-size: .9rem; }
.glossary-body dd { margin: 0; font-size: .88rem; color: var(--text-sec); line-height: 1.5; }
@media (max-width: 600px) {
  .glossary-body dl { grid-template-columns: 1fr; gap: 4px 0; }
  .glossary-body dt { margin-top: 10px; }
}

/* === Collapse extra (Top-N + show all) === */
.collapse-extra { margin-top: 12px; }
.collapse-extra summary {
  cursor: pointer;
  padding: 10px 16px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: transparent;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .82rem;
  color: var(--text-sec);
  list-style: none;
  text-align: center;
  transition: all var(--transition);
}
.collapse-extra summary:hover { background: var(--card-2); border-style: solid; color: var(--text); }
.collapse-extra summary::-webkit-details-marker { display: none; }
.collapse-extra[open] summary { background: var(--card-2); margin-bottom: 12px; }
.collapse-body { display: flex; flex-direction: column; gap: 10px; }
/* AJUSTE 2026-06-05 (review fix): removida regra .creatives-extra .collapse-body — wrapper <details> foi removido do markup. */

/* === Audience mobile list (≤600px renderiza linear em vez de heatmap) === */
.aud-mobile-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.aud-mobile-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
}
.aud-mobile-row .rank {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  color: var(--accent);
  font-size: 1rem;
  text-align: center;
}
.aud-mobile-row .who { font-weight: 600; font-size: .95rem; color: var(--text); margin-bottom: 2px; }
.aud-mobile-row .stats { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }

/* === Custom-range drawer (linha solo abaixo do empOverview) ===
   Desktop: aberto por boot() (open atributo) → inputs inline visíveis.
   Mobile <=480px: fechado por boot() → summary chip mostra "Período personalizado".
   Importante: UA stylesheet aplica details:not([open]) > :not(summary) { display: none },
   então não dá pra usar display:contents pra "esconder" o details no desktop. Solução: JS
   gerencia open/closed e o CSS só estiliza o body quando ele está visível. */
.custom-range-row {
  margin: 14px 0 18px;
}
.custom-range-row > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-sec);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .82rem;
  text-align: center;
  display: inline-block;
  max-width: fit-content;
}
.custom-range-row > summary::-webkit-details-marker { display: none; }
.custom-range-row > summary::after { content: ' ▾'; opacity: .55; font-size: .8em; }
.custom-range-row[open] > summary::after { content: ' ▴'; }
.custom-range-row .custom-range-body {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.custom-range-row .custom-range-body .date-in { flex: 0 1 auto; }
@media (min-width: 481px) {
  /* Desktop/tablet: summary é apenas um toggle compacto, body sempre aparece quando open */
  .custom-range-row > summary { display: inline-block; }
}
@media (max-width: 480px) {
  .custom-range-row > summary { display: block; max-width: none; }
  .custom-range-row .custom-range-body { gap: 8px; }
  .custom-range-row .custom-range-body .date-in { flex: 1 1 calc(50% - 6px); }
  .custom-range-row .custom-range-body #apply { flex: 1 0 100%; }
}

/* === Highlight badges (3 strat-pct gigantes) === */
.highlight-badges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 0 0 24px;
}
.hl-badge {
  padding: 20px 22px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hl-pct {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1;
}
/* AA-safe darker greens/reds — consistente com .delta e .verdict-badge (via tokens) */
.hl-pct.pos { color: var(--green-text); }
.hl-pct.neg { color: var(--red-text); }
.hl-pct.neutral { color: var(--text); }
.hl-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  color: var(--text-sec);
  font-weight: 600;
}
.hl-label {
  font-size: .82rem;
  color: var(--text-muted);
  max-width: 200px;
  line-height: 1.35;
}

/* === Headlines strip (mini-cards jornalísticos) === */
.headlines-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 28px;
}
.headline-card {
  padding: 14px 16px;
  background: var(--card-2);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: .92rem;
  line-height: 1.45;
  color: var(--text);
}
.headline-card strong { color: var(--text); font-weight: 700; }

/* === MTD card === */
.mtd-card {
  padding: 22px 26px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}
.mtd-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.mtd-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin: 0;
}
.mtd-partial {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.mtd-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.mtd-stat .lbl {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}
.mtd-stat .val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.mtd-stat .delta-row { margin-top: 6px; }
.mtd-reading {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .95rem;
  color: var(--text-sec);
  line-height: 1.5;
}

/* === Block divider (story flow) === */
.block-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 36px 0 22px;
}
.block-label {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: clamp(.85rem, 2.5vw, 1rem);
  text-transform: uppercase;
  letter-spacing: .3em;
  color: var(--text-muted);
  white-space: nowrap;
}
.hairline {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* === Section head h3 (escalada — antes 0.95, agora 1.15) === */
.section-head h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
}

/* === Insight grid (dual column FUNCIONA / OTIMIZAR) === */
.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.insight-box {
  padding: 22px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.insight-box.ok {
  border-left: 4px solid var(--green);
  background: linear-gradient(135deg, var(--card) 0%, var(--green-bg) 100%);
}
.insight-box.warn {
  border-left: 4px solid var(--yellow);
  background: linear-gradient(135deg, var(--card) 0%, var(--yellow-bg) 100%);
}
.insight-box h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.insight-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.insight-item {
  font-size: .92rem;
  line-height: 1.5;
  color: var(--text-sec);
}
.insight-item strong { font-weight: 700; color: var(--text); display: block; margin-bottom: 2px; }
.insight-item .metric { font-family: 'Outfit', sans-serif; font-weight: 600; color: var(--text); font-size: .88rem; }
.insight-item .detail { color: var(--text-muted); font-size: .85rem; display: block; margin-top: 2px; }

/* === Actionable grid (Top 3 Oportunidades + Top 3 Alertas) === */
.actionable-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.action-card {
  padding: 22px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.action-card.opp { border-top: 3px solid var(--accent); }
.action-card.alert { border-top: 3px solid var(--red); }
.action-card h4 {
  margin: 0 0 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.action-item:last-child { border-bottom: none; }
.action-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  line-height: 1.3;
}
.action-card.alert .action-num { color: var(--red); }
.action-text { font-size: .9rem; line-height: 1.45; color: var(--text-sec); }

/* === Plano 4 semanas === */
.plan-card {
  padding: 28px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}
.plan-card h3 {
  margin: 0 0 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  color: var(--text);
}
.plan-card .plan-sub {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: .9rem;
}
.plan-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.plan-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 18px;
  align-items: start;
}
.plan-num {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
}
.plan-body { min-width: 0; }
.plan-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 4px;
  color: var(--text);
}
.plan-detail {
  font-size: .9rem;
  color: var(--text-sec);
  line-height: 1.5;
  margin: 0;
}
.plan-outcome {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}
.plan-prazo {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: .72rem;
  white-space: nowrap;
  text-transform: uppercase;
  align-self: start;
}

/* === Empreendimentos overview === */
.emp-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.emp-card {
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.emp-photo {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--bg-2);
}
.emp-photo-fallback {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, var(--accent-glow), var(--bg-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--accent-3);
}
.emp-meta h4 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.emp-loc { font-size: .8rem; color: var(--text-muted); display: block; }
.emp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0;
}
.emp-stats .lbl {
  font-size: .7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .04em;
  display: block;
}
.emp-stats .val {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  display: block;
}
.emp-share-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}
.emp-share-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.emp-status {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  align-self: flex-start;
  font-family: 'Outfit', sans-serif;
}
/* WCAG AA: darker greens/reds pra contraste mínimo 4.5:1 em fonte pequena */
.emp-status.aceleracao { background: var(--green-bg); color: #047857; }
.emp-status.equilibrado { background: rgba(100,116,139,.10); color: var(--text-sec); }
.emp-status.pressao { background: var(--red-bg); color: #b91c1c; }
.emp-diagnose {
  font-size: .88rem;
  line-height: 1.5;
  color: var(--text-sec);
  margin: 0;
}

/* === Chart readings === */
.chart-reading {
  margin: 8px 0 0;
  padding: 8px 12px;
  background: var(--card-2);
  border-radius: var(--radius-xs);
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.chart-reading::before {
  content: '🔍';
  flex-shrink: 0;
  opacity: .7;
}

/* === Audience narrative === */
.aud-narrative {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  border-left: 3px solid var(--accent);
  margin-bottom: 16px;
}
.aud-narrative h4 {
  margin: 0 0 6px;
  font-family: 'Outfit', sans-serif;
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}
.aud-narrative p.narrative {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text);
}
.aud-narrative .pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.aud-narrative .pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card-solid);
  border: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-sec);
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
}
.aud-narrative .share-foot {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--text-muted);
}

/* === Exec quote === */
.exec-quote {
  padding: 32px 36px;
  border-radius: var(--radius);
  background: rgba(2,161,253,.06);
  border-left: 5px solid var(--accent);
  margin: 32px 0 18px;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
}

/* === Feedback callout (AJUSTE 2026-06-05) — pedido de retorno qualitativo dos leads === */
.feedback-callout {
  margin: 24px 0 18px;
  padding: 28px 32px;
  border-radius: var(--radius);
  background: rgba(2,161,253,.04);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}
.feedback-callout .fbc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.feedback-callout .fbc-icon { font-size: 1.4rem; line-height: 1; }
.feedback-callout .fbc-title {
  margin: 0; font-family: 'Outfit', sans-serif; font-weight: 700;
  font-size: 1.05rem; color: var(--text); line-height: 1.35;
}
.feedback-callout .fbc-body { margin: 0 0 18px; font-size: .95rem; line-height: 1.55; color: var(--text-sec); }
.feedback-callout .fbc-body strong { color: var(--text); font-weight: 700; }
.feedback-callout .fbc-checklist {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 18px; margin: 0 0 16px;
}
.feedback-callout .fbc-item {
  display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start;
  padding: 10px 12px; background: var(--card-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.feedback-callout .fbc-item b {
  display: block; font-family: 'Outfit', sans-serif; font-weight: 700;
  font-size: .88rem; color: var(--text); margin-bottom: 2px;
}
.feedback-callout .fbc-item span {
  display: block; font-size: .78rem; color: var(--text-muted); line-height: 1.4;
}
.feedback-callout .fbc-bullet {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; font-weight: 800; font-size: .82rem;
  font-family: 'Outfit', sans-serif;
}
.feedback-callout .fbc-bullet-good { background: rgba(16,185,129,.15); color: var(--green); }
.feedback-callout .fbc-bullet-best { background: rgba(2,161,253,.18); color: var(--accent); }
.feedback-callout .fbc-bullet-warn { background: rgba(245,158,11,.15); color: #b45309; }
.feedback-callout .fbc-bullet-mute { background: var(--card-solid); color: var(--text-muted); border: 1px dashed var(--border); }
.feedback-callout .fbc-howto {
  margin: 0; font-size: .82rem; color: var(--text-muted);
  font-style: italic; line-height: 1.5;
}
@media (max-width: 720px) {
  .feedback-callout { padding: 22px 20px; }
  .feedback-callout .fbc-title { font-size: .98rem; }
  .feedback-callout .fbc-checklist { grid-template-columns: 1fr; }
  .feedback-callout .fbc-body { font-size: .9rem; }
}
@media print {
  .feedback-callout { break-inside: avoid; background: #fff; }
}

/* === Copy summary button === */
.copy-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all var(--transition);
  margin-bottom: 8px;
  touch-action: manipulation; /* mata 300ms tap delay no iOS Safari */
}
.copy-summary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.copy-summary.copied { background: var(--green); box-shadow: 0 4px 16px rgba(16,185,129,.4); }

@media (max-width: 720px) {
  .copy-summary {
    position: fixed;
    /* Safe-area-inset: respeita home indicator do iPhone (notch + bottom bar) */
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    z-index: 999;
    padding: 14px 20px;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(2,161,253,.45), 0 2px 8px rgba(0,0,0,.18);
    font-size: .85rem;
    margin: 0;
  }
  /* Reserva espaço no body inteiro pra sticky button não cobrir exec-quote,
     glossary, footer ou outros details no fim da página.
     Aplicado só quando .copy-summary está visível (com texto) — evita gap fantasma
     quando whatsappSummary vazio ou filtrado por empreendimento. */
  body.has-sticky-cta { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

  /* Touch targets mobile (WCAG 2.5.8 >=44px) — sort-pill (campanhas) + creatives-sort */
  .sort-pill,
  .creatives-sort button {
    min-height: 44px;
    padding: 10px 14px;
    touch-action: manipulation;
  }
}

/* === Mobile === */
@media (max-width: 860px) {
  .highlight-badges,
  .headlines-strip,
  .insight-grid,
  .actionable-grid,
  .emp-overview,
  .mtd-stats { grid-template-columns: 1fr; }
  .plan-item { grid-template-columns: 44px 1fr; }
  .plan-prazo { grid-column: 2; justify-self: start; margin-top: 4px; }
  .verdict-card, .plan-card { padding: 22px 20px; }
  .exec-quote { padding: 22px 20px; font-size: 1.05rem; }
  .mtd-card { padding: 18px 20px; }
}

/* === Print extras: hide copy/verdict animations === */
@media print {
  .copy-summary { display: none !important; }
  .export-menu { display: none !important; }
  .verdict-card, .plan-card, .insight-box, .action-card, .mtd-card, .emp-card { break-inside: avoid; }
  .exec-quote { break-inside: avoid; }
  .verdict-card { padding: 24px 22px !important; }
  .verdict-text { font-size: 1.15rem !important; }
  /* Garantir bodies dos drawers visíveis (já forçado pelo seletor universal acima, redundância segura) */
  .tech-drawer .tech-drawer-body,
  .audit-drawer .audit-drawer-body,
  .glossary-drawer .glossary-body,
  .collapse-extra .collapse-body,
  .extras-drawer .headlines-strip { display: block !important; }
  .glossary-body dl { display: grid !important; }
  .health-bar { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; }
}

