/* ================================================================
   Insight Arltech Dashboard — style.css v2
   Clean light theme inspirado no BrewDirect
   ================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f6fa;
  --bg-2: #ffffff;
  --bg-3: #f0f1f7;
  --border: #e4e6ef;
  --border-h: #c9cce0;
  --text-1: #1a1d2e;
  --text-2: #6b7296;
  --text-3: #b0b5d0;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;

  --sidebar-w: 220px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  display: flex;
  min-height: 100vh;
}

/* ──────────────────────────────────────── SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  padding: 0;
  transition: width var(--transition);
}

.sidebar.collapsed {
  width: 76px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
  transition: opacity var(--transition);
}

.sidebar.collapsed .brand-name {
  display: none;
}

.brand-accent {
  color: var(--accent);
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: all var(--transition);
  margin-left: auto;
}

.sidebar-toggle:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.sidebar.collapsed .sidebar-toggle {
  margin-left: 0;
}

.sidebar.collapsed .sidebar-brand {
  flex-direction: column;
  padding: 16px 10px;
  gap: 16px;
}

/* NAV */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
}

.sidebar.collapsed .nav-item span {
  display: none;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 10px 4px;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
  margin: 4px 0;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-connect-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-h);
  background: transparent;
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  text-align: left;
}

.meta-connect-btn:hover {
  border-color: #1877f2;
  color: #1877f2;
  background: #eef4ff;
}

.meta-connect-btn.connected {
  border-color: var(--green);
  color: var(--green);
  border-style: solid;
  background: var(--green-soft);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  min-width: 0;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-1);
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-2);
}

.sidebar.collapsed .meta-connect-btn span,
.sidebar.collapsed .user-info {
  display: none;
}

.sidebar.collapsed .meta-connect-btn {
  justify-content: center;
  padding: 9px 0;
}

.sidebar.collapsed .user-row {
  flex-direction: column;
  padding: 8px 4px;
}

.sidebar.collapsed .user-row button {
  margin-left: 0 !important;
  margin-top: 8px;
}

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

.sidebar.collapsed~.main {
  margin-left: 76px;
}

/* ──────────────────────────────────────── TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.78rem;
  color: var(--text-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.82rem;
  color: var(--text-1);
  font-weight: 500;
  cursor: pointer;
}

.date-range svg {
  width: 14px;
  height: 14px;
  color: var(--text-2);
}

.date-filter select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 7px 12px;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.date-filter select:focus {
  border-color: var(--accent);
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-export:hover {
  background: var(--bg-3);
}

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

.btn-notif {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
}

.btn-notif:hover {
  background: var(--bg-2);
}

.btn-notif svg {
  width: 16px;
  height: 16px;
}

.btn-refresh {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-refresh:hover {
  background: var(--bg-2);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-refresh svg {
  width: 15px;
  height: 15px;
}

.btn-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

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

/* ──────────────────────────────────────── CONTENT */
.tab-content {
  display: none;
  padding: 24px 28px;
  flex-direction: column;
  gap: 20px;
}

.tab-content.active {
  display: flex;
}

/* ──────────────────────────────────────── KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-1);
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
}

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

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

.kpi-trend.neutral {
  color: var(--text-2);
}

.kpi-trend svg {
  width: 13px;
  height: 13px;
}

.kpi-trend .vs {
  color: var(--text-3);
  font-weight: 400;
}

.kpi-highlight {
  background: var(--blue-soft);
  border-color: #bfdbfe;
}

.kpi-highlight .kpi-value {
  color: var(--blue);
}

.kpi-highlight .kpi-label {
  color: #1d4ed8;
}

/* ──────────────────────────────────────── CHARTS ROW */
.charts-row {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 16px;
}

.chart-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-1);
}

.chart-legend {
  display: flex;
  gap: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-2);
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.dashed {
  background: none;
  border: 2px dashed var(--amber);
  border-radius: 50%;
}

.chart-body {
  position: relative;
  height: 220px;
}

.chart-body canvas {
  width: 100% !important;
  height: 100% !important;
}

/* CENTER donut text */
.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center .big {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-1);
}

.donut-center .small {
  font-size: 0.72rem;
  color: var(--text-2);
  font-weight: 500;
}

/* ──────────────────────────────────────── TABLES */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

.table-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
}

.table-link:hover {
  color: var(--accent-2);
}

.table-wrap {
  overflow-x: auto;
}

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

thead th {
  padding: 9px 16px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-3);
}

