@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0a0d14;
  --surface:    #1a1d27;
  --surface2:   #21253a;
  --border:     #2a2d3a;
  --border2:    #373a4d;
  --text:       #e2e8f0;
  --text-muted: #8892a4;
  --text-dim:   #5a6478;
  --accent:     #0ea5e9;
  --accent2:    #0284c7;
  --green:      #10b981;
  --green-dim:  #064e3b;
  --red:        #ef4444;
  --red-dim:    #450a0a;
  --yellow:     #f59e0b;
  --yellow-dim: #451a03;
  --blue:       #3b82f6;
  --blue-dim:   #1e3a5f;
  --sidebar-w:  240px;
  --header-h:   64px;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
}

html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #030812;
  background-image: url('/background-novo.png');
  background-size: cover;
  background-position: top center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #0d1117;
  border-right: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}

.sidebar-logo-img {
  max-width: 160px;
  width: 100%;
  height: auto;
  display: block;
}

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.nav-section {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(14,165,233,.2), rgba(2,132,199,.15));
  color: var(--text);
  border: 1px solid rgba(14,165,233,.25);
}

.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.api-status {
  display: flex; align-items: center; gap: 8px;
  font-size: .75rem; color: var(--text-muted);
}

.api-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background .3s;
}
.api-dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(16,185,129,.5); }
.api-dot.err { background: var(--red); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  height: 56px;
  background: #0d1117;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0;
  z-index: 50;
}

.header-title h1 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.header-title p {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.header-actions {
  display: flex; align-items: center; gap: 12px;
}

.period-select {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.period-select:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all .15s;
}

.btn-primary {
  background: #0ea5e9;
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
}
.btn-primary:hover { background: #0284c7; }
.btn-primary:active { background: #0284c7; }

.btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #374151;
  border-radius: 8px;
}
.btn-ghost:hover { color: var(--text); border-color: #4b5563; background: rgba(255,255,255,.04); }

.btn svg { width: 14px; height: 14px; }

/* ── Content ──────────────────────────────────────────────────────────────── */
.content {
  padding: 28px;
  flex: 1;
}

.page { display: none; }
.page.active { display: block; }

/* ── KPI Cards ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .2s;
}
.kpi-card:hover { border-color: var(--border2); }

.kpi-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
  line-height: 1;
}

.kpi-sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.kpi-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.kpi-icon.blue  { background: rgba(59,130,246,.15);  color: var(--blue); }
.kpi-icon.green { background: rgba(16,185,129,.15);  color: var(--green); }
.kpi-icon.red   { background: rgba(239,68,68,.15);   color: var(--red); }
.kpi-icon.purple{ background: rgba(2,132,199,.15);  color: var(--accent2); }
.kpi-icon.yellow{ background: rgba(245,158,11,.15);  color: var(--yellow); }

/* ── Panels ───────────────────────────────────────────────────────────────── */
.panel {
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}

.panel-title svg { width: 18px; height: 18px; color: var(--accent); }

.panel-subtitle {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.panel-body { padding: 0; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

thead th {
  padding: 11px 20px;
  text-align: left;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }

tbody td {
  padding: 13px 20px;
  color: var(--text);
  white-space: nowrap;
}

.td-name {
  display: flex; align-items: center; gap: 10px;
  max-width: 260px;
}

.td-thumb {
  width: 36px; height: 36px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}

.td-thumb-placeholder {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-dim);
}

.td-text-wrap { overflow: hidden; }

.td-main-text {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.td-sub-text {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Badges / Tags ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue); }
.badge-gray   { background: var(--surface2);   color: var(--text-muted); }

/* ── Metric value colors ──────────────────────────────────────────────────── */
.val-positive { color: var(--green); font-weight: 600; }
.val-negative { color: var(--red); font-weight: 600; }
.val-neutral  { color: var(--text-muted); }

/* ── Progress Bar ─────────────────────────────────────────────────────────── */
.progress-bar-wrap { display: flex; align-items: center; gap: 10px; }

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .4s ease;
}

/* ── Grid layouts ─────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ── Loading ──────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

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

.loading-overlay {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px;
  padding: 56px 20px;
  color: var(--text-muted);
  font-size: .82rem;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
  padding: 56px 20px;
  color: var(--text-muted);
  font-size: .85rem;
  text-align: center;
}

.empty-state svg { width: 40px; height: 40px; color: var(--text-dim); margin-bottom: 4px; }
.empty-state strong { color: var(--text); font-size: .95rem; display: block; }

/* ── VSL Cards ────────────────────────────────────────────────────────────── */
.vsl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 20px;
}

.vsl-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, transform .15s;
}
.vsl-card:hover { border-color: rgba(14,165,233,.4); transform: translateY(-2px); }

.vsl-thumb {
  width: 100%; height: 160px;
  object-fit: cover;
  background: var(--border);
}

.vsl-thumb-placeholder {
  width: 100%; height: 160px;
  background: linear-gradient(135deg, var(--border) 0%, var(--surface2) 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}

.vsl-body { padding: 16px; }

.vsl-name {
  font-size: .87rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vsl-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.vsl-metric {
  background: var(--surface);
  border-radius: 8px;
  padding: 10px;
}

.vsl-metric-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.vsl-metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.vsl-rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
  margin-right: 6px;
}
.vsl-rank-1 { background: rgba(245,158,11,.2); color: var(--yellow); }
.vsl-rank-2 { background: rgba(226,232,240,.1); color: #94a3b8; }
.vsl-rank-3 { background: rgba(180,100,60,.2); color: #c17d52; }
.vsl-rank-other { background: var(--border); color: var(--text-dim); }

/* ── VSL Highlight Card ───────────────────────────────────────────────────── */
.kpi-card--vsl {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(14,165,233,.1) 0%, rgba(2,132,199,.07) 100%);
  border-color: rgba(2,132,199,.35);
  position: relative;
  overflow: hidden;
}

.kpi-card--vsl::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(2,132,199,.18) 0%, transparent 70%);
  pointer-events: none;
}

.kpi-card--vsl:hover { border-color: rgba(2,132,199,.55); }

.kpi-vsl-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-vsl-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.kpi-vsl-metrics {
  display: flex;
  border-top: 1px solid rgba(2,132,199,.2);
  padding-top: 14px;
}

.kpi-vsl-metric {
  flex: 1;
  text-align: center;
  padding: 0 12px;
  border-right: 1px solid var(--border);
}
.kpi-vsl-metric:first-child { padding-left: 0; text-align: left; }
.kpi-vsl-metric:last-child  { border-right: none; }

.kpi-vsl-metric-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-vsl-metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.4px;
  line-height: 1;
}

@media (max-width: 520px) {
  .kpi-card--vsl { grid-column: span 1; }
}

/* ── UTM Chart bars ───────────────────────────────────────────────────────── */
.utm-bar-list { padding: 20px 22px; }

.utm-bar-item {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
}

.utm-bar-label {
  min-width: 110px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.utm-bar-track {
  flex: 1;
  height: 28px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.utm-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 6px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 10px;
  transition: width .6s cubic-bezier(.34,1.56,.64,1);
}

.utm-bar-fill-text {
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
}

.utm-bar-value {
  min-width: 90px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .8rem;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease;
  max-width: 340px;
}

.toast.err { border-left: 3px solid var(--red); }
.toast.ok  { border-left: 3px solid var(--green); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ── Filter Toggle ────────────────────────────────────────────────────────── */
.filter-toggle {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-muted);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.filter-toggle:hover { border-color: var(--accent); color: var(--text); }
.filter-toggle.active {
  background: rgba(14,165,233,.12);
  border-color: var(--accent);
  color: var(--accent);
}
.filter-toggle.active::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  background: none; border: none;
  color: var(--text); cursor: pointer; padding: 6px;
}

@media (max-width: 1280px) {
  .dash-row-3 { grid-template-columns: 1fr 1fr; }
  .dash-row-3 > .eagle-panel { grid-column: span 2; order: 3; }
  .metrics-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
  .dash-row-3, .dash-row-2 { grid-template-columns: 1fr; }
  .dash-row-3 > .eagle-panel { grid-column: span 1; order: 0; }
  .hero-banner { height: 200px; }
  .hero-title { font-size: 1.4rem; }
  .hero-content { padding: 28px 24px; }
}

@media (max-width: 640px) {
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .resumo-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ── Overlay (mobile) ─────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}
.sidebar-overlay.visible { display: block; }

/* ── Settings Modal ───────────────────────────────────────────────────────── */
.settings-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.settings-overlay.visible { display: flex; }

.settings-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.settings-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.settings-title {
  font-size: 1rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.settings-title svg { width: 20px; height: 20px; color: var(--accent); }

.settings-close {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 1.5rem; padding: 2px 8px;
  border-radius: 6px; line-height: 1;
  font-family: inherit;
}
.settings-close:hover { background: var(--surface2); color: var(--text); }

.settings-tabs {
  display: flex;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-tab {
  background: none; border: none;
  padding: 12px 16px;
  font-size: .82rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  transition: color .15s;
  display: flex; align-items: center; gap: 7px;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.settings-body { flex: 1; overflow-y: auto; padding: 24px; }

.settings-tab-content { display: none; }
.settings-tab-content.active { display: block; }

.settings-section-desc {
  font-size: .8rem; color: var(--text-muted);
  margin-bottom: 20px; line-height: 1.6;
}

.settings-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  flex-shrink: 0;
}

/* ── Form Elements ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: .7rem; font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .06em;
}

.form-optional {
  font-weight: 400; text-transform: none;
  letter-spacing: 0; color: var(--text-dim);
}

.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: .82rem; font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-dim); }

.form-hint {
  font-size: .75rem; color: var(--text-muted);
  line-height: 1.7;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 8px;
}

/* ── App Card ─────────────────────────────────────────────────────────────── */
.app-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.app-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.app-card-title {
  font-size: .88rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.app-card-title::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.app-remove-btn {
  background: none; border: 1px solid transparent;
  color: var(--text-dim); font-size: .72rem;
  cursor: pointer; padding: 4px 10px;
  border-radius: 6px; font-family: inherit;
  transition: all .15s;
}
.app-remove-btn:hover { color: var(--red); border-color: var(--red-dim); background: var(--red-dim); }

.app-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.app-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 16px 0;
}

.btn-sm { padding: 6px 12px; font-size: .75rem; }

/* ── Accounts List ────────────────────────────────────────────────────────── */
.accounts-section { margin-top: 4px; }
.accounts-section .form-label { margin-bottom: 8px; }

.accounts-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 36px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.accounts-empty {
  font-size: .75rem; color: var(--text-dim);
  font-style: italic;
  display: flex; align-items: center;
}

.account-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(14,165,233,.15);
  border: 1px solid rgba(14,165,233,.25);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: .72rem; font-family: monospace;
  color: var(--text);
}

.account-tag-remove {
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  padding: 0; font-size: 1rem;
  line-height: 1; display: flex; align-items: center;
  transition: color .1s;
}
.account-tag-remove:hover { color: var(--red); }

.account-add-row {
  display: flex; gap: 8px; align-items: center;
}
.account-add-row .form-input {
  flex: 1; font-family: monospace; font-size: .78rem;
}

.discover-result {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.discover-result-header {
  padding: 8px 14px;
  font-size: .68rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.discover-result-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; gap: 12px;
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
}
.discover-result-item:last-child { border-bottom: none; }
.discover-result-item:hover { background: rgba(255,255,255,.02); }
.discover-result-info { flex: 1; min-width: 0; }
.discover-result-name { color: var(--text); font-weight: 500; }
.discover-result-id { color: var(--text-muted); font-family: monospace; font-size: .7rem; margin-top: 2px; }
.discover-result-add {
  background: none; border: 1px solid var(--border2);
  color: var(--text-muted); font-size: .7rem;
  cursor: pointer; padding: 4px 12px;
  border-radius: 20px; font-family: inherit;
  transition: all .15s; white-space: nowrap; flex-shrink: 0;
}
.discover-result-add:hover { border-color: var(--accent); color: var(--accent); background: rgba(14,165,233,.1); }
.discover-result-add.added { border-color: var(--green-dim); color: var(--green); background: var(--green-dim); cursor: default; }

@media (max-width: 600px) {
  .settings-modal { max-height: 95vh; }
  .settings-overlay { padding: 12px; }
  .app-row-2 { grid-template-columns: 1fr; }
}

/* ── Hero Banner ──────────────────────────────────────────────────────────── */
.hero-banner {
  position: relative;
  height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  background-color: transparent;
  display: flex;
  align-items: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10,15,30,.7) 0%, rgba(10,15,30,.3) 60%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 40px 48px;
  max-width: 620px;
}

.hero-eyebrow {
  font-size: .82rem;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  margin-bottom: 10px;
  letter-spacing: .02em;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 14px;
  letter-spacing: -.5px;
}

.hero-accent { color: #0ea5e9; }

.hero-subtitle {
  font-size: .88rem;
  color: rgba(255,255,255,.65);
  line-height: 1.6;
  max-width: 480px;
}

/* ── Metrics Row ──────────────────────────────────────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 0;
  position: relative;
  overflow: hidden;
  transition: border-color .2s;
  display: flex;
  flex-direction: column;
}
.metric-card:hover { border-color: rgba(14,165,233,.35); }

.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.metric-label {
  font-size: .6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.mc-green  { color: var(--green); }
.mc-accent { color: var(--accent); }
.mc-red    { color: var(--red); }
.mc-yellow { color: var(--yellow); }
.mc-blue   { color: var(--blue); }
.mc-purple { color: #8b5cf6; }

.metric-delta {
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  display: none;
}
.metric-delta.pos { display: inline-flex; background: rgba(16,185,129,.15); color: var(--green); }
.metric-delta.neg { display: inline-flex; background: rgba(239,68,68,.15);  color: var(--red); }

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.4px;
  line-height: 1.1;
  margin-bottom: 10px;
  flex: 1;
}

.metric-sparkline { line-height: 0; margin: 0 -1px; }
.metric-sparkline svg { width: calc(100% + 2px); height: 44px; display: block; }

/* ── Dashboard 3-col / 2-col rows ─────────────────────────────────────────── */
.dash-row-3 {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.8fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dash-row-2 {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ── Eagle Intelligence ───────────────────────────────────────────────────── */
.eagle-panel .panel-body { overflow-y: auto; }

.ia-badge {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(59,130,246,.25));
  border: 1px solid rgba(139,92,246,.4);
  color: #a78bfa;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 7px;
  vertical-align: middle;
  white-space: nowrap;
}

.intel-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  margin-bottom: 7px;
  border: 1px solid transparent;
}
.intel-item:last-child { margin-bottom: 0; }
.intel-item.highlight { background: rgba(14,165,233,.07); border-color: rgba(14,165,233,.18); }
.intel-item.alert     { background: rgba(239,68,68,.07);  border-color: rgba(239,68,68,.18); }
.intel-item.good      { background: rgba(16,185,129,.07); border-color: rgba(16,185,129,.18); }
.intel-item.neutral   { background: var(--surface2); border-color: var(--border); }

.intel-icon { font-size: 1rem; flex-shrink: 0; line-height: 1.4; }

.intel-title {
  font-size: .76rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.intel-badge {
  font-size: .58rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.intel-badge-green { background: rgba(16,185,129,.15); color: var(--green); }
.intel-badge-red   { background: rgba(239,68,68,.15);  color: var(--red); }
.intel-badge-blue  { background: rgba(14,165,233,.15); color: var(--accent); }

.intel-text {
  font-size: .71rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Panel Footer ─────────────────────────────────────────────────────────── */
.panel-footer {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.panel-footer-link {
  font-size: .73rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: opacity .15s;
}
.panel-footer-link:hover { opacity: .7; }

/* ── Resumo Rápido Horizontal ─────────────────────────────────────────────── */
.resumo-h-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.resumo-h-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color .15s;
}
.resumo-h-card:hover { border-color: var(--border2); }

.resumo-h-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.resumo-h-label {
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.resumo-h-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
  line-height: 1;
}

/* ── Dashboard filter select ──────────────────────────────────────────────── */
.dash-select {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}
.dash-select:focus { border-color: var(--accent); }

/* ── Status dot ───────────────────────────────────────────────────────────── */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.ok::before  { background: var(--green); box-shadow: 0 0 5px rgba(16,185,129,.5); }
.status-dot.err::before { background: var(--red); }
.status-dot.warn::before{ background: var(--yellow); }
.status-dot.off::before { background: var(--text-dim); }

/* ── Circular thumbnail ───────────────────────────────────────────────────── */
.td-thumb-c {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}
.td-thumb-c-ph {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: .55rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

/* ── Estrutura Vencedora Card ─────────────────────────────────────────────── */
.estrutura-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px;
}

.estrutura-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.estrutura-item-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.estrutura-item-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.estrutura-item-sub {
  font-size: .72rem;
  color: var(--text-muted);
}

/* ── Campaign Search ─────────────────────────────────────────────────────── */
.campaign-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.campaign-search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.campaign-search-input {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .78rem;
  padding: 7px 12px 7px 32px;
  outline: none;
  width: 220px;
  transition: border-color .15s, width .2s;
}
.campaign-search-input:focus {
  border-color: var(--accent);
  width: 260px;
}
.campaign-search-input::placeholder { color: var(--text-dim); }

/* ── Campaign Tree ────────────────────────────────────────────────────────── */
.expand-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text-muted);
  width: 22px; height: 22px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .6rem;
  transition: all .15s;
  padding: 0;
  flex-shrink: 0;
}
.expand-btn:hover { border-color: var(--accent); color: var(--accent); }
.expand-btn.open { background: rgba(14,165,233,.1); border-color: var(--accent); color: var(--accent); }

.tree-level-2 { background: rgba(255,255,255,.015); }
.tree-level-2:hover { background: rgba(255,255,255,.03) !important; }
.tree-level-2 td:nth-child(2) { padding-left: 32px; }

.tree-level-3 { background: rgba(255,255,255,.008); }
.tree-level-3:hover { background: rgba(255,255,255,.02) !important; }
.tree-level-3 td:nth-child(2) { padding-left: 56px; }

.tree-loading td {
  padding: 10px 20px;
  color: var(--text-dim);
  font-size: .78rem;
  font-style: italic;
}

/* ── KPI icon colors ──────────────────────────────────────────────────────── */
.kpi-icon.blue   { background: rgba(59,130,246,.15);  color: var(--blue); }
.kpi-icon.green  { background: rgba(16,185,129,.15);  color: var(--green); }
.kpi-icon.red    { background: rgba(239,68,68,.15);   color: var(--red); }
.kpi-icon.purple { background: rgba(139,92,246,.15);  color: #8b5cf6; }
.kpi-icon.yellow { background: rgba(245,158,11,.15);  color: var(--yellow); }
.kpi-icon.accent { background: rgba(14,165,233,.15);  color: var(--accent); }

.kpi-icon.blue   .kpi-icon-inner { color: var(--blue); }
.kpi-icon.green  .kpi-icon-inner { color: var(--green); }

/* ── KPI icon per metric ──────────────────────────────────────────────────── */
.kpi-icon.blue { background: rgba(16,185,129,.15); color: var(--green); }
.kpi-icon.green { background: rgba(14,165,233,.15); color: var(--accent); }

.kpi-icon.kpi-receita  { background: rgba(16,185,129,.15); color: #10b981; }
.kpi-icon.kpi-roas     { background: rgba(14,165,233,.15); color: #0ea5e9; }
.kpi-icon.kpi-cpa      { background: rgba(239,68,68,.15);  color: #ef4444; }
.kpi-icon.kpi-compras  { background: rgba(245,158,11,.15); color: #f59e0b; }
.kpi-icon.kpi-impressoes { background: rgba(59,130,246,.15); color: #3b82f6; }
.kpi-icon.kpi-cliques  { background: rgba(139,92,246,.15); color: #8b5cf6; }