tbody td {
  padding: 11px 16px;
  color: var(--text-1);
  white-space: nowrap;
}

.loading-row {
  text-align: center;
  color: var(--text-3) !important;
  padding: 32px !important;
}

/* Ad row with icon */
.ad-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ad-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.ad-info strong {
  font-size: 0.83rem;
  font-weight: 600;
  display: block;
}

.ad-info span {
  font-size: 0.73rem;
  color: var(--text-2);
}

/* ──────────────────────────────────────── CHANNEL TABLE */
.channel-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ──────────────────────────────────────── BADGES */
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}

.badge-red {
  background: var(--red-soft);
  color: var(--red);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge-purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.badge-gray {
  background: var(--bg-3);
  color: var(--text-2);
}

.badge-info {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ──────────────────────────────────────── META CONNECT (Tab) */
.connect-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  gap: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.meta-logo-big {
  width: 64px;
  height: 64px;
  background: #1877f2;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  font-family: 'Inter', sans-serif;
}

.connect-hero h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.connect-hero p {
  color: var(--text-2);
  max-width: 420px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.btn-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1877f2;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  margin-top: 8px;
}

.btn-meta:hover {
  background: #1565d8;
  transform: translateY(-1px);
}

.btn-meta svg {
  width: 18px;
  height: 18px;
}

.connect-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: left;
}

.connect-step {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.connect-step .step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.connect-step h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.connect-step p {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.5;
}

/* Token form */
.token-form {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  max-width: 560px;
}

.token-form h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ──────────────────────────────────────── CONTROLS */
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  flex: 1;
  min-width: 180px;
  max-width: 340px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-box svg {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}

.search-box input {
  border: none;
  background: transparent;
  color: var(--text-1);
  font-size: 0.85rem;
  font-family: inherit;
  width: 100%;
  outline: none;
}

.controls-row select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 7px 12px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  box-shadow: var(--shadow-sm);
}

/* ──────────────────────────────────────── BUTTONS */
.btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-ghost:hover {
  border-color: var(--border-h);
  color: var(--text-1);
}

/* ──────────────────────────────────────── PIXEL PAGE */
.pixel-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}

.pixel-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.pixel-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.pixel-card-header svg {
  width: 20px;
  height: 20px;
  color: var(--purple);
}

.pixel-card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.funnel-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.flow-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  color: var(--accent);
}

.flow-icon svg {
  width: 16px;
  height: 16px;
}

.flow-text {
  font-size: 0.82rem;
  line-height: 1.5;
}

.flow-text strong {
  font-weight: 600;
}

.flow-arrow {
  text-align: center;
  color: var(--text-3);
  font-size: 1rem;
  margin: 3px 0;
}

.pixel-stats-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pixel-stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.kpi-value.large {
  font-size: 2rem;
}

/* ──────────────────────────────────────── INFO BOX */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--accent-soft);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
}

.info-box svg {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--accent);
  flex-shrink: 0;
}

.info-box strong {
  color: var(--text-1);
}

.info-box code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ──────────────────────────────────────── MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
  z-index: 200;
  place-items: center;
}

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

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: min(520px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text-1);
}

.modal-close svg {
  width: 17px;
  height: 17px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

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

.form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 9px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  background: var(--bg-2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ──────────────────────────────────────── TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-1);
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 300;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

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

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

/* ──────────────────────────────────────── ALERT */
.alert-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.83rem;
  color: #92400e;
}

.alert-row svg {
  width: 16px;
  height: 16px;
  color: var(--amber);
  flex-shrink: 0;
}

.alert-row a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
}

/* ──────────────────────────────────────── SCROLLBAR */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ──────────────────────────────────────── RESPONSIVE */
@media (max-width: 1000px) {

  .charts-row,
  .bottom-row {
    grid-template-columns: 1fr;
  }

  .pixel-grid {
    grid-template-columns: 1fr;
  }

  .connect-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }

  .btn-primary span {
    display: none;
  }

  .kanban-board {
    display: flex;
    /* Garante que assumirá flex-direction */
    flex-direction: column;
    overflow-x: visible;
  }

  .kanban-col {
    min-width: 100%;
    margin-bottom: 20px;
  }

  /* Responsividade Adicional para Dashboard App */
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-right {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .ads-sublevel-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .ads-sublevel-right {
    flex-wrap: wrap;
    width: 100%;
  }

  .ads-kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100% !important;
  }

  .pipeline-topbar>div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .tab-content {
    min-width: 0;
  }

  .table-card {
    min-width: 0;
  }
}

@media (max-width: 640px) {

  /* BOTTOM NAVIGATION BAR PARA MOBILE */
  .sidebar {
    width: 100%;
    height: 65px;
    bottom: 0;
    top: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 1000;
    padding: 0;
    align-items: center;
    justify-content: space-around;
  }

  .sidebar .brand-brand,
  .sidebar .brand-name,
  .sidebar .sidebar-toggle,
  .sidebar .nav-section-label,
  .sidebar-footer {
    display: none !important;
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    flex: 1;
    padding: 0;
    height: 100%;
    align-items: center;
    gap: 0;
    overflow-y: hidden;
  }

  .sidebar .nav-item {
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
    justify-content: center;
    border-radius: 0;
  }

  .sidebar .nav-item i {
    width: 20px;
    height: 20px;
  }

  .sidebar .nav-item span {
    display: block !important;
    font-size: 0.6rem;
    font-weight: 500;
    text-align: center;
  }

  .main {
    margin-left: 0 !important;
    margin-bottom: 65px;
    min-height: calc(100vh - 65px);
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px 16px;
  }

  .tab-content {
    padding: 16px;
  }
}

/* ══════════════════════════════════════════
   ADS SUB-TABS (Pills: Campanhas / Conjuntos / Anúncios)
   ══════════════════════════════════════════ */

.ads-sublevel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 70px;
  z-index: 90;
}

.ads-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-3);
  border-radius: 10px;
  padding: 4px;
}

.ads-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.ads-pill svg {
  width: 14px;
  height: 14px;
}

.ads-pill:hover {
  background: var(--bg-2);
  color: var(--text-1);
}

.ads-pill.active {
  background: var(--bg-2);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.ads-sublevel-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── KPI row de resumo do nível actual de anúncios */
.ads-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 1100px) {
  .ads-kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ads-kpi {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-value.sm {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ── thumbnail de criativo */
.ad-creative-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ad-creative-img {
  flex-shrink: 0;
}

.ad-creative-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}

.ad-creative-thumb.mini {
  width: 34px;
  height: 34px;
}

.ad-creative-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-soft), var(--blue-soft));
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

/* variantes de thumb por nível */
.campaign-thumb {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #fde68a;
}

.adset-thumb {
  background: var(--purple-soft);
  color: var(--purple);
  border-color: #ddd6fe;
}

/* ── Health score bar */
.health-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}

.health-label {
  font-size: 0.75rem;
  font-weight: 700;
}

.health-track {
  height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.health-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ── ad-id (ID pequeno abaixo do nome) */
.ad-id {
  font-size: 0.68rem !important;
  color: var(--text-3) !important;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ══════════════════════════════════════════
   PIPELINE KANBAN
   ══════════════════════════════════════════ */

.pipeline-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kanban-col.drop-over {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-soft);
}

.kanban-col-paid {
  border-color: #d1fae5;
  background: #f0fdf4;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}

.kanban-col-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-1);
}

.kanban-col-count {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-3);
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 99px;
}

.kanban-cards {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Kanban Card ── */
.kanban-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.18s, transform 0.18s, opacity 0.18s;
  position: relative;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: rotate(1.5deg) scale(0.97);
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
}

.kanban-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-meta {
  font-size: 0.71rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Score Badge ── */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}

.score-badge.hot {
  background: #fef3c7;
  color: #b45309;
}

.score-badge.warm {
  background: #dbeafe;
  color: #1d4ed8;
}

.score-badge.cold {
  background: var(--bg-3);
  color: var(--text-2);
}

.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.score-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s;
}

.score-fill.hot {
  background: #f59e0b;
}

.score-fill.warm {
  background: var(--blue);
}

.score-fill.cold {
  background: var(--text-3);
}

.score-num {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-2);
  min-width: 24px;
  text-align: right;
}

/* ── Channel table indicator ── */
.channel-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.channel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Responsive Kanban ── */
@media (max-width: 1100px) {
  .kanban-board {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .kanban-board {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
  }
}

/* Ads Toggle Switch */
.ad-toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.ad-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ad-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.ad-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.ad-toggle input:checked+.ad-slider {
  background-color: #10b981;
}

.ad-toggle input:focus+.ad-slider {
  box-shadow: 0 0 1px #10b981;
}

.ad-toggle input:checked+.ad-slider:before {
  transform: translateX(14px);
}

.ad-toggle input:disabled+.ad-slider {
  opacity: 0.5;
  cursor: not-allowed;
}